Merged from trunk r58{20,33}
authorFabian Groffen <grobian@gentoo.org>
Tue, 30 Jan 2007 16:53:04 +0000 (16:53 -0000)
committerFabian Groffen <grobian@gentoo.org>
Tue, 30 Jan 2007 16:53:04 +0000 (16:53 -0000)
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
<hydrogen@notyetimplemented.com> for the initial patch.

For bug #164363, shuffle the ip addresses returned from
socket.getaddrinfo().

svn path=/main/branches/prefix/; revision=5834

bin/ecompressdir
bin/emerge
bin/repoman

index cf834ba4519a6fa62ce2865f27af5dbf916f6b5b..243a6832cbf4470a18ef85fd4cf6cbb6705ac6b3 100755 (executable)
@@ -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}
index 28f7473f2b837873a94c6b6ca046373dbed34cf1..e8d1bbc1f4c9479cc82c7f40d4ef3d391fae8ff2 100755 (executable)
@@ -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"
index bc6c186289955ab06dbed07a65551d3f44618066..608538fe1591fad275a0abe1b6d852fdba3b9f38 100755 (executable)
@@ -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"],