* [gentoo-osx] [PREFIX] LD_LIBRARY_PATH issue
@ 2006-09-06 12:58 Grobian
2006-09-06 13:37 ` Michael Haubenwallner
0 siblings, 1 reply; 6+ messages in thread
From: Grobian @ 2006-09-06 12:58 UTC (permalink / raw
To: gentoo-osx
Hi all,
While trying to get "system" emerged, I ran into a problem with perl.
For a change, perl doesn't seem to be the problem itself to me :D
The problem is that perl links against gdbm which succeeds fine, but
then when running the linked executable, it fails to find (the right)
gdbm. I think that all packages before perl just didn't link against
dynamic libraries, or that my native system happened to have the same or
sufficient libraries installed. The problem is of course that the
dynamic (runtime) linker has to know that dynamic libraries exist on
other paths than the usual system paths. This is typically done using
the LD_LIBRARY_PATH environment variable.
I made a temporary hack using a profile.bash file to set the
LD_LIBRARY_PATH for portage itself. The whole issue triggered some
questions for me:
- should portage "inject" LD_LIBRARY_PATH itself in prefix to make sure
its environment is correct?
- all our shells should set LD_LIBRARY_PATH, right?
- if the shell sets it, portage uses it, does it? If so, the inject
should not be necessary if you require a portage built shell to be
used. During bootstrap this is a problem (the phase I'm in)
comments?
--
Fabian Groffen
Gentoo for Mac OS X Project
--
gentoo-osx@gentoo.org mailing list
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [gentoo-osx] [PREFIX] LD_LIBRARY_PATH issue
2006-09-06 12:58 [gentoo-osx] [PREFIX] LD_LIBRARY_PATH issue Grobian
@ 2006-09-06 13:37 ` Michael Haubenwallner
2006-09-06 19:20 ` Grobian
2006-09-06 19:45 ` Christopher Chan
0 siblings, 2 replies; 6+ messages in thread
From: Michael Haubenwallner @ 2006-09-06 13:37 UTC (permalink / raw
To: gentoo-osx
Hi,
this is one reason why i never stopped using my toolsbox to bootstrap
portage: it creates environment-scripts, besides others containing those
LD_LIBRARY_PATH bits. And well, this is called SHLIB_PATH on HP-UX and
LIBPATH on AIX.
And for the running portage, i've some patches to let portage
dynamically extend the list of extendable variables with values
from /etc/env.d/ files.
In combination with some baselayout-packages, which do those
configuration through /etc/env.d/, i'm able to inform portage to dupe
the value of LDPATH into LD_LIBRARY_PATH, SHLIB_PATH or LIBPATH,
depending on the profile, which unmask the correct baselayout for a
specific platform.
Patches/ebuilds coming soon ...
-- haubi
On Wed, 2006-09-06 at 14:58 +0200, Grobian wrote:
> Hi all,
>
> While trying to get "system" emerged, I ran into a problem with perl.
> For a change, perl doesn't seem to be the problem itself to me :D
>
> The problem is that perl links against gdbm which succeeds fine, but
> then when running the linked executable, it fails to find (the right)
> gdbm. I think that all packages before perl just didn't link against
> dynamic libraries, or that my native system happened to have the same or
> sufficient libraries installed. The problem is of course that the
> dynamic (runtime) linker has to know that dynamic libraries exist on
> other paths than the usual system paths. This is typically done using
> the LD_LIBRARY_PATH environment variable.
>
> I made a temporary hack using a profile.bash file to set the
> LD_LIBRARY_PATH for portage itself. The whole issue triggered some
> questions for me:
> - should portage "inject" LD_LIBRARY_PATH itself in prefix to make sure
> its environment is correct?
> - all our shells should set LD_LIBRARY_PATH, right?
> - if the shell sets it, portage uses it, does it? If so, the inject
> should not be necessary if you require a portage built shell to be
> used. During bootstrap this is a problem (the phase I'm in)
>
> comments?
>
> --
> Fabian Groffen
> Gentoo for Mac OS X Project
--
gentoo-osx@gentoo.org mailing list
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [gentoo-osx] [PREFIX] LD_LIBRARY_PATH issue
2006-09-06 13:37 ` Michael Haubenwallner
@ 2006-09-06 19:20 ` Grobian
2006-09-07 9:26 ` Michael Haubenwallner
2006-09-07 12:43 ` Michael Haubenwallner
2006-09-06 19:45 ` Christopher Chan
1 sibling, 2 replies; 6+ messages in thread
From: Grobian @ 2006-09-06 19:20 UTC (permalink / raw
To: gentoo-osx
On 06-09-2006 15:37:31 +0200, Michael Haubenwallner wrote:
> Hi,
>
> this is one reason why i never stopped using my toolsbox to bootstrap
> portage: it creates environment-scripts, besides others containing those
> LD_LIBRARY_PATH bits. And well, this is called SHLIB_PATH on HP-UX and
> LIBPATH on AIX.
With respect, but I think the reason we don't use toolbox is because I
never got it to bootstrap anything :(
> And for the running portage, i've some patches to let portage
> dynamically extend the list of extendable variables with values
> from /etc/env.d/ files.
> In combination with some baselayout-packages, which do those
> configuration through /etc/env.d/, i'm able to inform portage to dupe
> the value of LDPATH into LD_LIBRARY_PATH, SHLIB_PATH or LIBPATH,
> depending on the profile, which unmask the correct baselayout for a
> specific platform.
Ahh... I knew the problem was bigger than it looked :)
> Patches/ebuilds coming soon ...
Much appreciated
--
Fabian Groffen
Gentoo for Mac OS X Project
--
gentoo-osx@gentoo.org mailing list
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [gentoo-osx] [PREFIX] LD_LIBRARY_PATH issue
2006-09-06 13:37 ` Michael Haubenwallner
2006-09-06 19:20 ` Grobian
@ 2006-09-06 19:45 ` Christopher Chan
1 sibling, 0 replies; 6+ messages in thread
From: Christopher Chan @ 2006-09-06 19:45 UTC (permalink / raw
To: gentoo-osx
Looking forward to the patches, I'm just sourcing environment scripts as
well.
-----Original Message-----
From: Michael Haubenwallner [mailto:michael.haubenwallner@salomon.at]
Sent: Wednesday, September 06, 2006 6:38 AM
To: gentoo-osx@lists.gentoo.org
Subject: Re: [gentoo-osx] [PREFIX] LD_LIBRARY_PATH issue
Hi,
this is one reason why i never stopped using my toolsbox to bootstrap
portage: it creates environment-scripts, besides others containing those
LD_LIBRARY_PATH bits. And well, this is called SHLIB_PATH on HP-UX and
LIBPATH on AIX.
And for the running portage, i've some patches to let portage
dynamically extend the list of extendable variables with values
from /etc/env.d/ files.
In combination with some baselayout-packages, which do those
configuration through /etc/env.d/, i'm able to inform portage to dupe
the value of LDPATH into LD_LIBRARY_PATH, SHLIB_PATH or LIBPATH,
depending on the profile, which unmask the correct baselayout for a
specific platform.
Patches/ebuilds coming soon ...
-- haubi
On Wed, 2006-09-06 at 14:58 +0200, Grobian wrote:
> Hi all,
>
> While trying to get "system" emerged, I ran into a problem with perl.
> For a change, perl doesn't seem to be the problem itself to me :D
>
> The problem is that perl links against gdbm which succeeds fine, but
> then when running the linked executable, it fails to find (the right)
> gdbm. I think that all packages before perl just didn't link against
> dynamic libraries, or that my native system happened to have the same or
> sufficient libraries installed. The problem is of course that the
> dynamic (runtime) linker has to know that dynamic libraries exist on
> other paths than the usual system paths. This is typically done using
> the LD_LIBRARY_PATH environment variable.
>
> I made a temporary hack using a profile.bash file to set the
> LD_LIBRARY_PATH for portage itself. The whole issue triggered some
> questions for me:
> - should portage "inject" LD_LIBRARY_PATH itself in prefix to make sure
> its environment is correct?
> - all our shells should set LD_LIBRARY_PATH, right?
> - if the shell sets it, portage uses it, does it? If so, the inject
> should not be necessary if you require a portage built shell to be
> used. During bootstrap this is a problem (the phase I'm in)
>
> comments?
>
> --
> Fabian Groffen
> Gentoo for Mac OS X Project
--
gentoo-osx@gentoo.org mailing list
--
gentoo-osx@gentoo.org mailing list
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [gentoo-osx] [PREFIX] LD_LIBRARY_PATH issue
2006-09-06 19:20 ` Grobian
@ 2006-09-07 9:26 ` Michael Haubenwallner
2006-09-07 12:43 ` Michael Haubenwallner
1 sibling, 0 replies; 6+ messages in thread
From: Michael Haubenwallner @ 2006-09-07 9:26 UTC (permalink / raw
To: gentoo-osx
[-- Attachment #1: Type: text/plain, Size: 3008 bytes --]
On Wed, 2006-09-06 at 21:20 +0200, Grobian wrote:
> On 06-09-2006 15:37:31 +0200, Michael Haubenwallner wrote:
> With respect, but I think the reason we don't use toolbox is because I
> never got it to bootstrap anything :(
IIRC you did not manage to inform it where to download things from.
But it's ok for me to have a bootstrap-script in the tree, even i don't
plan to use it.
Well, here are the two portage patches for dynamically duping
environment values. Patch-Numbers fit into my previous mail containing a
bunch of other patches [1].
[06-env-conf+ext.patch]
Let portage create /etc/env.conf containing somewhat a dump of the
environment bits found in /etc/env.d/*, to be read by /sbin/extenv, see
below (the baselayout-prefix.ebuild).
[07-env-dup.patch]
Interpret variables PORTAGE_ENVDUP* found in /etc/env.d/*, to dupe
values from one environment variable to another. Example is to dupe
values from LDPATH to LD_LIBRARY_PATH, SHLIB_PATH or LIBPATH, see below
(the baselayout-linux.ebuild).
[baselayout-prefix-0.1.ebuild]
[baselayout-prefix-0.1_files.tar.gz]
Installs these (eprefix'ed) files:
/etc/profile
The entry point for this eprefix.
Utilizes /sbin/extenv to add values the environment.
It also sets up an alias 'eenv-clear', which sources /etc/unprofile,
to be able to remove all the environment values for this eprefix.
/sbin/extenv
Interprets /etc/env.conf and generates a list of shell commands (for
sh and csh) adding values to the environment.
/etc/unprofile
The exit point from this eprefix.
Also utilizes /sbin/extenv to remove values from the environment.
Also unaliases 'eenv-clear'.
/etc/env.d/98secondary
Contains values for PATH,ROOTPATH,LDPATH,... for this eprefix.
/var/spool/emerge/doasroot
Create it as empty file, currently not in use.
Intention is to collect commands from enewuser/enewgroup/... when
not run as real root (uid 0).
Additionally, two symlinks are created:
/sbin/functions.sh -> /usr/lib/portage/bin/isolated-functions.sh
/etc/init.d/functions.sh -> /sbin/functions.sh
I use /usr/lib/portage/bin/isolated-functions.sh because i did not know
better where to get those functions.sh from.
[baselayout-linux-0.1.ebuild]
Installs only one file:
/etc/env.d/99system
Only contains two lines:
PORTAGE_ENVDUP="LDPATH"
PORTAGE_ENVDUP_LDPATH="LD_LIBRARY_PATH"
This configures portage (with 07-env-dup.patch) to dupe collected
values from LDPATH into LD_LIBRARY_PATH.
Idea is to let make.profile symlink unmask different packages for hpux
and aix, to dupe LDPATH value into SHLIB_PATH and LIBPATH respectively.
Comments welcome!
[1] http://thread.gmane.org/gmane.linux.gentoo.macosx/1080/focus=1080
-haubi-
--
Michael Haubenwallner SALOMON Automation GmbH
Forschung & Entwicklung A-8114 Friesach bei Graz
mailto:michael.haubenwallner@salomon.at http://www.salomon.at
No HTML/MIME please, see http://expita.com/nomime.html
[-- Attachment #2: 06-env-conf+ext.patch --]
[-- Type: text/x-patch, Size: 8334 bytes --]
--- portage-prefix-2.1.14/pym/portage.py.orig 2006-06-01 09:30:01.000000000 +0200
+++ portage-prefix-2.1.14/pym/portage.py 2006-06-01 10:22:13.000000000 +0200
@@ -524,17 +524,22 @@
pos=pos+1
specials={
- "KDEDIRS":[],"PATH":[],"CLASSPATH":[],"LDPATH":[],"MANPATH":[],
- "INFODIR":[],"INFOPATH":[],"ROOTPATH":[],"CONFIG_PROTECT":[],
- "CONFIG_PROTECT_MASK":[],"PRELINK_PATH":[],"PRELINK_PATH_MASK":[],
- "PYTHONPATH":[], "ADA_INCLUDE_PATH":[], "ADA_OBJECTS_PATH":[]
+ "KDEDIRS" :{"separator":' ', "value":[],"from":"<portage>"},
+ "PATH" :{"separator":':', "value":[],"from":"<portage>"},
+ "CLASSPATH" :{"separator":':', "value":[],"from":"<portage>"},
+ "LDPATH" :{"separator":':', "value":[],"from":"<portage>"},
+ "MANPATH" :{"separator":':', "value":[],"from":"<portage>"},
+ "INFODIR" :{"separator":' ', "value":[],"from":"<portage>"},
+ "INFOPATH" :{"separator":':', "value":[],"from":"<portage>"},
+ "ROOTPATH" :{"separator":':', "value":[],"from":"<portage>"},
+ "CONFIG_PROTECT" :{"separator":' ', "value":[],"from":"<portage>"},
+ "CONFIG_PROTECT_MASK":{"separator":' ', "value":[],"from":"<portage>"},
+ "PRELINK_PATH" :{"separator":':', "value":[],"from":"<portage>"},
+ "PRELINK_PATH_MASK" :{"separator":' ', "value":[],"from":"<portage>"},
+ "PYTHONPATH" :{"separator":':', "value":[],"from":"<portage>"},
+ "ADA_INCLUDE_PATH" :{"separator":':', "value":[],"from":"<portage>"},
+ "ADA_OBJECTS_PATH" :{"separator":':', "value":[],"from":"<portage>"},
}
- colon_separated = [
- "ADA_INCLUDE_PATH", "ADA_OBJECTS_PATH",
- "LDPATH", "MANPATH",
- "PATH", "PRELINK_PATH",
- "PRELINK_PATH_MASK", "PYTHONPATH"
- ]
env={}
@@ -547,14 +552,35 @@
writemsg("!!! Parsing error in "+str(root)+portage_const.EPREFIX+"/etc/env.d/"+str(x)+"\n")
#parse error
continue
- # process PATH, CLASSPATH, LDPATH
+ # process PORTAGE_ENVEXT
+ if myconfig.has_key("PORTAGE_ENVEXT"):
+ for ee in myconfig["PORTAGE_ENVEXT"].split(" "):
+ if not ee:
+ continue
+ sep = ' '
+ if myconfig.has_key("PORTAGE_ENVSEP_"+ee):
+ sep = myconfig["PORTAGE_ENVSEP_"+ee]
+ del myconfig["PORTAGE_ENVSEP_"+ee]
+ if not specials.has_key(ee):
+ specials[ee] = {"separator": sep, "value":[], "from": x}
+ elif specials[ee]["separator"] != sep:
+ writemsg("!!! Different separator '"+sep+"' for "+ee
+ +" defined in "+x
+ +" and "+specials[ee]["from"]
+ +"\n"
+ )
+ del myconfig["PORTAGE_ENVEXT"]
+
+ # process expandable variables
for myspec in specials.keys():
if myconfig.has_key(myspec):
- if myspec in colon_separated:
- specials[myspec].extend(myconfig[myspec].split(":"))
- else:
- specials[myspec].append(myconfig[myspec])
+ specials[myspec]["value"].extend(
+ string.split(
+ varexpand(myconfig[myspec])
+ , specials[myspec]["separator"]
+ ))
del myconfig[myspec]
+
# process all other variables
for myenv in myconfig.keys():
env[myenv]=myconfig[myenv]
@@ -576,13 +602,13 @@
ld_cache_update=False
- newld=specials["LDPATH"]
+ newld=specials["LDPATH"]["value"]
if (oldld!=newld):
#ld.so.conf needs updating and ldconfig needs to be run
myfd = atomic_ofstream(os.path.join(root+portage_const.EPREFIX, "etc", "ld.so.conf"))
myfd.write("# ld.so.conf autogenerated by env-update; make all changes to\n")
myfd.write("# contents of "+portage_const.EPREFIX+"/etc/env.d directory\n")
- for x in specials["LDPATH"]:
+ for x in newld:
myfd.write(x+"\n")
myfd.close()
ld_cache_update=True
@@ -595,13 +621,13 @@
for x in map(lambda x: os.path.join(portage_const.EPREFIX,x), ["bin","sbin","usr/bin","usr/sbin","lib","usr/lib"]):
newprelink.write("-l "+x+"\n");
- for x in specials["LDPATH"]+specials["PATH"]+specials["PRELINK_PATH"]:
+ for x in specials["LDPATH"]["value"]+specials["PATH"]["value"]+specials["PRELINK_PATH"]["value"]:
if not x:
continue
if x[-1]!='/':
x=x+"/"
plmasked=0
- for y in specials["PRELINK_PATH_MASK"]:
+ for y in specials["PRELINK_PATH_MASK"]["value"]:
if not y:
continue
if y[-1]!='/':
@@ -611,14 +637,14 @@
break
if not plmasked:
newprelink.write("-h "+x+"\n")
- for x in specials["PRELINK_PATH_MASK"]:
+ for x in specials["PRELINK_PATH_MASK"]["value"]:
newprelink.write("-b "+x+"\n")
newprelink.close()
if not mtimedb.has_key("ldpath"):
mtimedb["ldpath"]={}
- for x in map(lambda x: portage_const.EPREFIX+x, specials["LDPATH"]+['/usr/lib','/lib']):
+ for x in map(lambda x: portage_const.EPREFIX+x, specials["LDPATH"]["value"]+['/usr/lib','/lib']):
try:
newldpathtime=os.stat(x)[stat.ST_MTIME]
except SystemExit, e:
@@ -655,61 +681,55 @@
del specials["LDPATH"]
- penvnotice = "# THIS FILE IS AUTOMATICALLY GENERATED BY env-update.\n"
- penvnotice += "# DO NOT EDIT THIS FILE. CHANGES TO STARTUP PROFILES\n"
+ envnotice = "# THIS FILE IS AUTOMATICALLY GENERATED BY env-update.\n"
+ envnotice += "# DO NOT EDIT THIS FILE."
+ penvnotice = envnotice + " CHANGES TO STARTUP PROFILES\n"
cenvnotice = penvnotice[:]
penvnotice += "# GO INTO "+portage_const.EPREFIX+"/etc/profile NOT "+portage_const.EPREFIX+"/etc/profile.env\n\n"
cenvnotice += "# GO INTO "+portage_const.EPREFIX+"/etc/csh.cshrc NOT "+portage_const.EPREFIX+"/etc/csh.env\n\n"
- #create /etc/profile.env for bash support
- outfile = atomic_ofstream(os.path.join(root+portage_const.EPREFIX, "etc", "profile.env"))
- outfile.write(penvnotice)
+ #create /etc/env.conf for baselayout-prefix support
+ outfile = atomic_ofstream(os.path.join(root+portage_const.EPREFIX, "etc", "env.conf"))
+ outfile.write(envnotice+"\n")
- for path in specials.keys():
- if len(specials[path])==0:
- continue
- outstring="export "+path+"='"
- if path in ["CONFIG_PROTECT","CONFIG_PROTECT_MASK"]:
- for x in specials[path][:-1]:
- outstring += x+" "
- else:
- for x in specials[path][:-1]:
- outstring=outstring+x+":"
- outstring=outstring+specials[path][-1]+"'"
- outfile.write(outstring+"\n")
-
- #create /etc/profile.env
- for x in env.keys():
- if type(env[x])!=types.StringType:
- continue
- outfile.write("export "+x+"='"+env[x]+"'\n")
- outfile.close()
+ #create /etc/profile.env for bash support
+ shoutfile = atomic_ofstream(os.path.join(root+portage_const.EPREFIX, "etc", "profile.env"))
+ shoutfile.write(penvnotice)
#create /etc/csh.env for (t)csh support
- outfile = atomic_ofstream(os.path.join(root+portage_const.EPREFIX, "etc", "csh.env"))
- outfile.write(cenvnotice)
+ cshoutfile = atomic_ofstream(os.path.join(root+portage_const.EPREFIX, "etc", "csh.env"))
+ cshoutfile.write(cenvnotice)
- for path in specials.keys():
- if len(specials[path])==0:
+ varlist=[]
+ for path, specs in specials.items():
+ sep, values = specs["separator"], specs["value"]
+ if not values:
continue
- outstring="setenv "+path+" '"
- if path in ["CONFIG_PROTECT","CONFIG_PROTECT_MASK"]:
- for x in specials[path][:-1]:
- outstring += x+" "
- else:
- for x in specials[path][:-1]:
- outstring=outstring+x+":"
- outstring=outstring+specials[path][-1]+"'"
- outfile.write(outstring+"\n")
- #get it out of the way
- del specials[path]
-
- #create /etc/csh.env
- for x in env.keys():
- if type(env[x])!=types.StringType:
+ varlist.append(path)
+
+ valstring = "%s" % sep.join(values)
+
+ outfile.write("PORTAGE_EXTSEP_%s='%s'\n" % (path, sep))
+ outfile.write("%s='%s'\n" % (path, valstring))
+ shoutfile.write("export %s='%s'\n" % (path, valstring))
+ cshoutfile.write("setenv %s '%s'\n" % (path, valstring))
+
+ outfile.write("PORTAGE_ENVEXT='%s'\n" % string.join(varlist,' '))
+
+ varlist=[]
+ for x in env:
+ if type(env[x])!=str:
continue
- outfile.write("setenv "+x+" '"+env[x]+"'\n")
+ outfile.write("%s='%s'\n" % (x,env[x]))
+ shoutfile.write("export %s='%s'\n" % (x,env[x]))
+ cshoutfile.write("setenv %s '%s'\n" % (x,env[x]))
+ varlist.append(x)
+
+ outfile.write("PORTAGE_ENVSET='%s'\n" % string.join(varlist,' '))
+
outfile.close()
+ shoutfile.close()
+ cshoutfile.close()
def new_protect_filename(mydest, newmd5=None):
"""Resolves a config-protect filename for merging, optionally
[-- Attachment #3: 07-env-dup.patch --]
[-- Type: text/x-patch, Size: 2713 bytes --]
diff -ru portage-prefix-2.1.14.orig/pym/portage.py portage-prefix-2.1.14/pym/portage.py
--- portage-prefix-2.1.14.orig/pym/portage.py 2006-06-01 10:57:49.000000000 +0200
+++ portage-prefix-2.1.14/pym/portage.py 2006-06-01 11:05:52.000000000 +0200
@@ -539,6 +539,7 @@
"PYTHONPATH" :{"separator":':', "value":[],"from":"<portage>"},
"ADA_INCLUDE_PATH" :{"separator":':', "value":[],"from":"<portage>"},
"ADA_OBJECTS_PATH" :{"separator":':', "value":[],"from":"<portage>"},
+ "PORTAGE_ENVDUP" :{"separator":' ', "value":[],"from":"<portage>"},
}
env={}
@@ -552,6 +553,22 @@
writemsg("!!! Parsing error in "+str(root)+portage_const.EPREFIX+"/etc/env.d/"+str(x)+"\n")
#parse error
continue
+
+ # process PORTAGE_ENVDUP
+ if myconfig.has_key("PORTAGE_ENVDUP"):
+ for ed in myconfig["PORTAGE_ENVDUP"].split(" "):
+ if not ed:
+ continue
+ if not myconfig.has_key("PORTAGE_ENVDUP_" + ed):
+ continue
+ if specials.has_key("PORTAGE_ENVDUP_" + ed):
+ continue
+ if myconfig.has_key("PORTAGE_ENVEXT"):
+ myconfig["PORTAGE_ENVEXT"] = myconfig["PORTAGE_ENVEXT"] \
+ + " " + "PORTAGE_ENVDUP_" + ed
+ else:
+ myconfig["PORTAGE_ENVEXT"] = "PORTAGE_ENVDUP_" + ed
+
# process PORTAGE_ENVEXT
if myconfig.has_key("PORTAGE_ENVEXT"):
for ee in myconfig["PORTAGE_ENVEXT"].split(" "):
@@ -585,6 +602,41 @@
for myenv in myconfig.keys():
env[myenv]=myconfig[myenv]
+ # process PORTAGE_ENVDUP
+ if specials.has_key("PORTAGE_ENVDUP"):
+ for dupvar in specials["PORTAGE_ENVDUP"]["value"]:
+ if not dupvar:
+ continue
+ dupenvvalue = None
+ dupspecvalue = None
+ if env.has_key(dupvar):
+ dupenvvalue=env["PORTAGE_ENVDUP_" + dupvar]
+ del env[dupvar]
+ elif specials.has_key(dupvar):
+ dupspecvalue=specials[dupvar]
+ if dupvar != "LDPATH":
+ del specials[dupvar]
+ else:
+ continue
+
+ for dupto in specials["PORTAGE_ENVDUP_" + dupvar]["value"]:
+ if not dupto:
+ continue
+ if dupenvvalue:
+ if env.has_key(dupto):
+ writemsg("!!! Cannot dup '"+dupvar+"' to '"+dupto
+ + "', '"+dupto+"' is defined separately.\n");
+ continue
+ env[dupto] = dupenvvalue
+ elif specials.has_key(dupto):
+ specials[dupto] = dupspecvalue
+ else:
+ specials[dupto] = {"separator": sep, "value":[], "from": x}
+ specials[dupto]["separator"] = dupspecvalue["separator"]
+ specials[dupto]["value"].extend(dupspecvalue["value"])
+ del specials["PORTAGE_ENVDUP_" + dupvar]
+ del specials["PORTAGE_ENVDUP"]
+
if os.path.exists(root+portage_const.EPREFIX+"/etc/ld.so.conf"):
myld=open(root+portage_const.EPREFIX+"/etc/ld.so.conf")
myldlines=myld.readlines()
[-- Attachment #4: baselayout-prefix-0.1.ebuild --]
[-- Type: text/plain, Size: 1633 bytes --]
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /cvsroot/secondary-portage/sys-apps/baselayout-secondary/baselayout-secondary-0.1.ebuild,v 1.4 2005/09/14 06:59:13 haubi Exp $
DESCRIPTION="Baselayout for Secondary Package Manager extending the environment"
HOMEPAGE=""
SRC_URI=""
LICENSE=""
SLOT="0"
EAPI="prefix"
KEYWORDS="x86"
IUSE=""
#PDEPEND=">=portage-2.1_pre"
DEPEND="app-shells/bash"
RDEPEND=""
src_install() {
insinto /etc || die
newins ${FILESDIR}/${PV}-inputrc inputrc || die
newins ${FILESDIR}/${PV}-profile profile || die
newins ${FILESDIR}/${PV}-unprofile unprofile || die
into /
newsbin ${FILESDIR}/${PV}-extenv extenv || die
cu_bash=${BASH}
test -r "${ROOT}/bin/bash" && cu_bash="${EPREFIX}/bin/bash"
dosed "s,@EPREFIX@,${EPREFIX},g
;s,@BASH@,${cu_bash},g
;s,@rootuser@,${PORTAGE_ROOTUSER:-$(id -un)},
" \
/etc/profile \
/etc/unprofile \
/sbin/extenv \
|| die
fperms a+x /sbin/extenv
insinto /etc/env.d
cat >> "${D}"/etc/env.d/98secondary <<-EOE
# /${EPREFIX}etc/env.d/98secondary
PATH='${EPREFIX}/usr/bin:${EPREFIX}/bin'
ROOTPATH='${EPREFIX}/usr/sbin:${EPREFIX}/sbin:${EPREFIX}/usr/bin:${EPREFIX}/bin'
LDPATH='${EPREFIX}/usr/lib:${EPREFIX}/lib'
INFODIR='${EPREFIX}/usr/share/info'
INFOPATH='${EPREFIX}/usr/share/info'
MANPATH='${EPREFIX}/usr/share/man'
EOE
dodir /etc/init.d || die
dosym /usr/lib/portage/bin/isolated-functions.sh /sbin/functions.sh || die
dosym /sbin/functions.sh /etc/init.d/functions.sh || die
dodir /var/spool/emerge || die
touch "${D}"/var/spool/emerge/doasroot || die
}
[-- Attachment #5: baselayout-prefix-0.1_files.tar.gz --]
[-- Type: application/x-compressed-tar, Size: 2176 bytes --]
[-- Attachment #6: baselayout-linux-0.1.ebuild --]
[-- Type: text/plain, Size: 674 bytes --]
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /cvsroot/secondary-portage/sys-apps/baselayout-secondary/baselayout-secondary-0.1.ebuild,v 1.4 2005/09/14 06:59:13 haubi Exp $
DESCRIPTION="Baselayout for Secondary Package Manager extending the environment"
HOMEPAGE=""
SRC_URI=""
LICENSE=""
SLOT="0"
EAPI="prefix"
KEYWORDS="x86"
IUSE=""
DEPEND=""
RDEPEND="sys-apps/baselayout-prefix"
PROVIDE="virtual/baselayout"
src_install() {
cat >> "${T}"/99system <<-EOE
# /${EPREFIX}etc/env.d/99system
PORTAGE_ENVDUP="LDPATH"
PORTAGE_ENVDUP_LDPATH="LD_LIBRARY_PATH"
EOE
doenvd "${T}"/99system || die
}
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [gentoo-osx] [PREFIX] LD_LIBRARY_PATH issue
2006-09-06 19:20 ` Grobian
2006-09-07 9:26 ` Michael Haubenwallner
@ 2006-09-07 12:43 ` Michael Haubenwallner
1 sibling, 0 replies; 6+ messages in thread
From: Michael Haubenwallner @ 2006-09-07 12:43 UTC (permalink / raw
To: gentoo-osx
[-- Attachment #1: Type: text/plain, Size: 3316 bytes --]
(Apologies if you get this mail a second time - first i tried with
baselayout-prefix/files attached as a tar.gz-ball and did not see this
mail in gmane.org for hours. Now these files are attached separately.)
On Wed, 2006-09-06 at 21:20 +0200, Grobian wrote:
> On 06-09-2006 15:37:31 +0200, Michael Haubenwallner wrote:
> With respect, but I think the reason we don't use toolbox is because I
> never got it to bootstrap anything :(
IIRC you did not manage to inform it where to download things from.
But it's ok for me to have a bootstrap-script in the tree, even i don't
plan to use it.
Well, here are the two portage patches for dynamically duping
environment values. Patch-Numbers fit into my previous mail containing a
bunch of other patches [1].
[06-env-conf+ext.patch]
Let portage create /etc/env.conf containing somewhat a dump of the
environment bits found in /etc/env.d/*, to be read by /sbin/extenv, see
below (the baselayout-prefix.ebuild).
[07-env-dup.patch]
Interpret variables PORTAGE_ENVDUP* found in /etc/env.d/*, to dupe
values from one environment variable to another. Example is to dupe
values from LDPATH to LD_LIBRARY_PATH, SHLIB_PATH or LIBPATH, see below
(the baselayout-linux.ebuild).
[baselayout-prefix-0.1.ebuild]
files: [0.1-extenv] [0.1-inputrc] [0.1-profile] [0.1-unprofile]
Installs these files:
/etc/profile
The entry point for this eprefix.
Utilizes /sbin/extenv to add values the environment.
It also sets up an alias 'eenv-clear', which sources /etc/unprofile,
to be able to remove all the environment values for this eprefix.
/sbin/extenv
Interprets /etc/env.conf and generates a list of shell commands (for
sh and csh) adding values to the environment.
/etc/unprofile
The exit point from this eprefix.
Also utilizes /sbin/extenv to remove values from the environment.
Also unaliases 'eenv-clear'.
/etc/env.d/98secondary
Contains values for PATH,ROOTPATH,LDPATH,... for this eprefix.
/var/spool/emerge/doasroot
Create it as empty file, currently not in use.
Intention is to collect commands from enewuser/enewgroup/... when
not run as real root (uid 0).
/etc/inputrc
Some maybe out-of-date inputrc, could be unneccesary here.
Additionally, two symlinks are created:
/sbin/functions.sh -> /usr/lib/portage/bin/isolated-functions.sh
/etc/init.d/functions.sh -> /sbin/functions.sh
I use /usr/lib/portage/bin/isolated-functions.sh because i did not know
better where to get those /sbin/functions.sh from.
[baselayout-linux-0.1.ebuild]
Installs only one file:
/etc/env.d/99system
Only contains two lines:
PORTAGE_ENVDUP="LDPATH"
PORTAGE_ENVDUP_LDPATH="LD_LIBRARY_PATH"
This configures portage (with 07-env-dup.patch) to dupe collected
values from LDPATH into LD_LIBRARY_PATH.
Idea is to let make.profile symlink unmask different packages for hpux
and aix, to dupe LDPATH value into SHLIB_PATH and LIBPATH respectively.
Comments welcome!
[1] http://thread.gmane.org/gmane.linux.gentoo.macosx/1080/focus=1080
-haubi-
--
Michael Haubenwallner SALOMON Automation GmbH
Forschung & Entwicklung A-8114 Friesach bei Graz
mailto:michael.haubenwallner@salomon.at http://www.salomon.at
No HTML/MIME please, see http://expita.com/nomime.html
[-- Attachment #2: 06-env-conf+ext.patch --]
[-- Type: text/x-patch, Size: 8334 bytes --]
--- portage-prefix-2.1.14/pym/portage.py.orig 2006-06-01 09:30:01.000000000 +0200
+++ portage-prefix-2.1.14/pym/portage.py 2006-06-01 10:22:13.000000000 +0200
@@ -524,17 +524,22 @@
pos=pos+1
specials={
- "KDEDIRS":[],"PATH":[],"CLASSPATH":[],"LDPATH":[],"MANPATH":[],
- "INFODIR":[],"INFOPATH":[],"ROOTPATH":[],"CONFIG_PROTECT":[],
- "CONFIG_PROTECT_MASK":[],"PRELINK_PATH":[],"PRELINK_PATH_MASK":[],
- "PYTHONPATH":[], "ADA_INCLUDE_PATH":[], "ADA_OBJECTS_PATH":[]
+ "KDEDIRS" :{"separator":' ', "value":[],"from":"<portage>"},
+ "PATH" :{"separator":':', "value":[],"from":"<portage>"},
+ "CLASSPATH" :{"separator":':', "value":[],"from":"<portage>"},
+ "LDPATH" :{"separator":':', "value":[],"from":"<portage>"},
+ "MANPATH" :{"separator":':', "value":[],"from":"<portage>"},
+ "INFODIR" :{"separator":' ', "value":[],"from":"<portage>"},
+ "INFOPATH" :{"separator":':', "value":[],"from":"<portage>"},
+ "ROOTPATH" :{"separator":':', "value":[],"from":"<portage>"},
+ "CONFIG_PROTECT" :{"separator":' ', "value":[],"from":"<portage>"},
+ "CONFIG_PROTECT_MASK":{"separator":' ', "value":[],"from":"<portage>"},
+ "PRELINK_PATH" :{"separator":':', "value":[],"from":"<portage>"},
+ "PRELINK_PATH_MASK" :{"separator":' ', "value":[],"from":"<portage>"},
+ "PYTHONPATH" :{"separator":':', "value":[],"from":"<portage>"},
+ "ADA_INCLUDE_PATH" :{"separator":':', "value":[],"from":"<portage>"},
+ "ADA_OBJECTS_PATH" :{"separator":':', "value":[],"from":"<portage>"},
}
- colon_separated = [
- "ADA_INCLUDE_PATH", "ADA_OBJECTS_PATH",
- "LDPATH", "MANPATH",
- "PATH", "PRELINK_PATH",
- "PRELINK_PATH_MASK", "PYTHONPATH"
- ]
env={}
@@ -547,14 +552,35 @@
writemsg("!!! Parsing error in "+str(root)+portage_const.EPREFIX+"/etc/env.d/"+str(x)+"\n")
#parse error
continue
- # process PATH, CLASSPATH, LDPATH
+ # process PORTAGE_ENVEXT
+ if myconfig.has_key("PORTAGE_ENVEXT"):
+ for ee in myconfig["PORTAGE_ENVEXT"].split(" "):
+ if not ee:
+ continue
+ sep = ' '
+ if myconfig.has_key("PORTAGE_ENVSEP_"+ee):
+ sep = myconfig["PORTAGE_ENVSEP_"+ee]
+ del myconfig["PORTAGE_ENVSEP_"+ee]
+ if not specials.has_key(ee):
+ specials[ee] = {"separator": sep, "value":[], "from": x}
+ elif specials[ee]["separator"] != sep:
+ writemsg("!!! Different separator '"+sep+"' for "+ee
+ +" defined in "+x
+ +" and "+specials[ee]["from"]
+ +"\n"
+ )
+ del myconfig["PORTAGE_ENVEXT"]
+
+ # process expandable variables
for myspec in specials.keys():
if myconfig.has_key(myspec):
- if myspec in colon_separated:
- specials[myspec].extend(myconfig[myspec].split(":"))
- else:
- specials[myspec].append(myconfig[myspec])
+ specials[myspec]["value"].extend(
+ string.split(
+ varexpand(myconfig[myspec])
+ , specials[myspec]["separator"]
+ ))
del myconfig[myspec]
+
# process all other variables
for myenv in myconfig.keys():
env[myenv]=myconfig[myenv]
@@ -576,13 +602,13 @@
ld_cache_update=False
- newld=specials["LDPATH"]
+ newld=specials["LDPATH"]["value"]
if (oldld!=newld):
#ld.so.conf needs updating and ldconfig needs to be run
myfd = atomic_ofstream(os.path.join(root+portage_const.EPREFIX, "etc", "ld.so.conf"))
myfd.write("# ld.so.conf autogenerated by env-update; make all changes to\n")
myfd.write("# contents of "+portage_const.EPREFIX+"/etc/env.d directory\n")
- for x in specials["LDPATH"]:
+ for x in newld:
myfd.write(x+"\n")
myfd.close()
ld_cache_update=True
@@ -595,13 +621,13 @@
for x in map(lambda x: os.path.join(portage_const.EPREFIX,x), ["bin","sbin","usr/bin","usr/sbin","lib","usr/lib"]):
newprelink.write("-l "+x+"\n");
- for x in specials["LDPATH"]+specials["PATH"]+specials["PRELINK_PATH"]:
+ for x in specials["LDPATH"]["value"]+specials["PATH"]["value"]+specials["PRELINK_PATH"]["value"]:
if not x:
continue
if x[-1]!='/':
x=x+"/"
plmasked=0
- for y in specials["PRELINK_PATH_MASK"]:
+ for y in specials["PRELINK_PATH_MASK"]["value"]:
if not y:
continue
if y[-1]!='/':
@@ -611,14 +637,14 @@
break
if not plmasked:
newprelink.write("-h "+x+"\n")
- for x in specials["PRELINK_PATH_MASK"]:
+ for x in specials["PRELINK_PATH_MASK"]["value"]:
newprelink.write("-b "+x+"\n")
newprelink.close()
if not mtimedb.has_key("ldpath"):
mtimedb["ldpath"]={}
- for x in map(lambda x: portage_const.EPREFIX+x, specials["LDPATH"]+['/usr/lib','/lib']):
+ for x in map(lambda x: portage_const.EPREFIX+x, specials["LDPATH"]["value"]+['/usr/lib','/lib']):
try:
newldpathtime=os.stat(x)[stat.ST_MTIME]
except SystemExit, e:
@@ -655,61 +681,55 @@
del specials["LDPATH"]
- penvnotice = "# THIS FILE IS AUTOMATICALLY GENERATED BY env-update.\n"
- penvnotice += "# DO NOT EDIT THIS FILE. CHANGES TO STARTUP PROFILES\n"
+ envnotice = "# THIS FILE IS AUTOMATICALLY GENERATED BY env-update.\n"
+ envnotice += "# DO NOT EDIT THIS FILE."
+ penvnotice = envnotice + " CHANGES TO STARTUP PROFILES\n"
cenvnotice = penvnotice[:]
penvnotice += "# GO INTO "+portage_const.EPREFIX+"/etc/profile NOT "+portage_const.EPREFIX+"/etc/profile.env\n\n"
cenvnotice += "# GO INTO "+portage_const.EPREFIX+"/etc/csh.cshrc NOT "+portage_const.EPREFIX+"/etc/csh.env\n\n"
- #create /etc/profile.env for bash support
- outfile = atomic_ofstream(os.path.join(root+portage_const.EPREFIX, "etc", "profile.env"))
- outfile.write(penvnotice)
+ #create /etc/env.conf for baselayout-prefix support
+ outfile = atomic_ofstream(os.path.join(root+portage_const.EPREFIX, "etc", "env.conf"))
+ outfile.write(envnotice+"\n")
- for path in specials.keys():
- if len(specials[path])==0:
- continue
- outstring="export "+path+"='"
- if path in ["CONFIG_PROTECT","CONFIG_PROTECT_MASK"]:
- for x in specials[path][:-1]:
- outstring += x+" "
- else:
- for x in specials[path][:-1]:
- outstring=outstring+x+":"
- outstring=outstring+specials[path][-1]+"'"
- outfile.write(outstring+"\n")
-
- #create /etc/profile.env
- for x in env.keys():
- if type(env[x])!=types.StringType:
- continue
- outfile.write("export "+x+"='"+env[x]+"'\n")
- outfile.close()
+ #create /etc/profile.env for bash support
+ shoutfile = atomic_ofstream(os.path.join(root+portage_const.EPREFIX, "etc", "profile.env"))
+ shoutfile.write(penvnotice)
#create /etc/csh.env for (t)csh support
- outfile = atomic_ofstream(os.path.join(root+portage_const.EPREFIX, "etc", "csh.env"))
- outfile.write(cenvnotice)
+ cshoutfile = atomic_ofstream(os.path.join(root+portage_const.EPREFIX, "etc", "csh.env"))
+ cshoutfile.write(cenvnotice)
- for path in specials.keys():
- if len(specials[path])==0:
+ varlist=[]
+ for path, specs in specials.items():
+ sep, values = specs["separator"], specs["value"]
+ if not values:
continue
- outstring="setenv "+path+" '"
- if path in ["CONFIG_PROTECT","CONFIG_PROTECT_MASK"]:
- for x in specials[path][:-1]:
- outstring += x+" "
- else:
- for x in specials[path][:-1]:
- outstring=outstring+x+":"
- outstring=outstring+specials[path][-1]+"'"
- outfile.write(outstring+"\n")
- #get it out of the way
- del specials[path]
-
- #create /etc/csh.env
- for x in env.keys():
- if type(env[x])!=types.StringType:
+ varlist.append(path)
+
+ valstring = "%s" % sep.join(values)
+
+ outfile.write("PORTAGE_EXTSEP_%s='%s'\n" % (path, sep))
+ outfile.write("%s='%s'\n" % (path, valstring))
+ shoutfile.write("export %s='%s'\n" % (path, valstring))
+ cshoutfile.write("setenv %s '%s'\n" % (path, valstring))
+
+ outfile.write("PORTAGE_ENVEXT='%s'\n" % string.join(varlist,' '))
+
+ varlist=[]
+ for x in env:
+ if type(env[x])!=str:
continue
- outfile.write("setenv "+x+" '"+env[x]+"'\n")
+ outfile.write("%s='%s'\n" % (x,env[x]))
+ shoutfile.write("export %s='%s'\n" % (x,env[x]))
+ cshoutfile.write("setenv %s '%s'\n" % (x,env[x]))
+ varlist.append(x)
+
+ outfile.write("PORTAGE_ENVSET='%s'\n" % string.join(varlist,' '))
+
outfile.close()
+ shoutfile.close()
+ cshoutfile.close()
def new_protect_filename(mydest, newmd5=None):
"""Resolves a config-protect filename for merging, optionally
[-- Attachment #3: 07-env-dup.patch --]
[-- Type: text/x-patch, Size: 2713 bytes --]
diff -ru portage-prefix-2.1.14.orig/pym/portage.py portage-prefix-2.1.14/pym/portage.py
--- portage-prefix-2.1.14.orig/pym/portage.py 2006-06-01 10:57:49.000000000 +0200
+++ portage-prefix-2.1.14/pym/portage.py 2006-06-01 11:05:52.000000000 +0200
@@ -539,6 +539,7 @@
"PYTHONPATH" :{"separator":':', "value":[],"from":"<portage>"},
"ADA_INCLUDE_PATH" :{"separator":':', "value":[],"from":"<portage>"},
"ADA_OBJECTS_PATH" :{"separator":':', "value":[],"from":"<portage>"},
+ "PORTAGE_ENVDUP" :{"separator":' ', "value":[],"from":"<portage>"},
}
env={}
@@ -552,6 +553,22 @@
writemsg("!!! Parsing error in "+str(root)+portage_const.EPREFIX+"/etc/env.d/"+str(x)+"\n")
#parse error
continue
+
+ # process PORTAGE_ENVDUP
+ if myconfig.has_key("PORTAGE_ENVDUP"):
+ for ed in myconfig["PORTAGE_ENVDUP"].split(" "):
+ if not ed:
+ continue
+ if not myconfig.has_key("PORTAGE_ENVDUP_" + ed):
+ continue
+ if specials.has_key("PORTAGE_ENVDUP_" + ed):
+ continue
+ if myconfig.has_key("PORTAGE_ENVEXT"):
+ myconfig["PORTAGE_ENVEXT"] = myconfig["PORTAGE_ENVEXT"] \
+ + " " + "PORTAGE_ENVDUP_" + ed
+ else:
+ myconfig["PORTAGE_ENVEXT"] = "PORTAGE_ENVDUP_" + ed
+
# process PORTAGE_ENVEXT
if myconfig.has_key("PORTAGE_ENVEXT"):
for ee in myconfig["PORTAGE_ENVEXT"].split(" "):
@@ -585,6 +602,41 @@
for myenv in myconfig.keys():
env[myenv]=myconfig[myenv]
+ # process PORTAGE_ENVDUP
+ if specials.has_key("PORTAGE_ENVDUP"):
+ for dupvar in specials["PORTAGE_ENVDUP"]["value"]:
+ if not dupvar:
+ continue
+ dupenvvalue = None
+ dupspecvalue = None
+ if env.has_key(dupvar):
+ dupenvvalue=env["PORTAGE_ENVDUP_" + dupvar]
+ del env[dupvar]
+ elif specials.has_key(dupvar):
+ dupspecvalue=specials[dupvar]
+ if dupvar != "LDPATH":
+ del specials[dupvar]
+ else:
+ continue
+
+ for dupto in specials["PORTAGE_ENVDUP_" + dupvar]["value"]:
+ if not dupto:
+ continue
+ if dupenvvalue:
+ if env.has_key(dupto):
+ writemsg("!!! Cannot dup '"+dupvar+"' to '"+dupto
+ + "', '"+dupto+"' is defined separately.\n");
+ continue
+ env[dupto] = dupenvvalue
+ elif specials.has_key(dupto):
+ specials[dupto] = dupspecvalue
+ else:
+ specials[dupto] = {"separator": sep, "value":[], "from": x}
+ specials[dupto]["separator"] = dupspecvalue["separator"]
+ specials[dupto]["value"].extend(dupspecvalue["value"])
+ del specials["PORTAGE_ENVDUP_" + dupvar]
+ del specials["PORTAGE_ENVDUP"]
+
if os.path.exists(root+portage_const.EPREFIX+"/etc/ld.so.conf"):
myld=open(root+portage_const.EPREFIX+"/etc/ld.so.conf")
myldlines=myld.readlines()
[-- Attachment #4: baselayout-prefix-0.1.ebuild --]
[-- Type: text/plain, Size: 1633 bytes --]
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /cvsroot/secondary-portage/sys-apps/baselayout-secondary/baselayout-secondary-0.1.ebuild,v 1.4 2005/09/14 06:59:13 haubi Exp $
DESCRIPTION="Baselayout for Secondary Package Manager extending the environment"
HOMEPAGE=""
SRC_URI=""
LICENSE=""
SLOT="0"
EAPI="prefix"
KEYWORDS="x86"
IUSE=""
#PDEPEND=">=portage-2.1_pre"
DEPEND="app-shells/bash"
RDEPEND=""
src_install() {
insinto /etc || die
newins ${FILESDIR}/${PV}-inputrc inputrc || die
newins ${FILESDIR}/${PV}-profile profile || die
newins ${FILESDIR}/${PV}-unprofile unprofile || die
into /
newsbin ${FILESDIR}/${PV}-extenv extenv || die
cu_bash=${BASH}
test -r "${ROOT}/bin/bash" && cu_bash="${EPREFIX}/bin/bash"
dosed "s,@EPREFIX@,${EPREFIX},g
;s,@BASH@,${cu_bash},g
;s,@rootuser@,${PORTAGE_ROOTUSER:-$(id -un)},
" \
/etc/profile \
/etc/unprofile \
/sbin/extenv \
|| die
fperms a+x /sbin/extenv
insinto /etc/env.d
cat >> "${D}"/etc/env.d/98secondary <<-EOE
# /${EPREFIX}etc/env.d/98secondary
PATH='${EPREFIX}/usr/bin:${EPREFIX}/bin'
ROOTPATH='${EPREFIX}/usr/sbin:${EPREFIX}/sbin:${EPREFIX}/usr/bin:${EPREFIX}/bin'
LDPATH='${EPREFIX}/usr/lib:${EPREFIX}/lib'
INFODIR='${EPREFIX}/usr/share/info'
INFOPATH='${EPREFIX}/usr/share/info'
MANPATH='${EPREFIX}/usr/share/man'
EOE
dodir /etc/init.d || die
dosym /usr/lib/portage/bin/isolated-functions.sh /sbin/functions.sh || die
dosym /sbin/functions.sh /etc/init.d/functions.sh || die
dodir /var/spool/emerge || die
touch "${D}"/var/spool/emerge/doasroot || die
}
[-- Attachment #5: baselayout-linux-0.1.ebuild --]
[-- Type: text/plain, Size: 674 bytes --]
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /cvsroot/secondary-portage/sys-apps/baselayout-secondary/baselayout-secondary-0.1.ebuild,v 1.4 2005/09/14 06:59:13 haubi Exp $
DESCRIPTION="Baselayout for Secondary Package Manager extending the environment"
HOMEPAGE=""
SRC_URI=""
LICENSE=""
SLOT="0"
EAPI="prefix"
KEYWORDS="x86"
IUSE=""
DEPEND=""
RDEPEND="sys-apps/baselayout-prefix"
PROVIDE="virtual/baselayout"
src_install() {
cat >> "${T}"/99system <<-EOE
# /${EPREFIX}etc/env.d/99system
PORTAGE_ENVDUP="LDPATH"
PORTAGE_ENVDUP_LDPATH="LD_LIBRARY_PATH"
EOE
doenvd "${T}"/99system || die
}
[-- Attachment #6: 0.1-extenv --]
[-- Type: text/plain, Size: 3803 bytes --]
#! @BASH@
envfile="@EPREFIX@/etc/env.conf"
die() {
[ "$*" ] && echo "$@" >&2
exit 1
}
echo_setenv() {
local var=$1
var=$1
shift
eval "local val=\"$*\""
eval "${var}=\"${val}\""
case "${shelltype}" in
sh)
if [ -n "${val}" ]
then
echo "${var}='${val}' ;"
echo "export ${var} ;"
else
echo "unset ${var} ;"
fi
;;
csh)
if [ -n "${val}" ]
then
echo "setenv ${var} '${val:0:1000}' ;"
val=${val:1000}
while [ -n "${val}" ]
do
echo "setenv ${var} \"\${${var}}\"'${val:0:1000}' ;"
val=${val:1000}
done
else
echo "unsetenv ${var} ;"
fi
;;
esac
}
parse_envfile() { (
local envfile=$1
local var
eval $(
. ${envfile} || die
echo "PORTAGE_ENVEXT=\$'${PORTAGE_ENVEXT-}'"
echo "PORTAGE_ENVSET=\$'${PORTAGE_ENVSET-}'"
)
for var in ${PORTAGE_ENVEXT-} ${PORTAGE_ENVSET-}
do
unset ${var}
done
. ${envfile} || { echo abort ; die ; }
for var in ${PORTAGE_ENVEXT-}
do
echo "extenv_var=\$'${var}'"
eval echo extenv_sep=\\\$\\\'\${PORTAGE_EXTSEP_${var}- }\\\'
eval echo extenv_val=\\\$\\\'\${${var}-}\\\'
done
for var in ${PORTAGE_ENVSET-}
do
echo "setenv_var=\$'${var}'"
eval echo setenv_val=\\\$\\\'\${${var}-}\\\'
done
) }
extenv_set() {
local envfile=$1
while read line
do
case "${line}" in
abort)
die
;;
extenv_var=*)
# extend environment variable
eval ${line}
# extenv_sep
read line
eval ${line}
# extenv_val
read line
eval ${line}
[ -n "${extenv_val}" ] || continue
eval extenv_oldval=\${${extenv_var}}
case "${extenv_sep}${extenv_oldval}${extenv_sep}" in
"${extenv_sep}${extenv_sep}")
# variable to be extended is empty
echo_setenv ${extenv_var} "${extenv_val}"
;;
*"${extenv_sep}${extenv_val}${extenv_sep}"*)
# variable to be extended already contains extval
;;
"${extenv_sep}${extenv_sep}"*)
# separator is already there
echo_setenv ${extenv_var} "${extenv_val}${extenv_oldval}"
;;
*)
# expand with separator
echo_setenv ${extenv_var} "${extenv_val}${extenv_sep}${extenv_oldval}"
;;
esac
;;
setenv_var=*)
# set environment variable
eval "${line}"
# setenv_val
read line
eval "${line}"
echo_setenv ${setenv_var} "${setenv_val}"
;;
esac
done <<-EOE
$(parse_envfile ${envfile})
EOE
}
extenv_unset() {
local envfile=$1
while read line
do
case "${line}" in
abort)
die
;;
extenv_var=*)
# extend environment variable
eval "${line}"
# extenv_sep
read line
eval "${line}"
# extenv_val
read line
eval "${line}"
eval extenv_oldval=\"\${${extenv_var}}\"
extenv_testval="${extenv_sep}${extenv_oldval}${extenv_sep}"
save_IFS=$IFS
IFS=$extenv_sep
extenv_newval=
for ov in ${extenv_oldval}
do
case "${extenv_sep}${extenv_val}${extenv_sep}" in
*"${extenv_sep}${ov}${extenv_sep}"*)
continue
;;
esac
extenv_newval="${extenv_newval}${extenv_newval:+${extenv_sep}}${ov}"
done
IFS=$save_IFS
echo_setenv ${extenv_var} "${extenv_newval}"
;;
setenv_var=*)
# set environment variable
eval "${line}"
# setenv_val
read line
eval "${line}"
# unset variable
echo_setenv ${setenv_var} ""
;;
esac
done <<-EOE
$(parse_envfile ${envfile})
EOE
}
extenv_none() { :;}
known_functions="set unset"
action=none
case "${SHELL}" in
*csh) shelltype=csh ;;
*) shelltype=sh ;;
esac
for arg in "$@"
do
case "X${arg}" in
X--debug) set -xv ; continue ;;
X--sh) shelltype=sh ; continue ;;
X--csh) shelltype=csh ; continue ;;
esac
for func in ${known_functions}
do
case "X${arg}" in
X--${func})
action=${func}
continue 2
;;
esac
done
case "X${arg}" in
X--*) die "invalid argument '${arg}'" ;;
esac
envfile="${arg}"
done
extenv_${action} ${envfile}
[-- Attachment #7: 0.1-inputrc --]
[-- Type: text/plain, Size: 1003 bytes --]
# /etc/inputrc:
# $Header: /cvsroot/secondary-portage/sys-apps/baselayout-secondary/files/0.1-inputrc,v 1.1 2005/05/27 15:45:21 haubi Exp $
# do not bell on tab-completion
#set bell-style none
set meta-flag on
set input-meta on
set convert-meta off
set output-meta on
# Completed names which are symbolic links to
# directories have a slash appended.
set mark-symlinked-directories on
$if mode=emacs
# for linux console and RH/Debian xterm
"\e[1~": beginning-of-line
"\e[4~": end-of-line
#"\e[5~": beginning-of-history
#"\e[6~": end-of-history
"\e[5~": history-search-backward
"\e[6~": history-search-forward
"\e[3~": delete-char
"\e[2~": quoted-insert
"\e[5C": forward-word
"\e[5D": backward-word
# for rxvt
"\e[8~": end-of-line
# for non RH/Debian xterm, can't hurt for RH/Debian xterm
"\eOH": beginning-of-line
"\eOF": end-of-line
# for freebsd console
"\e[H": beginning-of-line
"\e[F": end-of-line
$endif
# fix Home and End for German users
"\e[7~": beginning-of-line
"\e[8~": end-of-line
[-- Attachment #8: 0.1-profile --]
[-- Type: text/plain, Size: 965 bytes --]
# @EPREFIX@/etc/profile
# $Header: /cvsroot/secondary-portage/sys-apps/baselayout-secondary/files/0.1-profile,v 1.1 2005/07/08 07:03:42 haubi Exp $
if [ -e "@EPREFIX@/etc/env.conf" ]
then
ROOTPATH=${PATH}
export ROOTPATH
eval `@EPREFIX@/sbin/extenv --set --sh @EPREFIX@/etc/env.conf`
fi
case "`/usr/bin/whoami`" in
"root"|"@rootuser@")
export PATH="${ROOTPATH}"
;;
*)
esac
unset ROOTPATH
if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]
then
export INPUTRC="@EPREFIX@/etc/inputrc"
fi
# Extract the value of EDITOR
[ -z "${EDITOR-}" ] && EDITOR="`. @EPREFIX@/etc/rc.conf 2>/dev/null; echo ${EDITOR-}`"
[ -z "${EDITOR-}" ] && EDITOR="`. @EPREFIX@/etc/conf.d/basic 2>/dev/null; echo ${EDITOR-}`"
[ -z "${EDITOR-}" ] && EDITOR="@EPREFIX@/bin/nano"
export EDITOR
for x in @EPREFIX@/etc/profile.d/*.sh
do
if [ -x ${x} ]
then
. ${x}
fi
done
unset x
if [ -e @EPREFIX@/etc/unprofile ]
then
alias eenv-clear='. @EPREFIX@/etc/unprofile'
fi
[-- Attachment #9: 0.1-unprofile --]
[-- Type: text/plain, Size: 708 bytes --]
# @EPREFIX@/etc/unprofile
# $Header: /cvsroot/secondary-portage/sys-apps/baselayout-secondary/files/0.1-unprofile,v 1.1 2005/07/08 07:03:42 haubi Exp $
for x in @EPREFIX@/etc/profile.d/*.unsh
do
if [ -x ${x} ]
then
. ${x}
fi
done
unset x
if [ -e @EPREFIX@/etc/env.conf ]
then
ROOTPATH=${PATH}
export ROOTPATH
eval `@EPREFIX@/sbin/extenv --unset --sh @EPREFIX@/etc/env.conf`
fi
case "`/usr/bin/whoami`" in
"root")
export PATH="${ROOTPATH}"
;;
"@rootuser@")
export PATH="${ROOTPATH}"
;;
*)
esac
unset ROOTPATH
if [ "${INPUTRC-}" = "@EPREFIX@/etc/inputrc" ]
then
unset INPUTRC
fi
case "${EDITOR-}" in
"@EPREFIX@/"*) unset EDITOR ;;
esac
unalias eenv-clear 2>/dev/null
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2006-09-07 12:43 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-06 12:58 [gentoo-osx] [PREFIX] LD_LIBRARY_PATH issue Grobian
2006-09-06 13:37 ` Michael Haubenwallner
2006-09-06 19:20 ` Grobian
2006-09-07 9:26 ` Michael Haubenwallner
2006-09-07 12:43 ` Michael Haubenwallner
2006-09-06 19:45 ` Christopher Chan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox