Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 415899 - patch of sys-apps/openrc for Prefix directories
Summary: patch of sys-apps/openrc for Prefix directories
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:
Whiteboard:
Keywords:
Depends on:
Blocks: prefix-gx86 417391
  Show dependency tree
 
Reported: 2012-05-14 10:35 UTC by Benda Xu
Modified: 2012-09-29 03:16 UTC (History)
1 user (show)

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


Attachments
openrc.patch (openrc.patch,14.98 KB, patch)
2012-05-14 10:35 UTC, Benda Xu
Details | Diff
uprefix.patch (openrc-0.9.9.3-uprefix.patch,408 bytes, patch)
2012-05-14 10:38 UTC, Benda Xu
Details | Diff
openrc-9999.patch (openrc.patch,2.27 KB, patch)
2012-09-17 06:48 UTC, Benda Xu
Details | Diff
openrc.patch (openrc.patch,1.82 KB, patch)
2012-09-20 21:35 UTC, William Hubbs
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Benda Xu gentoo-dev 2012-05-14 10:35:16 UTC
Hi, please review the following patch for correct directories in Prefix.

Reproducible: Always
Comment 1 Benda Xu gentoo-dev 2012-05-14 10:35:46 UTC
Created attachment 311723 [details, diff]
openrc.patch
Comment 2 Benda Xu gentoo-dev 2012-05-14 10:38:49 UTC
Created attachment 311725 [details, diff]
uprefix.patch

This patch is meant to be applied to the git source.
Comment 3 William Hubbs gentoo-dev 2012-05-14 16:56:13 UTC
I would rather not encorporate this this way into the official openrc,
because I think we can do it in a more clean fashion.

We will need to add back the prefix support and make the build system
aware that it is building for prefix. We should probably add something
like MKPREFIX=yes to the make files and pass that on the make command
line.

This will be done after 0.10 is released.
Comment 4 Benda Xu gentoo-dev 2012-05-15 02:30:19 UTC
Ah, I see. Last time I didn't fully understand your MKPREFIX=yes talk.
Comment 5 Benda Xu gentoo-dev 2012-08-06 11:15:09 UTC
Hi, William. Back to this topic, how about the MKPREFIX=yes magic? Let me just make a draft patch.
Comment 6 William Hubbs gentoo-dev 2012-08-06 14:19:22 UTC
I have been thinking about this bug, and MKPREFIX=yes isn't going to
work.

I think we will have to make MKPREFIX be a variable that gets set to the
value of EPREFIX in the ebuild.
Comment 7 William Hubbs gentoo-dev 2012-08-06 14:23:53 UTC
I definitely could be wrong in my last comment; I'm not quite familiar
withhow the packages get installed in a prefix.
Comment 8 Benda Xu gentoo-dev 2012-08-07 04:25:45 UTC
HI, William,

(In reply to comment #7)
> I definitely could be wrong in my last comment; I'm not quite familiar
> withhow the packages get installed in a prefix.

Hmm, let's make it to the point.

ignoring the trivial ${D} -> ${ED} and ${ROOT} -> ${EROOT} transitions (I have tested this prefix aware ebuild on amd64 after all), the only significant things remaining are:

1. openrc.patch, Lines 53-58 MAKE_ARGS="${MAKE_ARGS} PREFIX=${EPREFIX}". This is quite similar to what you proposed MKPREFIX. At present, IMHO, no need to distinguish between MKPREFIX and PREFIX: It just works and PREFIX does not seem to be abused.

2. openrc.patch, Lines 70-75, it is a bug that will be triggered when openrc is freshly installed. This symlink trick in ebuild needs to be merge back to git tree.

3. UPREFIX = ${PREFIX}/usr is a resonable thing. why UPREFIX=${PREFIX} when PREFIX is defined?

I'd like to hear your opinion towards these 3 points and find a better way if you think something is not clean.
Comment 9 William Hubbs gentoo-dev 2012-08-16 16:08:22 UTC
(In reply to comment #8)
> 1. openrc.patch, Lines 53-58 MAKE_ARGS="${MAKE_ARGS} PREFIX=${EPREFIX}".
> This is quite similar to what you proposed MKPREFIX. At present, IMHO, no
> need to distinguish between MKPREFIX and PREFIX: It just works and PREFIX
> does not seem to be abused.

There is a difference between installing somewhere other than the default prefix and a gentoo prefix install. For a gentoo prefix install, we need to add -DPREFIX to the CFLAGS, but we shouldn't automatically do this for
make PREFIX=/foo/bar install.

> 2. openrc.patch, Lines 70-75, it is a bug that will be triggered when openrc
> is freshly installed. This symlink trick in ebuild needs to be merge back to
> git tree.

This is no longer a problem. The issue was fixed a while back in the git tree.

> 3. UPREFIX = ${PREFIX}/usr is a resonable thing. why UPREFIX=${PREFIX} when
> PREFIX is defined?

This one is actually a good question. I don't want to change it without knowing the history, so let me email Roy and ask about it.
Comment 10 Fabian Groffen gentoo-dev 2012-08-16 16:28:23 UTC
(In reply to comment #9)
> > 3. UPREFIX = ${PREFIX}/usr is a resonable thing. why UPREFIX=${PREFIX} when
> > PREFIX is defined?
> 
> This one is actually a good question. I don't want to change it without
> knowing the history, so let me email Roy and ask about it.

autoconf --prefix= includes /usr, so perhaps that was the idea behind it?
Comment 11 Benda Xu gentoo-dev 2012-08-17 04:56:05 UTC
(In reply to comment #10)
>
> autoconf --prefix= includes /usr, so perhaps that was the idea behind it?

Fabian, I don't quite catch it. Do you mean this autoconf default?

http://sunsite.ualberta.ca/Documentation/Gnu/autoconf-2.13/html_node/autoconf_19.html

OpenRC's build system doesn't use autoconf after all.
Comment 12 Benda Xu gentoo-dev 2012-08-17 05:57:03 UTC
@grobian, I see, it is just about the idea ;)

FYI:

    $ grep UPREFIX -r .
    ./mk/sys.mk:_UPREFIX_SH=                case "${PREFIX}" in "") echo /usr;; *) echo "${PREFIX}"/usr;; esac
    ./mk/sys.mk:_UPREFIX:=          $(shell ${_UPREFIX_SH})
    ./mk/sys.mk:UPREFIX=            ${_UPREFIX}
    ./mk/sys.mk:INCDIR?=            ${UPREFIX}/include
    ./mk/sys.mk:LIBDIR?=            ${UPREFIX}/${LIBNAME}
    ./mk/sys.mk:MANPREFIX?=         ${UPREFIX}/share
    ./mk/sys.mk:DOCDIR?=            ${UPREFIX}/share/doc

Just discussed with William on IRC. The plan is to override INCDIR LIBDIR MANPREFIX and DOCDIR explicitly and don't touch UPREFIX.
Comment 13 William Hubbs gentoo-dev 2012-09-01 01:44:02 UTC
@heroxdb:
It turns out that I was able to make UPREFIX smart enough to know when a
Prefix Installation is happening, so we do not need to override all of
the variables I thought we would. See commit 8e4169e.

Do you need ${EPREFIX}/etc/runlevels/* on Prefix? If not, I may be able
to skip installing that on a Prefix installation.

Do you need everything in the pkg_*inst functions on prefix? Also, what
about src_install? If you do not, you can test on the prefix use flag
and run only what you need.

Please update your patch to the openrc-9999 ebuild and attach the new
patch.

Thanks,

William
Comment 14 Benda Xu gentoo-dev 2012-09-17 05:23:49 UTC
(In reply to comment #13)
> @heroxdb:
> It turns out that I was able to make UPREFIX smart enough to know when a
> Prefix Installation is happening, so we do not need to override all of
> the variables I thought we would. See commit 8e4169e.

Tested to work.

> Do you need ${EPREFIX}/etc/runlevels/* on Prefix? If not, I may be able
> to skip installing that on a Prefix installation.

Yes, we need etc/runlevels in Prefix, too.
 
> Do you need everything in the pkg_*inst functions on prefix? Also, what
> about src_install? If you do not, you can test on the prefix use flag
> and run only what you need.

I don't think we need to differentiate here if pkg_*inst just work out of box and does no harm on prefix.

> Please update your patch to the openrc-9999 ebuild and attach the new
> patch.

Okay, please review.
Comment 15 Benda Xu gentoo-dev 2012-09-17 06:48:39 UTC
Created attachment 324072 [details, diff]
openrc-9999.patch

finally I decided to bypass pkg_*inst in prefix.
Comment 16 William Hubbs gentoo-dev 2012-09-20 21:35:49 UTC
Created attachment 324446 [details, diff]
openrc.patch

Your patch actually exposed a couple of things in OpenRc prefix support.

- We were setting the RC_SVCDIR based on the host operating system, which
is not good in a prefix environment.

- You should not need to set RC_SYS any longer; that is handled by
MKPREFIX=yes.

- PKG_PREFIX and LOCAL_PREFIX do not need to be set by the ebuild; they
  are handled appropriately in the Makefiles.

Please test with the slightly modified patch I have attached and let me
know your results.

Thanks,

William
Comment 17 Benda Xu gentoo-dev 2012-09-23 02:29:28 UTC
Ok, on Prefix we will not use $EPREFIX/run.

The commit 0a132cdca5 has an indentation error in Makefile:

    else ifneq (${OS},Linux)

Others works just fine. Thanks for the new clean patch.
Comment 18 William Hubbs gentoo-dev 2012-09-28 16:38:25 UTC
I checked everything again, and it looks like we can s/{D}/{ED}/ and
s/{ROOT}/{EROOT}/ and allow the pre/postinst to run on prefix systems. I
have done this as well as applied the original patch to -9999 in the
tree now.

Please test with openrc-9999 in the portage tree. If everything merges
successfully, close this bug.

Thanks,

William
Comment 19 Benda Xu gentoo-dev 2012-09-29 03:16:40 UTC
tested with one mod, committed and close. Thanks a lot, William.