Index: pym/portage/package/ebuild/doebuild.py |
diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py |
index 6fc7489aa7317a38de17091f976b1b8a3bc6a0a6..19ca140f94a0c1e81fed73f59a81d842a68972f1 100644 |
--- a/pym/portage/package/ebuild/doebuild.py |
+++ b/pym/portage/package/ebuild/doebuild.py |
@@ -4,6 +4,7 @@ |
__all__ = ['doebuild', 'doebuild_environment', 'spawn', 'spawnebuild'] |
import codecs |
+import fileinput |
import gzip |
from itertools import chain |
import logging |
@@ -1384,6 +1385,7 @@ def _post_src_install_uid_fix(mysettings, out): |
destdir = mysettings["D"] |
unicode_errors = [] |
+ fix_files = [] |
while True: |
@@ -1472,10 +1474,12 @@ def _post_src_install_uid_fix(mysettings, out): |
new_contents, mode='wb') |
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 |
@@ -1543,6 +1547,14 @@ def _post_src_install_uid_fix(mysettings, out): |
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" % \ |