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
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
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}
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.")
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
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"]:
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:
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"
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"],