Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 395827 - app-portage/portage-utils: find a way to patch for Prefix: post_sync and q-reinitialize from ${FILESDIR}
Summary: app-portage/portage-utils: find a way to patch for Prefix: post_sync and q-re...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Unspecified (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage Utils Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-23 18:26 UTC by Fabian Groffen
Modified: 2011-12-31 21:16 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fabian Groffen gentoo-dev 2011-12-23 18:26:25 UTC
Please review the following necessary changes for Prefix installs for portage-utils-0.9:

--- portage-utils-0.9.ebuild     2011-12-22 21:46:03.000000000 +0100
+++ portage-utils-0.9.ebuild    2011-12-23 09:41:41.817814000 +0100
@@ -19,7 +19,7 @@
        use static && append-ldflags -static
 
        # Avoid slow configure+gnulib+make if on an up-to-date Linux system
-       if ! use kernel_linux ; then
+       if use prefix || use !kernel_linux ; then
                econf --with-eprefix="${EPREFIX}"
        else
                tc-export CC
@@ -34,22 +34,28 @@
        doexe "${FILESDIR}"/post_sync || die
        insinto /etc/portage/postsync.d
        doins "${FILESDIR}"/q-reinitialize || die
+
+       # Portage fixes shebangs, we just need to fix the paths in the files
+       sed -i \
+               -e "s:\(/etc/portage/postsync.d\|/usr/bin/q\):${EPREFIX}&:g" \
+               ${ED}/etc/portage/bin/post_sync \
+               ${ED}/etc/portage/postsync.d/q-reinitialize || die
 }
 
 pkg_preinst() {
        # preserve +x bit on postsync files #301721
        local x
-       pushd "${D}" >/dev/null
+       pushd "${ED}" >/dev/null
        for x in etc/portage/postsync.d/* ; do
-               [[ -x ${ROOT}/${x} ]] && chmod +x "${x}"
+               [[ -x ${EROOT}/${x} ]] && chmod +x "${x}"
        done
 }
 
 pkg_postinst() {
-       elog "/etc/portage/postsync.d/q-reinitialize has been installed for convenience"
+       elog "${EPREFIX}/etc/portage/postsync.d/q-reinitialize has been installed for convenience"
        elog "If you wish for it to be automatically run at the end of every --sync:"
-       elog "   # chmod +x /etc/portage/postsync.d/q-reinitialize"
+       elog "   # chmod +x ${EPREFIX}/etc/portage/postsync.d/q-reinitialize"
        elog "Normally this should only take a few seconds to run but file systems"
        elog "such as ext3 can take a lot longer.  To disable, simply do:"
-       elog "   # chmod -x /etc/portage/postsync.d/q-reinitialize"
+       elog "   # chmod -x ${EPREFIX}/etc/portage/postsync.d/q-reinitialize"
 }
Comment 1 SpanKY gentoo-dev 2011-12-31 06:32:35 UTC
pkg_{pre,post}inst changes are fine

the first hunk should be "use prefix || ! use kernel_linux"

the 2nd hunk, i'm not sure about.  is there a way this could be done in the configure script itself ?  at least, you're missing quotes around ${ED} ...
Comment 2 Fabian Groffen gentoo-dev 2011-12-31 08:24:37 UTC
(In reply to comment #1)
> pkg_{pre,post}inst changes are fine
> 
> the first hunk should be "use prefix || ! use kernel_linux"

use understands "!xxxx", but I'll change it to "! use xxxx" if you like.

> the 2nd hunk, i'm not sure about.  is there a way this could be done in the
> configure script itself ?  at least, you're missing quotes around ${ED} ...

Of course, if they were .in files and configure would expand paths in them.  Quotes are indeed missing.
Comment 3 SpanKY gentoo-dev 2011-12-31 09:40:29 UTC
i know `use` supports that syntax (iirc, i added it), but i find it harder to quickly grok when scanning code.  keeping the operators before the command keeps it clearer i think.

for now, we can `sed` things, but long term, i'd like to see this in Makefile.am.  the files don't need to be ".in" and have autoconf replace them ... you can run the sed yourself in an install-hook in Makefile.am.
Comment 4 Fabian Groffen gentoo-dev 2011-12-31 11:56:57 UTC
I just committed the changes, and was about to make configure do its thing, until I realised that both files come from ${FILESDIR}, so not much configure-foo to add, unless we decide to move those files in the portage-utils repo (makes sense to me).

Changing this bug to reflect the work left to be done.
Comment 5 SpanKY gentoo-dev 2011-12-31 21:16:46 UTC
oh, in that case, don't worry about it