Chromium Code Reviews
Help | Chromium Project | Gerrit Changes | Sign in
(5)

Issue 6370011: Update Portage to support fixing *.la and *.pc files. (Closed)

Created:
10 years, 1 month ago by davidjames
Modified:
9 years, 7 months ago
Reviewers:
anush
CC:
chromium-os-reviews_chromium.org
Visibility:
Public.

Description

Update Portage to support fixing *.la and *.pc files. *.la and *.pc files need to be fixed up in order to ensure packages link against the right library when we try to build / install to different ROOTs. BUG=chromium-os:11316 TEST=Compile with build_packages --nousepkg Committed: http://chrome-svn/viewvc/chromeos?view=rev&revision=d406983

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+47 lines, -19 lines) Patch
M pym/portage/const.py View 1 chunk +1 line, -1 line 0 comments Download
M pym/portage/dbapi/vartree.py View 3 chunks +30 lines, -14 lines 0 comments Download
M pym/portage/package/ebuild/doebuild.py View 4 chunks +16 lines, -4 lines 0 comments Download

Messages

Total messages: 2 (0 generated)
davidjames
This CL just migrates the existing portage-2.1.9.25-crossdev.patch to the portage_tool repository.
10 years, 1 month ago (2011-01-26 00:24:03 UTC) #1
anush
10 years, 1 month ago (2011-01-26 00:57:47 UTC) #2
LGTM

On Tue, Jan 25, 2011 at 4:24 PM, <davidjames@chromium.org> wrote:

> Reviewers: anush,
>
> Message:
> This CL just migrates the existing portage-2.1.9.25-crossdev.patch to the
> portage_tool repository.
>
> Description:
> Update Portage to support fixing *.la and *.pc files.
>
> *.la and *.pc files need to be fixed up in order to ensure packages link
> against the right library when we try to build / install to different
> ROOTs.
>
> BUG=chromium-os:11316
> TEST=Compile with build_packages --nousepkg
>
> Please review this at http://codereview.chromium.org/6370011/
>
> SVN Base: ssh://git@gitrw.chromium.org:9222/portage_tool.git@cros-2.1.9
>
> Affected files:
>  M pym/portage/const.py
>  M pym/portage/dbapi/vartree.py
>  M pym/portage/package/ebuild/doebuild.py
>
>
> Index: pym/portage/const.py
> diff --git a/pym/portage/const.py b/pym/portage/const.py
> index
>
f798202776332ae734ba8a2b45206cdab7a8d9ff..b2d2f77143cc5f120255e140cd00239bc112c0de
> 100644
> --- a/pym/portage/const.py
> +++ b/pym/portage/const.py
> @@ -93,7 +93,7 @@ SUPPORTED_FEATURES       = frozenset([
>                            "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",
> Index: pym/portage/dbapi/vartree.py
> diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
> index
>
ccf239ff118209d1577700087563cf23737816c3..965f154901c19294538f86e3ccb075e430331cde
> 100644
> --- a/pym/portage/dbapi/vartree.py
> +++ b/pym/portage/dbapi/vartree.py
> @@ -58,6 +58,7 @@ from _emerge.PollScheduler import PollScheduler
>  from _emerge.MiscFunctionsProcess import MiscFunctionsProcess
>
>  import codecs
> +import fileinput
>  import gc
>  import re, shutil, stat, errno, subprocess
>  import logging
> @@ -1701,10 +1702,11 @@ class dblink(object):
>                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):
> @@ -3377,16 +3379,30 @@ class dblink(object):
>                        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.
> 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" % \
>
>
>

Powered by Google App Engine
This is Rietveld 408576698