Gentoo Archives: gentoo-portage-dev

From: Brian Dolbec <dolsen@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [PATCH] grabfile_package: support -* in profile "packages" files (bug 610670)
Date: Thu, 23 Feb 2017 15:52:20
Message-Id: 20170223075215.62392268.dolsen@gentoo.org
In Reply to: Re: [gentoo-portage-dev] [PATCH] grabfile_package: support -* in profile "packages" files (bug 610670) by Joakim Tjernlund
1 On Thu, 23 Feb 2017 11:53:15 +0000
2 Joakim Tjernlund <Joakim.Tjernlund@××××××××.com> wrote:
3
4 > On Thu, 2017-02-23 at 02:52 -0800, Zac Medico wrote:
5 > > Support -* in order to make it easier to create profiles for
6 > > minimal systems (especially those built entirely from binary
7 > > packages).
8 >
9 > Would be nice, but I don't get what the "packages" file is?
10
11
12 That would be the 'packages' file (list of required packages)that are
13 required for that specific profile. This patch would allow to
14 override that packages file to build an image that only contained the
15 minimum runtime pkgs required to perform the tasks it is suppose to.
16 The idea being you would not need gcc, automake, ... or even portage or
17 possibly python. The built image could of course be considered more
18 secure not having a compiler, etc... not to mention smaller.
19
20
21 Zac, looks fine to me.
22
23
24 >
25 > >
26 > > X-Gentoo-Bug: 610670
27 > > X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=610670
28 > > ---
29 > > pym/portage/util/__init__.py | 9 ++++++++-
30 > > 1 file changed, 8 insertions(+), 1 deletion(-)
31 > >
32 > > diff --git a/pym/portage/util/__init__.py
33 > > b/pym/portage/util/__init__.py index c2c871f..45710ba 100644
34 > > --- a/pym/portage/util/__init__.py
35 > > +++ b/pym/portage/util/__init__.py
36 > > @@ -478,13 +478,20 @@ def grabfile_package(myfilename,
37 > > compatlevel=0, recursive=0, eapi = read_corresponding_eapi_file(
38 > > myfilename, default=eapi_default)
39 > > mybasename = os.path.basename(myfilename)
40 > > + is_packages_file = mybasename == 'packages'
41 > > atoms = []
42 > > for pkg, source_file in pkgs:
43 > > pkg_orig = pkg
44 > > # for packages and package.mask files
45 > > if pkg[:1] == "-":
46 > > + if is_packages_file and pkg == '-*':
47 > > + if remember_source_file:
48 > > + atoms.append((pkg,
49 > > source_file))
50 > > + else:
51 > > + atoms.append(pkg)
52 > > + continue
53 > > pkg = pkg[1:]
54 > > - if pkg[:1] == '*' and mybasename == 'packages':
55 > > + if pkg[:1] == '*' and is_packages_file:
56 > > pkg = pkg[1:]
57 > > try:
58 > > pkg = Atom(pkg,
59 > > allow_wildcard=allow_wildcard,
60 >
61
62
63
64 --
65 Brian Dolbec <dolsen>

Replies