diff options
author | Michael Hanson <hansonorders@verizon.net> | 2011-03-31 00:54:04 (GMT) |
---|---|---|
committer | Michael Hanson <hansonorders@verizon.net> | 2011-03-31 00:54:04 (GMT) |
commit | bad80657ed72b6626fd7817da9625e01562ebdad (patch) | |
tree | 5ddccb8333c5fd27142c40c5d5f3a22485a985bc /build_tools | |
parent | 50635a9eefcbe0e387460cc808439df01e5b32e1 (diff) | |
download | linhes_dev-bad80657ed72b6626fd7817da9625e01562ebdad.zip |
mp.py: fix non-deletion of old pkgs
Diffstat (limited to 'build_tools')
-rwxr-xr-x | build_tools/bin/mp.py | 28 |
1 files 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 + "/") |