From 148a3b8ede3ff8ae3abb99adcf19eb946e8853a0 Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Mon, 7 May 2007 20:26:29 +0000 Subject: [PATCH] Merged from trunk 6477:6494 +------------------------------------------------------------------------+ | 6478 | For bug #175058, comment #15, expand all possible variables | | zmedico | in each argument. | |---------+--------------------------------------------------------------| | 6480 | For bug #177211, use chmod -R on the children of the current | | zmedico | directory in order to reduce the size of the argument list. | |---------+--------------------------------------------------------------| | 6482 | Use match_from_list in order to potentially avoid more | | zmedico | blocks. | |---------+--------------------------------------------------------------| | 6484 | Add missing base class. | | zmedico | | |---------+--------------------------------------------------------------| | 6485 | For bug #171259, fix vercmp so that implicit _p0 is less | | zmedico | than explicit _p0. Thanks to TGL | | | for the patch. | |---------+--------------------------------------------------------------| | 6487 | Use varexpand to expand FETCHCOMMAND and RESUMECOMMAND. | | zmedico | | |---------+--------------------------------------------------------------| | 6490 | Use shlex for better splitting of FETCHCOMMAND. | | zmedico | | |---------+--------------------------------------------------------------| | 6492 | Use shlex for better splitting of PORTAGE_RSYNC_OPTS and | | zmedico | PORTAGE_RSYNC_EXTRA_OPTS. | |---------+--------------------------------------------------------------| | 6494 | Prevent blockers that are only partially resolvable by merge | | zmedico | order from accidentally being ignored. | +------------------------------------------------------------------------+ svn path=/main/branches/prefix/; revision=6497 --- bin/ebuild.sh | 3 ++- pym/emerge/__init__.py | 55 ++++++++++++++++++++++++-------------- pym/portage/__init__.py | 17 ++++++------ pym/portage/env/loaders.py | 2 +- pym/portage/versions.py | 8 +++--- 5 files changed, 52 insertions(+), 33 deletions(-) diff --git a/bin/ebuild.sh b/bin/ebuild.sh index 5f0cbec02..2ef23ecb4 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -395,7 +395,8 @@ unpack() { done # Do not chmod '.' since it's probably ${WORKDIR} and PORTAGE_WORKDIR_MODE # should be preserved. - find . -mindepth 1 ! -type l -print0 | ${XARGS} -0 chmod -f a+rX,u+w,g-w,o-w + find . -mindepth 1 -maxdepth 1 ! -type l -print0 | \ + ${XARGS} -0 chmod -fR a+rX,u+w,g-w,o-w } strip_duplicate_slashes() { diff --git a/pym/emerge/__init__.py b/pym/emerge/__init__.py index cb6d6c257..e70ff7c32 100644 --- a/pym/emerge/__init__.py +++ b/pym/emerge/__init__.py @@ -978,6 +978,7 @@ class depgraph: self.args_keys = [] self.blocker_digraph = digraph() self.blocker_parents = {} + self._unresolved_blocker_parents = {} self._slot_collision_info = [] # Slot collision nodes are not allowed to block other packages since # blocker validation is only able to account for one package per slot. @@ -1904,7 +1905,6 @@ class depgraph: blocked_slots_final[cpv] = \ "%s:%s" % (portage.dep_getkey(cpv), final_db.aux_get(cpv, ["SLOT"])[0]) - blocked_slots_final_values = set(blocked_slots_final.itervalues()) for parent in list(self.blocker_parents[blocker]): ptype, proot, pcpv, pstatus = parent pdbapi = self.trees[proot][self.pkg_tree_map[ptype]].dbapi @@ -1927,15 +1927,16 @@ class depgraph: # merge of either package is triggered. continue if pstatus == "merge" and \ - slot_atom not in blocked_slots_final_values: - upgrade_matches = final_db.match(slot_atom) - if upgrade_matches: - # Apparently an upgrade may be able to invalidate - # this block. - upgrade_node = \ - self.pkg_node_map[proot][upgrade_matches[0]] - depends_on_order.add((upgrade_node, parent)) - continue + slot_atom in modified_slots[myroot]: + replacement = final_db.match(slot_atom) + if replacement: + if not portage.match_from_list(mydep, replacement): + # Apparently a replacement may be able to + # invalidate this block. + replacement_node = \ + self.pkg_node_map[proot][replacement[0]] + depends_on_order.add((replacement_node, parent)) + continue # None of the above blocker resolutions techniques apply, # so apparently this one is unresolvable. unresolved_blocks = True @@ -1978,6 +1979,9 @@ class depgraph: self.blocker_digraph.addnode(node, blocker) if not unresolved_blocks and not depends_on_order: self.blocker_parents[blocker].remove(parent) + if unresolved_blocks: + self._unresolved_blocker_parents.setdefault( + blocker, set()).add(parent) if not self.blocker_parents[blocker]: del self.blocker_parents[blocker] # Validate blockers that depend on merge order. @@ -2164,7 +2168,12 @@ class depgraph: for blocker in myblockers.root_nodes(): if not myblockers.child_nodes(blocker): myblockers.remove(blocker) - del self.blocker_parents[blocker] + unresolved = \ + self._unresolved_blocker_parents.get(blocker) + if unresolved: + self.blocker_parents[blocker] = unresolved + else: + del self.blocker_parents[blocker] if not reversed: """Blocker validation does not work with reverse mode, @@ -3897,7 +3906,7 @@ def action_sync(settings, trees, mtimedb, myopts, myaction): mytimeout=180 rsync_opts = [] - + import shlex, StringIO if settings["PORTAGE_RSYNC_OPTS"] == "": portage.writemsg("PORTAGE_RSYNC_OPTS empty or unset, using hardcoded defaults\n") rsync_opts.extend([ @@ -3924,7 +3933,11 @@ def action_sync(settings, trees, mtimedb, myopts, myaction): # defaults. portage.writemsg("Using PORTAGE_RSYNC_OPTS instead of hardcoded defaults\n", 1) - rsync_opts.extend(settings["PORTAGE_RSYNC_OPTS"].split()) + lexer = shlex.shlex(StringIO.StringIO( + settings.get("PORTAGE_RSYNC_OPTS","")), posix=True) + lexer.whitespace_split = True + rsync_opts.extend(lexer) + del lexer for opt in ("--recursive", "--times"): if opt not in rsync_opts: @@ -4033,8 +4046,12 @@ def action_sync(settings, trees, mtimedb, myopts, myaction): user_name="" updatecache_flg=True all_rsync_opts = set(rsync_opts) - all_rsync_opts.update( - settings.get("PORTAGE_RSYNC_EXTRA_OPTS","").split()) + lexer = shlex.shlex(StringIO.StringIO( + settings.get("PORTAGE_RSYNC_EXTRA_OPTS","")), posix=True) + lexer.whitespace_split = True + extra_rsync_opts = list(lexer) + del lexer + all_rsync_opts.update(extra_rsync_opts) family = socket.AF_INET if "-4" in all_rsync_opts or "--ipv4" in all_rsync_opts: family = socket.AF_INET @@ -4092,8 +4109,7 @@ def action_sync(settings, trees, mtimedb, myopts, myaction): if mytimestamp != 0 and "--quiet" not in myopts: print ">>> Checking server timestamp ..." - rsynccommand = " ".join([EPREFIX, "/usr/bin/rsync", " ".join(rsync_opts), - settings.get("PORTAGE_RSYNC_EXTRA_OPTS","")]) + rsynccommand = [EPREFIX+"/usr/bin/rsync"] + rsync_opts + extra_rsync_opts if "--debug" in myopts: print rsynccommand @@ -4106,7 +4122,7 @@ def action_sync(settings, trees, mtimedb, myopts, myaction): # connection attempt to an unresponsive server which rsync's # --timeout option does not prevent. if True: - mycommand = rsynccommand.split() + mycommand = rsynccommand[:] mycommand.append(dosyncuri.rstrip("/") + \ "/metadata/timestamp.chk") mycommand.append(tmpservertimestampfile) @@ -4180,8 +4196,7 @@ def action_sync(settings, trees, mtimedb, myopts, myaction): print elif (servertimestamp == 0) or (servertimestamp > mytimestamp): # actual sync - mycommand=rsynccommand+" "+dosyncuri+"/ "+myportdir - mycommand = mycommand.split() + mycommand = rsynccommand + [dosyncuri+"/", myportdir] exitcode = portage.process.spawn(mycommand, env=settings.environ()) if exitcode in [0,1,3,4,11,14,20,21]: diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index 7e27bbf9a..0357375b3 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -2639,14 +2639,15 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks", locfetch=fetchcommand writemsg_stdout(">>> Downloading '%s'\n" % \ re.sub(r'//(.+):.+@(.+)/',r'//\1:*password*@\2/', loc)) - myfetch = locfetch.split() - variables = {"${DISTDIR}":mysettings["DISTDIR"], - "${URI}":loc, "${FILE}":myfile} - for i in xrange(len(myfetch)): - token = myfetch[i].strip("\"'") - value = variables.get(token) - if value is not None: - myfetch[i] = value + variables = { + "DISTDIR": mysettings["DISTDIR"], + "URI": loc, + "FILE": myfile + } + import shlex, StringIO + lexer = shlex.shlex(StringIO.StringIO(locfetch), posix=True) + lexer.whitespace_split = True + myfetch = [varexpand(x, mydict=variables) for x in lexer] spawn_keywords = {} if "userfetch" in mysettings.features and \ diff --git a/pym/portage/env/loaders.py b/pym/portage/env/loaders.py index 6bfcce77b..c9fb7473d 100644 --- a/pym/portage/env/loaders.py +++ b/pym/portage/env/loaders.py @@ -53,7 +53,7 @@ class DataLoader(object): if f is None: # if they pass in no validator, just make a fake one # that always returns true - class AlwaysTrue(): + class AlwaysTrue(object): def validate(self, key): return True f = AlwaysTrue() diff --git a/pym/portage/versions.py b/pym/portage/versions.py index b3bae4126..77273ae48 100644 --- a/pym/portage/versions.py +++ b/pym/portage/versions.py @@ -124,12 +124,13 @@ def vercmp(ver1, ver2, silent=1): list2 = match2.group(6).split("_")[1:] for i in range(0, max(len(list1), len(list2))): + # Implicit _p0 is given a value of -1, so that 1 < 1_p0 if len(list1) <= i: - s1 = ("p","0") + s1 = ("p","-1") else: s1 = suffix_regexp.match(list1[i]).groups() if len(list2) <= i: - s2 = ("p","0") + s2 = ("p","-1") else: s2 = suffix_regexp.match(list2[i]).groups() if s1[0] != s2[0]: @@ -141,7 +142,8 @@ def vercmp(ver1, ver2, silent=1): except ValueError: r1 = 0 try: r2 = int(s2[1]) except ValueError: r2 = 0 - return r1 - r2 + if r1 - r2: + return r1 - r2 # the suffix part is equal to, so finally check the revision # PREFIX hack: a revision starting with 0 is an 'inter-revision', -- 2.26.2