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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pym/portage/dbapi/vartree.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2010-2011 Gentoo Foundation 1 # Copyright 2010-2011 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2 2 # Distributed under the terms of the GNU General Public License v2
3 3
4 __all__ = ['doebuild', 'doebuild_environment', 'spawn', 'spawnebuild'] 4 __all__ = ['doebuild', 'doebuild_environment', 'spawn', 'spawnebuild']
5 5
6 import codecs 6 import codecs
7 import fileinput
7 import gzip 8 import gzip
8 from itertools import chain 9 from itertools import chain
9 import logging 10 import logging
10 import os as _os 11 import os as _os
11 import re 12 import re
12 import shutil 13 import shutil
13 import signal 14 import signal
14 import stat 15 import stat
15 import sys 16 import sys
16 import tempfile 17 import tempfile
(...skipping 1360 matching lines...) Expand 10 before | Expand all | Expand 10 after
1377 os.system("mtree -c -p %s -k flags > %s" % \ 1378 os.system("mtree -c -p %s -k flags > %s" % \
1378 (_shell_quote(mysettings["D"]), 1379 (_shell_quote(mysettings["D"]),
1379 _shell_quote(os.path.join(mysettings["T"], "bsdflags.mtr ee")))) 1380 _shell_quote(os.path.join(mysettings["T"], "bsdflags.mtr ee"))))
1380 os.system("chflags -R noschg,nouchg,nosappnd,nouappnd %s" % \ 1381 os.system("chflags -R noschg,nouchg,nosappnd,nouappnd %s" % \
1381 (_shell_quote(mysettings["D"]),)) 1382 (_shell_quote(mysettings["D"]),))
1382 os.system("chflags -R nosunlnk,nouunlnk %s 2>/dev/null" % \ 1383 os.system("chflags -R nosunlnk,nouunlnk %s 2>/dev/null" % \
1383 (_shell_quote(mysettings["D"]),)) 1384 (_shell_quote(mysettings["D"]),))
1384 1385
1385 destdir = mysettings["D"] 1386 destdir = mysettings["D"]
1386 unicode_errors = [] 1387 unicode_errors = []
1388 fix_files = []
1387 1389
1388 while True: 1390 while True:
1389 1391
1390 unicode_error = False 1392 unicode_error = False
1391 size = 0 1393 size = 0
1392 counted_inodes = set() 1394 counted_inodes = set()
1393 fixlafiles_announced = False 1395 fixlafiles_announced = False
1394 fixlafiles = "fixlafiles" in mysettings.features 1396 fixlafiles = "fixlafiles" in mysettings.features
1395 1397
1396 for parent, dirs, files in os.walk(destdir): 1398 for parent, dirs, files in os.walk(destdir):
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1465 writemsg("Fixing .la fil es\n", fd=out) 1467 writemsg("Fixing .la fil es\n", fd=out)
1466 writemsg(" %s\n" % fpath[len(d estdir):], fd=out) 1468 writemsg(" %s\n" % fpath[len(d estdir):], fd=out)
1467 # write_atomic succeeds even in some cases in which 1469 # write_atomic succeeds even in some cases in which
1468 # a normal write might fail due to file permission 1470 # a normal write might fail due to file permission
1469 # settings on some operating sys tems such as HP-UX 1471 # settings on some operating sys tems such as HP-UX
1470 write_atomic(_unicode_encode(fpa th, 1472 write_atomic(_unicode_encode(fpa th,
1471 encoding=_encodings['mer ge'], errors='strict'), 1473 encoding=_encodings['mer ge'], errors='strict'),
1472 new_contents, mode='wb') 1474 new_contents, mode='wb')
1473 1475
1474 mystat = os.lstat(fpath) 1476 mystat = os.lstat(fpath)
1475 » » » » if stat.S_ISREG(mystat.st_mode) and \ 1477 » » » » if stat.S_ISREG(mystat.st_mode):
1476 » » » » » mystat.st_ino not in counted_inodes: 1478 » » » » » if fname.endswith(".pc") or fname.endswi th(".la"):
1477 » » » » » counted_inodes.add(mystat.st_ino) 1479 » » » » » » fix_files.append(fpath)
1478 » » » » » size += mystat.st_size 1480 » » » » » if mystat.st_ino not in counted_inodes:
1481 » » » » » » counted_inodes.add(mystat.st_ino )
1482 » » » » » » size += mystat.st_size
1479 if mystat.st_uid != portage_uid and \ 1483 if mystat.st_uid != portage_uid and \
1480 mystat.st_gid != portage_gid: 1484 mystat.st_gid != portage_gid:
1481 continue 1485 continue
1482 myuid = -1 1486 myuid = -1
1483 mygid = -1 1487 mygid = -1
1484 if mystat.st_uid == portage_uid: 1488 if mystat.st_uid == portage_uid:
1485 myuid = inst_uid 1489 myuid = inst_uid
1486 if mystat.st_gid == portage_gid: 1490 if mystat.st_gid == portage_gid:
1487 mygid = inst_gid 1491 mygid = inst_gid
1488 apply_secpass_permissions( 1492 apply_secpass_permissions(
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1536 try: 1540 try:
1537 os.unlink(filename) 1541 os.unlink(filename)
1538 except OSError: 1542 except OSError:
1539 pass 1543 pass
1540 continue 1544 continue
1541 codecs.open(_unicode_encode(os.path.join(build_info_dir, 1545 codecs.open(_unicode_encode(os.path.join(build_info_dir,
1542 k), encoding=_encodings['fs'], errors='strict'), 1546 k), encoding=_encodings['fs'], errors='strict'),
1543 mode='w', encoding=_encodings['repo.content'], 1547 mode='w', encoding=_encodings['repo.content'],
1544 errors='strict').write(v + '\n') 1548 errors='strict').write(v + '\n')
1545 1549
1550 re_root = mysettings["ROOT"].strip("/")
1551 if fix_files and re_root:
1552 # Replace references to our sysroot with references to "/" in bi npkg.
1553 # Sysroot will be re-appended when the package is installed.
1554 pat = re.compile(r"([' =](-[IL])?/)%s/" % re.escape(re_root))
1555 for line in fileinput.input(fix_files, inplace=1):
1556 sys.stdout.write(pat.sub(r"\1", line))
1557
1546 if bsd_chflags: 1558 if bsd_chflags:
1547 # Restore all of the flags saved above. 1559 # Restore all of the flags saved above.
1548 os.system("mtree -e -p %s -U -k flags < %s > /dev/null" % \ 1560 os.system("mtree -e -p %s -U -k flags < %s > /dev/null" % \
1549 (_shell_quote(mysettings["D"]), 1561 (_shell_quote(mysettings["D"]),
1550 _shell_quote(os.path.join(mysettings["T"], "bsdflags.mtr ee")))) 1562 _shell_quote(os.path.join(mysettings["T"], "bsdflags.mtr ee"))))
1551 1563
1552 def _merge_unicode_error(errors): 1564 def _merge_unicode_error(errors):
1553 lines = [] 1565 lines = []
1554 1566
1555 msg = _("This package installs one or more file names containing " 1567 msg = _("This package installs one or more file names containing "
(...skipping 11 matching lines...) Expand all
1567 msg = _("For best results, UTF-8 encoding is recommended. See " 1579 msg = _("For best results, UTF-8 encoding is recommended. See "
1568 "the Gentoo Linux Localization Guide for instructions " 1580 "the Gentoo Linux Localization Guide for instructions "
1569 "about how to configure your locale for UTF-8 encoding:" ) 1581 "about how to configure your locale for UTF-8 encoding:" )
1570 lines.extend(wrap(msg, 72)) 1582 lines.extend(wrap(msg, 72))
1571 lines.append("") 1583 lines.append("")
1572 lines.append("\t" + \ 1584 lines.append("\t" + \
1573 "http://www.gentoo.org/doc/en/guide-localization.xml") 1585 "http://www.gentoo.org/doc/en/guide-localization.xml")
1574 lines.append("") 1586 lines.append("")
1575 1587
1576 return lines 1588 return lines
OLDNEW
« 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