From: Fabian Groffen Date: Fri, 7 Mar 2008 20:13:48 +0000 (-0000) Subject: Merged from trunk 9405:9428 X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=12b191b58921e1938b46264af223e4366170ea56;p=portage.git Merged from trunk 9405:9428 | 9406 | undo registrations of preserved libraries if the merge | | genone | fails, bug #210501 | | 9407 | ensure that global variables are used to prevent confusing | | genone | issues like bug #212055 | | 9408 | stack use flags from package.use for multiple matching atoms | | genone | (bug #200385) | | 9409 | remove FEATURES=livecvsportage | | genone | | | 9410 | apply r9408 also for profile-base package.*use* files | | genone | | | 9411 | Fix typo. | | zmedico | | | 9412 | change stacking order of r9408 so more specific atoms | | genone | override generic ones | | 9413 | fix indentation screwup from r9412 | | genone | | | 9414 | one more fix to restore correct order for usemask/useforce | | genone | | | 9415 | Make profile stacking of default USE and package.* slightly | | zmedico | more efficient by skipping list.insert() calls when | | | possible. | | 9416 | Bug #211949 - As suggested by vapier, tighten the variable | | zmedico | filter to also exclude variable names that begin with a | | | digit or that contain any non-alphanumeric characters that | | | are not be supported by bash. | | 9418 | Quote the file path and uri inside FETCHCOMMAND and | | zmedico | RESUMECOMMAND. Thanks to igli for suggesting. | | 9419 | Fix the regex for bug #211949 so that it correctly matches | | zmedico | variable names that contain more than one non-alphanumeric | | | character. | | 9421 | Bug #211949 - Tweak the regex so that a leading whitespace | | zmedico | character cannot match the required non-alphanumeric group. | | 9423 | Buf #210372 - Fix FEATURES=suidctl so that it really works | | zmedico | again. | | 9425 | check available space in DISTDIR before trying to fetch/copy | | genone | a file, bug #212152 | | 9426 | don't list files as being merged when they are ignored due | | genone | to confmem, bug #212080 | | 9427 | fix message on ValueError to not sound like crap | | genone | | | 9428 | tell rpmbuild to clean it's working files after completion, | | genone | bug #97776 | svn path=/main/branches/prefix/; revision=9449 --- diff --git a/bin/ebuild.sh b/bin/ebuild.sh index e81cedb53..151ade086 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -1414,8 +1414,9 @@ PORTAGE_MUTABLE_FILTERED_VARS="AA HOSTNAME" # with names that are known to cause interference: # # * some specific variables for which bash does not allow assignment -# * any variables with names containing a hyphen (not allowed by bash) # * some specific variables that affect portage or sandbox behavior +# * variable names that begin with a digit or that contain any +# non-alphanumeric characters that are not be supported by bash # # --filter-sandbox causes all SANDBOX_* variables to be filtered, which # is only desired in certain cases, such as during preprocessing or when @@ -1444,7 +1445,9 @@ filter_readonly_variables() { SANDBOX_DEBUG_LOG SANDBOX_DISABLED SANDBOX_LIB SANDBOX_LOG SANDBOX_ON" filtered_vars="${readonly_bash_vars} ${READONLY_PORTAGE_VARS} - BASH_[_[:alnum:]]* PATH [-_[:alnum:]]*-[-_[:alnum:]]*" + BASH_[_[:alnum:]]* PATH + [[:digit:]][_[:alnum:]]* + [^[:space:]]*[^_[:alnum:][:space:]][^[:space:]]*" if hasq --filter-sandbox $* ; then filtered_vars="${filtered_vars} SANDBOX_[_[:alnum:]]*" else diff --git a/bin/filter-bash-environment.py b/bin/filter-bash-environment.py index 7e4a6dcc9..90a494778 100755 --- a/bin/filter-bash-environment.py +++ b/bin/filter-bash-environment.py @@ -7,6 +7,7 @@ import os, re, sys egrep_compat_map = { "[:alnum:]" : r'\w', + "[:digit:]" : r'\d', "[:space:]" : r'\s', } diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh index aa666e478..dc2d77573 100644 --- a/bin/misc-functions.sh +++ b/bin/misc-functions.sh @@ -586,6 +586,7 @@ preinst_suid_scan() { fi # total suid control. if hasq suidctl $FEATURES; then + local sfconf #TODO: not sure if PORTAGE_CONFIGROOT includes EPREFIX sfconf=${PORTAGE_CONFIGROOT}etc/portage/suidctl.conf # sandbox prevents us from writing directly @@ -596,19 +597,19 @@ preinst_suid_scan() { #note not space-safe for i in $(find "${ED}" -type f \( -perm -4000 -o -perm -2000 \) ); do if [ -s "${sfconf}" ]; then - suid="$(grep "^/${i#${D}}$" "${sfconf}")" - if [ "${suid}" = "${i/${D}}" ]; then - vecho "- ${i/${D}} is an approved suid file" + install_path=/${i#${D}} + if grep -q "^${install_path}\$" "${sfconf}" ; then + vecho "- ${install_path} is an approved suid file" else - vecho ">>> Removing sbit on non registered ${i/${D}}" + vecho ">>> Removing sbit on non registered ${install_path}" for x in 5 4 3 2 1 0; do echo -ne "\a"; sleep 0.25 ; done vecho -ne "\a" ls_ret=$(ls -ldh "${i}") chmod ugo-s "${i}" - grep "^#${i/${D}}$" "${sfconf}" > /dev/null || { + grep "^#${install_path}$" "${sfconf}" > /dev/null || { vecho ">>> Appending commented out entry to ${sfconf} for ${PF}" - echo "## ${ls_ret%${D}*}${ls_ret#*${D}}" >> "${sfconf}" - echo "#${i/${D}}" >> "${sfconf}" + echo "## ${ls_ret%${D}*}${install_path}" >> "${sfconf}" + echo "#${install_path}" >> "${sfconf}" # no delwrite() eh? # delwrite ${sconf} } @@ -720,7 +721,7 @@ dyn_rpm() { addwrite /usr/src/rpm addwrite "${RPMDIR}" dyn_spec - rpmbuild -bb "${PF}.spec" || die "Failed to integrate rpm spec file" + rpmbuild -bb --clean --rmsource "${PF}.spec" || die "Failed to integrate rpm spec file" install -D "/usr/src/rpm/RPMS/i386/${PN}-${PV}-${PR}.i386.rpm" \ "${RPMDIR}/${CATEGORY}/${PN}-${PV}-${PR}.rpm" || \ die "Failed to move rpm" diff --git a/bin/portageq b/bin/portageq index 486ac76c6..5ea82dbe2 100755 --- a/bin/portageq +++ b/bin/portageq @@ -503,7 +503,7 @@ def main(): # Multiple matches thrown from cpv_expand pkgs = e.args[0] # An error has occurred so we writemsg to stderr and exit nonzero. - portage.writemsg("The following packages available:\n", noiselevel=-1) + portage.writemsg("You specified an unqualified atom that matched multiple packages:\n", noiselevel=-1) for pkg in pkgs: portage.writemsg("* %s\n" % pkg, noiselevel=-1) portage.writemsg("\nPlease use a more specific atom.\n", noiselevel=-1) diff --git a/cnf/make.globals b/cnf/make.globals index 4fe1727ae..41bcdbc7c 100644 --- a/cnf/make.globals +++ b/cnf/make.globals @@ -29,8 +29,8 @@ RPMDIR=@DOMAIN_PREFIX@/usr/portage/rpm PORTAGE_TMPDIR=@DOMAIN_PREFIX@/var/tmp # Fetching command (5 tries, passive ftp for firewall compatibility) -FETCHCOMMAND="wget -t 5 -T 60 --passive-ftp -O \${DISTDIR}/\${FILE} \${URI}" -RESUMECOMMAND="wget -c -t 5 -T 60 --passive-ftp -O \${DISTDIR}/\${FILE} \${URI}" +FETCHCOMMAND="wget -t 5 -T 60 --passive-ftp -O \"\${DISTDIR}/\${FILE}\" \"\${URI}\"" +RESUMECOMMAND="wget -c -t 5 -T 60 --passive-ftp -O \"\${DISTDIR}/\${FILE}\" \"\${URI}\"" # Default user options FEATURES="distlocks metadata-transfer sandbox sfperms strict unmerge-orphans userfetch" diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index d74a92579..6f355935e 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -4047,9 +4047,7 @@ class depgraph(object): myversion = "%s-%s" % (mysplit[1], mysplit[2]) if myversion != portage.VERSION and "--quiet" not in self.myopts: - if mylist_index < len(mylist) - 1 and \ - "livecvsportage" not in self.settings.features and \ - EPREFIX == BPREFIX: + if mylist_index < len(mylist) - 1 and EPREFIX == BPREFIX: p.append(colorize("WARN", "*** Portage will stop merging at this point and reload itself,")) p.append(colorize("WARN", " then resume the merge.")) print @@ -4829,35 +4827,33 @@ class MergeTask(object): # Figure out if we need a restart. mysplit=portage.pkgsplit(x[2]) if mysplit[0] == "sys-apps/portage" and x[1] == "/": - if "livecvsportage" not in self.settings.features and \ - EPREFIX == BPREFIX: - if len(mymergelist) > mergecount: - emergelog(xterm_titles, - " ::: completed emerge ("+ \ - str(mergecount)+" of "+ \ - str(len(mymergelist))+") "+ \ - x[2]+" to "+x[1]) - emergelog(xterm_titles, " *** RESTARTING " + \ - "emerge via exec() after change of " + \ - "portage version.") - del mtimedb["resume"]["mergelist"][0] - mtimedb.commit() - portage.run_exitfuncs() - mynewargv=[sys.argv[0],"--resume"] - resume_opts = self.myopts.copy() - # For automatic resume, we need to prevent - # any of bad_resume_opts from leaking in - # via EMERGE_DEFAULT_OPTS. - resume_opts["--ignore-default-opts"] = True - for myopt, myarg in resume_opts.iteritems(): - if myopt not in bad_resume_opts: - if myarg is True: - mynewargv.append(myopt) - else: - mynewargv.append(myopt +"="+ myarg) - # priority only needs to be adjusted on the first run - os.environ["PORTAGE_NICENESS"] = "0" - os.execv(mynewargv[0], mynewargv) + if len(mymergelist) > mergecount and EPREFIX == BPREFIX: + emergelog(xterm_titles, + " ::: completed emerge ("+ \ + str(mergecount)+" of "+ \ + str(len(mymergelist))+") "+ \ + x[2]+" to "+x[1]) + emergelog(xterm_titles, " *** RESTARTING " + \ + "emerge via exec() after change of " + \ + "portage version.") + del mtimedb["resume"]["mergelist"][0] + mtimedb.commit() + portage.run_exitfuncs() + mynewargv=[sys.argv[0],"--resume"] + resume_opts = self.myopts.copy() + # For automatic resume, we need to prevent + # any of bad_resume_opts from leaking in + # via EMERGE_DEFAULT_OPTS. + resume_opts["--ignore-default-opts"] = True + for myopt, myarg in resume_opts.iteritems(): + if myopt not in bad_resume_opts: + if myarg is True: + mynewargv.append(myopt) + else: + mynewargv.append(myopt +"="+ myarg) + # priority only needs to be adjusted on the first run + os.environ["PORTAGE_NICENESS"] = "0" + os.execv(mynewargv[0], mynewargv) if "--pretend" not in self.myopts and \ "--fetchonly" not in self.myopts and \ diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index 926d50012..d86fcc1d6 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -1884,37 +1884,64 @@ class config(object): self.configdict["pkginternal"]["USE"] = pkginternaluse has_changed = True defaults = [] + pos = 0 for i in xrange(len(self.profiles)): - defaults.append(self.make_defaults_use[i]) cpdict = self.pkgprofileuse[i].get(cp, None) if cpdict: - best_match = best_match_to_list(cpv_slot, cpdict.keys()) - if best_match: - defaults.append(cpdict[best_match]) + keys = cpdict.keys() + while keys: + bestmatch = best_match_to_list(cpv_slot, keys) + if bestmatch: + keys.remove(bestmatch) + defaults.insert(pos, cpdict[bestmatch]) + else: + break + del keys + if self.make_defaults_use[i]: + defaults.insert(pos, self.make_defaults_use[i]) + pos = len(defaults) defaults = " ".join(defaults) if defaults != self.configdict["defaults"].get("USE",""): self.configdict["defaults"]["USE"] = defaults has_changed = True useforce = [] + pos = 0 for i in xrange(len(self.profiles)): - useforce.append(self.useforce_list[i]) cpdict = self.puseforce_list[i].get(cp, None) if cpdict: - best_match = best_match_to_list(cpv_slot, cpdict.keys()) - if best_match: - useforce.append(cpdict[best_match]) + keys = cpdict.keys() + while keys: + best_match = best_match_to_list(cpv_slot, keys) + if best_match: + keys.remove(best_match) + useforce.insert(pos, cpdict[best_match]) + else: + break + del keys + if self.useforce_list[i]: + useforce.insert(pos, self.useforce_list[i]) + pos = len(useforce) useforce = set(stack_lists(useforce, incremental=True)) if useforce != self.useforce: self.useforce = useforce has_changed = True usemask = [] + pos = 0 for i in xrange(len(self.profiles)): - usemask.append(self.usemask_list[i]) cpdict = self.pusemask_list[i].get(cp, None) if cpdict: - best_match = best_match_to_list(cpv_slot, cpdict.keys()) - if best_match: - usemask.append(cpdict[best_match]) + keys = cpdict.keys() + while keys: + best_match = best_match_to_list(cpv_slot, keys) + if best_match: + keys.remove(best_match) + usemask.insert(pos, cpdict[best_match]) + else: + break + del keys + if self.usemask_list[i]: + usemask.insert(pos, self.usemask_list[i]) + pos = len(usemask) usemask = set(stack_lists(usemask, incremental=True)) if usemask != self.usemask: self.usemask = usemask @@ -1923,9 +1950,15 @@ class config(object): self.puse = "" cpdict = self.pusedict.get(cp) if cpdict: - self.pusekey = best_match_to_list(cpv_slot, cpdict.keys()) - if self.pusekey: - self.puse = " ".join(cpdict[self.pusekey]) + keys = cpdict.keys() + while keys: + self.pusekey = best_match_to_list(cpv_slot, keys) + if self.pusekey: + keys.remove(self.pusekey) + self.puse = (" ".join(cpdict[self.pusekey])) + " " + self.puse + else: + break + del keys if oldpuse != self.puse: has_changed = True self.configdict["pkg"]["PKGUSE"] = self.puse[:] # For saving to PUSE file @@ -3197,10 +3230,19 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks", """ myfile_path = os.path.join(mysettings["DISTDIR"], myfile) fetched=0 + has_space = True file_lock = None if listonly: writemsg_stdout("\n", noiselevel=-1) else: + # check if there is enough space in DISTDIR to completely store myfile + # overestimate the filesize so we aren't bitten by FS overhead + vfs_stat = os.statvfs(mysettings["DISTDIR"]) + if myfile in mydigests \ + and (mydigests[myfile]["size"] + vfs_stat.f_bsize) >= (vfs_stat.f_bsize * vfs_stat.f_bavail): + writemsg("!!! Insufficient space to store %s in %s\n" % (myfile, mysettings["DISTDIR"]), noiselevel=-1) + has_space = False + if use_locks and can_fetch: waiting_msg = None if "parallel-fetch" in features: @@ -3217,7 +3259,7 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks", waiting_msg=waiting_msg) try: if not listonly: - if fsmirrors and not os.path.exists(myfile_path): + if fsmirrors and not os.path.exists(myfile_path) and has_space: for mydir in fsmirrors: mirror_file = os.path.join(mydir, myfile) try: @@ -3338,7 +3380,7 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks", else: continue - if fetched != 2: + if fetched != 2 and has_space: #we either need to resume or start the download #you can't use "continue" when you're inside a "try" block if fetched==1: diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index 9ff6ca0ab..5dd530101 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -2417,7 +2417,7 @@ class dblink(object): moveme = cfgfiledict["IGNORE"] cfgprot = cfgfiledict["IGNORE"] if not moveme: - zing = "-o-" + zing = "---" mymtime = long(mystat.st_mtime) else: moveme = 1 @@ -2441,7 +2441,6 @@ class dblink(object): zing = ">>>" if mymtime != None: - zing = ">>>" outfile.write("obj "+myrealdest+" "+mymd5+" "+str(mymtime)+"\n") writemsg_stdout("%s %s\n" % (zing,mydest)) else: @@ -2474,8 +2473,7 @@ class dblink(object): self.vartree.dbapi._categories = None if self.myroot == "/" and \ "sys-apps" == self.cat and \ - "portage" == pkgsplit(self.pkg)[0] and \ - "livecvsportage" not in self.settings.features: + "portage" == pkgsplit(self.pkg)[0]: settings = self.settings base_path_orig = os.path.dirname(settings["PORTAGE_BIN_PATH"]) from tempfile import mkdtemp @@ -2511,6 +2509,9 @@ class dblink(object): try: retval = self.treewalk(mergeroot, myroot, inforoot, myebuild, cleanup=cleanup, mydbapi=mydbapi, prev_mtimes=prev_mtimes) + # undo registrations of preserved libraries, bug #210501 + if retval != os.EX_OK: + self.vartree.dbapi.plib_registry.unregister(self.mycpv, self.settings["SLOT"], self.settings["COUNTER"]) # Process ebuild logfiles elog_process(self.mycpv, self.settings, phasefilter=filter_mergephases) if retval == os.EX_OK and "noclean" not in self.settings.features: diff --git a/pym/portage/elog/__init__.py b/pym/portage/elog/__init__.py index 5aa6930c7..3039370a3 100644 --- a/pym/portage/elog/__init__.py +++ b/pym/portage/elog/__init__.py @@ -56,7 +56,7 @@ def _load_mod(name): _elog_atexit_handlers = [] _preserve_logentries = {} def elog_process(cpv, mysettings, phasefilter=None): - + global _elog_atexit_handlers, _preserve_logentries logsystems = mysettings.get("PORTAGE_ELOG_SYSTEM","").split() for s in logsystems: diff --git a/pym/portage/elog/messages.py b/pym/portage/elog/messages.py index c86d67b02..0c3aa999e 100644 --- a/pym/portage/elog/messages.py +++ b/pym/portage/elog/messages.py @@ -47,6 +47,9 @@ def _elog_base(level, msg, phase="other", key=None, color=None): """ Backend for the other messaging functions, should not be called directly. """ + + global _msgbuffer + if color == None: color = "GOOD" print colorize(color, " * ")+msg @@ -59,6 +62,8 @@ def _elog_base(level, msg, phase="other", key=None, color=None): #raise NotImplementedError() def collect_messages(): + global _msgbuffer + rValue = _msgbuffer _reset_buffer() return rValue @@ -67,6 +72,8 @@ def _reset_buffer(): """ Reset the internal message buffer when it has been processed, should not be called directly. """ + global _msgbuffer + _msgbuffer = {} # creating and exporting the actual messaging functions