From: karltk Date: Wed, 7 Jan 2004 12:21:21 +0000 (-0000) Subject: New build system X-Git-Tag: gentoolkit-0.2.4.3~455 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=ae60b4b979ee95fc7e7899f12b200b490d05cd4d;p=gentoolkit.git New build system svn path=/; revision=47 --- diff --git a/trunk/ChangeLog b/trunk/ChangeLog index cc53b27..e8daca5 100644 --- a/trunk/ChangeLog +++ b/trunk/ChangeLog @@ -1,4 +1,8 @@ +2003-01-07 Karl Trygve Kalleberg + * Added new build system + * Added src/old-scripts, the scripts from app-portage/gentoolkit + 2003-12-08 Karl Trygve Kalleberg * Removed emerge-rsync, emerge-webrsync * Added moo diff --git a/trunk/Makefile b/trunk/Makefile index 202bdb6..17aaded 100644 --- a/trunk/Makefile +++ b/trunk/Makefile @@ -1,10 +1,11 @@ -VERSION=0.2.0 -PYVERSION="`python-config | sed 's/-l//' | sed 's/ -lm.*//'`" -DESTDIR= -docdir=$(DESTDIR)/usr/share/doc/gentoolkit-$(VERSION) -bindir=$(DESTDIR)/usr/bin -sbindir=$(DESTDIR)/usr/sbin -mandir=$(DESTDIR)/usr/share/man/man1 +# Copyright 2003-2004 Karl Trygve Kalleberg +# Copyright 2003-2004 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 +# +# $Header$ + +include makedefs.mak + all: echo $(PYVERSION) @@ -13,47 +14,46 @@ all: echo $(bindir) echo $(sbindir) echo $(mandir) - + +dist: + echo "Err0r: Must use either dist-gentoolkit or dist-gentoolkit-dev" + +dist-gentoolkit-dev: + echo "You wish..." + +dist-gentoolkit: + mkdir -p dist/gentoolkit-$(VERSION) + for x in gentool etcat qpkg revdep-rebuild old-scripts ; do \ + ( cd src/$$x ; make distdir=dist/gentoolkit-$(VERSION) dist ) \ + done install: + echo "Err0r: Must use either install-gentoolkit or install-gentoolkit-dev" + + +install-gentoolkit: install -d $(docdir) install -d $(bindir) install -d $(sbindir) install -d $(mandir) - + install -m 0644 {AUTHORS,ChangeLog,COPYING,NEWS,README,TODO} $(docdir)/ - install -m 0755 src/gentool/gentool $(bindir)/ - install -d $(docdir)/gentool - install -m 0644 src/gentool/{README,AUTHORS} $(docdir)/gentool/ - install -m 0644 src/gentool/gentool.1 $(mandir)/ - - install -m 0755 src/etcat/etcat $(bindir)/ - install -d $(docdir)/etcat - install -m 0644 src/etcat/{README,AUTHORS} $(docdir)/etcat/ - install -m 0644 src/etcat/etcat.1 $(mandir)/ - - install -m 0755 src/qpkg/qpkg $(bindir)/ - install -d $(docdir)/qpkg - install -m 0644 src/qpkg/{README,AUTHORS,ChangeLog} $(docdir)/qpkg/ - install -m 0644 src/qpkg/qpkg.1 $(mandir)/ - - install -m 0755 src/etc-update/etc-update $(bindir)/ - install -d $(docdir)/etc-update - install -m 0644 src/etc-update/{AUTHORS,ChangeLog,README} $(docdir)/etc-update/ - install -m 0644 src/etc-update/etc-update.1 $(mandir)/ - - install -m 0755 src/ekeyword/ekeyword $(bindir)/ - install -d $(docdir)/ekeyword - install -m 0644 src/ekeyword/{AUTHORS,README} $(docdir)/ekeyword/ - install -m 0644 src/ekeyword/ekeyword.1 $(mandir)/ - - install -m 0755 src/echangelog/echangelog $(bindir)/ - install -d $(docdir)/echangelog - install -m 0644 src/echangelog/{AUTHORS,README} $(docdir)/echangelog/ - install -m 0644 src/echangelog/echangelog.1 $(mandir)/ - - install -m 0755 src/revdep-rebuild/revdep-rebuild $(sbindir)/ - install -d $(docdir)/revdep-rebuild - install -m 0644 src/revdep-rebuild/{AUTHORS,README,TODO} $(docdir)/revdep-rebuild/ - install -m 0644 src/revdep-rebuild/revdep-rebuild.1 $(mandir)/ + for x in gentool etcat qpkg euse etc-update revdep-rebuild old-scripts ; do + ( cd src/$(x) ; make DESTDIR=$(DESTDIR) install ) + done + +install-gentoolkit-dev: + +# FIXME: we override the docdir for the -dev package, should be prettier + docdir=$(DESTDIR)/usr/share/doc/gentoolkit-dev-$(VERSION) + + install -d $(docdir) + install -d $(bindir) + install -d $(sbindir) + install -d $(mandir) + + install -m 0644 {AUTHORS,ChangeLog,COPYING,NEWS,README,README.Developer,TODO} $(docdir)/ + + for x in ekeyword echangelog ; do + ( cd src/$(x) ; make DESTDIR=$(DESTDIR) install ) diff --git a/trunk/README.Developer b/trunk/README.Developer new file mode 100644 index 0000000..6a98832 --- /dev/null +++ b/trunk/README.Developer @@ -0,0 +1,37 @@ + +OVERVIEW + +The CVS module 'gentoolkit' contains all the scripts and stuff for both the +gentoolkit and the gentoolkit-dev package. The gentoolkit-dev package is +an optional add-on, that is only intented for the Gentoo developers. + +MAKING A RELEASE + +Releases should only be made by members of the tools-portage team. See +http://www.gentoo.org/proj/en/metastructure/herds/herds.xml?select=tools-portage +for who to contact on IRC, or shuffle over a bug report to us, or send +us a mail at tools-portage@gentoo.org if you need an immediate release. + +The release manager (big words;) will then do + +1) make VERSION=major.minor.patch RELEASE_TAG= dist-gentoolkit +2) copy dist/gentoolkit-${VERSION}-${RELEASE_TAG}.tar.gz to + emu.gentoo.org/space/distfiles-local/ +3) make a new ebuild, app-portage/gentoolkit/gentoolkit-${VERSION}.ebuild + with a SRC_URI that points to + mirror://gentoo/gentoolkit-${VERSION}-${RELEASE_TAG}.tar.gz + (just use one of the previous ebuilds) + +The process is similar for gentoolkit-dev: + +1) make dist-gentoolkit-dev +2) copy dist/gentoolkit-dev-${VERSION}-${RELEASE_TAG}.tar.gz to emu +3) update app-portage/gentoolkit-dev + +Important! +1) _ALWAYS_ make sure you don't "overwrite" a previous release. Your + new VERSION must be newer than any previous released version. If you + mess up a release, don't overwrite with the same release number, iterate + the patch version and try again (and again, and again until you get + it right;) + diff --git a/trunk/makedefs.mak b/trunk/makedefs.mak new file mode 100644 index 0000000..2e1d56b --- /dev/null +++ b/trunk/makedefs.mak @@ -0,0 +1,16 @@ +# Copyright 2003 Karl Trygve Kalleberg +# Copyright 2003 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 +# +# $Header$ + +# Override this on command line when making a release, ie 'dist' + +VERSION=9.9.9 +PYVERSION="`python-config | sed 's/-l//' | sed 's/ -lm.*//'`" +DESTDIR= + +docdir=$(DESTDIR)/usr/share/doc/gentoolkit-$(VERSION) +bindir=$(DESTDIR)/usr/bin +sbindir=$(DESTDIR)/usr/sbin +mandir=$(DESTDIR)/usr/share/man/man1 diff --git a/trunk/src/echangelog/Makefile b/trunk/src/echangelog/Makefile new file mode 100644 index 0000000..c22ff68 --- /dev/null +++ b/trunk/src/echangelog/Makefile @@ -0,0 +1,20 @@ +# Copyright 2004 Karl Trygve Kalleberg +# Copyright 2004 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 +# +# $Header$ + +include ../../makedefs.mak + +all: + echo "DUNCRAGGON (n.) The name of Charles Bronson's retirement cottage." + +dist: + mkdir -p ../../$(distdir)/src/echangelog/ + cp {AUTHORS,README,TODO,ChangeLog,echangelog,echangelog.1} ../../$(distdir)/src/echangelog/ + +install: + install -m 0755 echangelog $(bindir)/ + install -d $(docdir)/echangelog + install -m 0644 {AUTHORS,README} $(docdir)/echangelog/ + install -m 0644 echangelog.1 $(mandir)/ diff --git a/trunk/src/ekeyword/Makefile b/trunk/src/ekeyword/Makefile new file mode 100644 index 0000000..a3f901d --- /dev/null +++ b/trunk/src/ekeyword/Makefile @@ -0,0 +1,21 @@ +# Copyright 2004 Karl Trygve Kalleberg +# Copyright 2004 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 +# +# $Header$ + +include ../../makdefs.mak + +all: + echo "ALBACETE (AL-ba-seet n.) A single surprisingly long hair growing in the middle of nowhere." + +dist: + mkdir -p ../../$(distdir)/src/ekeyword + cp {AUTHORS,README,TODO,ChangeLog,ekeyword,ekeyword.1} ../../$(distdir)/src/ekeyword/ + +install: + install -m 0755 ekeyword $(bindir)/ + install -d $(docdir)/ekeyword + install -m 0644 {AUTHORS,README,TODO,ChangeLog} $(docdir)/ekeyword/ + install -m 0644 ekeyword.1 $(mandir)/ + diff --git a/trunk/src/etc-update/Makefile b/trunk/src/etc-update/Makefile new file mode 100644 index 0000000..0338744 --- /dev/null +++ b/trunk/src/etc-update/Makefile @@ -0,0 +1,20 @@ +# Copyright 2004 Karl Trygve Kalleberg +# Copyright 2004 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 +# +# $Header$ + +include ../../makedefs.mak + +all: + echo "PAPPLE (vb.) To do what babies do to soup with their spoons." + +dist: + mkdir -p ../../$(distdir)/src/etc-update + cp {AUTHORS,README,TODO,ChangeLog,etc-update,etc-update.1} ../../$(distdir)/src/etc-update/ + +install: + install -m 0755 etc-update $(bindir)/ + install -d $(docdir)/etc-update + install -m 0644 {AUTHORS,ChangeLog,README} $(docdir)/etc-update/ + install -m 0644 etc-update.1 $(mandir)/ diff --git a/trunk/src/etcat/Makefile b/trunk/src/etcat/Makefile new file mode 100644 index 0000000..b996880 --- /dev/null +++ b/trunk/src/etcat/Makefile @@ -0,0 +1,17 @@ +# Copyright 2004 Karl Trygve Kalleberg +# Copyright 2004 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 +# +# $Header$ + +all: + +dist: + mkdir -p ../../$(distdir)/src/etcat + cp {AUTHORS,README,TODO,ChangeLog,etcat,etcat.1} ../../$(distdir)/src/etcat + +install: + install -m 0755 etcat $(bindir)/ + install -d $(docdir)/etcat + install -m 0644 {README,AUTHORS} $(docdir)/etcat/ + install -m 0644 etcat.1 $(mandir)/ diff --git a/trunk/src/etcat/TODO b/trunk/src/etcat/TODO new file mode 100644 index 0000000..e69de29 diff --git a/trunk/src/etcat/etcat b/trunk/src/etcat/etcat index 433ff8c..7c3737c 100755 --- a/trunk/src/etcat/etcat +++ b/trunk/src/etcat/etcat @@ -87,6 +87,12 @@ __version__ = "0.2.0" __productname__ = "etcat" __description__ = "Portage Information Extractor" +# .-------------------------------------------------------. +# | Initialise Paths | +# `-------------------------------------------------------' + +sys.path = ["/usr/lib/portage/pym"] + sys.path + # .-------------------------------------------------------. # | Initialise Colour Settings | # `-------------------------------------------------------' diff --git a/trunk/src/euse/ChangeLog b/trunk/src/euse/ChangeLog index fce7fd8..1aa2a6b 100644 --- a/trunk/src/euse/ChangeLog +++ b/trunk/src/euse/ChangeLog @@ -1,4 +1,4 @@ -* euse-0.1.0 (09 May 2003) +*euse-0.1.0 (09 May 2003) 09 May 2003; Arun Bhanu Initial commit to gentoolkit. diff --git a/trunk/src/euse/euse b/trunk/src/euse/euse index 336e5eb..1718153 100755 --- a/trunk/src/euse/euse +++ b/trunk/src/euse/euse @@ -509,7 +509,7 @@ sub parse_make if ($lines =~ m/^\s*USE[\s\n]*=[\s\n]*"([^"]*)"/ms) { my $use_var = $1; - $use_var =~ s/[\r\n]/ /g; + $use_var =~ s/[\r\n\\]/ /g; @site_uf_list = split(' ', $use_var); } #print ("Make: \n" . join (" ", @site_uf_list) . "\n"); diff --git a/trunk/src/euse/euse.1 b/trunk/src/euse/euse.1 index 841ba86..f5c57e0 100644 --- a/trunk/src/euse/euse.1 +++ b/trunk/src/euse/euse.1 @@ -1,6 +1,6 @@ .TH EUSE 1 2003-05-01 "Gentoo Linux" "Gentoo Toolkit" .SH NAME -euse \- command line USE flag editor for Gentoo Linux +euse \- Gentoo: command line USE flag editor .SH SYNOPSIS .B euse \fI[options]\fB diff --git a/trunk/src/gentool/Makefile b/trunk/src/gentool/Makefile new file mode 100644 index 0000000..a25a2b2 --- /dev/null +++ b/trunk/src/gentool/Makefile @@ -0,0 +1,20 @@ +# Copyright 2003 Karl Trygve Kalleberg +# Copyright 2003 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 +# +# $Header$ + +include ../../makedefs.mak + +all: + echo "YADDLETHORPE (vb.) (Of offended pooves.) To exit huffily from a boutique." + +dist: + mkdir -p ../../$(distdir)/src/gentool/ + cp {AUTHORS,README,TODO,ChangeLog,gentool,gentool.1} ../../$(distdir)/src/gentool/ + +install: + install -m 0755 gentool $(bindir)/ + install -d $(docdir)/gentool + install -m 0644 {README,AUTHORS} $(docdir)/gentool/ + install -m 0644 gentool.1 $(mandir)/ diff --git a/trunk/src/gentool/TODO b/trunk/src/gentool/TODO new file mode 100644 index 0000000..e69de29 diff --git a/trunk/src/gentoolkit/AUTHORS b/trunk/src/gentoolkit/AUTHORS new file mode 100644 index 0000000..e69de29 diff --git a/trunk/src/gentoolkit/ChangeLog b/trunk/src/gentoolkit/ChangeLog new file mode 100644 index 0000000..e69de29 diff --git a/trunk/src/gentoolkit/Makefile b/trunk/src/gentoolkit/Makefile new file mode 100644 index 0000000..5e42a97 --- /dev/null +++ b/trunk/src/gentoolkit/Makefile @@ -0,0 +1,18 @@ +# Copyright 2004 Karl Trygve Kalleberg +# Copyright 2004 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 +# +# $Header$ + +all: + echo "LISTOWEL (n.) The small mat on the bar designed to be more absorbent than the bar, but not as absorbent as your elbows." + +dist: + mkdir -p ../../${distdir}/src/gentoolkit + cp {AUTHORS,README,ChangeLog,TODO,gentoolkit.py} ../../${distdir}/src/gentoolkit/ + +install: + install -d $(docdir)/gentoolkit + install -m 0644 {AUTHORS,README,TODO,ChangeLog} $(docdir)/gentoolkit/ + install -d $(DESTDIR)/usr/lib/gentoolkit/pym + install -m 0644 gentoolkit.py $(DESTDIR)/usr/lib/gentoolkit/pym/ diff --git a/trunk/src/gentoolkit/README b/trunk/src/gentoolkit/README new file mode 100644 index 0000000..e69de29 diff --git a/trunk/src/gentoolkit/TODO b/trunk/src/gentoolkit/TODO new file mode 100644 index 0000000..e69de29 diff --git a/trunk/src/moo/moo b/trunk/src/moo/moo index 5013c77..828df08 100755 --- a/trunk/src/moo/moo +++ b/trunk/src/moo/moo @@ -168,10 +168,9 @@ class InterfaceHandler: def _loadAllInterfaces(self): ins=open("/proc/net/dev") for line in ins.readlines(): - tokens = line.split() - ifaceName = tokens[0].strip() - if ifaceName[-1] == ":": - ifaceName = ifaceName[:-1] + tokens = line.split(":") + if len(tokens) > 1: + ifaceName = tokens[0].strip() iface = Interface(ifaceName) self.ifaces[ifaceName] = iface def getInterface(self,ifaceName): diff --git a/trunk/src/old-scripts/Makefile b/trunk/src/old-scripts/Makefile new file mode 100644 index 0000000..99ac011 --- /dev/null +++ b/trunk/src/old-scripts/Makefile @@ -0,0 +1,31 @@ +# Copyright 2004 Karl Trygve Kalleberg +# Copyright 2004 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 +# +# $Header$ + +include ../../makedefs.mak + +all: + echo "BOTOLPHS Huge benign tumors which archdeacons and old chemistry teachers affect to wear on the sides of their noses." + +dist: + mkdir -p ../../$(distdir)/src/old-scripts/ + cp dep-clean{,.1} ../../$(distdir)/src/old-scripts/ + cp pkg-clean{,.1} ../../$(distdir)/src/old-scripts/ + cp ewhich{,.1} ../../$(distdir)/src/old-scripts/ + cp mkebuild{,.1} ../../$(distdir)/src/old-scripts/ + cp pkg-size{,.1} ../../$(distdir)/src/old-scripts/ + +install: + install -m 0755 dep-clean $(bindir)/ + install -m 0755 pkg-clean $(bindir)/ + install -m 0755 ewhich $(bindir)/ + install -m 0755 mkebuild $(bindir)/ + install -m 0755 pkg-size $(bindir)/ + + install -m 0644 dep-clean.1 $(mandir)/ + install -m 0644 pkg-clean.1 $(mandir)/ + install -m 0644 ewhich.1 $(mandir)/ + install -m 0644 mkebuild.1 $(mandir)/ + install -m 0644 pkg-size.1 $(mandir)/ diff --git a/trunk/src/old-scripts/dep-clean b/trunk/src/old-scripts/dep-clean new file mode 100644 index 0000000..89c6364 --- /dev/null +++ b/trunk/src/old-scripts/dep-clean @@ -0,0 +1,272 @@ +#!/bin/bash +#Shows unrequired packages and missing dependencies. +#Author/Maintainer: Brandon Low +#Author: Jerry Haltom + +echo +echo -e "\x1b[31;01m!!! As of Gentoolkit 0.2.0, this tool is deprecated." +echo -e "!!!\x1b[0;0m Please refer to 'emerge clean' and 'emerge depclean' for replacements." +echo + +PROG=`basename ${0}` + +tmp="/tmp/$$" + +#Get PORTDIR and PORTDIR_OVERLAY from portage +PORTDIR_OVERLAY="$(/usr/lib/portage/bin/portageq portdir_overlay)" +PORTDIR="$(/usr/lib/portage/bin/portageq portdir)" + +rm -rf ${tmp} > /dev/null 2>&1 +mkdir ${tmp} > /dev/null 2>&1 + +declare -i i + +set -- `getopt -n ${PROG} -o N,R,U,I,v,q,C,h -l needed,removed,unneeded,interactive,verbose,quiet,nocolor,help -- ${*/ --/};[ $? != 0 ] && echo "y"` + +while [ ${#} -gt 0 ] +do + a=${1} + shift + case "${a}" in + + -I|--interactive) + interactive=y + ;; + + -N|--needed) + needed=y + ;; + + -U|--unneeded) + unneeded=y + ;; + + -R|--removed) + removed=y + ;; + + -v|--verbose) + verb=y + ;; + + -q|--quiet) + quiet=y + ;; + + -C|--nocolor) + nocolor=y + ;; + + -h|--help) + usage=y + ;; + + --) + [ ${1} ] && usage=y && broke=y + break + ;; + + *) + usage=y + broke=y + echo "FIXME - OPTION PARSING - ${a}" + break + ;; + + esac +done + +if [ ! ${needed} ] && [ ! ${unneeded} ] && [ ! ${removed} ]; then + needed=y + unneeded=y + removed=y +fi + +#Set up colors +if [ ! "${nocolor}" ]; then + NO="\x1b[0;0m" + BR="\x1b[0;01m" + CY="\x1b[36;01m" + GR="\x1b[32;01m" + RD="\x1b[31;01m" + YL="\x1b[33;01m" + BL="\x1b[34;01m" +elif [ ${quiet} ] && ( + ( [ ${needed} ] && [ ${unneeded} ] ) || + ( [ ${unneeded} ] && [ ${removed} ] ) || + ( [ ${removed} ] && [ ${needed} ] ) + ); then + NEED=" N" + UNNE=" U" + REMO=" R" +fi + +if [ ${usage} ]; then + echo -e "${BR}GenToolKit's Dependency Checker! +${NO}Displays packages that are installed but which none +of the packages in world or system depend on, and +displays packages which are depended on by world or +system, but are not currently installed. + +${BR}USAGE: + ${BL}${PROG}${YL} [${NO}options${YL}]${NO} + ${BL}${PROG}${GR} --help${NO} + +${BR}OPTIONS: + ${GR}-U, --unneeded${NO} display unneeded packages that are installed (${GR}green${NO}) + ${GR}-N, --needed${NO} display needed packages that are not installed (${RD}red${NO}) + ${GR}-R, --removed${NO} display installed packages not in portage (${YL}yellow${NO}) + + ${GR}-I, --interactive${NO} interactively modify world file before proceeding + ${GR}-C, --nocolor${NO} output without color, if necessary, package types are + noted with ${GR}U, N${NO} and ${GR}R${NO} respectively + ${GR}-v, --verbose${NO} be more verbose + ${GR}-q, --quiet${NO} be quiet (just output the packages, no extra info) + +${BR}NOTES: + ${GR}*${NO} If this script is run on a system that is not up-to-date or which hasn't + been cleaned (with '${BL}emerge -c${NO}') recently, the output may be deceptive. + ${GR}*${NO} If the same package name appears in all three categories, then it is + definitely time to update that package and then run '${BL}emerge -c${NO}'. + ${GR}*${NO} The ${GR}-U, -N${NO} and ${GR}-R${NO} options may be combined, defaults to ${GR}-UNR${NO}" + rm -rf ${tmp} > /dev/null 2>&1 + [ ${broke} ] && exit 1 || exit 0 +fi + +X="\([^/]*\)" + +#Retrieve currently merged packages. +if [ ${verb} ];then + echo -e "${CY}Retrieving currently merged packages.${NO}" +fi +find /var/db/pkg/ -name '*.ebuild' | \ + sed -e "s:/var/db/pkg/::" \ + -e "s:${X}/${X}/${X}:\1/\2:" | \ + sort -u >> ${tmp}/current + +if [ ${verb} ]; then + echo -e "${CY}"`cat ${tmp}/current | wc -l` "currently merged packages.${NO}" + echo -e +fi + +#Retrieve system packages and add to image. +if [ ${verb} ];then + echo -e "${CY}Retrieving system packages.${NO}" +fi +emerge system -ep | \ + sed -e "/ebuild/s:^.*] \([^ ]*\) *:\1:p;d" | \ + sort -u \ + > ${tmp}/system + +if [ ${verb} ]; then + echo -e "${CY}"`cat ${tmp}/system | wc -l 2> /dev/null` "packages contained in system.${NO}" + echo -e + echo -e "${CY}Preparing world file.${NO}" +fi + +#Create local copy of world and ask user to verify it. +cp /var/cache/edb/world ${tmp}/world + +if [ ${interactive} ]; then + ${EDITOR} ${tmp}/world +fi + +#Retrieve world packages and dependencies and add to image. +if [ ${verb} ]; then + echo -e + echo -e "${CY}Preparing list of installed world packages.${NO}" + echo -e +fi + +cat ${tmp}/current | grep -f ${tmp}/world | sort > ${tmp}/world.inst +find ${PORTDIR} ${PORTDIR_OVERLAY} -iname '*.ebuild' | \ + awk -F'/' '{printf("%s/%s\n", $(NF-2), $NF)}' | \ + sed -e 's:\.ebuild::' > ${tmp}/ebuilds +grep -xf ${tmp}/world.inst ${tmp}/ebuilds >> ${tmp}/world.new + +if [ ${verb} ]; then + echo -e "${CY}"`cat ${tmp}/ebuilds | wc -l`"\tebuilds available.${NO}" + echo -e "${CY}"`cat ${tmp}/world.new | wc -l`"\tpackages contained in final world file.${NO}" + echo -e + echo -e "${CY}List prepared, checking dependencies with emerge -ep${NO}" +fi + +sort ${tmp}/world.new |sed -e 's:^:\\\=:' | uniq | xargs emerge -ep | \ + tee ${tmp}/log | sed -e '/ebuild/s:^.*] \([^ ]*\) *$:\1:p;d' > ${tmp}/image.unsorted + +depends=`cat ${tmp}/image.unsorted|wc -l` + +if [ ${depends} -lt "2" ]; then + echo -e "${RD}There appears to be an unresolved dependency in your world file." + echo -e "Please check for masking errors or other world file issues," + echo -e "and then try again." + echo -e + echo -e "The following is the emerge output for your reference:${NO}" + cat ${tmp}/log + rm -rf ${tmp} > /dev/null 2>&1 + exit 1 +fi + +cat ${tmp}/system >> ${tmp}/image.unsorted + +#Cleanup image +sort -u ${tmp}/image.unsorted > ${tmp}/image + +if [ ${verb} ];then + echo -e "${CY}"`cat ${tmp}/image | wc -l` "packages contained in final image.${NO}" + echo -e +fi + +#Determine packages that exist in current but not in image. +#These packages are safe to clean up. +if [ ${unneeded} ]; then + if [ ! ${quiet} ]; then + echo -e "${CY}These packages have no other packages depending on them.${NO}" + fi + + grep -vxf ${tmp}/image ${tmp}/current > ${tmp}/unneeded + for line in `cat ${tmp}/unneeded`;do + echo -e "${GR}${line}${CY}${UNNE}${NO}" + done + + if [ ! ${quiet} ];then + echo -e "${CY}Total of"`cat ${tmp}/unneeded|wc -l` "unneeded packages.${NO}" + fi +fi + +#Determine packages that exist in image but not in current. +#These packages should be added. +if [ ${needed} ]; then + if [ ! ${quiet} ];then + echo -e + echo -e "${CY}These packages are depended upon but are not present on the system.${NO}" + fi + + grep -vxf ${tmp}/current ${tmp}/image > ${tmp}/needed + for line in `cat ${tmp}/needed`;do + echo -e "${RD}${line}${CY}${NEED}${NO}" + done + + if [ ! ${quiet} ];then + echo -e "${CY}Total of"`cat ${tmp}/needed|wc -l` "needed packages.${NO}" + fi +fi + +#Determine packages that are installed but not currently in portage +if [ ${removed} ]; then + if [ ! ${quiet} ];then + echo -e + echo -e "${CY}These packages are installed but not in the portage tree.${NO}" + fi + grep -xf ${tmp}/current ${tmp}/ebuilds > ${tmp}/hascurrent + grep -vxf ${tmp}/hascurrent ${tmp}/current > ${tmp}/removed + for line in `cat ${tmp}/removed`;do + echo -e "${YL}${line}${CY}${REMO}${NO}" + done + + if [ ! ${quiet} ];then + echo -e "${CY}Total of"`cat ${tmp}/removed|wc -l` "removed packages.${NO}" + fi +fi + +rm -rf ${tmp} > /dev/null 2>&1 diff --git a/trunk/src/old-scripts/dep-clean.1 b/trunk/src/old-scripts/dep-clean.1 new file mode 100644 index 0000000..9747ce4 --- /dev/null +++ b/trunk/src/old-scripts/dep-clean.1 @@ -0,0 +1,190 @@ +.\" Automatically generated by Pod::Man version 1.15 +.\" Thu Jul 18 15:59:55 2002 +.\" +.\" Standard preamble: +.\" ====================================================================== +.de Sh \" Subsection heading +.br +.if t .Sp +.ne 5 +.PP +\fB\\$1\fR +.PP +.. +.de Sp \" Vertical space (when we can't use .PP) +.if t .sp .5v +.if n .sp +.. +.de Ip \" List item +.br +.ie \\n(.$>=3 .ne \\$3 +.el .ne 3 +.IP "\\$1" \\$2 +.. +.de Vb \" Begin verbatim text +.ft CW +.nf +.ne \\$1 +.. +.de Ve \" End verbatim text +.ft R + +.fi +.. +.\" Set up some character translations and predefined strings. \*(-- will +.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left +.\" double quote, and \*(R" will give a right double quote. | will give a +.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used +.\" to do unbreakable dashes and therefore won't be available. \*(C` and +.\" \*(C' expand to `' in nroff, nothing in troff, for use with C<> +.tr \(*W-|\(bv\*(Tr +.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' +.ie n \{\ +. ds -- \(*W- +. ds PI pi +. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch +. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch +. ds L" "" +. ds R" "" +. ds C` "" +. ds C' "" +'br\} +.el\{\ +. ds -- \|\(em\| +. ds PI \(*p +. ds L" `` +. ds R" '' +'br\} +.\" +.\" If the F register is turned on, we'll generate index entries on stderr +.\" for titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and +.\" index entries marked with X<> in POD. Of course, you'll have to process +.\" the output yourself in some meaningful fashion. +.if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. nr % 0 +. rr F +.\} +.\" +.\" For nroff, turn off justification. Always turn off hyphenation; it +.\" makes way too many mistakes in technical documents. +.hy 0 +.if n .na +.\" +.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). +.\" Fear. Run. Save yourself. No user-serviceable parts. +.bd B 3 +. \" fudge factors for nroff and troff +.if n \{\ +. ds #H 0 +. ds #V .8m +. ds #F .3m +. ds #[ \f1 +. ds #] \fP +.\} +.if t \{\ +. ds #H ((1u-(\\\\n(.fu%2u))*.13m) +. ds #V .6m +. ds #F 0 +. ds #[ \& +. ds #] \& +.\} +. \" simple accents for nroff and troff +.if n \{\ +. ds ' \& +. ds ` \& +. ds ^ \& +. ds , \& +. ds ~ ~ +. ds / +.\} +.if t \{\ +. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" +. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' +. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' +. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' +. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' +. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' +.\} +. \" troff and (daisy-wheel) nroff accents +.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' +.ds 8 \h'\*(#H'\(*b\h'-\*(#H' +.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] +.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' +.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' +.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] +.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] +.ds ae a\h'-(\w'a'u*4/10)'e +.ds Ae A\h'-(\w'A'u*4/10)'E +. \" corrections for vroff +.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' +.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' +. \" for low resolution devices (crt and lpr) +.if \n(.H>23 .if \n(.V>19 \ +\{\ +. ds : e +. ds 8 ss +. ds o a +. ds d- d\h'-1'\(ga +. ds D- D\h'-1'\(hy +. ds th \o'bp' +. ds Th \o'LP' +. ds ae ae +. ds Ae AE +.\} +.rm #[ #] #H #V #F C +.\" ====================================================================== +.\" +.IX Title "DEP-CLEAN 1" +.TH DEP-CLEAN 1 "Copyright 2002 Gentoo Technologies, Inc." "2002-07-18" "GenToolKit's Dependency Checker!" +.UC +.SH "NAME" +dep-clean \- Gentoo: Shows unrequired packages and missing dependencies. +.SH "SYNOPSIS" +.IX Header "SYNOPSIS" +.Vb 1 +\& dep-clean [-RUNICv] +.Ve +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +dep-clean displays extraneous, missing or extra packages. Extra packages are those in which are not a part of the portage tree (/usr/portage). It does \s-1NOT\s0 modify the system in any way. +.SH "OPTIONS" +.IX Header "OPTIONS" +.Ip "\-N, \-\-needed" 4 +.IX Item "-N, --needed" +Display needed packages that are not installed. (red) (default) +.Ip "\-R, \-\-removed" 4 +.IX Item "-R, --removed" +Display installed packages not in portage. (yellow) (default) +.Ip "\-U, \-\-unneeded" 4 +.IX Item "-U, --unneeded" +Display unneeded packages that are installed. (green) (default) +.Ip "\-I, \-\-interactive" 4 +.IX Item "-I, --interactive" +Interactively modify world file before proceeding. +.Ip "\-C, \-\-nocolor" 4 +.IX Item "-C, --nocolor" +Output without color. Package types will be noted with R, U and N. +.Ip "\-v, \-\-verbose" 4 +.IX Item "-v, --verbose" +Be more verbose. +.Ip "\-q, \-\-quiet" 4 +.IX Item "-q, --quiet" +Be quiet (display only packages). +.SH "NOTES" +.IX Header "NOTES" +.Ip "" 4 +If this script is run on a system that is not up-to-date or which hasn't been cleaned (with 'emerge \-c') recently, the output may be deceptive. +.Ip "" 4 +If the same package name appears in all three categories, then it is definitely time to update that package and then run 'emerge \-c'. +.Ip "" 4 +The \-U, \-N and \-R options may be combined, default is \-UNR +.SH "AUTHORS" +.IX Header "AUTHORS" +Jerry Haltom (dep-clean) +.br +Brandon Low (dep-clean) +.PP +Paul Belt (man page) diff --git a/trunk/src/old-scripts/ewhich b/trunk/src/old-scripts/ewhich new file mode 100755 index 0000000..4b1f875 --- /dev/null +++ b/trunk/src/old-scripts/ewhich @@ -0,0 +1,46 @@ +#!/usr/bin/python +# Copyright 1999-2003 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 +# $Header$ +# +# Author: Marius Mauch +# +# ewhich is a tool to get the ebuild filename for a given package name + +import portage,sys,os +from output import * + +print +print red("!!! As of Gentoolkit 0.2.0 this tool is deprecated") +print red("!!! ") + "Refer to 'equery which' for a replacement" +print + +def print_help(): + print + print fuscia(os.path.basename(sys.argv[0])), "is a tool to get the filename of the ebuild for a given package" + print ' '*len(os.path.basename(sys.argv[0])), "that would be used by portage with the current configuration" + print + print yellow("Syntax:"), os.path.basename(sys.argv[0]), teal("") + print + print teal(""), "is either a simple package name (like "+green("xfree")+")," + print " a package name with category (like "+green("x11-base/xfree")+")" + print " or a DEPEND style atom as defined in ebuild(5) (like "+green(">=x11-base/xfree-4.3.0")+")" + print + +if len(sys.argv) <= 1 or sys.argv[1] == "-h" or sys.argv[1] == "--help": + print_help() + sys.exit(0) + +p = portage.db[portage.root]["porttree"].dbapi.xmatch("bestmatch-visible", sys.argv[1]) +if len(p) <= 1: + print + print red("*"), "\""+sys.argv[1]+"\" is not a valid package name or a masked package" + print + sys.exit(1) +pv = portage.catpkgsplit(p) +ebuild = "/"+pv[0]+"/"+pv[1]+"/"+p.split("/")[1]+".ebuild" +for ov in portage.settings["PORTDIR_OVERLAY"].split(): + if os.path.exists(ov+ebuild): + print os.path.normpath(ov+ebuild) + sys.exit(0) +print os.path.normpath(portage.settings["PORTDIR"]+ebuild) diff --git a/trunk/src/old-scripts/ewhich.1 b/trunk/src/old-scripts/ewhich.1 new file mode 100644 index 0000000..4bc5459 --- /dev/null +++ b/trunk/src/old-scripts/ewhich.1 @@ -0,0 +1,24 @@ +.TH ewhich 1 "October 19, 2003" "ewhich" + +.SH NAME +ewhich \- Gentoo: program for resolving ebuild names + +.SH SYNOPSIS +.B ewhich +[ -h | --help ] + +.SH DESCRIPTION +.B ewhich +is a little tool to find the actual ebuild file for a given package name. +It can use simple package names (like xfree), package names with category +(like x11-base/xfree) or DEPEND atoms (like >=x11-base/xfree-4.3.0). + +.SH BUGS +.B ewhich +No known bugs + +.SH SEE ALSO +emerge(1), make.conf(5), ebuild(5) + +.SH AUTHOR +Marius Mauch diff --git a/trunk/src/old-scripts/mkebuild b/trunk/src/old-scripts/mkebuild new file mode 100644 index 0000000..9ee0ce1 --- /dev/null +++ b/trunk/src/old-scripts/mkebuild @@ -0,0 +1,216 @@ +#!/bin/bash + +# Copyright (c) 2002 +# John Stalker +# Department of Mathematics +# Princeton University + +echo +echo -e "\x1b[31;01m!!! As of Gentoolkit 0.2.0, this tool is deprecated" +echo -e "!!!\x1b[0;0m Refer to app-portage/ebuilder for a replacement." +echo + +CONFIG_FILE=${HOME}/.mkebuild +if [ -e $CONFIG_FILE ] +then + source $CONFIG_FILE +else + echo This appears to be the first time you have used mkebuild. + echo I am going to make some guesses. If any of these are wrong + echo you should edit the file ${CONFIG_FILE}. + echo + MY_NAME=`awk -F":" '/^'${USER}:'/ { print $5 }' /etc/passwd` + echo Your name is ${MY_NAME}. + echo 'MY_NAME="'${MY_NAME}'"' >${CONFIG_FILE} + COPYRIGHT="Gentoo Technologies, Inc." + echo You wish to asign copyright to ${COPYRIGHT} + echo 'COPYRIGHT="'${COPYRIGHT}'"' >>${CONFIG_FILE} + MY_EMAIL=${USER}"@"${HOSTNAME} + echo Your email address is ${MY_EMAIL}. + echo 'MY_EMAIL='${MY_EMAIL} >>$CONFIG_FILE + LICENSE="the GNU General Public License, v2" + echo Your preferred license is ${LICENSE}. + echo 'LICENSE="'${LICENSE}'"' >>${CONFIG_FILE} + LOCAL_SOURCE=${HOME} + echo You download sources to ${LOCAL_SOURCE}. + echo LOCAL_SOURCE=${LOCAL_SOURCE} >>${CONFIG_FILE} + BUILD_DIRECTORY=${HOME} + echo You build packages in ${BUILD_DIRECTORY}. + echo 'BUILD_DIRECTORY='${BUILD_DIRECTORY} >>${CONFIG_FILE} + echo +fi +FILE_NAME=`basename $1` +SOURCE_LOCATION=`dirname $1` +PACKAGE_NAME=${FILE_NAME%.*} +FILE_EXTENSION=${FILE_NAME##*.} +if [ "${PACKAGE_NAME##*.}" = "tar" ] +then + FILE_EXTENSION=tar.${FILE_EXTENSION} + PACKAGE_NAME=${PACKAGE_NAME%.tar} +fi +EBUILD_FILE=${PWD}/${PACKAGE_NAME}.ebuild +echo "# Copyright" `date +"%Y"` ${COPYRIGHT} >${EBUILD_FILE} +echo "# Distributed under the terms of" ${LICENSE} >>${EBUILD_FILE} +#echo "# Author" ${MY_NAME} '<'${MY_EMAIL}'>' >>${EBUILD_FILE} +echo "# \$Header$" >>${EBUILD_FILE} +echo >>${EBUILD_FILE} +echo 'DESCRIPTION=""' >>${EBUILD_FILE} +echo 'SRC_URI="'${SOURCE_LOCATION}'/${P}.'${FILE_EXTENSION}'"' >>${EBUILD_FILE} +echo 'HOMEPAGE="'${SOURCE_LOCATION}'/"' >>${EBUILD_FILE} +echo 'LICENSE=""' >>${EBUILD_FILE} +echo 'SLOT="0"' >>${EBUILD_FILE} +echo 'KEYWORDS="~x86"' >>${EBUILD_FILE} +echo 'IUSE=""' >>${EBUILD_FILE} +echo >>${EBUILD_FILE} +echo 'DEPEND=""' >>${EBUILD_FILE} +echo >>${EBUILD_FILE} +echo '#RDEPEND=""' >>${EBUILD_FILE} +echo 'S=${WORKDIR}/${P}' >>${EBUILD_FILE} +echo >>${EBUILD_FILE} +echo 'src_unpack() {' >>${EBUILD_FILE} +echo >>${EBUILD_FILE} +echo -e "\t"'unpack ${A}' >>${EBUILD_FILE} +echo -e "\t"'cd ${S}' >>${EBUILD_FILE} +echo >>${EBUILD_FILE} +echo '}' >>${EBUILD_FILE} +if [ -e ${LOCAL_SOURCE}/${FILE_NAME} ] +then + echo I am assuming that $1 really + echo exists and that ${LOCAL_SOURCE}/${FILE_NAME} + echo is a faithful copy. +else + echo I didn\'t find ${LOCAL_SOURCE}/${FILE_NAME} so I will fetch + echo $1. + cd ${LOCAL_SOURCE} + wget $1 +fi +if [ -e ${BUILD_DIRECTORY}/${PACKAGE_NAME} ] +then + echo + echo I am assuming that ${BUILD_DIRECTORY}/${PACKAGE_NAME} \ + is the unpacked + echo version of ${LOCAL_SOURCE}/${FILE_NAME}. +else + cd ${BUILD_DIRECTORY} + if [ $? -ne 0 ] + then + echo + echo I was unable to enter the directory ${BUILD_DIRECTORY}. + exit 1 + fi + case "${FILE_EXTENSION}" in + tar.gz|tgz) + tar xzf ${LOCAL_SOURCE}/${FILE_NAME} + ;; + tar.bz2|tbz2) + tar xjf ${LOCAL_SOURCE}/${FILE_NAME} + ;; + tar.Z|tar.z) + unzip ${LOCAL_SOURCE}/${FILE_NAME} + tar xf ${PACKAGE_NAME}.tar + ;; + *) + echo + echo I can\'t figure out how to uncompress + echo ${LOCAL_SOURCE}/${FILE_NAME} + exit 1 + esac + if [ $? -ne 0 ] + then + echo + echo I was unable to uncompress ${LOCAL_SOURCE}/${FILE_NAME}. + exit 1 + fi +fi +cd ${BUILD_DIRECTORY}/${PACKAGE_NAME} +if [ $? -ne 0 ] +then + echo + echo I could not change directory to ${BUILD_DIRECTORY}/${PACKAGE_NAME} + exit 1 +fi +echo +echo You might want to look at the following files for configuration and +echo dependency information: +find ${PWD} -name README -print +find ${PWD} -name README.txt -print +find ${PWD} -name INSTALL -print +find ${PWD} -name INSTALL.txt -print +find ${PWD} -name Changes -print +find ${PWD} -name CHANGES.txt -print +find ${PWD} -name FAQ.txt +find ${PWD} -name ChangeLog -print +find ${PWD} -name NEWS -print +echo >>${EBUILD_FILE} +echo 'src_compile() {' >>${EBUILD_FILE} +echo >>${EBUILD_FILE} +echo +if [ -e Imakefile ] +then + echo I found an Imakefile. I am assuming that we should use xmkmf. + echo I don\'t really understand xmkmf so you will have to configure + echo things on your own. + echo + echo -e "\t"'xmkmf || die' >>${EBUILD_FILE} + echo -e "\tmake Makefiles" >>${EBUILD_FILE} + echo -e "\tmake includes" >>${EBUILD_FILE} + echo -e "\tmake depend" >>${EBUILD_FILES} +elif [ -e configure ] +then + echo I found a configure file. I am assuming that we are using autoconf +. + echo I will take care of setting the most commonly used options. I am + echo including a list of all the available options to confiigure, commen +ted + echo out. You might want to look it over to see if I have missed anythi +ng. + echo + ./configure --help >.config.options + echo -e "\t./configure \\" >>${EBUILD_FILE} + awk '/--prefix/ { print "\t\t--prefix=/usr \\"}' \ + .config.options >>${EBUILD_FILE} + awk '/--infodir/ { print "\t\t--infodir=/usr/share/info \\"}' \ + .config.options >>${EBUILD_FILE} + awk '/--mandir/ { print "\t\t--mandir=/usr/share/man \\"}' \ + .config.options >>${EBUILD_FILE} + echo -e "\t\t"'|| die "./configure failed"' >>${EBUILD_FILE} + echo -e "#\tAvailable options to configure:" >>${EBUILD_FILE} + awk '/--/ { print "#" $0 }' .config.options >>${EBUILD_FILE} + echo -e "\t"'emake || die' >>${EBUILD_FILE} +elif [ -e Makefile ] +then + echo I found a Makefile. You should look at it and possibly prepare + echo a patch. + echo + echo -e "\temake || die" >>${EBUILD_FILE} +else + echo I couldn\'t find a Imakefile, configure script, or Makefile for + echo this package. You will have to figure out what to do on your + echo own. + echo +fi +echo '}' >>${EBUILD_FILE} +echo >>${EBUILD_FILE} +echo 'src_install () {' >>${EBUILD_FILE} +echo >>${EBUILD_FILE} +echo -e "\t"'make DESTDIR=${D} install || die' >>${EBUILD_FILE} +echo '}' >>${EBUILD_FILE} +echo >>${EBUILD_FILE} +echo >>${EBUILD_FILE} +echo >>${EBUILD_FILE} +echo I couldn\'t supply a package description for the ebuild file +echo because I don\'t know what ${PACKAGE_NAME} does. +echo +echo I am assume the hompage for this package is ${SOURCE_LOCATION}/. +echo If that is not correct you will need to edit that portion of +echo the ebuild file as well. +echo +echo I don\'t understand dependencies yet. You will have to add any +echo dependencies you know of by hand. Then try your ebuild script +echo out to see if there are any dependencies you don\'t know of. +echo +echo I am assuming that this package comes with a well-behaved Makefile +echo which does not install anything outside of '${DESTDIR}'. You will +echo need to check this by looking at the portion of the Makefile +echo beginning with the line '"install:"'. + diff --git a/trunk/src/old-scripts/mkebuild.1 b/trunk/src/old-scripts/mkebuild.1 new file mode 100644 index 0000000..e977615 --- /dev/null +++ b/trunk/src/old-scripts/mkebuild.1 @@ -0,0 +1,12 @@ +.TH mkebuild "1" "Nov 2003" "gentoolkit" +.SH NAME +mkebuild \- Gentoo: Interactive ebuild generator +.SH SYNOPSIS +.B mkebuild +.SH BUGS +This tool does not yet have a man page. Feel free to submit a bug about it to +http://bugs.gentoo.org +.SH AUTHORS +This informative man page was written by Karl Trygve Kalleberg +. + diff --git a/trunk/src/old-scripts/pkg-clean b/trunk/src/old-scripts/pkg-clean new file mode 100644 index 0000000..a9d9709 --- /dev/null +++ b/trunk/src/old-scripts/pkg-clean @@ -0,0 +1,108 @@ +#!/usr/bin/python +# Copyright 1999-2003 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 +# $Header$ +# Author: Leo Lipelis +# Author: Karl Trygve Kalleberg + +import commands +import re +import sys +import string +import time +import os +from output import * + +print +print red("!!! As of Gentoolkit 0.2.0, this tool is deprecated") +print red("!!!") + " Refer to 'emerge clean' and 'emerge depclean' for replacements." +print + +time.sleep(4) + +# constants for package tuples that are stored in pkg_hash +PKG_TIME = 0 # number of seconds for ctime function +PKG = 1 # package full path as accepted by ebuild +PKG_NAME = 2 # package name as accepted by emerge + +(status, pkg_files) = commands.getstatusoutput( + "find /var/db/pkg -iname '*.ebuild' -printf '%T@ %p\n' | sort -n") + +pkg_file_list = pkg_files.splitlines() + +pkg_hash = {} +for time_pkg_pair in pkg_file_list: + (pkg_time, pkg) = time_pkg_pair.split() + pkg_time = string.atoi(pkg_time) + # This covers developer trees with not-accepted categories + tmp_name = re.match(r'/var/db/pkg/(.*/.*)/.*', pkg) + if not tmp_name: continue + pkg_name = tmp_name.group(1) + tmp_core = re.match(r'(.*)-\d.*', pkg_name) + if not tmp_core: continue + pkg_core = tmp_core.group(1) + if pkg_hash.has_key(pkg_core): + pkg_hash[pkg_core].append((pkg_time, pkg, pkg_name)) + else: + pkg_hash[pkg_core] = [(pkg_time, pkg, pkg_name)] + +total_len = len(pkg_hash.keys()) +curpkg = 0 +tmpname = os.tmpnam() +assume_yes = 0 + +if len(sys.argv) > 1: + if sys.argv[1] in ["-y", "--yes"]: + assume_yes = 1 + elif sys.argv[1] in ["-h", "--help"]: + print """pkg-clean [options] + +-y, --yes Don't ask for individual confirmation before unmerging; assume yes. +""" + sys.exit(0) + +for pkg_core in pkg_hash.keys(): + print "Examining %s:" % (pkg_core) + if len(pkg_hash[pkg_core]) < 2: + continue + unmerged_indexes = [] + + curpkg += 1 + choices = "" + idx = 1 + for pkg_tuple in pkg_hash[pkg_core]: + choices += " %d \"%s %s\" 0" % \ + (idx, time.ctime(pkg_tuple[PKG_TIME]), + pkg_tuple[PKG_NAME]) + idx += 1 + + params = "dialog --separate-output --backtitle \"pkg-clean processing package %d of %d\" " % ( curpkg, total_len) + params += "--checklist \"Select which package(s) to unmerge\" 20 70 12" + choices + res = os.system(params + " 2> " + tmpname) + if res: + sys.exit(0) + + ins = open(tmpname) + for j in ins.readlines(): + idx = string.atoi(j) + if idx == 0: + break + + full_path = pkg_hash[pkg_core][idx-1][PKG] + ebuild = string.replace(full_path, "/var/db/pkg/", "") + + if not assume_yes: + params = "dialog --backtitle \"" + ebuild + "\" " + \ + "--yesno \"Are you sure you want to unmerge " + ebuild + " ?\" 20 70" + res = os.system(params) + else: + res = 0 + + if res == 0: + (status, unmerge_out) = commands.getstatusoutput( + "ebuild %s unmerge" % (full_path)) + print unmerge_out + time.sleep(2) + if status != 0: + sys.exit(status) + ins.close() diff --git a/trunk/src/old-scripts/pkg-clean.1 b/trunk/src/old-scripts/pkg-clean.1 new file mode 100644 index 0000000..110e182 --- /dev/null +++ b/trunk/src/old-scripts/pkg-clean.1 @@ -0,0 +1,12 @@ +.TH pkg-clean "1" "Nov 2003" "gentoolkit" +.SH NAME +pkg-clean \- Gentoo: Clean obsolete packages +.SH SYNOPSIS +.B pkg-clean +.SH BUGS +This tool does not yet have a man page. Feel free to submit a bug about it to +http://bugs.gentoo.org +.SH AUTHORS +This informative man page was written by Karl Trygve Kalleberg +. + diff --git a/trunk/src/old-scripts/pkg-size b/trunk/src/old-scripts/pkg-size new file mode 100644 index 0000000..8770db7 --- /dev/null +++ b/trunk/src/old-scripts/pkg-size @@ -0,0 +1,63 @@ +#!/bin/sh +# Copyright 1999-2003 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 +# $Header$ +# Author: Karl Trygve Kalleberg + +echo +echo -e "\x1b[31;01m!!! As of Gentoolkit 0.2.0, this tool is deprecated." +echo -e "!!!\x1b[0;0m Refer to 'equery size' for a replacement." +echo + +spec=$1 + +if [ -z "$spec" ] ; then + echo "Usage: pkg-size package" + exit 1 +fi + +name=`echo $1 | sed "s/\([^/]*\)\///"` +category=`echo $1 | sed "s/\/.*//"` + +if [ "$category" == "$name" ] ; then + category= +fi + +function tryfile() { + local foo + foo=/var/db/pkg/$1/CONTENTS + bar=`ls $foo 2> /dev/null` + for i in $bar ; do + if [ -f "$i" ] ; then + echo $i + break + fi + done +} + +file=`tryfile "${category}/${name}"` +if [ -z $file ] ; then + file=`tryfile "${category}/${name}*"` + if [ -z $file ] ; then + file=`tryfile "${category}*/${name}"` + if [ -z $file ] ; then + file=`tryfile "${category}*/${name}*"` + if [ -z $file ] ; then + echo "!!! Package resembling ${category}/${name} not found" + exit 1 + fi + fi + fi +fi + +pkgname=`echo $file | sed -e "s:\/var\/db\/pkg\/::" -e "s:\/CONTENTS::"` + +totals=`cat $file|grep "obj"|awk '{ print $2 }' | sed "s/ /\\ /" | xargs du -scb | grep total | cut -f 1` + +size=0 +for i in $totals ; do + size=$[size+i] +done + +echo "$pkgname $size ($[size/1024]KB)" + diff --git a/trunk/src/old-scripts/pkg-size.1 b/trunk/src/old-scripts/pkg-size.1 new file mode 100644 index 0000000..b195412 --- /dev/null +++ b/trunk/src/old-scripts/pkg-size.1 @@ -0,0 +1,11 @@ +.TH pkg-size "1" "Nov 2003" "gentoolkit" +.SH NAME +pkg-size \- Gentoo: Package size calculator +.SH SYNOPSIS +.B pkg-size +\fIpackage\fR +.SH DESCRIPTION +Calculate size of \fIpackage\fR. +.SH AUTHORS +\fBpkg-size\fR was written by Karl Trygve Kalleberg . + diff --git a/trunk/src/qpkg/Makefile b/trunk/src/qpkg/Makefile new file mode 100644 index 0000000..692c006 --- /dev/null +++ b/trunk/src/qpkg/Makefile @@ -0,0 +1,20 @@ +# Copyright 2004 Karl Trygve Kalleberg +# Copyright 2004 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 +# +# $Header$ + +include ../../makedefs.mak + +all: + echo "HATHERSAGE (n.) The tiny snippets of beard which coat the inside of a washbasin after shaving in it." + +dist: + mkdir -p ../../${distdir}/src/qpkg + cp {README,AUTHORS,ChangeLog,TODO,qpkg,qpkg.1} ../../${distdir}/src/qpkg/ + +install: + install -m 0755 qpkg $(bindir)/ + install -d $(docdir)/qpkg + install -m 0644 {README,AUTHORS,ChangeLog} $(docdir)/qpkg/ + install -m 0644 qpkg.1 $(mandir)/ diff --git a/trunk/src/qpkg/TODO b/trunk/src/qpkg/TODO new file mode 100644 index 0000000..e69de29 diff --git a/trunk/src/revdep-rebuild/ChangeLog b/trunk/src/revdep-rebuild/ChangeLog new file mode 100644 index 0000000..d48f7b7 --- /dev/null +++ b/trunk/src/revdep-rebuild/ChangeLog @@ -0,0 +1,4 @@ +2004-01-07 Karl Trygve Kalleberg + * Added Makefile + * Copied revdep-rebuild script from app-portage/gentoolkit + diff --git a/trunk/src/revdep-rebuild/Makefile b/trunk/src/revdep-rebuild/Makefile new file mode 100644 index 0000000..58c9dff --- /dev/null +++ b/trunk/src/revdep-rebuild/Makefile @@ -0,0 +1,21 @@ +# Copyright 2004 Karl Trygve Kalleberg +# Copyright 2004 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 +# +# $Header$ + +include ../../makedefs.mak + +all: + echo "AIGBURTH (AYG-berth n.) Any piece of readily identifiable anatomy found among cooked meat." + +dist: + mkdir -p ../../$(distdir)/src/revdep-rebuild + cp {AUTHORS,README,TODO,ChangeLog,revdep-rebuild,revdep-rebuild.1} ../../$(distdir)/src/revdep-rebuild/ + +install: + + install -m 0755 revdep-rebuild $(sbindir)/ + install -d $(docdir)/revdep-rebuild + install -m 0644 {AUTHORS,README,TODO} $(docdir)/revdep-rebuild/ + install -m 0644 revdep-rebuild.1 $(mandir)/ diff --git a/trunk/src/revdep-rebuild/TODO b/trunk/src/revdep-rebuild/TODO index 7344bd5..9844ae6 100644 --- a/trunk/src/revdep-rebuild/TODO +++ b/trunk/src/revdep-rebuild/TODO @@ -3,4 +3,4 @@ - use timestamps of files to know when to rebuild - if ts of cache is older than any of the package's contained files, we must rebuild - +- update to use equery diff --git a/trunk/src/revdep-rebuild/revdep-rebuild b/trunk/src/revdep-rebuild/revdep-rebuild index 71e9f4b..028e3d1 100755 --- a/trunk/src/revdep-rebuild/revdep-rebuild +++ b/trunk/src/revdep-rebuild/revdep-rebuild @@ -2,16 +2,31 @@ # Copyright 1999-2003 Gentoo Technologies, Inc. # $Header$ + +# revdep-rebuild: Reverse dependency rebuilder. # Author: Stanislav Brabec # requires: qpkg -# FIXME: Rebuild order should follow DEPEND tree, otherwise packages -# can be rebuild incorrectly or fail. +# Known problems: +# +# In exact ebuild mode revdep-rebuild can fails to get order packages, +# which are not up to date. This is because emerge first tries to +# merge latest package and last in resort it tries to degrade. +# http://bugs.gentoo.org/show_bug.cgi?id=23018 +# +# Rebuild in --package-names mode should be default, but emerge has no +# feature to update to latest version of defined SLOT. +# http://bugs.gentoo.org/show_bug.cgi?id=4698 # Mask of specially evaluated libraries (exactly one space separated). LD_LIBRARY_MASK="libodbcinst.so libodbc.so libjava.so libjvm.so" +# List of directories to be searched (feel free to edit it) +# Note /usr/libexec and /usr/local/subprefix cotradicts FHS, but are present +# /var/something is for cgi and similar scripts +SEARCH_DIRS="/lib /bin /sbin /usr/lib /usr/bin /usr/sbin /usr/libexec /usr/X11R6/lib /usr/X11R6/bin /usr/X11R6/sbin /usr/e1* /usr/local /usr/qt* /usr/kde/*/lib /usr/*-*-linux-gnu /opt /var/qmail /var/vpopmail /home/httpd/cgi-bin" + # Base of temporary files names. LIST=~/.revdep-rebuild @@ -30,240 +45,331 @@ BL="\x1b[34;01m" alias echo_v=echo PACKAGE_NAMES=false +SONAME="not found" +SONAME_GREP=fgrep +SEARCH_BROKEN=true while : ; do - case "$1" in + case "$1" in -h | --help ) - echo "Usage: $0 [OPTIONS] [--] [EMERGE_OPTIONS]" - echo - echo "Broken reverse dependency rebuilder." - echo - echo " -X, --package-names recompile based on package names, not exact versions" - echo " -q, --quiet be less verbose" - echo - echo "Calls emerge, all other options are used for it (e. g. -p, --pretend)." - echo - echo "Report bugs to " - exit 0 - ;; + echo "Usage: $0 [OPTIONS] [--] [EMERGE_OPTIONS]" + echo + echo "Broken reverse dependency rebuilder." + echo + echo " -X, --package-names recompile based on package names, not exact versions" + echo " --soname SONAME recompile packages using library with SONAME instead" + echo " of broken library (SONAME providing library must be" + echo " present in the system)" + echo " --soname-regexp SONAME" + echo " the same as --soname, but accepts grep-style regexp" + echo " -q, --quiet be less verbose" + echo + echo "Calls emerge, all other options are used for it (e. g. -p, --pretend)." + echo + echo "Report bugs to " + exit 0 + ;; -X | --package-names ) - PACKAGE_NAMES=true - shift - ;; + PACKAGE_NAMES=true + shift + ;; -q | --quiet ) - alias echo_v=: - shift - ;; + alias echo_v=: + shift + ;; + --soname=* ) + SONAME="${1#*=}" + SEARCH_BROKEN=false + shift + ;; + --soname ) + SONAME="$2" + SEARCH_BROKEN=false + shift 2 + ;; + --soname-regexp=* ) + SONAME="${1#*=}" + SONAME_GREP=grep + SEARCH_BROKEN=false + shift + ;; + --soname-regexp ) + SONAME="$2" + SONAME_GREP=grep + SEARCH_BROKEN=false + shift 2 + ;; -- ) - shift - break - ;; + shift + break + ;; * ) - break - ;; - esac + break + ;; + esac done function set_trap () { - trap "rm_temp $1" SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM + trap "rm_temp $1" SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM } function rm_temp () { - echo " terminated." - echo "Removing incomplete $1." - rm $1 - echo - exit 1 + echo " terminated." + echo "Removing incomplete $1." + rm $1 + echo + exit 1 } +if $SEARCH_BROKEN ; then + SONAME_SEARCH="$SONAME" + LLIST=$LIST + HEAD_TEXT="broken by any package update" + OK_TEXT="Dynamic linking on your system is consistent" + WORKING_TEXT=" consistency" +else + SONAME_SEARCH=" $SONAME " + LLIST=${LIST}_$(echo "$SONAME_SEARCH$SONAME" | md5sum | head -c 8) + HEAD_TEXT="using given shared object name" + OK_TEXT="There are no dynamic links to $SONAME" + WORKING_TEXT="" +fi + echo echo "Checking reverse dependencies..." -echo "Packages containing binaries and libraries broken by any package update," +echo "Packages containing binaries and libraries $HEAD_TEXT," echo "will be recompiled." echo echo -n -e "${GR}Collecting system binaries and libraries...${NO}" if [ -f $LIST.1_files ] ; then - echo " using existing $LIST.1_files." + echo " using existing $LIST.1_files." else - set_trap "$LIST.1_files" -# Note /usr/libexec and /usr/local/subprefix cotradicts FHS, but are present - find /lib /bin /sbin /usr/lib /usr/bin /usr/sbin /usr/libexec /usr/X11R6/lib /usr/X11R6/bin /usr/X11R6/sbin /usr/local /usr/kde/*/lib /usr/*-*-linux-gnu /opt -type f \( -perm +u+x -o -name '*.so' -o -name '*.so.*' \) 2>/dev/null >$LIST.1_files - echo -e " done.\n ($LIST.1_files)" + set_trap "$LIST.1_files" + find $SEARCH_DIRS -type f \( -perm +u+x -o -name '*.so' -o -name '*.so.*' \) 2>/dev/null >$LIST.1_files + echo -e " done.\n ($LIST.1_files)" fi -echo -echo -n -e "${GR}Collecting complete LD_LIBRARY_PATH...${NO}" -if [ -f $LIST.2_ldpath ] ; then - echo " using existing $LIST.2_ldpath." -else - set_trap "$LIST.2_ldpath" - ( - grep '.*\.so\(\|\..*\)$' <$LIST.1_files | sed 's:/[^/]*$::' - sed '/^#/d;s/#.*$//' $LIST.2_ldpath - echo -e " done.\n ($LIST.2_ldpath)" +if $SEARCH_BROKEN ; then + echo + echo -n -e "${GR}Collecting complete LD_LIBRARY_PATH...${NO}" + if [ -f $LIST.2_ldpath ] ; then + echo " using existing $LIST.2_ldpath." + else + set_trap "$LIST.2_ldpath" + ( + grep '.*\.so\(\|\..*\)$' <$LIST.1_files | sed 's:/[^/]*$::' + sed '/^#/d;s/#.*$//' $LIST.2_ldpath + echo -e " done.\n ($LIST.2_ldpath)" + fi + export COMPLETE_LD_LIBRARY_PATH="$(cat $LIST.2_ldpath)" fi -export COMPLETE_LD_LIBRARY_PATH="$(cat $LIST.2_ldpath)" echo -echo -n -e "${GR}Checking dynamic linking consistency...${NO}" -if [ -f $LIST.3_broken ] ; then - echo " using existing $LIST.3_broken." +echo -n -e "${GR}Checking dynamic linking$WORKING_TEXT...${NO}" +if [ -f $LLIST.3_rebuild ] ; then + echo " using existing $LLIST.3_rebuild." else - echo_v - set_trap "$LIST.3_broken" - LD_MASK="\\( $(echo "$LD_LIBRARY_MASK" | sed 's/\./\\./g;s/ / \\| /g') \\)" - echo -n >$LIST.3_broken - cat $LIST.1_files | while read FILE ; do -# Note: double checking seems to be faster than single -# with complete path (special add ons are rare). - if ldd "$FILE" 2>/dev/null | grep -v "$LD_MASK" | - fgrep -q 'not found' ; then - if LD_LIBRARY_PATH="$COMPLETE_LD_LIBRARY_PATH" \ + echo_v + set_trap "$LLIST.3_rebuild" + LD_MASK="\\( $(echo "$LD_LIBRARY_MASK" | sed 's/\./\\./g;s/ / \\| /g') \\)" + echo -n >$LLIST.3_rebuild + cat $LIST.1_files | while read FILE ; do + # Note: double checking seems to be faster than single + # with complete path (special add ons are rare). + if ldd "$FILE" 2>/dev/null | grep -v "$LD_MASK" | + $SONAME_GREP -q "$SONAME_SEARCH" ; then + if $SEARCH_BROKEN ; then + if LD_LIBRARY_PATH="$COMPLETE_LD_LIBRARY_PATH" \ ldd "$FILE" 2>/dev/null | grep -v "$LD_MASK" | - fgrep -q 'not found' ; then - echo "$FILE" >>$LIST.3_broken - echo_v " broken $FILE (requires $(ldd "$FILE" | sed -n 's/ \(.*\) => not found$/\1/p' | tr '\n' ' ' | sed 's/ $//' ))" - fi + $SONAME_GREP -q "$SONAME_SEARCH" ; then + echo "$FILE" >>$LLIST.3_rebuild + echo_v " broken $FILE (requires $(ldd "$FILE" | sed -n 's/ \(.*\) => not found$/\1/p' | tr '\n' ' ' | sed 's/ $//' ))" + fi + else + echo "$FILE" >>$LLIST.3_rebuild + echo_v " found $FILE" + fi fi - done - echo -e " done.\n ($LIST.3_broken)" + done + echo -e " done.\n ($LLIST.3_rebuild)" fi if $PACKAGE_NAMES ; then - EXACT_EBUILDS=false - - echo - echo -n -e "${GR}Assigning files to packages...${NO}" - if [ -f $LIST.4_packages_raw ] ; then - echo " using existing $LIST.4_packages_raw." - else - set_trap "$LIST.4_packages_raw" - echo -n >$LIST.4_packages_raw - echo -n >$LIST.4_package_owners - cat $LIST.3_broken | while read FILE ; do - PKG="$(qpkg -nc -f "$FILE")" - if [ -z "$PKG" ] ; then - echo -n -e "\n ${RD}*** $FILE not owned by any package is broken! ***${NO}" - echo "$FILE -> (none)" >> $LIST.4_package_owners - echo_v -n -e "\n $FILE -> (none)" - else - echo "$PKG" >> $LIST.4_packages_raw - echo "$FILE -> $PKG" >> $LIST.4_package_owners - echo_v -n -e "\n $FILE -> $PKG" - fi - done - echo_v - echo -e " done.\n ($LIST.4_packages_raw, $LIST.4_package_owners)" - fi + EXACT_EBUILDS=false - echo - echo -n -e "${GR}Cleaning list of packages to rebuild...${NO}" - if [ -f $LIST.5_packages ] ; then - echo " using existing $LIST.5_packages." - else - set_trap "$LIST.5_packages" - sort <$LIST.4_packages_raw | uniq >$LIST.5_packages - echo -e " done.\n ($LIST.5_packages)" - fi + echo + echo -n -e "${GR}Assigning files to packages...${NO}" + if [ -f $LLIST.4_packages_raw ] ; then + echo " using existing $LLIST.4_packages_raw." + else + set_trap "$LLIST.4_packages_raw" + echo -n >$LLIST.4_packages_raw + echo -n >$LLIST.4_package_owners + cat $LLIST.3_rebuild | while read FILE ; do + PKG="$(qpkg -nc -f "$FILE")" + if [ -z "$PKG" ] ; then + echo -n -e "\n ${RD}*** $FILE not owned by any package is broken! ***${NO}" + echo "$FILE -> (none)" >> $LLIST.4_package_owners + echo_v -n -e "\n $FILE -> (none)" + else + echo "$PKG" >> $LLIST.4_packages_raw + echo "$FILE -> $PKG" >> $LLIST.4_package_owners + echo_v -n -e "\n $FILE -> $PKG" + fi + done + echo_v + echo -e " done.\n ($LLIST.4_packages_raw, $LLIST.4_package_owners)" + fi - REBUILD_LIST="$(cat $LIST.5_packages | tr '\n' ' ')" + echo + echo -n -e "${GR}Cleaning list of packages to rebuild...${NO}" + if [ -f $LLIST.5_packages ] ; then + echo " using existing $LLIST.5_packages." + else + set_trap "$LLIST.5_packages" + sort -u $LLIST.4_packages_raw >$LLIST.5_packages + echo -e " done.\n ($LLIST.5_packages)" + fi + + RAW_REBUILD_LIST="$(cat $LLIST.5_packages | tr '\n' ' ')" else - EXACT_EBUILDS=true - - echo - echo -n -e "${GR}Assigning files to ebuilds...${NO}" - if [ -f $LIST.4_ebuilds ] ; then - echo " using existing $LIST.4_ebuilds." - else - set_trap "$LIST.4_ebuilds" - cat $LIST.3_broken | sed 's/^/obj /;s/$/ /' | - ( - cd /var/db/pkg - fgrep -l -f - */*/CONTENTS - ) | sed s:/CONTENTS:: > $LIST.4_ebuilds - echo -e " done.\n ($LIST.4_ebuilds)" - fi + EXACT_EBUILDS=true + + echo + echo -n -e "${GR}Assigning files to ebuilds...${NO}" + if [ -f $LLIST.4_ebuilds ] ; then + echo " using existing $LLIST.4_ebuilds." + else + if [ -s "$LLIST.3_rebuild" ] ; then + set_trap "$LLIST.4_ebuilds" + cat $LLIST.3_rebuild | sed 's/^/obj /;s/$/ /' | + ( + cd /var/db/pkg + fgrep -l -f - */*/CONTENTS + ) | sed s:/CONTENTS:: > $LLIST.4_ebuilds + echo -e " done.\n ($LLIST.4_ebuilds)" + else + echo " Nothing to rebuild" + echo -n > $LLIST.4_ebuilds + fi + fi - REBUILD_LIST="$(cat $LIST.4_ebuilds | sed s/^/=/ | tr '\n' ' ')" + RAW_REBUILD_LIST="$(cat $LLIST.4_ebuilds | sed s/^/=/ | tr '\n' ' ')" +fi + +echo +echo -n -e "${GR}Evaluating package order...${NO}" +if [ -f $LLIST.5_order ] ; then + echo " using existing $LLIST.5_order." +else + if [ ! -z "$RAW_REBUILD_LIST" ] ; then + REBUILD_GREP="^\\($( (emerge --nospinner --pretend --oneshot --nodeps $RAW_REBUILD_LIST ; echo $? >$LLIST.5_status ) | sed -n 's/\./\\&/g;s/ //g;s/$/\\/;s/\[[^]]*\]//gp' | tr '\n' '|' | sed 's/|$//'))\$" + if [ $(cat $LLIST.5_status) -gt 0 ] ; then + echo "" + echo -e "${RD}Warning: Failed to resolve package order." + echo -e "Will merge in \"random\" order!${NO}" + echo "Possible reasons:" + echo "- Some ebuilds are no more in portage tree." + echo "- Some ebuilds are masked, try to change ACCEPT_KEYWORDS=\"~\"" + echo " and/or use /etc/portage/package.unmask" + for i in . . . . . ; do + echo -n -e '\a.' + sleep 1 + done + ln -f $LLIST.4_ebuilds $LLIST.5_order + else + emerge --nospinner --pretend --oneshot --emptytree $RAW_REBUILD_LIST | sed -n 's/ //g;s/^.*\]//p' | grep "$REBUILD_GREP" >$LLIST.5_order + fi + else + echo -n "" >$LLIST.5_order + fi + echo -e " done.\n ($LLIST.5_order)" fi +REBUILD_LIST="$(cat $LLIST.5_order | sed s/^/=/ | tr '\n' ' ')" + trap - SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM if [ -z "$REBUILD_LIST" ] ; then - echo -e "\n${GR}Dynamic linking on your system is consistent... All done.${NO} " - rm $LIST.?_* - exit 0 + echo -e "\n${GR}$OK_TEXT... All done.${NO} " + rm $LIST.[1-2]_* + rm $LLIST.[3-9]_* + exit 0 fi IS_REAL_MERGE=true -echo " $* " | grep -q '\( -p \| --pretend \)' && IS_REAL_MERGE=false +echo " $* " | grep -q '\( -p \| --pretend \| -f \| --fetchonly \)' && IS_REAL_MERGE=false echo echo -e "${GR}All prepared. Starting rebuild...${NO}" echo "emerge --oneshot --nodeps $@ $REBUILD_LIST" if $IS_REAL_MERGE ; then - for i in . . . . . . . . . . ; do - echo -n -e '\a.' - sleep 1 - done - echo + for i in . . . . . . . . . . ; do + echo -n -e '\a.' + sleep 1 + done + echo fi #if $EXACT_EBUILDS ; then # Uncomment following, if you want to recompile masked ebuilds. ## FIXME: Check for PORTDIR_OVERLAY -# echo -e "${GR}Temporarilly disablink package mask...${NO}" -# trap "mv -i /usr/portage/profiles/package.mask.hidden /usr/portage/profiles/package.mask ; echo -e "\\n\\nTerminated." ; exit 1" \ +# echo -e "${GR}Temporarilly disablink package mask...${NO}" +# trap "mv -i /usr/portage/profiles/package.mask.hidden /usr/portage/profiles/package.mask ; echo -e "\\n\\nTerminated." ; exit 1" \ # SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM -# mv -i /usr/portage/profiles/package.mask /usr/portage/profiles/package.mask.hidden +# mv -i /usr/portage/profiles/package.mask /usr/portage/profiles/package.mask.hidden #fi # Run in background to correctly handle Ctrl-C ( - emerge --oneshot --nodeps $@ $REBUILD_LIST - echo $? >$LIST.6_status + emerge --oneshot --nodeps $@ $REBUILD_LIST + echo $? >$LLIST.6_status ) & wait #if $EXACT_EBUILDS ; then -# mv -i /usr/portage/profiles/package.mask.hidden /usr/portage/profiles/package.mask -# trap - SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM +# mv -i /usr/portage/profiles/package.mask.hidden /usr/portage/profiles/package.mask +# trap - SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM #fi -if [ "$(cat $LIST.6_status)" -gt 0 ] ; then - echo - echo -e "${RD}Result is not OK, you have following chances:${NO}" - echo "- if emerge failed during build, fix the problems and re-run this script" - echo " or" - echo "- use -X or --package-names as first argument (try to rebuild package, not exact" - echo " ebuild - ignores SLOT!)" - echo " or" - echo "- modify the above emerge command and run it manually" - echo " or" - echo "- compile or unmerge unsatisfied packages manually, remove temporary files and" - echo " try again (you can edit package/ebuild list first)" - echo - echo -e "${GR}To remove temporary files, please run:${NO}" - echo "rm $LIST.?_*" -else - if $IS_REAL_MERGE ; then - trap "echo -e \" terminated. Please remove them manually:\nrm $LIST.?_*\" ; exit 1" \ - SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM - echo -n -e "${GR}Build finished correctly. Removing temporary files...${NO} " - for i in . . . . . . . . . . ; do - echo -n -e '.' - sleep 1 - done +if [ "$(cat $LLIST.6_status)" -gt 0 ] ; then + echo + echo -e "${RD}Result is not OK, you have following choices:${NO}" + echo "- if emerge failed during build, fix the problems and re-run revdep-rebuild" + echo " or" + echo "- use -X or --package-names as first argument (try to rebuild package, not exact" + echo " ebuild - ignores SLOT!)" + echo " or" + echo "- set ACCEPT_KEYWORDS=\"~\" and/or /etc/portage/package.unmask" + echo " (and remove $LLIST.5_order to be evaluated again)" + echo " or" + echo "- modify the above emerge command and run it manually" + echo " or" + echo "- compile or unmerge unsatisfied packages manually, remove temporary files and" + echo " try again (you can edit package/ebuild list first)" echo - rm $LIST.?_* - echo "You can re-run this script to verify that all libraries and binaries" - echo "are fixed. If some inconsistency remains, it can be orphaned file, deep" - echo "dependency, binary package or specially evaluated library." - else - echo -e "${GR}Now you can remove -p (or --pretend) from arguments and re-run the script.${NO}" - fi + echo -e "${GR}To remove temporary files, please run:${NO}" + echo "rm $LIST*.?_*" +else + if $IS_REAL_MERGE ; then + trap "echo -e \" terminated. Please remove them manually:\nrm $LIST*.?_*\" ; exit 1" \ + SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM + echo -n -e "${GR}Build finished correctly. Removing temporary files...${NO} " + for i in . . . . . . . . . . ; do + echo -n -e '.' + sleep 1 + done + echo + rm $LIST.[1-2]_* + rm $LLIST.[3-9]_* + echo "You can re-run revdep-rebuild to verify that all libraries and binaries" + echo "are fixed. If some inconsistency remains, it can be orphaned file, deep" + echo "dependency, binary package or specially evaluated library." + else + echo -e "${GR}Now you can remove -p (or --pretend) from arguments and re-run revdep-rebuild.${NO}" + fi fi