diff options
author | Michael Hanson <mihanson@linhes.org> | 2012-02-21 21:47:57 (GMT) |
---|---|---|
committer | Michael Hanson <mihanson@linhes.org> | 2012-02-21 21:47:57 (GMT) |
commit | ccafc53c03852163cd67a63ce45577209da3ab20 (patch) | |
tree | 6f827b48b8ecd51d12ba1e32e3029e5a9373a142 | |
parent | c56256903b3fb109e548ff048b90c89b5f55f2a4 (diff) | |
download | linhes_dev-ccafc53c03852163cd67a63ce45577209da3ab20.zip |
mp.py: Fix greedy deletes and false negatives when using --rmold option.
PKGVER must only contain numbers [0-9] or periods [.] when PKGVER is
different from the pervious PKGVER.
-rwxr-xr-x | build_tools/bin/mp.py | 52 |
1 files changed, 37 insertions, 15 deletions
diff --git a/build_tools/bin/mp.py b/build_tools/bin/mp.py index 0fc4cfb..20835f0 100755 --- a/build_tools/bin/mp.py +++ b/build_tools/bin/mp.py @@ -1,5 +1,5 @@ #!/usr/bin/env python2 -# Version 0.7 +# Version 0.7.1 import os import sys @@ -243,13 +243,15 @@ def update_repo(): print "Package file:",TOTALPKG # Remove old package(s) from local copy - pv = re.compile('[\d]+[\w.]+') + oldpkgcheck = re.compile( i + "-" + epoch + '(pkgver|[\d.]+)' + "-" + '(?!pkgrel)' ) dirlist = os.listdir(DOCROOT) for n in dirlist: if n.startswith(i): - num = len(i) + 1 - print "Bytes to seek ahead:",num - OLDPKG = glob.glob(i + "-" + pv.search(n,num).group() + "-[0-9]*.pkg.tar.?z") + if not oldpkgcheck.search(n): + print n,"does not match" + continue + else: + OLDPKG = glob.glob(oldpkgcheck.search(n).group() + "*.pkg.tar.?z") print "OLDPKG =",OLDPKG if OLDPKG: for DELPKG in OLDPKG: @@ -273,28 +275,48 @@ def update_repo(): def update_src_pkg(): print "---------------------------------SRC------------------------------" - print "SRCPKG:",SRCPKG - OLDSRCPKG = [] + os.chdir(SRCPKGHOME + "/" + REPO) + + print + print "INFO: Changed working dir to",SRCPKGHOME + "/" + REPO + print + + if pkgbase: + SRCPKG = pkgbase + "-" + epoch + pkgver + "-" + pkgrel + ".src.tar.gz" + i = pkgbase + else: + SRCPKG = pkgname + "-" + epoch + pkgver + "-" + pkgrel + ".src.tar.gz" + i = pkgname + print "Source package will be:",SRCPKG + + if not SRCPKGHOME + "/" + REPO + "/" + SRCPKG: + print "ERROR in function update_repo: Couldn't find the new package",SRCPKGHOME + "/" + REPO + "/" + SRCPKG + sys.exit(2) + + print "SRCPKG:",SRCPKG + oldpkgcheck = re.compile( i + "-" + epoch + '(pkgver|[\d.]+)' + "-" + '(?!pkgrel)' ) dirlist = os.listdir(SRCPKGHOME + "/" + REPO) - #pv = re.compile('[\d]+[.]*[\d]*[.]*[\d]*[.]*[\d]*[.]*[\d]*') - pv = re.compile('[\d]+[\w.]+') if pkgbase: # Remove old src package(s) from local copy if "--rmold" in cli_list: for n in dirlist: if n.startswith(pkgbase): - num = len(pkgbase) + 1 - print "Bytes to seek ahead:",num - OLDSRCPKG = glob.glob(pkgbase + "-" + pv.search(n,num).group() + "-*.src.tar.?z") + if not oldpkgcheck.search(n): + print n,"does not match" + continue + else: + OLDSRCPKG = glob.glob(oldpkgcheck.search(n).group() + "*.src.tar.gz") else: # Remove old src package(s) from local copy if "--rmold" in cli_list: for n in dirlist: if n.startswith(pkgname): - num = len(pkgname) + 1 - print "Bytes to seek ahead:",num - OLDSRCPKG = glob.glob(pkgname + "-" + pv.search(n,num).group() + "-*.src.tar.?z") + if not oldpkgcheck.search(n): + print n,"does not match" + continue + else: + OLDSRCPKG = glob.glob(oldpkgcheck.search(n).group() + "*.src.tar.gz") if OLDSRCPKG: print "OLDSRCPKG =",OLDSRCPKG for DELSRCPKG in OLDSRCPKG: |