aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Stubbs <jstubbs@gentoo.org>2005-05-01 16:09:19 +0000
committerJason Stubbs <jstubbs@gentoo.org>2005-05-01 16:09:19 +0000
commit859ca899903bcd62660879993f72f365b7939a79 (patch)
tree9cd85b5abc22f93106dbe82683e1f677f7c21b8b
parentDropped confmem from 16 previous files down to 1 previous file so that (diff)
downloadportage-cvs-portage_2_0_51_21.tar.gz
portage-cvs-portage_2_0_51_21.tar.bz2
portage-cvs-portage_2_0_51_21.zip
Removed g-cpan.pl as it is now maintained externally. Removed other oldportage_2_0_51_21
and/or unmaintained scripts.
-rw-r--r--ChangeLog6
-rw-r--r--bin/db-update.py60
-rwxr-xr-xbin/dispatch-conf-dialog287
-rwxr-xr-xbin/fixvardbentries167
-rwxr-xr-xbin/fixvirtuals33
-rwxr-xr-xbin/g-cpan.pl368
-rwxr-xr-xbin/queryhost.sh47
-rw-r--r--man/g-cpan.pl.125
8 files changed, 5 insertions, 988 deletions
diff --git a/ChangeLog b/ChangeLog
index abee3a2..004198d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,6 @@
# ChangeLog for Portage; the Gentoo Linux ports system
# Copyright 1999-2005 Gentoo Foundation; Distributed under the GPL v2
-# $Id: ChangeLog,v 1.796.2.116 2005/05/01 16:04:51 jstubbs Exp $
+# $Id: ChangeLog,v 1.796.2.117 2005/05/01 16:09:19 jstubbs Exp $
MAJOR CHANGES in 2.0.51:
1. /var/cache/edb/virtuals is no longer used at all. It's calculated now.
@@ -9,6 +9,10 @@
*portage-2.0.51.21 (01 May 2005): Maintainence Release
+ 01 May 2005; Jason Stubbs <jstubbs@gentoo.org>: Removed g-cpan.pl as it
+ is now maintained externally. Removed other old and/or unmaintained
+ scripts.
+
01 May 2005; Jason Stubbs <jstubbs@gentoo.org> pym/portage.py: Dropped
confmem from 16 previous files down to 1 previous file so that upgrading
and downgrading behaves in terms of config files.
diff --git a/bin/db-update.py b/bin/db-update.py
deleted file mode 100644
index a55d021..0000000
--- a/bin/db-update.py
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/usr/bin/python -O
-# Copyright 1999-2004 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/bin/db-update.py,v 1.9 2004/10/11 04:01:00 jstubbs Exp $
-
-import os,sys,string
-sys.path = ["/usr/lib/portage/pym"]+sys.path
-
-import portage
-
-os.chdir(portage.root+portage.VDB_PATH)
-myvirts=portage.grabdict(portage.root+"var/cache/edb/virtuals")
-mypvirts={}
-if portage.profiledir:
- mypvirts=portage.grabdict(portage.profiledir+"/virtuals")
-mydict={}
-myvalidargs=[]
-origkey={}
-for x in sys.argv[1:]:
- myparts=string.split(x,"/")
- x=myparts[1]+"/"+myparts[2]
- try:
- myfile=open(x+"/VIRTUAL","r")
- except SystemExit, e:
- raise # Needed else the app won't quit
- except:
- continue
- myline=myfile.readline()
- mykey=string.join(string.split(myline))
- if portage.isspecific(x):
- mysplit=portage.catpkgsplit(x)
- newkey=mysplit[0]+"/"+mysplit[1]
- origkey[newkey]=x
- x=newkey
- else:
- origkey[x]=x
- if portage.isspecific(mykey):
- mysplit=portage.catpkgsplit(mykey)
- mykey=mysplit[0]+"/"+mysplit[1]
- myvalidargs.append(x)
- mydict[x]=mykey
-for x in mydict.keys():
- if mypvirts.has_key(x) and len(mypvirts[x])>=1 and mypvirts[x][0]==mydict[x]:
- #this is a default setting; don't record
- continue
- if myvirts.has_key(x):
- if mydict[x] not in myvirts[x]:
- myvirts[x][0:0]=[mydict[x]]
- else:
- myvirts[x]=[mydict[x]]
-print ">>> Database upgrade..."
-print ">>> Writing out new virtuals file..."
-portage.writedict(myvirts,portage.root+"var/cache/edb/virtuals")
-if not os.path.exists("/tmp/db-upgrade-bak"):
- os.mkdir("/tmp/db-upgrade-bak")
-print ">>> Backing up to /tmp/db-upgrade-bak..."
-for myarg in myvalidargs:
- print ">>> Backing up",portage.root+portage.VDB_PATH+"/"+origkey[myarg]
- os.system("mv "+portage.root+portage.VDB_PATH+"/"+origkey[myarg]+" /tmp/db-upgrade-bak")
-print ">>> Done."
diff --git a/bin/dispatch-conf-dialog b/bin/dispatch-conf-dialog
deleted file mode 100755
index 2447e3a..0000000
--- a/bin/dispatch-conf-dialog
+++ /dev/null
@@ -1,287 +0,0 @@
-#!/usr/bin/python -O
-# Copyright 1999-2004 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/bin/dispatch-conf-dialog,v 1.3 2004/10/04 13:56:50 vapier Exp $
-
-#
-# dispatch-conf-dialog -- Integrate modified configs, post-emerge
-# using a simple dialog interface...
-#
-# Jeremy Wohl (http://igmus.org)
-#
-# TODO
-# dialog menus
-#
-import os, shutil, sys, string, re, commands
-sys.path = ["/usr/lib/portage/pym"]+sys.path
-
-from stat import *
-import portage, dispatch_conf
-
-from dcdialog import *
-
-from commands import *
-
-FIND_EXTANT_CONFIGS = "find %s -iname '._cfg????_*'"
-DIFF_CONTENTS = 'diff -Nau %s %s'
-DIFF_CVS_INTERP = 'diff -Nau %s %s | grep "^[+-][^+-]" | grep -v "# .Header:.*"'
-DIFF_WSCOMMENTS = 'diff -Nau %s %s | grep "^[+-][^+-]" | grep -v "^[-+]#" | grep -v "^[-+][:space:]*$"'
-MERGE = 'sdiff --suppress-common-lines --output=%s %s %s'
-
-LOG_CHANGES_TO = '/tmp/dispatch-conf.changes'
-
-MANDATORY_OPTS = [ 'archive-dir', 'diff', 'pager', 'replace-cvs', 'replace-wscomments' ]
-
-ITEMS = ['u','z','n','e', 'm','l','t','q']
-LONG_ITEMS = [ 'update current config with new config and continue', 'zap (delete) new config and continue', 'skip to next config, leave all intact','edit new config','interactively merge current and new configs','look at diff between pre-merged and merged configs','toggle new config between merged and pre-merged state','quit']
-
-
-class dispatch:
- options = {}
-
- def grind (self, config_paths):
- confs = []
- count = 0
-
- if os.path.exists(LOG_CHANGES_TO):
- shutil.move(LOG_CHANGES_TO, LOG_CHANGES_TO + '.old')
-
- self.options = dispatch_conf.read_config(MANDATORY_OPTS)
-
- #
- # Build list of extant configs
- #
-
- for path in config_paths.split ():
- if not os.path.exists (path):
- continue
-
- confs += self.massage (os.popen (FIND_EXTANT_CONFIGS % (path,)).readlines ())
-
- #
- # Remove new configs identical to current
- # and
- # Auto-replace configs a) whose differences are simply CVS interpolations,
- # or b) whose differences are simply ws or comments,
- # or c) in paths now unprotected by CONFIG_PROTECT_MASK,
- #
-
- def f (conf):
- mrgconf = re.sub(r'\._cfg', '._mrg', conf['new'])
- archive = os.path.join(self.options['archive-dir'], conf['current'].lstrip('/'))
- if self.options['use-rcs'] == 'yes':
- dispatch_conf.rcs_archive(archive, conf['current'], conf['new'], mrgconf)
- else:
- dispatch_conf.file_archive(archive, conf['current'], conf['new'], mrgconf)
- if os.path.exists(archive + '.dist'):
- unmodified = len(commands.getoutput(DIFF_CONTENTS % (conf['current'], archive + '.dist'))) == 0
- else:
- unmodified = 0
- if os.path.exists(mrgconf):
- if len(commands.getoutput(DIFF_CONTENTS % (conf['new'], mrgconf))) == 0:
- os.unlink(mrgconf)
- newconf = conf['new']
- else:
- newconf = mrgconf
- else:
- newconf = conf['new']
-
- same_file = len(commands.getoutput (DIFF_CONTENTS % (conf ['current'], newconf))) == 0
- same_cvs = len(commands.getoutput (DIFF_CVS_INTERP % (conf ['current'], newconf))) == 0
- same_wsc = len(commands.getoutput (DIFF_WSCOMMENTS % (conf ['current'], newconf))) == 0
-
- # Do options permit?
- same_cvs = same_cvs and self.options['replace-cvs'] == 'yes'
- same_wsc = same_wsc and self.options['replace-wscomments'] == 'yes'
- unmodified = unmodified and self.options['replace-unmodified'] == 'yes'
-
- if same_file:
- os.unlink (conf ['new'])
- self.post_process(conf['current'])
- if os.path.exists(mrgconf):
- os.unlink(mrgconf)
- return False
- elif unmodified or same_cvs or same_wsc or conf ['dir'] in portage.settings ['CONFIG_PROTECT_MASK'].split ():
- self.replace(newconf, conf['current'])
- self.post_process(conf['current'])
- if newconf == mrgconf:
- os.unlink(conf['new'])
- elif os.path.exists(mrgconf):
- os.unlink(mrgconf)
- return False
- else:
- return True
-
- confs = filter (f, confs)
-
- #
- # Interactively process remaining
- #
- dialog = Dialog()
- dialog.setBackgroundTitle('dispatch-conf Dialog Interface')
-
- for conf in confs:
- count = count + 1
-
- newconf = conf['new']
- mrgconf = re.sub(r'\._cfg', '._mrg', newconf)
- if os.path.exists(mrgconf):
- newconf = mrgconf
- show_new_diff = 0
-
- while 1:
- if show_new_diff:
-## os.system((self.options['diff'] + '| %s') % (conf['new'], mrgconf, self.options['pager']))
- (xx,yy) = getstatusoutput((self.options['diff']) % (conf['new'], mrgconf))
- dialog.scrollbox(yy,24,70)
- show_new_diff = 0
- else:
-## os.system((self.options['diff'] + '| %s') % (conf['current'], newconf, self.options['pager']))
- (xx,yy) = getstatusoutput((self.options['diff']) % (conf['current'], newconf))
- dialog.scrollbox(yy,24,70)
-
-
-
-## print
-## print '>> (%i of %i) -- %s' % (count, len(confs), conf ['current'])
-## print '>> q quit, h help, n next, e edit-new, z zap-new, u use-new\n m merge, t toggle-merge, l look-merge: ',
- c = dialog.menu_ext('(%i of %i) -- %s' % (count, len(confs), conf ['current']),18,70,LONG_ITEMS,ITEMS)
- #c = getch ()
-
- if c == 'q' or c==None:
- sys.exit (0)
-## if c == 'h':
-## self.do_help ()
-## continue
- elif c == 't':
- if newconf == mrgconf:
- newconf = conf['new']
- elif os.path.exists(mrgconf):
- newconf = mrgconf
- continue
- elif c == 'n':
- break
- elif c == 'm':
- merged = '/tmp/dispatch-conf.merged.%i' % (os.getpid (),)
-## print
- os.system (MERGE % (merged, conf ['current'], newconf))
- shutil.move (merged, mrgconf)
- mystat = os.lstat(conf['new'])
- os.chmod(mrgconf, mystat[ST_MODE])
- os.chown(mrgconf, mystat[ST_UID], mystat[ST_GID])
- newconf = mrgconf
- continue
- elif c == 'l':
- show_new_diff = 1
- continue
- elif c == 'e':
- os.system(os.environ['EDITOR'] + ' ' + newconf)
- continue
- elif c == 'z':
- os.unlink(conf['new'])
- if os.path.exists(mrgconf):
- os.unlink(mrgconf)
- break
- elif c == 'u':
- self.replace(newconf, conf ['current'])
- self.post_process(conf['current'])
- if newconf == mrgconf:
- os.unlink(conf['new'])
- elif os.path.exists(mrgconf):
- os.unlink(mrgconf)
- break
- else:
- continue
-
-
- def replace (self, newconf, curconf):
- """Replace current config with the new/merged version. Also logs
- the diff of what changed into the LOG_CHANGES_TO file."""
- os.system((DIFF_CONTENTS % (curconf, newconf)) + '>>' + LOG_CHANGES_TO)
- try:
- shutil.move (newconf, curconf)
- except (IOError, os.error), why:
- print >> sys.stderr, 'dispatch-conf: Error renaming %s to %s: %s; fatal' % \
- (newconf, curconf, str(why))
-
-
- def post_process(self, curconf):
- archive = os.path.join(self.options['archive-dir'], curconf.lstrip('/'))
- if self.options['use-rcs'] == 'yes':
- dispatch_conf.rcs_archive_post_process(archive)
- else:
- dispatch_conf.file_archive_post_process(archive)
-
-
- def massage (self, newconfigs):
- """Sort, rstrip, remove old versions, break into triad hash.
-
- Triad is dictionary of current (/etc/make.conf), new (/etc/._cfg0003_make.conf)
- and dir (/etc).
-
- We keep ._cfg0002_conf over ._cfg0001_conf and ._cfg0000_conf.
- """
- h = {}
-
- newconfigs.sort ()
-
- for nconf in newconfigs:
- nconf = nconf.rstrip ()
- conf = re.sub (r'\._cfg\d+_', '', nconf)
- dir = re.match (r'^(.+)/', nconf).group (1)
-
- if h.has_key (conf):
- mrgconf = re.sub(r'\._cfg', '._mrg', h[conf]['new'])
- if os.path.exists(mrgconf):
- os.unlink(mrgconf)
- os.unlink(h[conf]['new'])
-
- h [conf] = { 'current' : conf, 'dir' : dir, 'new' : nconf }
-
- configs = h.values ()
- configs.sort (lambda a, b: cmp(a ['current'], b ['current']))
-
- return configs
-
-
-## def do_help (self):
-## print; print
-
-## print ' u -- update current config with new config and continue'
-## print ' z -- zap (delete) new config and continue'
-## print ' n -- skip to next config, leave all intact'
-## print ' e -- edit new config'
-## print ' m -- interactively merge current and new configs'
-## print ' l -- look at diff between pre-merged and merged configs'
-## print ' t -- toggle new config between merged and pre-merged state'
-## print ' h -- this screen'
-## print ' q -- quit'
-
-## print; print 'press any key to return to diff...',
-
-## getch ()
-
-
-## def getch ():
-## # from ASPN - Danny Yoo
-## #
-## import sys, tty, termios
-
-## fd = sys.stdin.fileno()
-## old_settings = termios.tcgetattr(fd)
-## try:
-## tty.setraw(sys.stdin.fileno())
-## ch = sys.stdin.read(1)
-## finally:
-## termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
-## return ch
-
-
-# run
-d = dispatch ()
-
-if len(sys.argv) > 1:
- # for testing
- d.grind (string.join (sys.argv [1:]))
-else:
- d.grind (portage.settings ['CONFIG_PROTECT'])
diff --git a/bin/fixvardbentries b/bin/fixvardbentries
deleted file mode 100755
index 7fa76ee..0000000
--- a/bin/fixvardbentries
+++ /dev/null
@@ -1,167 +0,0 @@
-#!/usr/bin/python -O
-# Copyright 1999-2004 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/bin/fixvardbentries,v 1.4 2004/10/11 04:01:00 jstubbs Exp $
-
-import os
-import sys
-
-def fix_entries(path):
- path += "/"
-
- # Find the ebuild
- contents = os.listdir(path)
- ebuild = None
- for fn in contents:
- if fn[-7:] == ".ebuild":
- ebuild = fn
- break
- if ebuild is None:
- print "missing ebuild in",path
- return
-
- # Read it
- ebuildfile = open(path+ebuild)
- orig = ebuildfile.readlines()
- ebuildfile.close()
-
- # Quickly check it
- if "\1" not in " ".join(orig):
- return False
-
- # Read the original environment
- if "environment.bz2" in contents:
- os.system("bzip2 -dk "+path+"environment.bz2")
- elif "environment" in contents:
- os.system("bzip2 -zk "+path+"environment")
- else:
- print "environement.bz2 missing!"
- print "Please find and remove ^A occurences manually"
- print "or replace the ebuild with one from your portage"
- print "tree as a last resort."
- return False
- try:
- envfile = open(path+"environment")
- except SystemExit, e:
- raise # this needs to be propogated
- except:
- print "environment.bz2 corrupt!"
- print "There is no way to fix this ebuild automatically."
- print "Try editing the ebuild to remove any ^A occurrences,"
- print 'possible replacing them with `"`, or copy an ebuild'
- print "of the same version (if possible) from the portage tree."
- print
- return False
- lines = envfile.readlines()
- envfile.close()
- os.remove(path+"environment")
-
- # Parse it
- env = {}
- for line in lines:
- line = " ".join(line.split())
- values = line.split("=")
- if len(values) == 1:
- break
- key = values[0]
- value = "=".join(values[1:])
- if value and value[0] == "$":
- value = value[1:]
- if value and value[0] == "'":
- value = value[1:-1]
- value = value.replace("\\n","\n")
- value = value.replace("\\t","\t")
- env[key] = value
-
- # Revert the *DEPEND files to their originals
- for key in ["DEPEND","RDEPEND","PDEPEND"]:
- if not env.has_key(key):
- env[key] = ""
- f = open(path+key, "w")
- f.write(env[key])
- f.close()
-
- # Check and fix unbalanced quotes
- quotecount = 0
- for l in orig:
- quotecount += l.count('"')
- if (quotecount % 2):
- for x in range(len(orig)-1,-1,-1):
- if "\1" in orig[x]:
- for y in range(len(orig[x])-1,-1,-1):
- if orig[x][y]=="\1":
- orig[x] = orig[x][:y] + '"' + orig[x][y+1:]
- break
- break
-
- # Replace *DEPEND in the ebuild with their originals
- fixed = []
- x=0
- while x != len(orig):
- for key in ["DEPEND","RDEPEND","PDEPEND"]:
- if orig[x].startswith(key):
- quotes = 0
- while quotes != 2:
- if x >= len(orig):
- print "Definate bug"
- print "Please attach ebuild",ebuild,"to bug 46096"
- print
- return False
- if not orig[x]:
- print "Possible bug - if the original ebuild you see both DEPEND and RDEPEND"
- print "in the following but the 'fixed' ebuild doesn't have both then please"
- print "attach",ebuild,"to bug 46096 with the following output:"
- print orig
- print
- continue
- quotes += orig[x].count('"')
- if quotes == 2:
- break
- if quotes > 2:
- print "Unfixable ebuild",ebuild
- print "Please attach it to bug 46906"
- print
- return False
- x += 1
- fixed += [key+'="'+env[key]+'"\n']
- x += 1
- break
- if x != len(orig):
- fixed += orig[x]
- x += 1
- ebuildfile = open(path+ebuild,"w")
- ebuildfile.writelines(fixed)
- ebuildfile.close()
-
- if "\1" in " ".join(fixed):
- print "Partially Fixed... see below"
- else:
- print "Fixed"
-
- return True
-
-
-vardb = "/var/db/pkg/"
-changed = False
-for cat in os.listdir(vardb):
- if os.path.isdir(vardb+cat):
- for pkg in os.listdir(vardb+cat):
- if pkg[0] != "-" and os.path.isdir(vardb+cat+"/"+pkg):
- changed = (changed or fix_entries(vardb+cat+"/"+pkg))
-
-if changed:
-
- print "Any ebuilds that were partially fixed can not be fixed any further"
- print "by this script or possible any other. Unmerging the package will"
- print "more than likely work. If it doesn't, however, try editing the"
- print "ebuild to leave only the pkg_prerm and pkg_postrm functions (if"
- print "they exist) or copying an ebuild - even of a different version -"
- print "from the main portage tree."
-
- import portage
- if portage.mtimedb.has_key("updates"):
- del portage.mtimedb["updates"]
-
-else:
- print "No corruption found!"
-
diff --git a/bin/fixvirtuals b/bin/fixvirtuals
deleted file mode 100755
index 6793a71..0000000
--- a/bin/fixvirtuals
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/usr/bin/python -O
-# Copyright 1999-2004 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/bin/fixvirtuals,v 1.3 2004/10/11 04:01:00 jstubbs Exp $
-
-import os,sys
-sys.path = ["/usr/lib/portage/pym"]+sys.path
-
-import portage
-
-if portage.secpass!=2:
- print "fixvirtuals: root access required."
- sys.exit(1)
-
-newvirts={}
-myvirts=portage.grabdict("/var/cache/edb/virtuals")
-myprovides=portage.db["/"]["vartree"].get_all_provides()
-
-for myvirt in myprovides.keys():
- newvirts[myvirt]=[]
- for mycatpkg in myprovides[myvirt]:
- mysplit=portage.catpkgsplit(mycatpkg)
- pkg=mysplit[0]+"/"+mysplit[1]
-
- try:
- if (newvirts[myvirt].index(pkg)):
- pass
- except SystemExit, e:
- raise # This needs to be propogated
- except:
- newvirts[myvirt].append(pkg)
-
-portage.writedict(newvirts,"/var/cache/edb/virtuals")
diff --git a/bin/g-cpan.pl b/bin/g-cpan.pl
deleted file mode 100755
index 35e0132..0000000
--- a/bin/g-cpan.pl
+++ /dev/null
@@ -1,368 +0,0 @@
-#!/usr/bin/perl -w
-# Copyright 1999-2004 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/bin/Attic/g-cpan.pl,v 1.16 2004/10/20 17:40:54 carpaski Exp $
-
-# History:
-
-# 05/23/03: jrray@gentoo.org:
-#
-# Skip modules the CPAN thinks are included with perl (closes bug 14679).
-#
-# Used the CPAN module to discover the real location of Makefile.PL to set
-# the ${S} variable in the ebuild, sometimes the location isn't the same as
-# ${P}.
-#
-# Don't assume the filename of the tarball will be ${P}.tar.gz, use the
-# real filename out of CPAN.
-#
-# Some modules' filenames have underscores in unfortunate places. Change
-# all of them to hyphens to avoid that mess.
-#
-# 02/23/03: alain@gentoo.org: removed portage direct-access code, and switched to using the
-# portageq utility which hides the portage APIs.
-#
-# 01/08/03: jrray@gentoo.org: remove dependency on Digest::MD5
-#
-# 01/07/03: jrray@gentoo.org: getting the way subroutines are fed variables
-# sorted out (they're in @_)
-# Clean out module_check, unnecessary temp variables are evil.
-# It isn't okay to skip a module if module_check succeeds when
-# that module is listed as a dependency for a module we're trying
-# to install, the subsequent emerge can fail if the ebuild doesn't
-# exist. So only skip a module if it is a first order module from
-# the command line but not if it is being considered to meet a
-# dependency.
-# Use the portage python module to learn some configuration values
-# instead of trying to parse make.conf.
-# Need to use system and not exec when calling out to emerge, exec
-# ends our process!
-#
-# 12/09/02: baz@bluefuton.com: some further amends:
-# standardised code, declared external vars early,
-# amended layout and sub styles for consistency and brevity,
-# also removed a 'spare' function :-)
-#
-# 12/07/02: mcummings: Reviewed baz's comments (thanks!). Moved the make.conf check to an external
-# sub so that we could grab other important functions. Added Digest::MD5 so that we could
-# check the checksum more cleanly instead of making a system call.
-# Thanks to stocke2 for pointing me in the direction of File::Path -
-# and helping me debug silly michael coding with rmtree
-#
-# 12/07/02: baz@bluefuton.com: comments added, basically a very picky code review.
-#
-# 12/06/02: mcummings; Added emerge functionality. Now emerges modules on the
-# fly
-#
-# 12/03/02: mcummings; Added checks for /var/db/pkg and manually installed
-# modules
-#
-# 11/07/02: jrray : Initial upload to bug 3450
-#
-
-# modules to use - these will need to be marked as
-# dependencies, and installable by portage
-use strict;
-use File::Spec;
-use File::Path;
-use CPAN;
-eval 'use Digest::MD5;';
-my $have_digestmd5 = $@ ? 0 : 1;
-
-# output error if no arguments
-unless (@ARGV) {
- print "Feed me perl modules\n";
- exit;
-}
-# Set our temporary overlay directory for the scope of this run. By setting an overlay directory,
-# we bypass the predefined portage directory and allow portage to build a package outside of its
-# normal tree.
-my $tmp_overlay_dir = "/tmp/perl-modules_$$";
-my @ebuild_list;
-
-# Set up global paths
-my $TMP_DEV_PERL_DIR = '/var/tmp/db/dev-perl';
-my $MAKECONF = '/etc/make.conf';
-my ( $OVERLAY_DIR, $PORTAGE_DIR, $PORTAGE_DEV_PERL, $PORTAGE_DISTDIR ) = get_globals();
-
-# Create the ebuild in PORTDIR_OVERLAY, if it is defined and exists
-$tmp_overlay_dir = $OVERLAY_DIR unless $OVERLAY_DIR eq "";
-
-my $arches = join( ' ', map { chomp; $_ } `cat $PORTAGE_DIR/profiles/arch.list` );
-
-#this should never find the dir, but just to be safe
-unless ( -d $tmp_overlay_dir ) {
- mkpath( [$tmp_overlay_dir], 1, 0755 )
- or die "Couldn't create '$tmp_overlay_dir': $|";
-}
-
-# Now we cat our dev-perl directory onto our overlay directory.
-# This is done so that portage records the appropriate path, i.e. dev-perl/package
-my $perldev_overlay = File::Spec->catfile( $tmp_overlay_dir, 'dev-perl' );
-
-unless ( -d $perldev_overlay ) {
- # create perldev overlay dir if not present
- mkpath( [$perldev_overlay], 1, 0755 )
- or die "Couldn't create '$perldev_overlay': $|";
-}
-
-# Now we export our overlay directory into the session's env vars
-$ENV{'PORTDIR_OVERLAY'} = $tmp_overlay_dir;
-
-# jrray printing functions
-sub printbig {
- print '*' x 72, "\n";
- print '*', "\n";
- print '*', "\n";
- print '* ', @_;
- print '*', "\n";
- print '*', "\n";
- print '*' x 72, "\n";
-}
-
-sub ebuild_exists {
- my ($dir) = @_;
-
- # check the main portage tree
- return 1
- if ( ( -d File::Spec->catfile( $PORTAGE_DEV_PERL, $dir ) )
- || ( -d File::Spec->catfile( $perldev_overlay, $dir ) )
- || ( -d File::Spec->catfile( $TMP_DEV_PERL_DIR, $dir ) ) );
-
- # check for ebuilds that have be created by g-cpan.pl
- for my $ebuild ( @ebuild_list ) {
- return 1 if ( $ebuild eq $dir );
- }
-
- return 0;
-}
-
-sub module_check {
-
- # module_check evaluates whether a module can be loaded from @INC.
- # This allows us to assure that if a module has been manually installed, we know about it.
- my $check = shift;
- eval "use $check;";
- return $@ ? 0 : 1;
-}
-
-sub portage_dir {
- my $obj = shift;
- my $file = $obj->cpan_file;
-
- # remove underscores
- $file =~ tr/_/-/;
-
- # turn this into a directory name suitable for portage tree
- return undef unless ( $file =~ m|.*/(.*)-[^-]+\.| );
- return $1;
-}
-
-sub create_ebuild {
- my ( $module, $dir, $file, $build_dir, $prereq_pm, $md5 ) = @_;
-
- # First, make the directory
- my $fulldir = File::Spec->catdir( $perldev_overlay, $dir );
- my $filesdir = File::Spec->catdir( $fulldir, 'files' );
- mkdir $fulldir, 0755 or die "Couldn't create '$fulldir': $!";
- mkdir $filesdir, 0755 or die "Couldn't create '$filesdir': $!";
-
- # What to call this ebuild?
- unless ( $file =~ m/(.*)\/(.*?)\.(?:tar|tgz|zip|bz2|gz)/ ) {
- warn("Couldn't turn '$file' into an ebuild name\n");
- return;
- }
-
- my ( $modpath, $filename ) = ( $1, $2 );
-
- # remove underscores
- $filename =~ tr/_/-/;
-
- my $ebuild = File::Spec->catdir( $fulldir, "$filename.ebuild" );
- my $digest = File::Spec->catdir( $filesdir, "digest-$filename" );
-
- my $desc = $module->description || 'No description available.';
-
- open EBUILD, ">$ebuild" or die "Could not write to '$ebuild': $!";
- print EBUILD <<"HERE";
-
-
-# Copyright 1999-2004 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-inherit perl-module
-
-S=\${WORKDIR}/$build_dir
-DESCRIPTION="$desc"
-SRC_URI="http://www.cpan.org/modules/by-authors/id/$file"
-HOMEPAGE="http://www.cpan.org/modules/by-authors/id/$modpath/\${P}.readme"
-
-SLOT="0"
-LICENSE="Artistic | GPL-2"
-KEYWORDS="$arches"
-
-HERE
-
- if ( $prereq_pm && keys %$prereq_pm ) {
-
- print EBUILD q|DEPEND="|;
-
- my $first = 1;
- my %dup_check;
- for ( keys %$prereq_pm ) {
-
- my $obj = CPAN::Shell->expandany($_);
- my $dir = portage_dir($obj);
- next if $dir eq "perl";
- if ( ( !$dup_check{$dir} ) && ( !module_check($dir) ) ) {
- $dup_check{$dir} = 1;
- print EBUILD "\n\t" unless $first;
- print EBUILD "dev-perl/$dir";
- }
- $first = 0;
- }
- print EBUILD qq|"\n\n|;
- }
-
- close EBUILD;
-
- # write the digest too
- open DIGEST, ">$digest" or die "Could not write to '$digest': $!";
- print DIGEST $md5, "\n";
- close DIGEST;
-}
-
-sub install_module {
- my ($module_name, $recursive) = @_;
-
- my $obj = CPAN::Shell->expandany($module_name);
- unless ( ref $obj eq "CPAN::Module" ) {
- warn("Don't know what '$module_name' is\n");
- return;
- }
-
- my $file = $obj->cpan_file;
- my $dir = portage_dir($obj);
- unless ($dir) {
- warn("Couldn't turn '$file' into a directory name\n");
- return;
- }
-
- if ( ebuild_exists($dir) ) {
- printbig "Ebuild already exists for '$module_name': $dir\n";
- return;
-
- }
- elsif ( !defined $recursive && module_check($module_name) ) {
- printbig "Module already installed for '$module_name'\n";
- return;
- }
- elsif ( $dir eq 'perl' ) {
- printbig "Module '$module_name' is part of the base perl install\n";
- return;
- }
-
- printbig "Need to create ebuild for '$module_name': $dir\n";
-
- # check depends ... with CPAN have to make the module
- # before it can tell us what the depends are, this stinks
-
- $CPAN::Config->{prerequisites_policy} = "";
- $CPAN::Config->{inactivity_timeout} = 30;
-
- my $pack = $CPAN::META->instance( 'CPAN::Distribution', $file );
- $pack->called_for( $obj->id );
- $pack->make;
- $pack->unforce if $pack->can("unforce") && exists $obj->{'force_update'};
- delete $obj->{'force_update'};
-
- # grab the MD5 checksum for the source file now
-
- my $localfile = $pack->{localfile};
- ( my $base = $file ) =~ s/.*\/(.*)/$1/;
-
- my $md5digest;
- if ($have_digestmd5) {
- open( DIGIFILE, $localfile ) or die "Can't open '$file': $!";
- binmode(DIGIFILE);
- $md5digest = Digest::MD5->new->addfile(*DIGIFILE)->hexdigest;
- close(DIGIFILE);
- } else {
- ($md5digest = qx(/usr/bin/md5sum $localfile)) =~ s/^(.*?)\s.*$/$1/s;
- }
-
- my $md5string = sprintf "MD5 %s %s %d", $md5digest, $base,
- -s $localfile;
-
- # make ebuilds for all the prereqs
- my $prereq_pm = $pack->prereq_pm;
- install_module($_, 1) for ( keys %$prereq_pm );
-
- # get the build dir from CPAN, this will tell us definitively
- # what we should set S to in the ebuild
- # strip off the path element
- (my $build_dir = $pack->{build_dir}) =~ s|.*/||;
-
- create_ebuild( $obj, $dir, $file, $build_dir, $prereq_pm, $md5string );
-
- system('/bin/mv', '-f', $localfile, $PORTAGE_DISTDIR);
-
- push @ebuild_list, $dir;
-}
-
-sub clean_up {
-
- #Probably don't need to do this, but for sanity's sake, we reset this var
- $ENV{'PORTDIR_OVERLAY'} = $OVERLAY_DIR;
-
- #Clean out the /tmp tree we were using
- rmtree( ["$tmp_overlay_dir"] ) if $OVERLAY_DIR eq "";
-}
-
-sub emerge_module {
- foreach my $ebuild_name (@ebuild_list) {
- $ebuild_name =~ m/.*\/(.*)-[^-]+\./;
- print "emerging $ebuild_name\n";
-# system("emerge $ebuild_name");
- system( "emerge", "--digest", $ebuild_name );
-
- }
-}
-
-sub get_globals {
-
- my ( $OVERLAY_DIR, $PORTAGE_DIR, $PORTAGE_DEV_PERL, $PORTAGE_DISTDIR );
-
- # let's not beat around the bush here, make.conf isn't the
- # only place these variables can be defined
-
- $OVERLAY_DIR=qx(/usr/lib/portage/bin/portageq portdir_overlay);
- $PORTAGE_DIR=qx(/usr/lib/portage/bin/portageq portdir);
- $PORTAGE_DISTDIR=qx(/usr/lib/portage/bin/portageq distdir);
-
- chomp $OVERLAY_DIR;
- chomp $PORTAGE_DIR;
- chomp $PORTAGE_DISTDIR;
-
- unless ( length $OVERLAY_DIR && -d $OVERLAY_DIR ) {
- $OVERLAY_DIR = "";
- }
-
- unless ( length $PORTAGE_DIR && -d $PORTAGE_DIR ) {
- $PORTAGE_DIR = "/usr/portage";
- }
-
- unless ( length $PORTAGE_DISTDIR && -d $PORTAGE_DISTDIR ) {
- $PORTAGE_DISTDIR = "/usr/portage/distfiles";
- }
-
- # Finally, set the dev-perl dir explicitly
- $PORTAGE_DEV_PERL = "$PORTAGE_DIR/dev-perl";
-
- return ( $OVERLAY_DIR, $PORTAGE_DIR, $PORTAGE_DEV_PERL, $PORTAGE_DISTDIR );
-
-}
-
-install_module($_) for (@ARGV);
-emerge_module($_) for (@ARGV);
-clean_up();
diff --git a/bin/queryhost.sh b/bin/queryhost.sh
deleted file mode 100755
index d1ff1c7..0000000
--- a/bin/queryhost.sh
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/bin/bash
-# Copyright 1999-2004 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/bin/queryhost.sh,v 1.6 2004/10/04 13:56:50 vapier Exp $
-
-# Ping a single host and collect the round-trip time. Unfortunately
-# this measures latency, not bandwidth, but it's better than nothing.
-pinghost() {
- local host result
-
- # Extract the hostname from the URL
- host="${1#*://}"; host="${host%%/*}"
-
- # Attempt to ping the host three times, with an overall timeout of
- # 10 seconds.
- result=`ping -q -c3 -w10 ${host} 2>/dev/null`
-
- # Extract average ping time, truncated to integer
- result="${result%.?/*}"
- result="${result##*/}"
-
- # Test for sensible $result and return. If zero packets were
- # received, then $result will not be sensible since the above
- # extraction would have failed.
- if [ "$result" -gt 0 ] 2>/dev/null; then
- return $result
- else
- return 9999
- fi
-}
-
-# Ping all of the hosts in parallel, collate the output.
-pingall() {
- local i output
-
- for i in $*
- do
- # Do this as a single echo so it happens as a single
- # "write". This is so that the writes coming from the
- # multiple processes aren't mixed within a line. It should
- # usually work. :-)
- ( pinghost $i; echo "$? $i" ) &
- done
- wait
-}
-
-pingall $1 | sort -n | awk '{print $NF}'
diff --git a/man/g-cpan.pl.1 b/man/g-cpan.pl.1
deleted file mode 100644
index 331583b..0000000
--- a/man/g-cpan.pl.1
+++ /dev/null
@@ -1,25 +0,0 @@
-.TH "G-CPAN.PL" "1" "Feb 2004" "Portage 2.0.51" "Portage"
-.SH NAME
-g-cpan.pl \- install CPAN-provided Perl modules using Gentoo's Portage
-.SH SYNOPSIS
-\fBg-cpan.pl\fR <\fImodule-name\fR>
-.SH "DESCRIPTION"
-.B g-cpan.pl
-is a perl script that installs a CPAN module (including its
-dependencies) using Gentoo's Portage. It saves dependency information and
-stored files as if they were installed through a regular ebuild.
-
-The first time you run \fBg-cpan.pl\fR, it will ask you to setup your CPAN
-environment. Most users can agree with the defaults asked.
-.SH "EXAMPLES"
-Here we install Jabber::RPC
-
-# \fBg-cpan.pl Jabber::RPC\fR
-.SH "AUTHORS"
-J Robert Ray <jrray@gentoo.org> (g-cpan.pl)
-.br
-Sven Vermeulen <swift@gentoo.org> (manpage)
-.SH "REPORTING BUGS"
-Please report bugs via http://bugs.gentoo.org/
-.SH "CVS HEADER"
-$Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/man/Attic/g-cpan.pl.1,v 1.3 2004/09/17 00:17:10 vapier Exp $