Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 488460 - app-misc/pax-utils: prefix support
Summary: app-misc/pax-utils: prefix support
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: SpanKY
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: prefix-gx86
  Show dependency tree
 
Reported: 2013-10-18 06:54 UTC by Benda Xu
Modified: 2016-12-16 18:50 UTC (History)
2 users (show)

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


Attachments
pax-utils.patch (pax-utils.patch,1011 bytes, patch)
2013-10-18 06:56 UTC, Benda Xu
Details | Diff
lddtree.patch (pax-utils-0.7-lddtree-prefix.patch,1012 bytes, patch)
2013-10-18 07:00 UTC, Benda Xu
Details | Diff
pax-utils-0.7-lddtree-prefix.patch (pax-utils-0.7-lddtree-prefix.patch,3.90 KB, patch)
2013-11-03 07:40 UTC, Benda Xu
Details | Diff
pax-utils-0.7-lddtree-prefix.patch (pax-utils-0.7-lddtree-prefix.patch,4.22 KB, patch)
2013-12-15 03:45 UTC, Benda Xu
Details | Diff
patch against gx86 version (pax-utils-0.8.1.ebuild.patch,1.56 KB, patch)
2014-04-14 19:56 UTC, Christoph Junghans (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Benda Xu gentoo-dev 2013-10-18 06:54:37 UTC
Two patches: one for EAPI bump; The other for lddtree.py

Reproducible: Always
Comment 1 Benda Xu gentoo-dev 2013-10-18 06:56:10 UTC
Created attachment 361196 [details, diff]
pax-utils.patch
Comment 2 Benda Xu gentoo-dev 2013-10-18 07:00:06 UTC
Created attachment 361198 [details, diff]
lddtree.patch

There may be a better way to encode @GENTOO_PORTAGE_EPREFIX@ for etc/ld.so.conf.

os.path.dirname(interp) can be prefixified.
Comment 3 SpanKY gentoo-dev 2013-10-19 05:40:28 UTC
Comment on attachment 361196 [details, diff]
pax-utils.patch

use EAPI=4.  otherwise looks OK.
Comment 4 SpanKY gentoo-dev 2013-10-19 05:44:38 UTC
Comment on attachment 361198 [details, diff]
lddtree.patch

>-  ldpaths['conf'] = ParseLdSoConf(root + 'etc/ld.so.conf', root=root)
>+  ldpaths['conf'] = ParseLdSoConf(root + '@GENTOO_PORTAGE_EPREFIX@/etc/ld.so.conf', root=root)

GENTOO_PORTAGE_EPREFIX has to be dynamic.  tests get run locally w/out going through `emerge`.  you'll also have to check the / usage.

>+        slibdir=os.path.dirname(interp)

your style is also incorrect.  you need spaces around the =.

>+        libdir=os.path.dirname(slibdir) + '/usr/' + os.path.basename(slibdir)

this is confusing.  use EPREFIX rather than deriving it via slibdir.  i'm not sure this is even correct.
Comment 5 Benda Xu gentoo-dev 2013-11-03 07:40:53 UTC
Created attachment 362466 [details, diff]
pax-utils-0.7-lddtree-prefix.patch

$ lddtree ~/gnto bin/ls
/home/benda/gnto/bin/ls (interpreter => /home/benda/gnto/lib/ld-linux.so.2)
    libacl.so.1 => /home/benda/gnto/lib/libacl.so.1
        libattr.so.1 => /home/benda/gnto/lib/libattr.so.1
    libc.so.6 => /home/benda/gnto/lib/libc.so.6

$ lddtree -R ~/gnto/usr/armv7a-hardfloat-linux-gnueabi/ /usr/bin/rpcgen
/home/benda/gnto/usr/armv7a-hardfloat-linux-gnueabi/usr/bin/rpcgen (interpreter => /home/benda/gnto/usr/armv7a-hardfloat-linux-gnueabi/lib/ld-linux-armhf.so.3)
    libc.so.6 => /home/benda/gnto/usr/armv7a-hardfloat-linux-gnueabi/lib/libc.so.6
Comment 6 Benda Xu gentoo-dev 2013-11-03 07:41:55 UTC
Thanks, Mike. Got a better patch to make EPREFIX overridable.
Comment 7 Benda Xu gentoo-dev 2013-11-22 09:14:34 UTC
This is a friendly reminder of RFC, Mike.
Comment 8 SpanKY gentoo-dev 2013-11-28 07:16:04 UTC
Comment on attachment 362466 [details, diff]
pax-utils-0.7-lddtree-prefix.patch

>+  parser.add_option('-P', '--prefix',
>+    default=os.environ.get('EPREFIX', ''), type='string',
>+    action='callback', callback=_NormalizePath,
>+    help='Specify EPREFIX for binaries from Gentoo Prefix')

it should default to the compile time eprefix

   default=os.environ.get('EPREFIX', '@EPREFIX@'), type='string',
 ...
 if options.prefix == '@''PREFIX''@':
   options.prefix = ''
Comment 9 Benda Xu gentoo-dev 2013-12-15 03:45:59 UTC
Created attachment 365366 [details, diff]
pax-utils-0.7-lddtree-prefix.patch

updated as per comment 8. Will need prefix.eclass and "eprefixify lddtree.py" to replace @GENTOO_PORTAGE_EPREFIX@.
Comment 10 SpanKY gentoo-dev 2014-03-20 08:26:36 UTC
initial support merged:
http://sources.gentoo.org/gentoo-projects/pax-utils/lddtree.py?r1=1.43&r2=1.44

i did not include the normpath() call on the interp as that doesn't make sense
Comment 11 Benda Xu gentoo-dev 2014-03-20 08:40:48 UTC
Looks nice. Thanks Mike.
Comment 12 SpanKY gentoo-dev 2014-03-21 19:01:12 UTC
re-open if pax-utils-0.8.1 doesn't work for you
Comment 13 Christoph Junghans (RETIRED) gentoo-dev 2014-03-24 19:51:15 UTC
Works for me.

Two things:
- we need to force USE=python in prefix. Maybe REQUIRED_USE="prefix? ( python )" ?
- add hpux magic
--- /usr/portage/app-misc/pax-utils/pax-utils-0.8.1.ebuild	2014-03-20 23:36:34.000000000 -0600
+++ pax-utils-0.8.1.ebuild	2014-03-24 10:52:13.960048993 -0600

@@ -31,7 +32,14 @@
 }
 
 src_compile() {
-	_emake CC="$(tc-getCC)"
+	local libs
+	if [[ ${CHOST} == *-hpux* ]]; then
+		append-flags -I"${EPREFIX}"/usr/$(get_libdir)/gnulib/include
+		append-ldflags -L"${EPREFIX}"/usr/$(get_libdir)/gnulib/lib
+		libs="-lgnu"
+	fi
+	use prefix && eprefixify lddtree.py
+	_emake CC="$(tc-getCC)" LIBS="${libs}"
 }
Comment 14 Christoph Junghans (RETIRED) gentoo-dev 2014-04-14 19:56:19 UTC
Created attachment 374924 [details, diff]
patch against gx86 version

Please review the leftover prefix changes.
Comment 15 SpanKY gentoo-dev 2014-04-27 14:45:55 UTC
Comment on attachment 374924 [details, diff]
patch against gx86 version

>+	local libs
>+	if [[ ${CHOST} == *-hpux* ]]; then
>+		append-flags -I"${EPREFIX}"/usr/$(get_libdir)/gnulib/include
>+		append-ldflags -L"${EPREFIX}"/usr/$(get_libdir)/gnulib/lib
>+		libs="-lgnu"
>+	fi

this is bug 413967 ... i'm not going to add gnulib stuff like this to the ebuild

>+	use prefix && eprefixify lddtree.py

wouldn't it be better to use a python eclass ?

>+	use prefix && use !python && ewarn "With USE=-python lddtree will not work in Prefix"

eh ?
Comment 16 Christoph Junghans (RETIRED) gentoo-dev 2014-04-27 19:46:33 UTC
(In reply to SpanKY from comment #15)
> Comment on attachment 374924 [details, diff] [details, diff]
> patch against gx86 version
> 
> >+	local libs
> >+	if [[ ${CHOST} == *-hpux* ]]; then
> >+		append-flags -I"${EPREFIX}"/usr/$(get_libdir)/gnulib/include
> >+		append-ldflags -L"${EPREFIX}"/usr/$(get_libdir)/gnulib/lib
> >+		libs="-lgnu"
> >+	fi
> 
> this is bug 413967 ... i'm not going to add gnulib stuff like this to the
> ebuild
we can drop this considering that bug #413967 will hopefully attack this issue.

> >+	use prefix && eprefixify lddtree.py
> wouldn't it be better to use a python eclass ?
Huh? Which python eclass are you thinking of? Wasn't Benda's patch made for eprefixify? (We could use `sed -i -e "s|@GENTOO_PORTAGE_EPREFIX@|${EPREFIX}|g" lddtree.py` instead)

> >+	use prefix && use !python && ewarn "With USE=-python lddtree will not work in Prefix"
> eh ?
The shell version of lddtree isn't prefix-save, but REQUIRED_USE="prefix? ( python )" might break bootstrapping. So a warning seems like a reasonable option. Not installing the shell version might work, too.
Comment 17 SpanKY gentoo-dev 2014-04-29 21:39:04 UTC
(In reply to Christoph Junghans from comment #16)
> > >+	use prefix && eprefixify lddtree.py
> >
> > wouldn't it be better to use a python eclass ?
>
> Huh? Which python eclass are you thinking of? Wasn't Benda's patch made for
> eprefixify? (We could use `sed -i -e
> "s|@GENTOO_PORTAGE_EPREFIX@|${EPREFIX}|g" lddtree.py` instead)

aren't there python eclasses specifically designed for installing python scripts with wrappers to the various implementation versions ?  like the whole python-exec business.

> > >+	use prefix && use !python && ewarn "With USE=-python lddtree will not work in Prefix"
> >
> > eh ?
>
> The shell version of lddtree isn't prefix-save

why not ?  it's just a bash script that runs `scanelf` and parses the output.
Comment 18 Christoph Junghans (RETIRED) gentoo-dev 2014-04-30 15:15:48 UTC
(In reply to SpanKY from comment #17)
> (In reply to Christoph Junghans from comment #16)
> > > >+	use prefix && eprefixify lddtree.py
> > >
> > > wouldn't it be better to use a python eclass ?
> >
> > Huh? Which python eclass are you thinking of? Wasn't Benda's patch made for
> > eprefixify? (We could use `sed -i -e
> > "s|@GENTOO_PORTAGE_EPREFIX@|${EPREFIX}|g" lddtree.py` instead)
> 
> aren't there python eclasses specifically designed for installing python
> scripts with wrappers to the various implementation versions ?  like the
> whole python-exec business.
I am not sure how this relates, but if we install a wrapper (python_doexe) and derive EPREFIX from EPYTHON (EPRFIX=${EPYTHON%%/usr/bin/*}), that might work, too.

> 
> > > >+	use prefix && use !python && ewarn "With USE=-python lddtree will not work in Prefix"
> > >
> > > eh ?
> >
> > The shell version of lddtree isn't prefix-save
> why not ?  it's just a bash script that runs `scanelf` and parses the output.
It has a hard-coded ROOT in there, which we would need to change, too.
Comment 19 SpanKY gentoo-dev 2014-04-30 20:44:38 UTC
(In reply to Christoph Junghans from comment #18)

the $ROOT is merely to make people's lives easier when running it by hand; it is not required for functional behavior.  you can pass a different root with --root.  it does hardcode /usr relative to whatever root the user gave them, but i don't think that qualifies as "will not work".
Comment 20 Benda Xu gentoo-dev 2014-05-01 00:54:31 UTC
(In reply to SpanKY from comment #19)
> (In reply to Christoph Junghans from comment #18)
> 
> the $ROOT is merely to make people's lives easier when running it by hand;
> it is not required for functional behavior.  you can pass a different root
> with --root.  it does hardcode /usr relative to whatever root the user gave
> them, but i don't think that qualifies as "will not work".

A minor correction to Chris': It is EPREFIX instead of ROOT getting set by eprefixify. Otherwise it will work, but setting a default saves the extra typing of lddtree --prefix /prefix/dir/.
Comment 21 Christoph Junghans (RETIRED) gentoo-dev 2014-05-01 16:30:59 UTC
(In reply to Benda Xu from comment #20)
> (In reply to SpanKY from comment #19)
> > (In reply to Christoph Junghans from comment #18)
> > 
> > the $ROOT is merely to make people's lives easier when running it by hand;
> > it is not required for functional behavior.  you can pass a different root
> > with --root.  it does hardcode /usr relative to whatever root the user gave
> > them, but i don't think that qualifies as "will not work".
> 
> A minor correction to Chris': It is EPREFIX instead of ROOT getting set by
> eprefixify. Otherwise it will work, but setting a default saves the extra
> typing of lddtree --prefix /prefix/dir/.
We could weaken the warning to:
use prefix && use !python && ewarn "Please use lddtree with --root=${EPREFIX}"
Comment 22 SpanKY gentoo-dev 2015-07-20 04:10:08 UTC
can we get a refresh/agreement on this ?  i've lost track of what exactly still needs to be merged.  please use the latest git repo too rather than the latest release.
Comment 23 Fabian Groffen gentoo-dev 2016-12-16 13:18:56 UTC
1.1.6 was identical in Prefix and gx86, 1.1.7 fails to compile on Solaris, will have to check what latest git does + separate bug.  Ebuild changes seem fine, so closing this bug.
Comment 24 SpanKY gentoo-dev 2016-12-16 17:26:56 UTC
i want to do a new release soonish (due to some other big changes), so if you want to send me some patches, now would be a good time :)
Comment 25 Fabian Groffen gentoo-dev 2016-12-16 18:50:38 UTC
Well, adding "|| echo 1" for the getconf call made me able to at least start autogen.sh (and run into trouble with xmlto).