Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(867)

Unified Diff: pym/portage/package/ebuild/doebuild.py

Issue 6370011: Update Portage to support fixing *.la and *.pc files. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/portage_tool.git@cros-2.1.9
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pym/portage/dbapi/vartree.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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" % \
« no previous file with comments | « pym/portage/dbapi/vartree.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698