Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 34964 - [PATCH] BUILD_PKGS=... : a configurable "buildpkg" replacement
Summary: [PATCH] BUILD_PKGS=... : a configurable "buildpkg" replacement
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Enhancement/Feature Requests (show other bugs)
Hardware: All All
: Low enhancement
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-12-03 04:14 UTC by TGL
Modified: 2013-02-15 23:08 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
2.0.49-r16-buildsyspkg.patch (buildsyspkg.patch,1.49 KB, patch)
2003-12-03 04:16 UTC, TGL
Details | Diff
2.0.49-r18-buildsyspkg-feature.patch (buildsyspkg-feature.patch,1.88 KB, patch)
2003-12-10 01:06 UTC, TGL
Details | Diff
custom-buildpkg-2.0.50_pre1.patch (custom-buildpkg-2.0.50_pre1.patch,5.10 KB, patch)
2003-12-12 03:46 UTC, TGL
Details | Diff
custom-buildpkg-cnf-2.0.50_pre1.patch (custom-buildpkg-cnf-2.0.50_pre1.patch,2.41 KB, patch)
2003-12-12 03:48 UTC, TGL
Details | Diff
custom-buildpkg-2.0.50_pre10.patch (custom-buildpkg-2.0.50_pre10.patch,206.85 KB, patch)
2004-01-08 05:33 UTC, TGL
Details | Diff
custom-buildpkg-2.0.50_pre10.patch (custom-buildpkg-2.0.50_pre10.patch,5.46 KB, patch)
2004-01-08 05:42 UTC, TGL
Details | Diff
custom-buildpkg--code.patch (custom-buildpkg--code.patch,4.57 KB, patch)
2004-01-12 03:22 UTC, TGL
Details | Diff
custom-buildpkg--conf.patch (custom-buildpkg--conf.patch,2.12 KB, patch)
2004-01-12 05:20 UTC, TGL
Details | Diff
custom-buildpkg--code.patch (custom-buildpkg--code.patch,5.31 KB, patch)
2004-02-03 09:07 UTC, TGL
Details | Diff
portage-2.0-svn20051024-BUILD_PKGS-code.patch (portage-2.0-svn20051024-BUILD_PKGS-code.patch,7.29 KB, patch)
2005-10-25 10:21 UTC, TGL
Details | Diff
portage-2.0-svn20051024-BUILD_PKGS-cnf.patch (portage-2.0-svn20051024-BUILD_PKGS-cnf.patch,41.49 KB, patch)
2005-10-25 10:21 UTC, TGL
Details | Diff
portage-2.0-svn20051024-BUILD_PKGS-man.patch (portage-2.0-svn20051024-BUILD_PKGS-man.patch,2.17 KB, patch)
2005-10-25 10:22 UTC, TGL
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description TGL 2003-12-03 04:14:59 UTC
Hi,

I've added a small feature to my portage to keep binary packages tarballs 
of system packages. I thought this may be usefull in case I break 
glibc/gcc/python/portage/whatever.

The FEATURE flag is named "buildsyspkg", and implementation is local to
"bin/emerge", class "depgraph", method "merge".

I will attach a patch, made against 2.0.49-r16. It won't apply to -r18, 
sorry. I will post an updated patch later, but have not moved to -r18 yet.

Also, I would like to hear your opinion on a more general approach to 
selecting what binary packages one want to keep. Here is what I have 
in mind:
 - only feature "buildpkg" force tarballs creation
 - a variable "PACKAGES_TO_KEEP" defines what are packages that should 
 be built when "buildpkg" is enabled. It's default value is "*", so that
 "buildpkg" default behavior doesn't change.
 - in this variable, you can set both some "category/package" entries, 
 or/and the usual packages sets ("system" and "world")

The goal is to be able to define a real backup policy for packages. 
Personnaly, I want to:
 - keep system packages for safety
 - keep xfree/open-office/mozilla because they are slow to build and I 
 sometimes use them on other stations, or share them with other people
 - drop all other packages

I'm sure I'm not the only user with this kind of policy, more or less 
applied by hand now. 

Any suggestion/criticism before I start implementing this?

Thanks.
Comment 1 TGL 2003-12-03 04:16:07 UTC
Created attachment 21634 [details, diff]
2.0.49-r16-buildsyspkg.patch
Comment 2 TGL 2003-12-10 01:06:29 UTC
Created attachment 21963 [details, diff]
2.0.49-r18-buildsyspkg-feature.patch

Here is the same patch against -r18.
Comment 3 TGL 2003-12-10 07:39:38 UTC
I realized there is a bug: when a package instanciates a virtual from system, it is not recognized as being part of system. For instance, no binary package will be created for modutils, because it is virtual/modutils that is in system.

I've start working on the more customizable solution I've described in my first post, so I think I will only fix this there.
Comment 4 TGL 2003-12-12 03:44:38 UTC
I've more or less implemented the other patch I've described in comment #1.
With this version, there is no more "buildsyspkg" feature flag, but the 
behavior of "buildpkg" changes. Binary tarballs are now built depending on
a policy defined by the incremental variable BUILD_PKGS. 

Valid rules are {*,system,category,category/package}, and their negations 
("!something"). A package will be kept if it matches at least one positive 
rules, and no negative rule. The default should be "*" so that "buildpkg" 
default behavior doesn't change.

Example to keep all packages but kernels/headers:
   BUILD_PKGS="!sys-kernel"
Example to keep system packages but kernels/headers, and also xfree:
   BUILD_PKGS="-* system !sys-kernel x11-base/xfree"

Misc notes:
 - "world" is not a valid rule. This is because when I check if a package
is to be kept, it is probably not yet in world file. But I don't really 
think this rule would have been useful.
 - "system" is still problematic because of virtuals (see my previous 
comment). What I've implemented solve most of the cases, but will still fail
to recognize a package that provides a system virtual if it is merged for the
first time and is not the virtual default. This is because the package is 
neither yet in profile/virtuals, nor in edb/virtuals. A really correct 
implementation can only rely on the "PROVIDE" field of the ebuild, but I 
can't use it because it is not an aux_get key.
Comment 5 TGL 2003-12-12 03:46:28 UTC
Created attachment 22080 [details, diff]
custom-buildpkg-2.0.50_pre1.patch

The patch includes a reverse for the previous "buildsyspkg" stuff.
Comment 6 TGL 2003-12-12 03:48:02 UTC
Created attachment 22081 [details, diff]
custom-buildpkg-cnf-2.0.50_pre1.patch

This is a proposal of some make.{globals,conf} additions.
Comment 7 Marius Mauch (RETIRED) gentoo-dev 2004-01-05 20:44:44 UTC
looking at the code I think it handles "!foo foo/bar" wrong as it breaks the for loop in isbuildpkg() on the first matching negative rule, so it won't build a package for foo/bar. And somehow I'm not comfortable with the syntax for BUILD_PKGS either, just thinking about a better way.
Comment 8 TGL 2004-01-07 06:16:15 UTC
It's not a bug, it's a feature :/  The predicate is "at least one positive rule and no negative rule". This was enough for the few policies I've thought of, but it is true that for your example it is stupid. 

A better predicate would be "at least one positive rule with no negative rule of a lower level", meaning that for instance:
 - "system !category" (resp. "system !cat/pkg") would build for system but the category (resp. the pkg), because a category rule (resp. a pkg rule) is lower level than the system rule.
 - "category !category/pkgA" would build the whole category but pkgA, because a pkg rule is lower level than a category rule.
 - "system !category category/pkgA" (your example) would act as expected ({system} - {category} + {category/pkgA}), because the last rule is positive and no lower level rule negates it.

Would it be okay like this? I will code this soon to make it clear.

On the syntax, well, I agree it is not quite intuitive. I'm opened to any better proposition. The only thing that really limit possibilities I think is that I would like to keep the var incremental, so that you can easily add a package to your build list on command line before a "emerge -uD world" for instance.
Comment 9 TGL 2004-01-08 05:33:45 UTC
Created attachment 23379 [details, diff]
custom-buildpkg-2.0.50_pre10.patch

Here is a patch modified as described in the above comment, that should better
handle Marius' example.
Comment 10 TGL 2004-01-08 05:42:04 UTC
Created attachment 23380 [details, diff]
custom-buildpkg-2.0.50_pre10.patch

Doh!, did I really do that? Sorry, this one sounds better.
Comment 11 TGL 2004-01-12 03:22:42 UTC
Created attachment 23666 [details, diff]
custom-buildpkg--code.patch

Updated for 2.0.50_pre12.
Comment 12 TGL 2004-01-12 05:20:06 UTC
Created attachment 23673 [details, diff]
custom-buildpkg--conf.patch

Updated make.conf comments.
Comment 13 TGL 2004-02-03 09:07:57 UTC
Created attachment 24890 [details, diff]
custom-buildpkg--code.patch

Seems that when i've attached the last update, i've choosed the wrong file, and
reverted the rules priorities stuff introduced in the previous version. Here is
the right, finally, the right patch.
Comment 14 Marius Mauch (RETIRED) gentoo-dev 2004-02-08 17:55:09 UTC
supposed to be fixed in 2.0.50 which is stable now. If this bug is not fixed please reopen.
Comment 15 TGL 2004-02-08 23:01:27 UTC
What is in 2.0.50 is the very first patch. Everything in this report starting at comment #3 is still pending.
Comment 16 Nicholas Jones (RETIRED) gentoo-dev 2004-10-22 08:48:01 UTC
Bug has been fixed and released in stable portages on or before 2.0.51-r2
Comment 17 TGL 2005-10-25 10:21:10 UTC
Created attachment 71430 [details, diff]
portage-2.0-svn20051024-BUILD_PKGS-code.patch

Synced with recent portage-2.0 SVN, and made various rewrites/changes:
 - deprecates FEATURES=buildpkg (resp. buildsyspkg) in favor of BUILD_PKGS="*"
(resp. BUILD_PKGS="system"). The feature flags still work though, but with a
warning.
 - added support for shell-like patterns in BUILD_PKGS elements (to match
stuffs like "sys-*" or "*/mozilla*")
 - refactored to put more code in portage.config and less in emerge. It plays
better with local USE flags and conditional PROVIDE this way, and is probably a
bit cleaner
Comment 18 TGL 2005-10-25 10:21:55 UTC
Created attachment 71431 [details, diff]
portage-2.0-svn20051024-BUILD_PKGS-cnf.patch

Documentation for cnf/make.conf*
Comment 19 TGL 2005-10-25 10:22:36 UTC
Created attachment 71432 [details, diff]
portage-2.0-svn20051024-BUILD_PKGS-man.patch

Adds documentation to man/make.conf.5
Comment 20 TGL 2005-10-25 10:24:59 UTC
Reopening now that patches are up-to-date again. Low priority tho, since it's a
new feature that most people have been able to live without so far.
Comment 21 Zac Medico gentoo-dev 2013-02-15 23:08:53 UTC
(In reply to comment #17)
>  - added support for shell-like patterns in BUILD_PKGS elements (to match
> stuffs like "sys-*" or "*/mozilla*")

Nowadays you can use wildcard atoms in /etc/portage/package.env to enable FEATURES=buildpkg for the packages you want.