From bad80657ed72b6626fd7817da9625e01562ebdad Mon Sep 17 00:00:00 2001 From: Michael Hanson Date: Wed, 30 Mar 2011 17:54:04 -0700 Subject: mp.py: fix non-deletion of old pkgs --- build_tools/bin/mp.py | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/build_tools/bin/mp.py b/build_tools/bin/mp.py index 18a4f2c..bbab019 100755 --- a/build_tools/bin/mp.py +++ b/build_tools/bin/mp.py @@ -1,5 +1,5 @@ #!/usr/bin/env python2 -# Version 0.6.4 +# Version 0.6.5 import os import sys @@ -12,6 +12,7 @@ import glob import shutil import optparse import fileinput +import fnmatch PKGHOME = "/data/pkg_repo/packages" SRCPKGHOME = "/data/pkg_repo/src_packages" @@ -225,14 +226,13 @@ def update_repo(): else: print "ERROR in function update_repo: Couldn't find the new package ",TOTALPKG sys.exit(2) - # Remove old package from local copy - ## FIX ME - ## This only works is the pkgver of the old pkg is the same as the new. - OLDPKG = glob.glob(i + "-" + pkgver + "-*-" + CARCH + ".pkg.tar.*z") + # Remove old package(s) from local copy + OLDPKG = glob.glob(i + "-" + "[0-9]*" + "-*-" + CARCH + ".pkg.tar.?z") + print "OLDPKG =",OLDPKG if OLDPKG: - DELPKG = OLDPKG.pop() - print "Deleting old package:",DELPKG - os.remove(DELPKG) + for DELPKG in OLDPKG: + print "Deleting old package:",DELPKG + os.remove(DELPKG) # Remove any symlinks to old packages # We make it conditional on "--force" because force will overwrite # an existing package and we want the symlink to stay, pointing to @@ -252,11 +252,15 @@ def update_src_pkg(): print "---------------------------------SRC------------------------------" print "SRCPKG:",SRCPKG os.chdir(SRCPKGHOME + "/" + REPO) - OLDSRCPKG = glob.glob(pkgname + "-" + pkgver + "-*.src.tar.*z") + if pkgbase: + OLDSRCPKG = glob.glob(pkgbase + "-" + "[0-9]*" + "-*.src.tar.?z") + else: + OLDSRCPKG = glob.glob(pkgname + "-" + "[0-9]*" + "-*.src.tar.?z") + print "OLDSRCPKG =",OLDSRCPKG if OLDSRCPKG: - for member in OLDSRCPKG: - print "Removing old source package",member - os.remove(SRCPKGHOME + "/" + REPO + "/" + member) + for DELSRCPKG in OLDSRCPKG: + print "Removing old source package",DELSRCPKG + os.remove(SRCPKGHOME + "/" + REPO + "/" + DELSRCPKG) print "Copying source package to",SRCPKGHOME + "/" + REPO + "/" + SRCPKG shutil.copy2(PKGHOME + "/" + SRCPKG, SRCPKGHOME + "/" + REPO + "/") -- cgit v0.12