Index: sys-apps/portage/files/portage-2.1.9.25-crossdev.patch |
diff --git a/sys-apps/portage/files/portage-2.1.9.25-crossdev.patch b/sys-apps/portage/files/portage-2.1.9.25-crossdev.patch |
new file mode 100644 |
index 0000000000000000000000000000000000000000..27e49612004cea630749ea6ad579773a7c1a9645 |
--- /dev/null |
+++ b/sys-apps/portage/files/portage-2.1.9.25-crossdev.patch |
@@ -0,0 +1,128 @@ |
+--- portage/pym/portage/package/ebuild/doebuild.py.orig 2010-12-23 11:33:27.000000000 -0800 |
++++ portage/pym/portage/package/ebuild/doebuild.py 2010-12-23 11:46:47.000000000 -0800 |
+@@ -4,6 +4,7 @@ |
+ __all__ = ['doebuild', 'doebuild_environment', 'spawn', 'spawnebuild'] |
+ |
+ import codecs |
++import fileinput |
+ import gzip |
+ from itertools import chain |
+ import logging |
+@@ -1363,6 +1364,7 @@ |
+ |
+ destdir = mysettings["D"] |
+ unicode_errors = [] |
++ fix_files = [] |
+ |
+ while True: |
+ |
+@@ -1450,10 +1452,12 @@ |
+ f.close() |
+ |
+ mystat = os.lstat(fpath) |
+- if stat.S_ISREG(mystat.st_mode) and \ |
+- mystat.st_ino not in counted_inodes: |
+- counted_inodes.add(mystat.st_ino) |
+- size += mystat.st_size |
++ if stat.S_ISREG(mystat.st_mode): |
++ if fname.endswith(".pc") or fname.endswith(".la"): |
++ fix_files.append(fpath) |
++ if mystat.st_ino not in counted_inodes: |
++ counted_inodes.add(mystat.st_ino) |
++ size += mystat.st_size |
+ if mystat.st_uid != portage_uid and \ |
+ mystat.st_gid != portage_gid: |
+ continue |
+@@ -1521,6 +1525,14 @@ |
+ mode='w', encoding=_encodings['repo.content'], |
+ errors='strict').write(v + '\n') |
+ |
++ re_root = mysettings["ROOT"].strip("/") |
++ if fix_files and re_root: |
++ # Replace references to our sysroot with references to "/" in binpkg. |
++ # Sysroot will be re-appended when the package is installed. |
++ pat = re.compile(r"([' =](-[IL])?/)%s/" % re.escape(re_root)) |
++ for line in fileinput.input(fix_files, inplace=1): |
++ sys.stdout.write(pat.sub(r"\1", line)) |
++ |
+ if bsd_chflags: |
+ # Restore all of the flags saved above. |
+ os.system("mtree -e -p %s -U -k flags < %s > /dev/null" % \ |
+--- portage/pym/portage/dbapi/vartree.py.orig2 2010-12-23 11:48:32.000000000 -0800 |
++++ portage/pym/portage/dbapi/vartree.py 2010-12-23 12:17:52.000000000 -0800 |
+@@ -58,6 +58,7 @@ |
+ from _emerge.MiscFunctionsProcess import MiscFunctionsProcess |
+ |
+ import codecs |
++import fileinput |
+ import gc |
+ import re, shutil, stat, errno, subprocess |
+ import logging |
+@@ -1694,10 +1695,11 @@ |
+ else: |
+ self.settings.pop("PORTAGE_LOG_FILE", None) |
+ |
+- env_update(target_root=self.settings['ROOT'], |
+- prev_mtimes=ldpath_mtimes, |
+- contents=contents, env=self.settings.environ(), |
+- writemsg_level=self._display_merge) |
++ if 'no-env-update' not in self.settings.features: |
++ env_update(target_root=self.settings['ROOT'], |
++ prev_mtimes=ldpath_mtimes, |
++ contents=contents, env=self.settings.environ(), |
++ writemsg_level=self._display_merge) |
+ return os.EX_OK |
+ |
+ def _display_merge(self, msg, level=0, noiselevel=0): |
+@@ -3369,16 +3371,30 @@ |
+ showMessage(_("!!! FAILED postinst: ")+str(a)+"\n", |
+ level=logging.ERROR, noiselevel=-1) |
+ |
+- downgrade = False |
+- for v in otherversions: |
+- if pkgcmp(catpkgsplit(self.pkg)[1:], catpkgsplit(v)[1:]) < 0: |
+- downgrade = True |
+- |
+- #update environment settings, library paths. DO NOT change symlinks. |
+- env_update(makelinks=(not downgrade), |
+- target_root=self.settings['ROOT'], prev_mtimes=prev_mtimes, |
+- contents=contents, env=self.settings.environ(), |
+- writemsg_level=self._display_merge) |
++ if 'no-env-update' not in self.settings.features: |
++ downgrade = False |
++ for v in otherversions: |
++ if pkgcmp(catpkgsplit(self.pkg)[1:], catpkgsplit(v)[1:]) < 0: |
++ downgrade = True |
++ |
++ #update environment settings, library paths. DO NOT change symlinks. |
++ env_update(makelinks=(not downgrade), |
++ target_root=self.settings['ROOT'], prev_mtimes=prev_mtimes, |
++ contents=contents, env=self.settings.environ(), |
++ writemsg_level=self._display_merge) |
++ |
++ # Fix *.{la,pc} files to point to libs in target_root, if they |
++ # don't do so already. |
++ re_root = self.settings["ROOT"].strip("/") |
++ if re_root: |
++ fix_files = [] |
++ for path in contents: |
++ if path.endswith(".la") or path.endswith(".pc"): |
++ if os.path.exists(path): fix_files.append(path) |
++ if fix_files: |
++ pat = re.compile(r"([' =](?:-[IL])?/)(usr|lib|opt)") |
++ for line in fileinput.input(fix_files, inplace=1): |
++ sys.stdout.write(pat.sub(r"\1%s/\2" % re_root, line)) |
+ |
+ # For gcc upgrades, preserved libs have to be removed after the |
+ # the library path has been updated. |
+--- portage/pym/portage/const.py.orig 2010-12-23 12:19:06.000000000 -0800 |
++++ portage/pym/portage/const.py 2010-12-23 12:23:58.000000000 -0800 |
+@@ -93,7 +93,7 @@ |
+ "installsources", "keeptemp", "keepwork", "fixlafiles", "lmirror", |
+ "metadata-transfer", "mirror", "multilib-strict", "news", |
+ "noauto", "noclean", "nodoc", "noinfo", "noman", "nostrip", |
+- "notitles", "parallel-fetch", "parse-eapi-ebuild-head", |
++ "notitles", "no-env-update", "parallel-fetch", "parse-eapi-ebuild-head", |
+ "prelink-checksums", "preserve-libs", |
+ "protect-owned", "python-trace", "sandbox", |
+ "selinux", "sesandbox", "severe", "sfperms", |