summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Robbins <drobbins@gentoo.org>2001-01-22 16:00:45 +0000
committerDaniel Robbins <drobbins@gentoo.org>2001-01-22 16:00:45 +0000
commit61cf431ffffa95a85ef2a46cc11917037941d179 (patch)
tree3b7d43976fed37216172801a31d69f5f8a372362 /sys-apps
parent*** empty log message *** (diff)
downloadhistorical-61cf431ffffa95a85ef2a46cc11917037941d179.tar.gz
historical-61cf431ffffa95a85ef2a46cc11917037941d179.tar.bz2
historical-61cf431ffffa95a85ef2a46cc11917037941d179.zip
env-update move
Diffstat (limited to 'sys-apps')
-rw-r--r--sys-apps/baselayout/baselayout-1.5-r1.ebuild (renamed from sys-apps/baselayout/baselayout-1.5.ebuild)4
-rwxr-xr-xsys-apps/portage/files/env-update4
-rw-r--r--sys-apps/portage/files/portage.py84
-rw-r--r--sys-apps/portage/portage-1.4-r6.ebuild (renamed from sys-apps/portage/portage-1.4-r5.ebuild)4
4 files changed, 93 insertions, 3 deletions
diff --git a/sys-apps/baselayout/baselayout-1.5.ebuild b/sys-apps/baselayout/baselayout-1.5-r1.ebuild
index ac202269813d..0ba217ce3531 100644
--- a/sys-apps/baselayout/baselayout-1.5.ebuild
+++ b/sys-apps/baselayout/baselayout-1.5-r1.ebuild
@@ -1,7 +1,7 @@
# Copyright 1999-2000 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License, v2 or later
# Author Achim Gottinger <achim@gentoo.org>
-# $Header: /var/cvsroot/gentoo-x86/sys-apps/baselayout/baselayout-1.5.ebuild,v 1.1 2001/01/09 23:04:11 drobbins Exp $# Copyright 1999-2000 Gentoo Technologies, Inc.
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/baselayout/baselayout-1.5-r1.ebuild,v 1.1 2001/01/22 16:00:40 drobbins Exp $# Copyright 1999-2000 Gentoo Technologies, Inc.
A=""
S=${WORKDIR}/${P}
@@ -103,7 +103,7 @@ src_install()
insinto /etc
doins inittab
into /usr
- dosbin rc-update env-update
+ dosbin rc-update
insinto /usr/bin
insopts -m0755
doins colors
diff --git a/sys-apps/portage/files/env-update b/sys-apps/portage/files/env-update
new file mode 100755
index 000000000000..ab7d82a0bbc0
--- /dev/null
+++ b/sys-apps/portage/files/env-update
@@ -0,0 +1,4 @@
+#!/usr/bin/env python
+
+import portage
+portage.env_update()
diff --git a/sys-apps/portage/files/portage.py b/sys-apps/portage/files/portage.py
index 6744c2e85be4..54a0bdf20abc 100644
--- a/sys-apps/portage/files/portage.py
+++ b/sys-apps/portage/files/portage.py
@@ -76,6 +76,90 @@ categories=("app-admin", "app-arch", "app-cdr", "app-doc", "app-editors", "app-e
"net-print", "net-www", "packages", "sys-apps", "sys-devel", "sys-kernel", "sys-libs", "x11-base", "x11-libs",
"x11-terms", "x11-wm","virtual")
+#parse /etc/env.d and generate /etc/profile.env
+
+def env_update():
+ global root
+ fns=os.listdir(root+"etc/env.d")
+ fns.sort()
+ pos=0
+ while (pos<len(fns)):
+ if fns[pos]<=2:
+ del fns[pos]
+ continue
+ if (fns[pos][0] not in string.digits) or (fns[pos][1] not in string.digits):
+ del fns[pos]
+ continue
+ pos=pos+1
+
+ specials={"PATH":[],"CLASSPATH":[],"LDPATH":[],"MANPATH":[],"INFODIR":[],"ROOTPATH":[]}
+ env={}
+
+ for x in fns:
+ myconfig=configfile(root+"etc/env.d/"+x)
+ # process PATH, CLASSPATH, LDPATH
+ for myspec in specials.keys():
+ if myconfig.has_key(myspec):
+ if myspec=="LDPATH":
+ specials[myspec].extend(string.split(myconfig.get_key(myspec),":"))
+ else:
+ specials[myspec].append(myconfig.get_key(myspec))
+ myconfig.del_key(myspec)
+ # process all other variables
+ for myenv in myconfig.all_keys():
+ env[myenv]=myconfig.get_key(myenv)
+
+ if os.path.exists(root+"etc/ld.so.conf"):
+ myld=open(root+"etc/ld.so.conf")
+ myldlines=myld.readlines()
+ myld.close()
+ oldld=[]
+ for x in myldlines:
+ #each line has at least one char (a newline)
+ if x[0]=="#":
+ continue
+ oldld.append(x[:-1])
+ oldld.sort()
+ # os.rename(root+"etc/ld.so.conf",root+"etc/ld.so.conf.bak")
+ # Where is the new ld.so.conf generated? (achim)
+ else:
+ oldld=None
+ specials["LDPATH"].sort()
+ if (oldld!=specials["LDPATH"]):
+ #ld.so.conf needs updating and ldconfig needs to be run
+ newld=open(root+"etc/ld.so.conf","w")
+ newld.write("# ld.so.conf autogenerated by env-update; make all changes to\n")
+ newld.write("# contents of /etc/env.d directory\n")
+ for x in specials["LDPATH"]:
+ newld.write(x+"\n")
+ newld.close()
+ #run ldconfig here
+ print ">>> Regenerating "+root+"etc/ld.so.cache..."
+ getstatusoutput("/sbin/ldconfig -r "+root)
+ del specials["LDPATH"]
+
+ outfile=open(root+"/etc/profile.env","w")
+
+ for path in specials.keys():
+ if len(specials[path])==0:
+ continue
+ outstring="export "+path+"='"
+ 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/profile.env
+ for x in env.keys():
+ if type(env[x])!=types.StringType:
+ continue
+ outfile.write("export "+x+"='"+env[x]+"'\n")
+ outfile.close()
+
+ #need to add cshrc support
+
#new configfile reading code using shlex
class configfile:
def __init__(self,cfgfile):
diff --git a/sys-apps/portage/portage-1.4-r5.ebuild b/sys-apps/portage/portage-1.4-r6.ebuild
index 96157d7224c0..d5f198edcd35 100644
--- a/sys-apps/portage/portage-1.4-r5.ebuild
+++ b/sys-apps/portage/portage-1.4-r6.ebuild
@@ -1,7 +1,7 @@
# Copyright 1999-2000 Gentoo Technologies, Inc. Distributed under the terms
# of the GNU General Public License, v2 or later
# Author Daniel Robbins <drobbins@gentoo.org>
-# $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/portage-1.4-r5.ebuild,v 1.1 2001/01/20 18:24:27 drobbins Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/portage-1.4-r6.ebuild,v 1.1 2001/01/22 16:00:42 drobbins Exp $
A=""
S=${WORKDIR}/${P}
@@ -39,6 +39,8 @@ src_install() {
dosym /usr/lib/portage/bin/pkgmerge /usr/sbin/pkgmerge
dosym /usr/lib/portage/bin/portage-maintain /usr/sbin/portage-maintain
dosym newins /usr/lib/portage/bin/donewins
+ exeinto /usr/sbin
+ doexe env-update
}
pkg_postinst() {