From 5c834bcce8452e036309d068eb3e907f5256e8aa Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Tue, 30 Jan 2007 16:53:04 +0000 Subject: [PATCH] Merged from trunk r58{20,33} Minor cleanup for the LIVEVCS.stable code. add support for transparently decompressing gz/Z/bz2 files since some upstream packages will compress for us (SpankMan) For bug #164078, don't trigger the CLEAN_DELAY countdown for autoclean operations since those are most likely unattended. Thanks to Dan for the initial patch. For bug #164363, shuffle the ip addresses returned from socket.getaddrinfo(). svn path=/main/branches/prefix/; revision=5834 --- bin/ecompressdir | 46 ++++++++++++++++++++++++++++++++++++---------- bin/emerge | 11 +++++++---- bin/repoman | 16 ++++++++++++---- 3 files changed, 55 insertions(+), 18 deletions(-) diff --git a/bin/ecompressdir b/bin/ecompressdir index cf834ba45..243a6832c 100755 --- a/bin/ecompressdir +++ b/bin/ecompressdir @@ -17,6 +17,35 @@ fi source "${PORTAGE_BIN_PATH:-${EPREFIX}/usr/lib/portage/bin}"/isolated-functions.sh +# funk_up_dir(action, suffix, binary) +# - action: compress or decompress +# - suffix: the compression suffix to work with +# - binary: the program to execute that'll compress/decompress +# The directory we act on is implied in the ${dir} variable +funk_up_dir() { + local act=$1 suffix=$2 binary=$3 + + local negate="" + [[ ${act} == "compress" ]] && negate="!" + + # first we act on all the files + find "${dir}" -type f ${negate} -iname '*.'${suffix} -print0 | ${XARGS} -0 ${binary} + ((ret+=$?)) + + find -L "${dir}" -type l | \ + while read brokenlink ; do + olddest=$(readlink "${brokenlink}") + [[ ${act} == "compress" ]] \ + && newdest="${olddest}${suffix}" \ + || newdest="${olddest%.${suffix}}" + rm -f "${brokenlink}" + [[ ${act} == "compress" ]] \ + && ln -snf "${newdest}" "${brokenlink}${suffix}" \ + || ln -snf "${newdest}" "${brokenlink%.${suffix}}" + ((ret+=$?)) + done +} + ret=0 for dir in "$@" ; do @@ -28,16 +57,13 @@ for dir in "$@" ; do vecho "${0##*/}: $(ecompress --bin) ${dir#${D}}" fi - find "${dir}" -type f '!' -name '*'${suffix} -print0 | ${XARGS} -0 ecompress - ((ret+=$?)) - find -L "${dir}" -type l | \ - while read brokenlink ; do - olddest=$(readlink "${brokenlink}") - newdest="${olddest}${suffix}" - rm -f "${brokenlink}" - ln -snf "${newdest}" "${brokenlink}${suffix}" - ((ret+=$?)) - done + # not uncommon for packages to compress doc files themselves + funk_up_dir "decompress" "Z" "gunzip" + funk_up_dir "decompress" "gz" "gunzip" + funk_up_dir "decompress" "bz2" "bunzip2" + + # now lets do our work + funk_up_dir "compress" "${suffix}" "ecompress" done exit ${ret} diff --git a/bin/emerge b/bin/emerge index 28f7473f2..e8d1bbc1f 100755 --- a/bin/emerge +++ b/bin/emerge @@ -3068,7 +3068,7 @@ class MergeTask(object): xsplit=portage.pkgsplit(x[2]) emergelog(xterm_titles, " >>> AUTOCLEAN: " + xsplit[0]) retval = unmerge(pkgsettings, self.myopts, vartree, - "clean", [xsplit[0]], ldpath_mtimes) + "clean", [xsplit[0]], ldpath_mtimes, autoclean=1) if not retval: emergelog(xterm_titles, " --- AUTOCLEAN: Nothing unmerged.") @@ -3154,7 +3154,7 @@ class MergeTask(object): return os.EX_OK def unmerge(settings, myopts, vartree, unmerge_action, unmerge_files, - ldpath_mtimes): + ldpath_mtimes, autoclean=0): candidate_catpkgs=[] global_unmerge=0 xterm_titles = "notitles" not in settings.features @@ -3406,7 +3406,8 @@ def unmerge(settings, myopts, vartree, unmerge_action, unmerge_files, print return 0 #the real unmerging begins, after a short delay.... - countdown(int(settings["CLEAN_DELAY"]), ">>> Unmerging") + if not autoclean: + countdown(int(settings["CLEAN_DELAY"]), ">>> Unmerging") for x in pkgmap.keys(): for y in pkgmap[x]["selected"]: @@ -3845,6 +3846,8 @@ def action_sync(settings, trees, mtimedb, myopts, myaction): ips.append("[%s]" % addrinfo[4][0]) else: ips.append(addrinfo[4][0]) + from random import shuffle + shuffle(ips) except SystemExit, e: raise # Needed else can't exit except Exception, e: @@ -4836,7 +4839,7 @@ def action_build(settings, trees, mtimedb, print ">>> Auto-cleaning packages..." vartree = trees[settings["ROOT"]]["vartree"] unmerge(settings, myopts, vartree, "clean", ["world"], - ldpath_mtimes) + ldpath_mtimes, autoclean=1) else: portage.writemsg_stdout(colorize("WARN", "WARNING:") + " AUTOCLEAN is disabled. This can cause serious" diff --git a/bin/repoman b/bin/repoman index bc6c18628..608538fe1 100755 --- a/bin/repoman +++ b/bin/repoman @@ -1161,12 +1161,20 @@ for x in scanlist: Ebuilds that inherit a "Live" eclasss (darcs,subversion,git,cvs,etc..) should not be allowed to be marked stable """ - if set(["darcs","cvs","subversion","git"]).intersection(myaux["INHERITED"].split()): - bad_stable_keywords = [keyword for keyword in myaux["KEYWORDS"].split() if not keyword.startswith("~") and not keyword.startswith("-")] + if set(["darcs","cvs","subversion","git"]).intersection( + myaux["INHERITED"].split()): + bad_stable_keywords = [] + for keyword in myaux["KEYWORDS"].split(): + if not keyword.startswith("~") and \ + not keyword.startswith("-"): + bad_stable_keywords.append(keyword) + del keyword if bad_stable_keywords: stats["LIVEVCS.stable"] += 1 - fails["LIVEVCS.stable"].append(x+"/"+y+".ebuild with stable keywords:%s " % bad_stable_keywords) - del bad_stable_keywords + fails["LIVEVCS.stable"].append( + x + "/" + y + ".ebuild with stable keywords:%s " % \ + bad_stable_keywords) + del bad_stable_keywords if "--ignore-arches" in myoptions: arches = [[repoman_settings["ARCH"], repoman_settings["ARCH"], -- 2.26.2