From: thierry Date: Thu, 19 Mar 2009 11:13:26 +0000 (+0000) Subject: update X-Git-Tag: foo~254 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=cd560735d51a9ab862f6f9869b622f2fac676ee7;p=infrastructure.git update --- diff --git a/scripts/alpha-repo.py b/scripts/alpha-repo.py index c4fef59..fc3900e 100755 --- a/scripts/alpha-repo.py +++ b/scripts/alpha-repo.py @@ -68,13 +68,21 @@ def extract_contents (standard): contents = [ rpm_name(rpm_file) for rpm_file in rpm_files] return contents -def install_xfer (repo,rpm_name,options): +def install_standard_rpm_name (repo,rpm_name,options): + former_alpha_rpms = set(glob.glob ('%s/%s*rpm'%(repo,rpm_name))) xfer_patt= '%s/xfer/RPMS/*/%s*.rpm' % (repo, rpm_name); xfer_rpm_names=glob.glob(xfer_patt) for xfer_rpm_name in xfer_rpm_names: command = 'mv %s %s' % ( xfer_rpm_name, repo) if prompt('Adopt %s'%os.path.basename(xfer_rpm_name)): run(command,options) + try: + former_alpha_rpms.remove('%s/%s'%(repo,rpm_name)) + except: + pass + for former in former_alpha_rpms: + if prompt ('Remove old %s'%os.path.basename(former)): + command.run("rm %s"%former,options) def remaining_rpms (root): command="find %s -name '*.rpm'"%root @@ -106,27 +114,34 @@ def main (): repo=options.repo standard=options.standard + ### in case we have leftovers from a previous run days ago, better clean it up xfer='%s/xfer'%repo if os.path.isdir(xfer): if prompt('Want to clean up %s'%xfer,False): run('rm -rf %s'%xfer,options) + # go get the stuff if prompt ('Need to fetch rpms from %s ' % http): rsync_xfer(http,repo,options) + # install yumgroups if prompt ('Install yumgroups'): command="mv %s/xfer/RPMS/yumgroups.xml %s/"%(repo,repo) run(command,options) + # compute the set of rpms currently in the standard repo + # i.e. the ones that come with noderepo if prompt ('Get list of standard rpms from %s ' % standard): rpm_names=extract_contents(standard) + # interactively propose to move them in the right place if prompt ('Moving standard rpms to %s' % repo): for rpm_name in rpm_names: - install_xfer(repo,rpm_name,options) + install_standard_rpm_name(repo,rpm_name,options) # once here, we have moved all the rpms that belonged to the standard noderepo - # let's manually scan the other ones as there might be new rpms needed + # let's manually scan the ones that remain in xfer/ + # as there might be new rpms in this new build # the list proposed here contains mostly server-side rpms, # so the prompt default is False if prompt ('Scan remaining rpms for double-check'): @@ -141,6 +156,3 @@ def main (): if __name__ == '__main__': main() - - -