Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 583740 - RFC: hprefixify and prefixify_ro prefix.eclass
Summary: RFC: hprefixify and prefixify_ro prefix.eclass
Status: RESOLVED FIXED
Alias: None
Product: Gentoo/Alt
Classification: Unclassified
Component: Prefix Support (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: Gentoo Prefix
URL: http://article.gmane.org/gmane.linux....
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-22 04:10 UTC by Benda Xu
Modified: 2016-07-21 01:45 UTC (History)
0 users

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


Attachments
prefix.eclass.patch (prefix.patch,1.22 KB, patch)
2016-05-22 04:11 UTC, Benda Xu
Details | Diff
prefix.eclass.patch (prefix.eclass.patch,2.14 KB, patch)
2016-06-15 10:39 UTC, Benda Xu
Details | Diff
prefix.patch (prefix.patch,2.79 KB, patch)
2016-06-30 00:41 UTC, Benda Xu
Details | Diff
prefix.patch (prefix.patch,2.24 KB, patch)
2016-07-17 10:12 UTC, Benda Xu
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Benda Xu gentoo-dev 2016-05-22 04:10:12 UTC
There are many cases that a patch should be prefixified before applied.  The new function eprefixify_patch achieves this.

Reproducible: Always
Comment 1 Benda Xu gentoo-dev 2016-05-22 04:11:37 UTC
Created attachment 434936 [details, diff]
prefix.eclass.patch
Comment 2 Fabian Groffen gentoo-dev 2016-05-22 07:42:36 UTC
Hmmm, I guess the only "win" here is not to have to specify the actualy files being patched?

I think your description should mention the patches are applied too.

Performance suggestion: vectorise the thing, so:
- cp all patches at once to ${T}/tmpspace
- eprefixify all patches at once in ${T}/tmpspace
- epatch all patches at once from ${T}/tmpspace

Other than that, got for it on -dev ML.
Comment 3 Benda Xu gentoo-dev 2016-06-15 10:39:32 UTC
Created attachment 437630 [details, diff]
prefix.eclass.patch

epatch is too special.  Instead a wrapper to any ebuild helper functions will provide nice syntax sugar.

In addition, heuristics are added to cover some trivial eprefixify cases.
Comment 4 Benda Xu gentoo-dev 2016-06-30 00:41:16 UTC
Created attachment 439182 [details, diff]
prefix.patch

Guys, what do you think?
Comment 5 Fabian Groffen gentoo-dev 2016-06-30 09:12:19 UTC
I see what you're trying to do, but I'm wondering whether it isn't going the wrong way.  Like for instance eselect now has built-in eprefix support in its install, we should aim for the same approach with most packages.

Can you give an estimation about how many ebuilds will use this functionality?
Comment 6 Benda Xu gentoo-dev 2016-06-30 12:50:58 UTC
(In reply to Fabian Groffen from comment #5)
> I see what you're trying to do, but I'm wondering whether it isn't going the
> wrong way.  Like for instance eselect now has built-in eprefix support in
> its install, we should aim for the same approach with most packages.

Yeah.  eselect is what we can control. Aiming for a perfect Prefix support is feasible.  The same applies to other gentoo-born packages, like OpenRC.
 
> Can you give an estimation about how many ebuilds will use this
> functionality?

I think at least 30% of the ebuilds can benefit from this functionality.

For example www-client/w3m I worked on today. It has /usr /usr/local/lib /usr/lib /usr/lib64, etc. hard-coded in configure (via acinclude.m4), which is very common.  Any library dependence has to be manually specified with econf --with-foo=${EPREFIX}/usr.  But if we use the heuristics to prefixify acinclude.m4.  The (prefixified) default paths work again.

Lines of code to support Prefix decreases, which makes the merge of Prefix to gx86 less intrusive. The logics are shifted from ebuilds to prefix.eclass.
Comment 7 Benda Xu gentoo-dev 2016-07-07 02:58:32 UTC
hi Fabian, is this update reasonable?  There seems to be no objections from gentoo-dev.
Comment 8 Fabian Groffen gentoo-dev 2016-07-07 06:40:03 UTC
Well, I'm not a fan of the fuzzy auto-replacement, but that's because I can see it go wrong sometimes.

How about the following:

- split out the autoreplacement stuff, e.g. keep eprefixy as-is, it replaces the @...@ thing and that's it
- make the autoreplacement function work with a default param, which can be overridden (the -e opt) such that when the default is too greedy, it can be adjusted, reusing the magic of the function

Idea is that it seems wrong to me to need both replacement of @...@, and autoreplacement, so this way we make it explicit.  I also believe that eprefixify is a safer option than the autoreplacements, so nicer from that point of view too.

I personally feel fprefixify is a too ugly hack, but if you deem it very useful (for the time being?) then ok, and you could have it run both eprefixify as well as the new function which does the autoreplacement, so you get the behaviour you get right now.
Comment 9 Benda Xu gentoo-dev 2016-07-17 10:12:34 UTC
Created attachment 440934 [details, diff]
prefix.patch

> Well, I'm not a fan of the fuzzy auto-replacement, but that's because I can see it go wrong sometimes.

Yeah, so I made it customizable.

> How about the following:

> - split out the autoreplacement stuff, e.g. keep eprefixy as-is, it replaces the @...@ thing and that's it

Done

> - make the autoreplacement function work with a default param, which can be overridden (the -e opt) such that when the default is too greedy, it can be adjusted, reusing the magic of the function

> Idea is that it seems wrong to me to need both replacement of @...@, and autoreplacement, so this way we make it explicit.  I also believe that eprefixify is a safer option than the autoreplacements, so nicer from that point of view too.

Okay.  I split out hperfixify for the heuristics.  I also added another option -w for the line matches to prevent from the default to be too greedy.

> I personally feel fprefixify is a too ugly hack, but if you deem it very useful (for the time being?) then ok, and you could have it run both eprefixify as well as the new function which does the autoreplacement, so you get the behaviour you get right now.

Yeah, it's ugly.  I would like to replace it with prefixify_ro, to copy a read-only file to ${T} and prefixify.

What do you think?
Comment 10 Fabian Groffen gentoo-dev 2016-07-18 07:47:43 UTC
Ok, I like this approach much more.  Thanks!
Comment 11 Benda Xu gentoo-dev 2016-07-21 01:45:00 UTC
In tree with some minor changes.  Thanks

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ecdc2eb2332e