From 31aae840abc5a687b77a719379705f0a429da498 Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Sun, 5 Oct 2008 16:46:05 +0000 Subject: [PATCH] Merged from trunk -r11621:11630 | 11622 | A cpv can be returned from dbapi.match() as an old-style | | zmedico | virtual match even in cases when the package does not | | | actually PROVIDE the virtual. Filter out any such false | | | matches inside depgraph._select_package() and | | | _show_unsatisfied_dep(). Thanks to Ned Ludd for | | | reporting this issue which was discovered when attempting to | | | install virtual/libc on uclibc profile. Apparently the | | | uclibc ebuilds need to be fixed to properly set PROVIDE when | | | the metadata cache is generated. | | 11623 | Bug #239529 - Fix 'doins' to work with symlinks to | | zmedico | directories, like it did before the changes from bug | | | #210575. | | 11624 | Add missing quotes on pushd argument from previous commit. | | zmedico | | | 11625 | Redirect pushd and popd output to /dev/null when | | zmedico | appropriate. | | 11626 | Fix PreservedLibsRegistry.store() so that it only rewrites | | zmedico | the data file when something has changed. | | 11627 | Only update the confmem file when something has changed. | | zmedico | | | 11628 | * When ensuring sane $PWD in ebuild.sh, die if the `cd | | zmedico | "$PORTAGE_BUILDDIR"` call fails. * Create $PORTAGE_BUILDDIR | | | for the "fetch" phase too since it might be necessary to | | | call pkg_nofetch. | | 11629 | Bug #239529 - When doins is called on a symlink to a | | zmedico | directory, preserve the name of the symlink for the | | | installed directory. This involves temporarily renaming the | | | directory and then renaming it back again. | | 11630 | In dyn_clean, cd to $PORTAGE_BUILDDIR/.. before attempting | | zmedico | to remove it since some kernels, such as Solaris, return | | | EINVAL when an attempt is made to remove the current working | | | directory. Thanks to Fabian Groffen for | | | reporting. | svn path=/main/branches/prefix/; revision=11632 --- bin/doins | 32 ++++++++++++++++++++++++++------ bin/ebuild.sh | 12 ++++++++---- pym/_emerge/__init__.py | 31 +++++++++++++++++++++++++------ pym/portage/__init__.py | 3 +-- pym/portage/dbapi/vartree.py | 13 ++++++++----- 5 files changed, 68 insertions(+), 23 deletions(-) diff --git a/bin/doins b/bin/doins index 009ae47ed..7a97e6f8b 100755 --- a/bin/doins +++ b/bin/doins @@ -25,6 +25,9 @@ if [[ ${INSDESTTREE#${D}} != "${INSDESTTREE}" ]]; then exit 1 fi +TMP=$T/.doins_tmp +mkdir "$TMP" + if [[ ${INSDESTTREE#${EPREFIX}} != "${INSDESTTREE}" ]]; then vecho "-------------------------------------------------------" 1>&2 vecho "You should not use \${EPREFIX} with helpers." 1>&2 @@ -39,8 +42,8 @@ _doins() { local mysrc="$1" mydir="$2" cleanup="" rval if [ -L "$mysrc" ] ; then - cp "$mysrc" "${T}" - mysrc="${T}/${mysrc##*/}" + cp "$mysrc" "$TMP" + mysrc="$TMP/${mysrc##*/}" cleanup=${mysrc} fi @@ -72,13 +75,30 @@ for x in "$@" ; do else pushd "${x%/*}" >/dev/null fi - find "${x##*/}" -type d -exec dodir "${INSDESTTREE}/{}" \; - find "${x##*/}" \( -type f -or -type l \) -print0 | _xdoins - popd >/dev/null + x=${x##*/} + x_orig=$x + # Follow any symlinks recursively until we've got + # a normal directory for 'find' to traverse. + while [ -L "$x" ] ; do + pushd "$(readlink "$x")" >/dev/null + x=${PWD##*/} + pushd "${PWD%/*}" >/dev/null + done + if [[ $x != $x_orig ]] ; then + mv "$x" "$TMP/$x_orig" + pushd "$TMP" >/dev/null + fi + find "$x_orig" -type d -exec dodir "${INSDESTTREE}/{}" \; + find "$x_orig" \( -type f -or -type l \) -print0 | _xdoins + if [[ $x != $x_orig ]] ; then + popd >/dev/null + mv "$TMP/$x_orig" "$x" + fi + while popd >/dev/null 2>&1 ; do true ; done ((++success)) else _doins "${x}" && ((++success)) fi done - +rm -rf "$TMP" [ $success -gt 0 ] && exit 0 || exit 1 diff --git a/bin/ebuild.sh b/bin/ebuild.sh index 4ea2caf93..33ba5fae4 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -273,7 +273,10 @@ register_die_hook() { } # Ensure that $PWD is sane whenever possible. -cd "$PORTAGE_BUILDDIR" 2>/dev/null +if ! hasq "$EBUILD_PHASE" clean depend help ; then + cd "$PORTAGE_BUILDDIR" || \ + die "PORTAGE_BUILDDIR does not exist: '$PORTAGE_BUILDDIR'" +fi #if no perms are specified, dirs/files will have decent defaults #(not secretive, but not stupid) @@ -757,9 +760,10 @@ dyn_clean() { # result in it wiping the users distfiles directory (bad). rm -rf "${PORTAGE_BUILDDIR}/distdir" - if [ -z "$(find "${PORTAGE_BUILDDIR}" -mindepth 1 -maxdepth 1)" ]; then - rmdir "${PORTAGE_BUILDDIR}" - fi + # Some kernels, such as Solaris, return EINVAL when an attempt + # is made to remove the current working directory. + cd "$PORTAGE_BUILDDIR"/.. + rmdir "$PORTAGE_BUILDDIR" 2>/dev/null true } diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index 4b7e20cbf..b4d9d955a 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -5220,6 +5220,7 @@ class depgraph(object): def _show_unsatisfied_dep(self, root, atom, myparent=None, arg=None): atom = portage.dep.Atom(atom) + atom_set = InternalPackageSet(initial_atoms=(atom,)) atom_without_use = atom if atom.use: atom_without_use = portage.dep.remove_slot(atom) @@ -5257,13 +5258,22 @@ class depgraph(object): for cpv in cpv_list: metadata, mreasons = get_mask_info(root_config, cpv, pkgsettings, db, pkg_type, built, installed, db_keys) - if atom.use and not mreasons: - missing_use.append(Package(built=built, cpv=cpv, + if metadata is not None: + pkg = Package(built=built, cpv=cpv, installed=installed, metadata=metadata, - root_config=root_config)) - else: - masked_packages.append( - (root_config, pkgsettings, cpv, metadata, mreasons)) + root_config=root_config) + if pkg.cp != atom.cp: + # A cpv can be returned from dbapi.match() as an + # old-style virtual match even in cases when the + # package does not actually PROVIDE the virtual. + # Filter out any such false matches here. + if not atom_set.findAtomForPackage(pkg): + continue + if atom.use and not mreasons: + missing_use.append(pkg) + continue + masked_packages.append( + (root_config, pkgsettings, cpv, metadata, mreasons)) missing_use_reasons = [] missing_iuse_reasons = [] @@ -5357,6 +5367,7 @@ class depgraph(object): if not isinstance(atom, portage.dep.Atom): atom = portage.dep.Atom(atom) atom_cp = atom.cp + atom_set = InternalPackageSet(initial_atoms=(atom,)) existing_node = None myeb = None usepkgonly = "--usepkgonly" in self.myopts @@ -5504,6 +5515,14 @@ class depgraph(object): pkgsettings.setcpv(pkg) pkg.metadata["USE"] = pkgsettings["PORTAGE_USE"] + if pkg.cp != atom.cp: + # A cpv can be returned from dbapi.match() as an + # old-style virtual match even in cases when the + # package does not actually PROVIDE the virtual. + # Filter out any such false matches here. + if not atom_set.findAtomForPackage(pkg): + continue + myarg = None if root == self.target_root: try: diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index a24220cc2..950f5353c 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -5478,8 +5478,7 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0, # Build directory creation isn't required for any of these. have_build_dirs = False - if mydo not in ("clean", "cleanrm", "digest", - "fetch", "help", "manifest"): + if mydo not in ("digest", "help", "manifest"): mystatus = prepare_build_dirs(myroot, mysettings, cleanup) if mystatus: return mystatus diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index 2708cc9df..32ec351b7 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -65,12 +65,13 @@ class PreservedLibsRegistry(object): raise PermissionDenied(self._filename) else: raise e - + self._data_orig = self._data.copy() def store(self): """ Store the registry data to file. No need to call this if autocommit was enabled. """ - if os.environ.get("SANDBOX_ON") == "1": + if os.environ.get("SANDBOX_ON") == "1" or \ + self._data == self._data_orig: return try: f = atomic_ofstream(self._filename) @@ -3495,6 +3496,7 @@ class dblink(object): #if we have a file containing previously-merged config file md5sums, grab it. conf_mem_file = os.path.join(destroot, EPREFIX_LSTRIP, CONFIG_MEMORY_FILE) cfgfiledict = grabdict(conf_mem_file) + cfgfiledict_orig = cfgfiledict.copy() if "NOCONFMEM" in self.settings: cfgfiledict["IGNORE"]=1 else: @@ -3555,9 +3557,10 @@ class dblink(object): # write out our collection of md5sums cfgfiledict.pop("IGNORE", None) - ensure_dirs(os.path.dirname(conf_mem_file), - gid=portage_gid, mode=02750, mask=02) - writedict(cfgfiledict, conf_mem_file) + if cfgfiledict != cfgfiledict_orig: + ensure_dirs(os.path.dirname(conf_mem_file), + gid=portage_gid, mode=02750, mask=02) + writedict(cfgfiledict, conf_mem_file) # These caches are populated during collision-protect and the data # they contain is now invalid. It's very important to invalidate -- 2.26.2