diff options
author | Daniel Robbins <drobbins@gentoo.org> | 2001-09-28 22:37:56 +0000 |
---|---|---|
committer | Daniel Robbins <drobbins@gentoo.org> | 2001-09-28 22:37:56 +0000 |
commit | c8787e776c773da55e919c0b30d6df6cd74fac88 (patch) | |
tree | d4c718163cf3b9a887a999190eefb2f9d11c8cd8 /sys-apps | |
parent | glibc fixes (diff) | |
download | historical-c8787e776c773da55e919c0b30d6df6cd74fac88.tar.gz historical-c8787e776c773da55e919c0b30d6df6cd74fac88.tar.bz2 historical-c8787e776c773da55e919c0b30d6df6cd74fac88.zip |
massive cleanup
Diffstat (limited to 'sys-apps')
209 files changed, 0 insertions, 22793 deletions
diff --git a/sys-apps/portage/files/1.5/bin/dobin b/sys-apps/portage/files/1.5/bin/dobin deleted file mode 100755 index f1fba6f1196b..000000000000 --- a/sys-apps/portage/files/1.5/bin/dobin +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -if [ ${#} -lt 1 ] -then - echo "${0}: at least one argument needed" - return -fi -if [ ! -d ${D}${DESTTREE}/bin ] -then - install -d ${D}${DESTTREE}/bin -fi -for x in "$@" -do - if [ -x ${x} ] - then - if [ -z "$DEBUG" ] - then - MYVAL=`file ${x} | grep "ELF"` - if [ -n "$MYVAL" ] - then - strip ${x} - fi - fi - #if executable, use existing perms - install ${x} ${D}${DESTTREE}/bin - else - #otherwise, use reasonable defaults - echo ">>> dobin: making ${x} executable..." - install -m0755 --owner=root --group=root ${x} ${D}${DESTTREE}/bin - fi - done - diff --git a/sys-apps/portage/files/1.5/bin/dodir b/sys-apps/portage/files/1.5/bin/dodir deleted file mode 100755 index 9138f5c647f5..000000000000 --- a/sys-apps/portage/files/1.5/bin/dodir +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - for x in "$@" - do - install -d ${DIROPTIONS} ${D}${x} - done diff --git a/sys-apps/portage/files/1.5/bin/dodoc b/sys-apps/portage/files/1.5/bin/dodoc deleted file mode 100755 index 23c4dc6ac30d..000000000000 --- a/sys-apps/portage/files/1.5/bin/dodoc +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -for x in "$@" -do -if [ -e ${x} ] -then - if [ ! -d ${D}usr/share/doc/${PF} ] - then - install -d ${D}usr/share/doc/${PF} - fi - if [ -z ${DOCDESTTREE} ] - then - install -m0644 ${x} ${D}usr/share/doc/${PF} - gzip -f -9 ${D}usr/share/doc/${PF}/${x##*/} - else - install -m0644 ${x} ${D}usr/share/doc/${PF}/${DOCDESTTREE} - gzip -f -9 ${D}usr/share/doc/${PF}/${DOCDESTTREE}/${x##*/} - fi -else - echo "${0}: ${x} does not exist." - fi -done - diff --git a/sys-apps/portage/files/1.5/bin/doexe b/sys-apps/portage/files/1.5/bin/doexe deleted file mode 100755 index c9ae3a17d432..000000000000 --- a/sys-apps/portage/files/1.5/bin/doexe +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash - mynum=${#} - if [ ${mynum} -lt 1 ] - then - echo "doexe: at least one argument needed" - return - fi - if [ ! -d ${D}${EXEDESTTREE} ] - then - install -d ${D}${EXEDESTTREE} - fi - for x in "$@" - do - if [ -L ${x} ] - then - cp ${x} ${T} - mysrc=${T}/`/usr/bin/basename ${x}` - elif [ -d ${x} ] - then - echo "doexe: warning, skipping directory ${x}" - continue - else - mysrc=${x} - fi - install ${EXEOPTIONS} ${mysrc} ${D}${EXEDESTTREE} - if [ -n "$DEBUG" ] - then - strip ${D}${EXEDESTTREE}/`/usr/bin/basename ${x}` - fi - done - - diff --git a/sys-apps/portage/files/1.5/bin/dohard b/sys-apps/portage/files/1.5/bin/dohard deleted file mode 100755 index 283f4683af8e..000000000000 --- a/sys-apps/portage/files/1.5/bin/dohard +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - if [ ${#} -ne 2 ] - then - echo "${0}: two arguments needed" - return - fi - mysrc=${1} - mydest=${2} - ln -f ${D}${mysrc} ${D}${mydest} - diff --git a/sys-apps/portage/files/1.5/bin/doinfo b/sys-apps/portage/files/1.5/bin/doinfo deleted file mode 100755 index 8779c0fc11a8..000000000000 --- a/sys-apps/portage/files/1.5/bin/doinfo +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -if [ ${#} -lt 1 ] -then - echo "doinfo: at least one argument needed" - return -fi -if [ ! -d ${D}usr/share/info ] -then - install -d ${D}usr/share/info -fi -for x in "$@" -do - if [ -e ${x} ] - then - install -m0644 ${x} ${D}usr/share/info - gzip -f -9 ${D}usr/share/info/${x##*/} - else - echo "doinfo: ${x} does not exist" - fi -done - diff --git a/sys-apps/portage/files/1.5/bin/doins b/sys-apps/portage/files/1.5/bin/doins deleted file mode 100755 index e37f8f37f447..000000000000 --- a/sys-apps/portage/files/1.5/bin/doins +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -if [ $# -lt 1 ] -then - echo "${0}: at least one argument needed" - exit -fi -if [ ! -d ${D}${INSDESTTREE} ] - then - install -d ${D}${INSDESTTREE} -fi -for x in "$@" -do - if [ -L $x ] - then - cp $x ${T} - mysrc=${T}/`/usr/bin/basename ${x}` - elif [ -d $x ] - then - echo "doins: warning, skipping directory ${x}" - continue - else - mysrc=${x} - fi - install ${INSOPTIONS} ${mysrc} ${D}${INSDESTTREE} -done - - diff --git a/sys-apps/portage/files/1.5/bin/dolib b/sys-apps/portage/files/1.5/bin/dolib deleted file mode 100755 index 2b6dfa4b48e6..000000000000 --- a/sys-apps/portage/files/1.5/bin/dolib +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -if [ ${#} -lt 1 ] -then - echo "${0}: at least one argument needed" - return -fi -if [ ! -d ${D}${DESTTREE}/lib ] -then - install -d ${D}${DESTTREE}/lib -fi -for x in "$@" -do - if [ -e ${x} ] - then - install ${LIBOPTIONS} ${x} ${D}${DESTTREE}/lib - else - echo "${0}: ${x} does not exist" - fi -done diff --git a/sys-apps/portage/files/1.5/bin/dolib.a b/sys-apps/portage/files/1.5/bin/dolib.a deleted file mode 100755 index 24a01f68a83f..000000000000 --- a/sys-apps/portage/files/1.5/bin/dolib.a +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -if [ ${#} -lt 1 ] -then - echo "${0}: at least one argument needed" - return -fi -if [ ! -d ${D}${DESTTREE}/lib ] -then - install -d ${D}${DESTTREE}/lib -fi -for x in "$@" -do - if [ -e ${x} ] - then - install -m0644 ${x} ${D}${DESTTREE}/lib - else - echo "${0}: ${x} does not exist" - fi -done - - diff --git a/sys-apps/portage/files/1.5/bin/dolib.so b/sys-apps/portage/files/1.5/bin/dolib.so deleted file mode 100755 index 225e5a46339c..000000000000 --- a/sys-apps/portage/files/1.5/bin/dolib.so +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -if [ ${#} -lt 1 ] -then - echo "${0}: at least one argument needed" - return -fi -if [ ! -d ${D}${DESTTREE}/lib ] -then - install -d ${D}${DESTTREE}/lib -fi -for x in "$@" -do - if [ -e ${x} ] - then - if [ -n "$DEBUG" ] - then - strip --strip-unneeded ${x} - fi - install -m0755 ${x} ${D}${DESTTREE}/lib - else - echo "${0}: ${x} does not exist" - fi -done - - diff --git a/sys-apps/portage/files/1.5/bin/doman b/sys-apps/portage/files/1.5/bin/doman deleted file mode 100755 index d45b7780f18e..000000000000 --- a/sys-apps/portage/files/1.5/bin/doman +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -if [ ${#} -lt 1 ] -then - echo "${0}: at least one argument needed" - return -fi -myloc=$DESTTREE -if [ "$myloc" = "" ] -then - myloc=/usr -fi -for x in "$@" -do - md=${x##*.} - mandir=man${md:0:1} - if [ -e ${x} ] - then - if [ ! -d ${D}${myloc}/share/man/${mandir} ] - then - install -d ${D}${myloc}/share/man/${mandir} - fi - install -m0644 ${x} ${D}${myloc}/share/man/${mandir} - gzip -f -9 ${D}${myloc}/share/man/${mandir}/${x##*/} - else - echo "doman: ${x} does not exist." - fi -done diff --git a/sys-apps/portage/files/1.5/bin/domo b/sys-apps/portage/files/1.5/bin/domo deleted file mode 100755 index ef393b92a066..000000000000 --- a/sys-apps/portage/files/1.5/bin/domo +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - mynum=${#} - if [ ${mynum} -lt 1 ] - then - echo "${0}: at least one argument needed" - return - fi - if [ ! -d ${D}${DESTTREE}/share/locale ] - then - install -d ${D}${DESTTREE}/share/locale/ - fi - for x in "$@" - do - if [ -e ${x} ] - then - mytiny=${x##*/} - mydir=${D}${DESTTREE}/share/locale/${mytiny%.*}/LC_MESSAGES - if [ ! -d ${mydir} ] - then - install -d ${mydir} - fi - install -m0644 ${x} ${mydir}/${MOPREFIX}.mo - else - echo "${0}: ${x} does not exist" - fi - done - diff --git a/sys-apps/portage/files/1.5/bin/dopython b/sys-apps/portage/files/1.5/bin/dopython deleted file mode 100755 index 08991dbcd2f1..000000000000 --- a/sys-apps/portage/files/1.5/bin/dopython +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/spython - -from sys import * -import portage -import types -mycommand=argv[1]+"(" -x=2 -while (x<len(argv)): - if x==(len(argv)-1): - mycommand=mycommand+'"'+argv[x]+'"' - else: - mycommand=mycommand+'"'+argv[x]+'",' - x=x+1 -mycommand=mycommand+")" -exec("myresult="+mycommand) -if type(myresult)==types.IntType: - exit(myresult) diff --git a/sys-apps/portage/files/1.5/bin/dosbin b/sys-apps/portage/files/1.5/bin/dosbin deleted file mode 100755 index fb67970cf7ca..000000000000 --- a/sys-apps/portage/files/1.5/bin/dosbin +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -if [ ${#} -lt 1 ] - then - echo "${0}: at least one argument needed" - return - fi - if [ ! -d ${D}${DESTTREE}/sbin ] - then - install -d ${D}${DESTTREE}/sbin - fi - for x in "$@" - do - if [ -x ${x} ] - then - if [ -z "$DEBUG" ] - then - MYVAL=`file ${x} | grep "ELF"` - if [ "$MYVAL" ] - then - strip ${x} - fi - fi - #if executable, use existing perms - install -m0755 ${x} ${D}${DESTTREE}/sbin - else - #otherwise, use reasonable defaults - echo ">>> dosbin: making ${x} executable..." - install -m0755 --owner=root --group=root ${x} ${D}${DESTTREE}/sbin - fi - done - diff --git a/sys-apps/portage/files/1.5/bin/dosed b/sys-apps/portage/files/1.5/bin/dosed deleted file mode 100755 index cf5d1f51b010..000000000000 --- a/sys-apps/portage/files/1.5/bin/dosed +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh - - -mysed="s:${D}::g" - -for x in "$@" -do - y=${D}${x} - if [ -a "${y}" ] - then - if [ -f "${y}" ] - then - mysrc=${T}/`/usr/bin/basename ${y}` - cp ${y} ${mysrc} - sed -e "${mysed}" ${mysrc} > ${y} - else - echo "${y} is not a regular file!" - return - fi - else - mysed=${x} - fi -done diff --git a/sys-apps/portage/files/1.5/bin/dosym b/sys-apps/portage/files/1.5/bin/dosym deleted file mode 100755 index 7c0cadd1b3f9..000000000000 --- a/sys-apps/portage/files/1.5/bin/dosym +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - if [ ${#} -ne 2 ] - then - echo "${0}: two arguments needed" - return - fi - target=${1} - linkname=${2} - ln -sf ${target} ${D}${linkname} - - diff --git a/sys-apps/portage/files/1.5/bin/ebuild b/sys-apps/portage/files/1.5/bin/ebuild deleted file mode 100755 index 4c991a7f2d53..000000000000 --- a/sys-apps/portage/files/1.5/bin/ebuild +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/spython -import os -import sys - -def getroot(): - try: - a=os.environ["ROOT"] - except: - return "/" - return os.path.normpath(a+"/") - - -if os.getuid()!=0: - print "!!! ebuild must be run by root." - sys.exit(1) - -if len(sys.argv)<=2: - print "expecting two arguments." - sys.exit(1) - -import portage -import getopt - -debug=0 - -opts,pargs=getopt.getopt(sys.argv[1:],'',['debug']) -for opt in opts: - if opt[0]=='--debug': - debug=1 - -for x in pargs[1:]: - a=portage.doebuild(pargs[0],x,getroot(),debug=debug) - if a: - sys.exit(a) diff --git a/sys-apps/portage/files/1.5/bin/ebuild.sh b/sys-apps/portage/files/1.5/bin/ebuild.sh deleted file mode 100755 index e5af041c83e0..000000000000 --- a/sys-apps/portage/files/1.5/bin/ebuild.sh +++ /dev/null @@ -1,736 +0,0 @@ -#!/bin/bash -#we need this next line for "die" and "assert" -shopt -s expand_aliases -source /etc/profile.env > /dev/null 2>&1 -export PATH="/sbin:/usr/sbin:/usr/lib/portage/bin:/bin:/usr/bin:${ROOTPATH}" -if [ -e /etc/rc.d/config/functions ] -then - source /etc/rc.d/config/functions > /dev/null 2>&1 -fi - -#if no perms are specified, dirs/files will have decent defaults -#(not secretive, but not stupid) -umask 022 -export DESTTREE=/usr -export INSDESTTREE="" -export EXEDESTTREE="" -export DOCDESTTREE="" -export INSOPTIONS="-m0644" -export EXEOPTIONS="-m0755" -export LIBOPTIONS="-m0644" -export DIROPTIONS="-m0755" -export MOPREFIX=${PN} -export KVERS=`uname -r` - - -unpack() { - local x - for x in "$@" - do - echo ">>> Unpacking ${x}" - case "${x##*.}" in - tar) - tar xf ${DISTDIR}/${x} || die - ;; - gz|tgz|Z|z) - tar xzf ${DISTDIR}/${x} || die - ;; - bz2|tbz2) - cat ${DISTDIR}/${x} | bzip2 -d | tar xf - || die - ;; - ZIP|zip) - unzip ${DISTDIR}/${x} || die - ;; - *) - echo '!!!'" Error: couldn't unpack ${x}: file format not recognized" - exit 1 - ;; - esac - done -} - -src_unpack() { - unpack ${A} -} - -src_compile() { - return -} - -src_install() -{ - return -} - -pkg_preinst() -{ - return -} - -pkg_postinst() -{ - return -} - -pkg_prerm() -{ - return -} - -pkg_postrm() -{ - return -} - -try() { - env "$@" - if [ $? -ne 0 ] - then - echo - echo '!!! '"ERROR: the $1 command did not complete successfully." - echo '!!! '"(\"$*\")" - echo '!!! '"Since this is a critical task, ebuild will be stopped." - echo - exit 1 - fi -} - -dyn_touch() { - local x - for x in ${A} - do - if [ -e ${DISTDIR}/${x} ] - then - touch ${DISTDIR}/${x} - fi - done -} - -dyn_digest() { - local x - if [ ! -d ${FILESDIR} ] - then - install -d ${FILESDIR} - if [ -n "${MAINTAINER}" ] - then - echo ">>> adding ${FILESDIR} to CVS (just in case it isn't there)" - ( echo; cd `/usr/bin/dirname ${FILESDIR}`; cvs add `/usr/bin/basename ${FILESDIR}`; echo) - fi - fi - rm -f ${FILESDIR}/.digest-${PF} - touch ${FILESDIR}/.digest-${PF} - for x in ${A} - do - if [ ! -e ${DISTDIR}/${x} ] - then - echo '!!! Cannot compute message digests: '${x} not found - echo "error, aborting." - exit 1 - else - mymd5=`md5sum ${DISTDIR}/${x} | cut -f1 -d" "` - echo "MD5 $mymd5 $x" >> ${FILESDIR}/.digest-${PF} - fi - done - mv ${FILESDIR}/.digest-${PF} ${FILESDIR}/digest-${PF} - if [ -n "${MAINTAINER}" ] - then - echo ">>> adding digest-${PF} to CVS (just in case it isn't there)" - ( echo; cd ${FILESDIR}; cvs add digest-${PF}; echo ) - fi - echo ">>> Computed message digests." -} - -digest_check() { - if [ ! -e ${FILESDIR}/digest-${PF} ] - then - echo '!!!'" No message digest file found." - if [ -n "$MAINTAINER" ] - then - echo '>>> Maintainer mode: auto-computing digests.' - dyn_digest - return 0 - else - echo '!!!'" Maintainer: ebuild digest to update message digests." - return 1 - fi - fi - if [ ! -e ${DISTDIR}/${1} ] - then - echo '!!!'" ${1} not found." - echo '!!!'" Ebuild fetch to retrieve files." - return 1 - fi - local mycdigest=`grep " ${1}" ${FILESDIR}/digest-${PF} | cut -f2 -d" "` - if [ -z "$mycdigest" ] - then - echo - echo '!!!'" No message digest found for ${1}." - if [ -n "$MAINTAINER" ] - then - echo '>>> Maintainer mode: auto-computing digests.' - dyn_digest - echo - return 0 - else - echo '!!!'" Maintainer: ebuild digest to update message digests." - echo - return 1 - fi - fi - local mydigest=`md5sum ${DISTDIR}/${1} | cut -f1 -d" "` - if [ "$mycdigest" != "$mydigest" ] - then - echo - echo '!!!'" ${1}: message digests do not match!" - echo '!!!'" ${1} is corrupt or incomplete" - echo ">>> md5 con ${mycdigest}" - echo ">>> md5 now ${mydigest}" - echo ">>> Please delete/redownload ${DISTDIR}/${1}" - echo - return 1 - else - echo ">>> md5 ;-) ${1}" - fi - return 0 -} - -dyn_batchdigest() { - local x - if [ ! -e ${FILESDIR}/digest-${PF} ] - then - if [ "${A}" != "" ] - then - echo "${CATEGORY}/${PF} has no digest file." - fi - exit 1 - fi - for x in ${A} - do - if [ ! -e ${DISTDIR}/${x} ] - then - echo "${CATEGORY}/${PF}:${x} does not exist in ${DISTDIR}." - continue - else - local mycdigest=`grep " ${x}" ${FILESDIR}/digest-${PF} | cut -f2 -d" "` - if [ -z "$mycdigest" ] - then - echo "${CATEGORY}/${PF}:${x} digest not yet recorded." - continue - fi - local mydigest=`md5sum ${DISTDIR}/${x} | cut -f1 -d" "` - if [ "$mycdigest" != "$mydigest" ] - then - echo "${CATEGORY}/${PF}:${x} is corrupt or has an invalid digest." - fi - fi - done -} - - -dyn_fetch() { - local y - for y in ${A} - do - if [ ! -e ${DISTDIR}/${y} ] - then - echo ">>> Fetching ${y}..." - echo - local x - local _SRC_URI - for x in ${GENTOO_MIRRORS} - do - _SRC_URI="${_SRC_URI} ${x}/distfiles/${y}" - done - _SRC_URI="${_SRC_URI} `queryhost.sh "${SRC_URI}"`" - for x in ${_SRC_URI} - do - if [ ! -e ${DISTDIR}/${y} ] - then - if [ "$y" = "${x##*/}" ] - then - echo ">>> Trying site ${x}..." - eval "${FETCHCOMMAND}" - fi - fi - done - if [ ! -e ${DISTDIR}/${y} ] - then - echo '!!!'" Couldn't download ${y}. Aborting." - exit 1 - fi - echo - fi - done - for y in ${A} - do - digest_check ${y} - if [ $? -ne 0 ] - then - exit 1 - fi - done -} - -dyn_unpack() { - trap "abort_unpack" SIGINT SIGQUIT - local newstuff="no" - if [ -e ${WORKDIR} ] - then - local x - local checkme - if [ -n "${MAINTAINER}" ] - then - checkme="${DISTDIR}/${A}" - else - checkme="${DISTDIR}/${A} ${EBUILD}" - fi - for x in $checkme - do - echo ">>> Checking ${x}'s mtime..." - if [ ${x} -nt ${WORKDIR} ] - then - echo ">>> ${x} has been updated; recreating WORKDIR..." - newstuff="yes" - rm -rf ${WORKDIR} - break - fi - done - fi - if [ -e ${WORKDIR} ] - then - if [ "$newstuff" = "no" ] - then - echo ">>> WORKDIR is up-to-date, keeping..." - return 0 - fi - fi - install -m0700 -d ${WORKDIR} - cd ${WORKDIR} - echo ">>> Unpacking source..." - src_unpack - echo ">>> Source unpacked." - cd .. - trap SIGINT SIGQUIT -} - -dyn_clean() { - if [ -d ${WORKDIR} ] - then - rm -rf ${WORKDIR} - fi - if [ -d ${BUILDDIR}/image ] - then - rm -rf ${BUILDDIR}/image - fi - if [ -d ${BUILDDIR}/build-info ] - then - rm -rf ${BUILDDIR}/build-info - fi - rm -rf ${BUILDDIR}/.compiled -} - -into() { - if [ $1 = "/" ] - then - export DESTTREE="" - else - export DESTTREE=$1 - if [ ! -d ${D}${DESTTREE} ] - then - install -d ${D}${DESTTREE} - fi - fi -} - -insinto() { - if [ $1 = "/" ] - then - export INSDESTTREE="" - else - export INSDESTTREE=$1 - if [ ! -d ${D}${INSDESTTREE} ] - then - install -d ${D}${INSDESTTREE} - fi - fi -} - -exeinto() { - if [ $1 = "/" ] - then - export EXEDESTTREE="" - else - export EXEDESTTREE=$1 - if [ ! -d ${D}${EXEDESTTREE} ] - then - install -d ${D}${EXEDESTTREE} - fi - fi -} -docinto() { - if [ $1 = "/" ] - then - export DOCDESTTREE="" - else - export DOCDESTTREE=$1 - if [ ! -d ${D}usr/share/doc/${PF}/${DOCDESTTREE} ] - then - install -d ${D}usr/share/doc/${PF}/${DOCDESTTREE} - fi - fi -} - -insopts() { - INSOPTIONS="" - for x in $* - do - #if we have a debug build, let's not strip anything - if [ -n "$DEBUG" ] && [ "$x" = "-s" ] - then - continue - else - INSOPTIONS="$INSOPTIONS $x" - fi - done - export INSOPTIONS -} - -diropts() { - DIROPTIONS="" - for x in $* - do - DIROPTIONS="${DIROPTIONS} $x" - done - export DIROPTIONS -} - -exeopts() { - EXEOPTIONS="" - for x in $* - do - #if we have a debug build, let's not strip anything - if [ -n "$DEBUG" ] && [ "$x" = "-s" ] - then - continue - else - EXEOPTIONS="$EXEOPTIONS $x" - fi - done - export EXEOPTIONS -} - -libopts() { - LIBOPTIONS="" - for x in $* - do - #if we have a debug build, let's not strip anything - if [ -n "$DEBUG" ] && [ "$x" = "-s" ] - then - continue - else - LIBOPTIONS="$LIBOPTIONS $x" - fi - done - export LIBOPTIONS -} - -abort_compile() { - echo - echo '*** Compilation Aborted ***' - echo - cd ${BUILDDIR} #original dir - rm -f .compiled - trap SIGINT SIGQUIT - exit 1 -} - -abort_unpack() { - echo - echo '*** Unpack Aborted ***' - echo - cd ${BUILDDIR} #original dir - rm -f .unpacked - rm -rf work - trap SIGINT SIGQUIT - exit 1 -} - -abort_package() { - echo - echo '*** Packaging Aborted ***' - echo - cd ${BUILDDIR} #original dir - rm -f .packaged - rm -f ${PKGDIR}/All/${PF}.t* - trap SIGINT SIGQUIT - exit 1 -} - -abort_image() { - echo - echo '*** Imaging Aborted ***' - echo - cd ${BUILDDIR} #original dir - rm -rf image - trap SIGINT SIGQUIT - exit 1 -} - -dyn_compile() { - trap "abort_compile" SIGINT SIGQUIT - export CFLAGS CXXFLAGS LIBCFLAGS LIBCXXFLAGS - if [ ${BUILDDIR}/.compiled -nt ${WORKDIR} ] - then - echo ">>> It appears that ${PN} is already compiled. skipping." - echo ">>> (clean to force compilation)" - trap SIGINT SIGQUIT - return - fi - if [ -d ${S} ] - then - cd ${S} - fi - src_compile - cd ${BUILDDIR} - touch .compiled - if [ ! -e "build-info" ] - then - mkdir build-info - fi - cd build-info - echo "$CFLAGS" > CFLAGS - echo "$CXXFLAGS" > CXXFLAGS - echo "$CHOST" > CHOST - echo "$USE" > USE - echo "$LICENSE" > LICENSE - echo "$CATEGORY" > CATEGORY - echo "$PF" > PF - echo "$RDEPEND" > RDEPEND - echo "$PROVIDE" > PROVIDE - cp ${EBUILD} ${PF}.ebuild - if [ -n "$DEBUG" ] - then - touch DEBUG - fi - trap SIGINT SIGQUIT -} - -dyn_package() { - trap "abort_package" SIGINT SIGQUIT - cd ${BUILDDIR}/image - tar cvf ../bin.tar * - cd .. - bzip2 -f bin.tar - xpak build-info inf.xpak - tbz2tool join bin.tar.bz2 inf.xpak ${PF}.tbz2 - mv ${PF}.tbz2 ${PKGDIR}/All - rm -f inf.xpak bin.tar.bz2 - if [ ! -d ${PKGDIR}/${CATEGORY} ] - then - install -d ${PKGDIR}/${CATEGORY} - fi - ln -sf ${PKGDIR}/All/${PF}.tbz2 ${PKGDIR}/${CATEGORY}/${PF}.tbz2 - echo ">>> Done." - cd ${BUILDDIR} - touch .packaged - trap SIGINT SIGQUIT -} - -dyn_install() { - local ROOT - trap "abort_image" SIGINT SIGQUIT - rm -rf ${BUILDDIR}/image - mkdir ${BUILDDIR}/image - if [ -d ${S} ] - then - cd ${S} - fi - echo - echo ">>> Install ${PF} into ${D} category ${CATEGORY}" - src_install - prepall - cd ${D} - echo ">>> Completed installing into ${D}" - echo - cd ${BUILDDIR} - trap SIGINT SIGQUIT -} - -dyn_spec() { - tar czf /usr/src/redhat/SOURCES/${PF}.tar.gz ${O}/${PF}.ebuild ${O}/files - - cat <<__END1__ > ${PF}.spec -Summary: ${DESCRIPTION} -Name: ${PN} -Version: ${PV} -Release: ${PR} -Copyright: GPL -Group: portage/${CATEGORY} -Source: ${PF}.tar.gz -Buildroot: ${D} -%description -${DESCRIPTION} - -${HOMEPAGE} - -%prep -%setup -c - -%build - -%install - -%clean - -%files -/ -__END1__ - -} - -dyn_rpm () { - dyn_spec - rpm -bb ${PF}.spec - install -D /usr/src/redhat/RPMS/i386/${PN}-${PV}-${PR}.i386.rpm ${RPMDIR}/${CATEGORY}/${PN}-${PV}-${PR}.rpm -} - -dyn_help() { - echo - echo "Portage" - echo "Copyright 2000 Gentoo Technologies, Inc." - echo - echo "How to use the ebuild command:" - echo - echo "The first argument to ebuild should be an existing .ebuild file." - echo - echo "One or more of the following options can then be specified. If more" - echo "than one option is specified, each will be executed in order." - echo - echo " check : test if all dependencies get resolved" - echo " fetch : download source archive(s) and patches" - echo " unpack : unpack/patch sources (auto-fetch if needed)" - echo " compile : compile sources (auto-fetch/unpack if needed)" - echo " merge : merge image into live filesystem, recording files in db" - echo " (auto-fetch/unpack/compile if needed)" - echo " unmerge : remove package from live filesystem" - echo " package : create tarball package of type ${PACKAGE}" - echo " (will be stored in ${PKGDIR}/All)" - echo " clean : clean up all source and temporary files" - echo - echo "The following settings will be used for the ebuild process:" - echo - echo " package : ${PF}" - echo " category : ${CATEGORY}" - echo " description : ${DESCRIPTION}" - echo " system : ${CHOST}" - echo " c flags : ${CFLAGS}" - echo " c++ flags : ${CXXFLAGS}" - echo " make flags : ${MAKEOPTS}" - echo -n " build mode : " - if [ -n "${DEBUG}" ] - then - echo "debug (large)" - else - echo "production (stripped)" - fi - echo " merge to : ${ROOT}" - echo - if [ -n "$USE" ] - then - echo "Additionally, support for the following toolkits will be enabled if necessary:" - echo - echo " ${USE}" - fi - echo -} - -#The following diefunc() and aliases come from Aron Griffis -- an excellent bash coder -- thanks! - -diefunc() { - local funcname="$1" lineno="$2" exitcode="$3" - shift 3 - echo >&2 - echo "!!! ERROR: The ebuild did not complete successfully." >&2 - echo "!!! Function $funcname, Line $lineno, Exitcode $exitcode" >&2 - echo "!!! ${*:-(no error message)}" >&2 - echo >&2 - exit 1 -} - -alias die='diefunc "$FUNCNAME" "$LINENO" "$?"' -alias assert='_retval=$?; [ $_retval = 0 ] || diefunc "$FUNCNAME" "$LINENO" "$_retval"' - - -#if [ -e ${PEBUILD} ] -#then -# source ${PEBUILD} -#fi -source ${EBUILD} -if [ $? -ne 0 ] -then - #abort if there was a parse problem - exit 1 -fi -#this is a little trick to define ${A} if it hasn't been defined yet -if [ "${A}" = "" ] -then - if [ "${SRC_URI}" != "" ] - then - rm -f ${T}/archives.orig - for x in ${SRC_URI} - do - echo `basename $x` >> ${T}/archives.orig - done - cat ${T}/archives.orig | sort | uniq > ${T}/archives - rm ${T}/archives.orig - export A=`cat ${T}/archives` - rm ${T}/archives - fi -fi - -if [ "${RDEPEND}" = "" ] -then - export RDEPEND=${DEPEND} -fi - -count=1 -while [ $count -le $# ] -do - eval "myarg=\${${count}}" - case $myarg in - prerm|postrm|preinst|postinst|config) - if [ "$PORTAGE_DEBUG" = "0" ] - then - pkg_${myarg} - else - set -x - pkg_${myarg} - set +x - fi - ;; - unpack|compile|help|batchdigest|touch|clean|fetch|digest|pkginfo|pkgloc|unmerge|merge|package|install|rpm) - if [ "$PORTAGE_DEBUG" = "0" ] - then - dyn_${myarg} - else - set -x - dyn_${myarg} - set +x - fi - ;; - depend) - echo $DEPEND - echo $RDEPEND - ;; - *) - echo "Please specify a valid command." - echo - dyn_help - ;; - esac - if [ $? -ne 0 ] - then - exit 1 - fi - count=$(( $count + 1)) -done diff --git a/sys-apps/portage/files/1.5/bin/ebuild.sh-1.5.1 b/sys-apps/portage/files/1.5/bin/ebuild.sh-1.5.1 deleted file mode 100755 index d79ef87b0c14..000000000000 --- a/sys-apps/portage/files/1.5/bin/ebuild.sh-1.5.1 +++ /dev/null @@ -1,664 +0,0 @@ -#!/bin/bash -source /etc/profile -export PATH="/usr/lib/portage/bin:${PATH}" -source /etc/rc.d/config/functions -export DESTTREE=/usr -export INSDESTTREE="" -export EXEDESTTREE="" -export DOCDESTTREE="" -export INSOPTIONS="-m0644" -export EXEOPTIONS="-m0755" -export LIBOPTIONS="-m0644" -export DIROPTIONS="-m0755" -export MOPREFIX=${PN} -export KVERS=`uname -r` - -src_unpack() { - unpack ${A} -} - -src_compile() { - return -} - -src_install() -{ - return -} - -pkg_preinst() -{ - return -} - -pkg_postinst() -{ - return -} - -pkg_prerm() -{ - return -} - -pkg_postrm() -{ - return -} - -try() { - eval $* - if [ $? -ne 0 ] - then - echo - echo '!!! '"ERROR: the $1 command did not complete successfully." - echo '!!! '"(\"$*\")" - echo '!!! '"Since this is a critical task, ebuild will be stopped." - echo - exit 1 - fi -} - -dyn_touch() { - local x - for x in ${A} - do - if [ -e ${DISTDIR}/${x} ] - then - touch ${DISTDIR}/${x} - fi - done -} - -dyn_digest() { - local x - if [ ! -d ${FILESDIR} ] - then - install -d ${FILESDIR} - if [ -n "${MAINTAINER}" ] - then - echo ">>> adding ${FILESDIR} to CVS (just in case it isn't there)" - ( echo; cd `/usr/bin/dirname ${FILESDIR}`; cvs add `/usr/bin/basename ${FILESDIR}`; echo) - fi - fi - for x in ${A} - do - if [ ! -e ${DISTDIR}/${x} ] - then - echo '!!! Cannot compute message digests: '${x} not found - echo "error, aborting." - exit 1 - else - mymd5=`md5sum ${DISTDIR}/${x} | cut -f1 -d" "` - echo "MD5 $mymd5 $x" >> ${FILESDIR}/.digest-${PF} - fi - done - mv ${FILESDIR}/.digest-${PF} ${FILESDIR}/digest-${PF} - if [ -n "${MAINTAINER}" ] - then - echo ">>> adding digest-${PF} to CVS (just in case it isn't there)" - ( echo; cd ${FILESDIR}; cvs add digest-${PF}; echo ) - fi - echo ">>> Computed message digests." -} - -digest_check() { - if [ ! -e ${FILESDIR}/digest-${PF} ] - then - echo '!!!'" No message digest file found." - if [ -n "$MAINTAINER" ] - then - echo '>>> Maintainer mode: auto-computing digests.' - dyn_digest - return 0 - else - echo '!!!'" Maintainer: ebuild digest to update message digests." - return 1 - fi - fi - if [ ! -e ${DISTDIR}/${1} ] - then - echo '!!!'" ${1} not found." - echo '!!!'" Ebuild fetch to retrieve files." - return 1 - fi - local mycdigest=`grep " ${1}" ${FILESDIR}/digest-${PF} | cut -f2 -d" "` - if [ -z "$mycdigest" ] - then - echo - echo '!!!'" No message digest found for ${1}." - if [ -n "$MAINTAINER" ] - then - echo '>>> Maintainer mode: auto-computing digests.' - dyn_digest - echo - return 0 - else - echo '!!!'" Maintainer: ebuild digest to update message digests." - echo - return 1 - fi - fi - local mydigest=`md5sum ${DISTDIR}/${1} | cut -f1 -d" "` - if [ "$mycdigest" != "$mydigest" ] - then - echo - echo '!!!'" ${1}: message digests do not match!" - echo '!!!'" ${1} is corrupt or incomplete" - echo ">>> md5 con ${mycdigest}" - echo ">>> md5 now ${mydigest}" - echo ">>> Please delete/redownload ${DISTDIR}/${1}" - echo - return 1 - else - echo ">>> md5 ;-) ${1}" - fi - return 0 -} - -dyn_batchdigest() { - local x - if [ ! -e ${FILESDIR}/digest-${PF} ] - then - if [ "${A}" != "" ] - then - echo "${CATEGORY}/${PF} has no digest file." - fi - exit 1 - fi - for x in ${A} - do - if [ ! -e ${DISTDIR}/${x} ] - then - echo "${CATEGORY}/${PF}:${x} does not exist in ${DISTDIR}." - continue - else - local mycdigest=`grep " ${x}" ${FILESDIR}/digest-${PF} | cut -f2 -d" "` - if [ -z "$mycdigest" ] - then - echo "${CATEGORY}/${PF}:${x} digest not yet recorded." - continue - fi - local mydigest=`md5sum ${DISTDIR}/${x} | cut -f1 -d" "` - if [ "$mycdigest" != "$mydigest" ] - then - echo "${CATEGORY}/${PF}:${x} is corrupt or has an invalid digest." - fi - fi - done -} - - -dyn_fetch() { - local y - for y in ${A} - do - if [ ! -e ${DISTDIR}/${y} ] - then - echo ">>> Fetching ${y}..." - echo - local x - local _SRC_URI - for x in ${GENTOO_MIRRORS} - do - _SRC_URI="${_SRC_URI} ${x}/distributions/gentoo/gentoo-sources/${y}" - done - _SRC_URI="${_SRC_URI} `queryhost.sh "${SRC_URI}"`" - for x in ${_SRC_URI} - do - if [ ! -e ${DISTDIR}/${y} ] - then - if [ $y == ${x##*/} ] - then - echo ">>> Trying site ${x}..." - eval "${FETCHCOMMAND}" - fi - fi - done - if [ ! -e ${DISTDIR}/${y} ] - then - echo '!!!'" Couldn't download ${y}. Aborting." - exit 1 - fi - echo - fi - done - for y in ${A} - do - digest_check ${y} - if [ $? -ne 0 ] - then - exit 1 - fi - done -} - -dyn_unpack() { - trap "abort_unpack" SIGINT SIGQUIT - local newstuff="no" - if [ -e ${WORKDIR} ] - then - local x - local checkme - if [ -n "${MAINTAINER}" ] - then - checkme="${DISTDIR}/${A}" - else - checkme="${DISTDIR}/${A} ${EBUILD}" - fi - for x in $checkme - do - echo ">>> Checking ${x}'s mtime..." - if [ ${x} -nt ${WORKDIR} ] - then - echo ">>> ${x} has been updated; recreating WORKDIR..." - newstuff="yes" - rm -rf ${WORKDIR} - break - fi - done - fi - if [ -e ${WORKDIR} ] - then - if [ "$newstuff" = "no" ] - then - echo ">>> WORKDIR is up-to-date, keeping..." - return 0 - fi - fi - install -m0700 -d ${WORKDIR} - cd ${WORKDIR} - echo ">>> Unpacking source..." - src_unpack - echo ">>> Source unpacked." - cd .. - trap SIGINT SIGQUIT -} - -dyn_clean() { - if [ -d ${WORKDIR} ] - then - rm -rf ${WORKDIR} - fi - if [ -d ${BUILDDIR}/image ] - then - rm -rf ${BUILDDIR}/image - fi - if [ -d ${BUILDDIR}/build-info ] - then - rm -rf ${BUILDDIR}/build-info - fi - rm -rf ${BUILDDIR}/.compiled -} - -into() { - if [ $1 = "/" ] - then - export DESTTREE="" - else - export DESTTREE=$1 - if [ ! -d ${D}${DESTTREE} ] - then - install -d ${D}${DESTTREE} - fi - fi -} - -insinto() { - if [ $1 = "/" ] - then - export INSDESTTREE="" - else - export INSDESTTREE=$1 - if [ ! -d ${D}${INSDESTTREE} ] - then - install -d ${D}${INSDESTTREE} - fi - fi -} - -exeinto() { - if [ $1 = "/" ] - then - export EXEDESTTREE="" - else - export EXEDESTTREE=$1 - if [ ! -d ${D}${EXEDESTTREE} ] - then - install -d ${D}${EXEDESTTREE} - fi - fi -} -docinto() { - if [ $1 = "/" ] - then - export DOCDESTTREE="" - else - export DOCDESTTREE=$1 - if [ ! -d ${D}usr/share/doc/${PF}/${DOCDESTTREE} ] - then - install -d ${D}usr/share/doc/${PF}/${DOCDESTTREE} - fi - fi -} - -insopts() { - INSOPTIONS="" - for x in $* - do - #if we have a debug build, let's not strip anything - if [ -n "$DEBUG" ] && [ "$x" = "-s" ] - then - continue - else - INSOPTIONS="$INSOPTIONS $x" - fi - done - export INSOPTIONS -} - -diropts() { - DIROPTIONS="" - for x in $* - do - DIROPTIONS="${DIROPTIONS} $x" - done - export DIROPTIONS -} - -exeopts() { - EXEOPTIONS="" - for x in $* - do - #if we have a debug build, let's not strip anything - if [ -n "$DEBUG" ] && [ "$x" = "-s" ] - then - continue - else - EXEOPTIONS="$EXEOPTIONS $x" - fi - done - export EXEOPTIONS -} - -libopts() { - LIBOPTIONS="" - for x in $* - do - #if we have a debug build, let's not strip anything - if [ -n "$DEBUG" ] && [ "$x" = "-s" ] - then - continue - else - LIBOPTIONS="$LIBOPTIONS $x" - fi - done - export LIBOPTIONS -} - -abort_compile() { - echo - echo '*** Compilation Aborted ***' - echo - cd ${BUILDDIR} #original dir - rm -f .compiled - trap SIGINT SIGQUIT - exit 1 -} - -abort_unpack() { - echo - echo '*** Unpack Aborted ***' - echo - cd ${BUILDDIR} #original dir - rm -f .unpacked - rm -rf work - trap SIGINT SIGQUIT - exit 1 -} - -abort_package() { - echo - echo '*** Packaging Aborted ***' - echo - cd ${BUILDDIR} #original dir - rm -f .packaged - rm -f ${PKGDIR}/All/${PF}.t* - trap SIGINT SIGQUIT - exit 1 -} - -abort_image() { - echo - echo '*** Imaging Aborted ***' - echo - cd ${BUILDDIR} #original dir - rm -rf image - trap SIGINT SIGQUIT - exit 1 -} - -dyn_compile() { - trap "abort_compile" SIGINT SIGQUIT - export CFLAGS CXXFLAGS LIBCFLAGS LIBCXXFLAGS - if [ ${BUILDDIR}/.compiled -nt ${WORKDIR} ] - then - echo ">>> It appears that ${PN} is already compiled. skipping." - echo ">>> (clean to force compilation)" - trap SIGINT SIGQUIT - return - fi - if [ -d ${S} ] - then - cd ${S} - fi - src_compile - cd ${BUILDDIR} - touch .compiled - if [ ! -e "build-info" ] - then - mkdir build-info - fi - cd build-info - echo "$CFLAGS" > CFLAGS - echo "$CXXFLAGS" > CXXFLAGS - echo "$CHOST" > CHOST - echo "$USE" > USE - echo "$LICENSE" > LICENSE - echo "$CATEGORY" > CATEGORY - echo "$PF" > PF - echo "$RDEPEND" > RDEPEND - echo "$PROVIDE" > PROVIDE - cp ${EBUILD} ${PF}.ebuild - if [ -n "$DEBUG" ] - then - touch DEBUG - fi - trap SIGINT SIGQUIT -} - -dyn_package() { - trap "abort_package" SIGINT SIGQUIT - cd ${BUILDDIR}/image - tar cvf ../bin.tar * - cd .. - bzip2 -f bin.tar - xpak build-info inf.xpak - tbz2tool join bin.tar.bz2 inf.xpak ${PF}.tbz2 - mv ${PF}.tbz2 ${PKGDIR}/All - rm -f inf.xpak bin.tar.bz2 - if [ ! -d ${PKGDIR}/${CATEGORY} ] - then - install -d ${PKGDIR}/${CATEGORY} - fi - ln -sf ${PKGDIR}/All/${PF}.tbz2 ${PKGDIR}/${CATEGORY}/${PF}.tbz2 - echo ">>> Done." - cd ${BUILDDIR} - touch .packaged - trap SIGINT SIGQUIT -} - -dyn_install() { - local ROOT - trap "abort_image" SIGINT SIGQUIT - rm -rf ${BUILDDIR}/image - mkdir ${BUILDDIR}/image - if [ -d ${S} ] - then - cd ${S} - fi - echo - echo ">>> Install ${PF} into ${D} category ${CATEGORY}" - src_install - prepall - cd ${D} - echo ">>> Completed installing into ${D}" - echo - cd ${BUILDDIR} - trap SIGINT SIGQUIT -} - -dyn_spec() { - tar czf /usr/src/redhat/SOURCES/${PF}.tar.gz ${O}/${PF}.ebuild ${O}/files - - cat <<__END1__ > ${PF}.spec -Summary: ${DESCRIPTION} -Name: ${PN} -Version: ${PV} -Release: ${PR} -Copyright: GPL -Group: portage/${CATEGORY} -Source: ${PF}.tar.gz -Buildroot: ${D} -%description -${DESCRIPTION} - -${HOMEPAGE} - -%prep -%setup -c - -%build - -%install - -%clean - -%files -/ -__END1__ - -} - -dyn_rpm () { - dyn_spec - rpm -bb ${PF}.spec - install -D /usr/src/redhat/RPMS/i386/${PN}-${PV}-${PR}.i386.rpm ${RPMDIR}/${CATEGORY}/${PN}-${PV}-${PR}.rpm -} - -dyn_help() { - echo - echo "Portage" - echo "Copyright 2000 Gentoo Technologies, Inc." - echo - echo "How to use the ebuild command:" - echo - echo "The first argument to ebuild should be an existing .ebuild file." - echo - echo "One or more of the following options can then be specified. If more" - echo "than one option is specified, each will be executed in order." - echo - echo " check : test if all dependencies get resolved" - echo " fetch : download source archive(s) and patches" - echo " unpack : unpack/patch sources (auto-fetch if needed)" - echo " compile : compile sources (auto-fetch/unpack if needed)" - echo " merge : merge image into live filesystem, recording files in db" - echo " (auto-fetch/unpack/compile if needed)" - echo " unmerge : remove package from live filesystem" - echo " package : create tarball package of type ${PACKAGE}" - echo " (will be stored in ${PKGDIR}/All)" - echo " clean : clean up all source and temporary files" - echo - echo "The following settings will be used for the ebuild process:" - echo - echo " package : ${PF}" - echo " category : ${CATEGORY}" - echo " description : ${DESCRIPTION}" - echo " system : ${CHOST}" - echo " c flags : ${CFLAGS}" - echo " c++ flags : ${CXXFLAGS}" - echo " make flags : ${MAKEOPTS}" - echo -n " build mode : " - if [ -n "${DEBUG}" ] - then - echo "debug (large)" - else - echo "production (stripped)" - fi - echo " merge to : ${ROOT}" - echo - if [ -n "$USE" ] - then - echo "Additionally, support for the following toolkits will be enabled if necessary:" - echo - echo " ${USE}" - fi - echo -} - -#if [ -e ${PEBUILD} ] -#then -# source ${PEBUILD} -#fi -source ${EBUILD} - -#this is a little trick to define ${A} if it hasn't been defined yet -if [ "${A}" = "" ] -then - if [ "${SRC_URI}" != "" ] - then - rm -f ${T}/archives.orig - for x in ${SRC_URI} - do - echo `basename $x` >> ${T}/archives.orig - done - cat ${T}/archives.orig | sort | uniq > ${T}/archives - rm ${T}/archives.orig - export A=`cat ${T}/archives` - rm ${T}/archives - fi -fi - -if [ "${RDEPEND}" = "" ] -then - export RDEPEND=${DEPEND} -fi - - -count=1 -while [ $count -le $# ] -do - eval "myarg=\${${count}}" - case $myarg in - prerm|postrm|preinst|postinst|config) - pkg_${myarg} - ;; - unpack|compile|help|batchdigest|touch|clean|fetch|digest|pkginfo|pkgloc|unmerge|merge|package|install|rpm) - dyn_${myarg} - ;; - depend) - echo $DEPEND - echo $RDEPEND - ;; - *) - echo "Please specify a valid command." - echo - dyn_help - ;; - esac - if [ $? -ne 0 ] - then - exit 1 - fi - count=$(( $count + 1)) -done diff --git a/sys-apps/portage/files/1.5/bin/ebuild.sh.cfg b/sys-apps/portage/files/1.5/bin/ebuild.sh.cfg deleted file mode 100755 index e2d75d92d6d7..000000000000 --- a/sys-apps/portage/files/1.5/bin/ebuild.sh.cfg +++ /dev/null @@ -1,677 +0,0 @@ -#!/bin/bash -source /etc/profile -export PATH="/usr/lib/portage/bin:${PATH}" -source /etc/rc.d/config/functions -export DESTTREE=/usr -export INSDESTTREE="" -export EXEDESTTREE="" -export DOCDESTTREE="" -export INSOPTIONS="-m0644" -export EXEOPTIONS="-m0755" -export LIBOPTIONS="-m0644" -export DIROPTIONS="-m0755" -export MOPREFIX=${PN} -export KVERS=`uname -r` - -src_unpack() { - unpack ${A} -} - -src_compile() { - return -} - -src_install() -{ - return -} - -pkg_preinst() -{ - return -} - -pkg_postinst() -{ - return -} - -pkg_prerm() -{ - return -} - -pkg_postrm() -{ - return -} - -try() { - eval $* - if [ $? -ne 0 ] - then - echo - echo '!!! '"ERROR: the $1 command did not complete successfully." - echo '!!! '"(\"$*\")" - echo '!!! '"Since this is a critical task, ebuild will be stopped." - echo - exit 1 - fi -} - -dyn_touch() { - local x - for x in ${A} - do - if [ -e ${DISTDIR}/${x} ] - then - touch ${DISTDIR}/${x} - fi - done -} - -dyn_digest() { - local x - if [ ! -d ${FILESDIR} ] - then - install -d ${FILESDIR} - if [ -n "${MAINTAINER}" ] - then - echo ">>> adding ${FILESDIR} to CVS (just in case it isn't there)" - ( echo; cd `/usr/bin/dirname ${FILESDIR}`; cvs add `/usr/bin/basename ${FILESDIR}`; echo) - fi - fi - for x in ${A} - do - if [ ! -e ${DISTDIR}/${x} ] - then - echo '!!! Cannot compute message digests: '${x} not found - echo "error, aborting." - exit 1 - else - mymd5=`md5sum ${DISTDIR}/${x} | cut -f1 -d" "` - echo "MD5 $mymd5 $x" >> ${FILESDIR}/.digest-${PF} - fi - done - mv ${FILESDIR}/.digest-${PF} ${FILESDIR}/digest-${PF} - if [ -n "${MAINTAINER}" ] - then - echo ">>> adding digest-${PF} to CVS (just in case it isn't there)" - ( echo; cd ${FILESDIR}; cvs add digest-${PF}; echo ) - fi - echo ">>> Computed message digests." -} - -digest_check() { - if [ ! -e ${FILESDIR}/digest-${PF} ] - then - echo '!!!'" No message digest file found." - if [ -n "$MAINTAINER" ] - then - echo '>>> Maintainer mode: auto-computing digests.' - dyn_digest - return 0 - else - echo '!!!'" Maintainer: ebuild digest to update message digests." - return 1 - fi - fi - if [ ! -e ${DISTDIR}/${1} ] - then - echo '!!!'" ${1} not found." - echo '!!!'" Ebuild fetch to retrieve files." - return 1 - fi - local mycdigest=`grep " ${1}" ${FILESDIR}/digest-${PF} | cut -f2 -d" "` - if [ -z "$mycdigest" ] - then - echo - echo '!!!'" No message digest found for ${1}." - if [ -n "$MAINTAINER" ] - then - echo '>>> Maintainer mode: auto-computing digests.' - dyn_digest - echo - return 0 - else - echo '!!!'" Maintainer: ebuild digest to update message digests." - echo - return 1 - fi - fi - local mydigest=`md5sum ${DISTDIR}/${1} | cut -f1 -d" "` - if [ "$mycdigest" != "$mydigest" ] - then - echo - echo '!!!'" ${1}: message digests do not match!" - echo '!!!'" ${1} is corrupt or incomplete" - echo ">>> md5 con ${mycdigest}" - echo ">>> md5 now ${mydigest}" - echo ">>> Please delete/redownload ${DISTDIR}/${1}" - echo - return 1 - else - echo ">>> md5 ;-) ${1}" - fi - return 0 -} - -dyn_batchdigest() { - local x - if [ ! -e ${FILESDIR}/digest-${PF} ] - then - if [ "${A}" != "" ] - then - echo "${CATEGORY}/${PF} has no digest file." - fi - exit 1 - fi - for x in ${A} - do - if [ ! -e ${DISTDIR}/${x} ] - then - echo "${CATEGORY}/${PF}:${x} does not exist in ${DISTDIR}." - continue - else - local mycdigest=`grep " ${x}" ${FILESDIR}/digest-${PF} | cut -f2 -d" "` - if [ -z "$mycdigest" ] - then - echo "${CATEGORY}/${PF}:${x} digest not yet recorded." - continue - fi - local mydigest=`md5sum ${DISTDIR}/${x} | cut -f1 -d" "` - if [ "$mycdigest" != "$mydigest" ] - then - echo "${CATEGORY}/${PF}:${x} is corrupt or has an invalid digest." - fi - fi - done -} - - -dyn_fetch() { - local y - for y in ${A} - do - if [ ! -e ${DISTDIR}/${y} ] - then - echo ">>> Fetching ${y}..." - echo - local x - local _SRC_URI - for x in ${GENTOO_MIRRORS} - do - _SRC_URI="${_SRC_URI} ${x}/distributions/gentoo/gentoo-sources/${y}" - done - _SRC_URI="${_SRC_URI} `queryhost.sh "${SRC_URI}"`" - for x in ${_SRC_URI} - do - if [ ! -e ${DISTDIR}/${y} ] - then - if [ $y == ${x##*/} ] - then - echo ">>> Trying site ${x}..." - eval "${FETCHCOMMAND}" - fi - fi - done - if [ ! -e ${DISTDIR}/${y} ] - then - echo '!!!'" Couldn't download ${y}. Aborting." - exit 1 - fi - echo - fi - done - for y in ${A} - do - digest_check ${y} - if [ $? -ne 0 ] - then - exit 1 - fi - done -} - -dyn_unpack() { - trap "abort_unpack" SIGINT SIGQUIT - local newstuff="no" - if [ -e ${WORKDIR} ] - then - local x - local checkme - if [ -n "${MAINTAINER}" ] - then - checkme="${DISTDIR}/${A}" - else - checkme="${DISTDIR}/${A} ${EBUILD}" - fi - for x in $checkme - do - echo ">>> Checking ${x}'s mtime..." - if [ ${x} -nt ${WORKDIR} ] - then - echo ">>> ${x} has been updated; recreating WORKDIR..." - newstuff="yes" - rm -rf ${WORKDIR} - break - fi - done - fi - if [ -e ${WORKDIR} ] - then - if [ "$newstuff" = "no" ] - then - echo ">>> WORKDIR is up-to-date, keeping..." - return 0 - fi - fi - install -m0700 -d ${WORKDIR} - cd ${WORKDIR} - echo ">>> Unpacking source..." - src_unpack - echo ">>> Source unpacked." - cd .. - trap SIGINT SIGQUIT -} - -dyn_clean() { - if [ -d ${WORKDIR} ] - then - rm -rf ${WORKDIR} - fi - if [ -d ${BUILDDIR}/image ] - then - rm -rf ${BUILDDIR}/image - fi - if [ -d ${BUILDDIR}/build-info ] - then - rm -rf ${BUILDDIR}/build-info - fi - rm -rf ${BUILDDIR}/.compiled -} - -into() { - if [ $1 = "/" ] - then - export DESTTREE="" - else - export DESTTREE=$1 - if [ ! -d ${D}${DESTTREE} ] - then - install -d ${D}${DESTTREE} - fi - fi -} - -insinto() { - if [ $1 = "/" ] - then - export INSDESTTREE="" - else - export INSDESTTREE=$1 - if [ ! -d ${D}${INSDESTTREE} ] - then - install -d ${D}${INSDESTTREE} - fi - fi -} - -exeinto() { - if [ $1 = "/" ] - then - export EXEDESTTREE="" - else - export EXEDESTTREE=$1 - if [ ! -d ${D}${EXEDESTTREE} ] - then - install -d ${D}${EXEDESTTREE} - fi - fi -} -docinto() { - if [ $1 = "/" ] - then - export DOCDESTTREE="" - else - export DOCDESTTREE=$1 - if [ ! -d ${D}usr/share/doc/${PF}/${DOCDESTTREE} ] - then - install -d ${D}usr/share/doc/${PF}/${DOCDESTTREE} - fi - fi -} - -insopts() { - INSOPTIONS="" - for x in $* - do - #if we have a debug build, let's not strip anything - if [ -n "$DEBUG" ] && [ "$x" = "-s" ] - then - continue - else - INSOPTIONS="$INSOPTIONS $x" - fi - done - export INSOPTIONS -} - -diropts() { - DIROPTIONS="" - for x in $* - do - DIROPTIONS="${DIROPTIONS} $x" - done - export DIROPTIONS -} - -exeopts() { - EXEOPTIONS="" - for x in $* - do - #if we have a debug build, let's not strip anything - if [ -n "$DEBUG" ] && [ "$x" = "-s" ] - then - continue - else - EXEOPTIONS="$EXEOPTIONS $x" - fi - done - export EXEOPTIONS -} - -libopts() { - LIBOPTIONS="" - for x in $* - do - #if we have a debug build, let's not strip anything - if [ -n "$DEBUG" ] && [ "$x" = "-s" ] - then - continue - else - LIBOPTIONS="$LIBOPTIONS $x" - fi - done - export LIBOPTIONS -} - -abort_compile() { - echo - echo '*** Compilation Aborted ***' - echo - cd ${BUILDDIR} #original dir - rm -f .compiled - trap SIGINT SIGQUIT - exit 1 -} - -abort_unpack() { - echo - echo '*** Unpack Aborted ***' - echo - cd ${BUILDDIR} #original dir - rm -f .unpacked - rm -rf work - trap SIGINT SIGQUIT - exit 1 -} - -abort_package() { - echo - echo '*** Packaging Aborted ***' - echo - cd ${BUILDDIR} #original dir - rm -f .packaged - rm -f ${PKGDIR}/All/${PF}.t* - trap SIGINT SIGQUIT - exit 1 -} - -abort_image() { - echo - echo '*** Imaging Aborted ***' - echo - cd ${BUILDDIR} #original dir - rm -rf image - trap SIGINT SIGQUIT - exit 1 -} - -dyn_compile() { - trap "abort_compile" SIGINT SIGQUIT - export CFLAGS CXXFLAGS LIBCFLAGS LIBCXXFLAGS - if [ ${BUILDDIR}/.compiled -nt ${WORKDIR} ] - then - echo ">>> It appears that ${PN} is already compiled. skipping." - echo ">>> (clean to force compilation)" - trap SIGINT SIGQUIT - return - fi - if [ -d ${S} ] - then - cd ${S} - fi - src_compile - cd ${BUILDDIR} - touch .compiled - if [ ! -e "build-info" ] - then - mkdir build-info - fi - cd build-info - echo "$CFLAGS" > CFLAGS - echo "$CXXFLAGS" > CXXFLAGS - echo "$CHOST" > CHOST - echo "$USE" > USE - echo "$LICENSE" > LICENSE - echo "$CATEGORY" > CATEGORY - echo "$PF" > PF - echo "$RDEPEND" > RDEPEND - echo "$PROVIDE" > PROVIDE - cp ${EBUILD} ${PF}.ebuild - if [ -n "$DEBUG" ] - then - touch DEBUG - fi - trap SIGINT SIGQUIT -} - -dyn_package() { - trap "abort_package" SIGINT SIGQUIT - cd ${BUILDDIR}/image - tar cvf ../bin.tar * - cd .. - bzip2 -f bin.tar - xpak build-info inf.xpak - tbz2tool join bin.tar.bz2 inf.xpak ${PF}.tbz2 - mv ${PF}.tbz2 ${PKGDIR}/All - rm -f inf.xpak bin.tar.bz2 - if [ ! -d ${PKGDIR}/${CATEGORY} ] - then - install -d ${PKGDIR}/${CATEGORY} - fi - ln -sf ${PKGDIR}/All/${PF}.tbz2 ${PKGDIR}/${CATEGORY}/${PF}.tbz2 - echo ">>> Done." - cd ${BUILDDIR} - touch .packaged - trap SIGINT SIGQUIT -} - -dyn_install() { - local ROOT - trap "abort_image" SIGINT SIGQUIT - rm -rf ${BUILDDIR}/image - mkdir ${BUILDDIR}/image - if [ -d ${S} ] - then - cd ${S} - fi - echo - echo ">>> Install ${PF} into ${D} category ${CATEGORY}" - src_install - prepall - cd ${D} - #prep for config-file management - if [ -d etc ] - then - echo ">>> Prepping files in /etc..." - cd etc - local mycfg - local newcfg - for mycfg in `find -type f` - do - newcfg="`dirname $mycfg`/._cfg_`basename $mycfg`" - mv "$mycfg" "$newcfg" - done - fi - echo ">>> Completed installing into ${D}" - echo - cd ${BUILDDIR} - trap SIGINT SIGQUIT -} - -dyn_spec() { - tar czf /usr/src/redhat/SOURCES/${PF}.tar.gz ${O}/${PF}.ebuild ${O}/files - - cat <<__END1__ > ${PF}.spec -Summary: ${DESCRIPTION} -Name: ${PN} -Version: ${PV} -Release: ${PR} -Copyright: GPL -Group: portage/${CATEGORY} -Source: ${PF}.tar.gz -Buildroot: ${D} -%description -${DESCRIPTION} - -${HOMEPAGE} - -%prep -%setup -c - -%build - -%install - -%clean - -%files -/ -__END1__ - -} - -dyn_rpm () { - dyn_spec - rpm -bb ${PF}.spec - install -D /usr/src/redhat/RPMS/i386/${PN}-${PV}-${PR}.i386.rpm ${RPMDIR}/${CATEGORY}/${PN}-${PV}-${PR}.rpm -} - -dyn_help() { - echo - echo "Portage" - echo "Copyright 2000 Gentoo Technologies, Inc." - echo - echo "How to use the ebuild command:" - echo - echo "The first argument to ebuild should be an existing .ebuild file." - echo - echo "One or more of the following options can then be specified. If more" - echo "than one option is specified, each will be executed in order." - echo - echo " check : test if all dependencies get resolved" - echo " fetch : download source archive(s) and patches" - echo " unpack : unpack/patch sources (auto-fetch if needed)" - echo " compile : compile sources (auto-fetch/unpack if needed)" - echo " merge : merge image into live filesystem, recording files in db" - echo " (auto-fetch/unpack/compile if needed)" - echo " unmerge : remove package from live filesystem" - echo " package : create tarball package of type ${PACKAGE}" - echo " (will be stored in ${PKGDIR}/All)" - echo " clean : clean up all source and temporary files" - echo - echo "The following settings will be used for the ebuild process:" - echo - echo " package : ${PF}" - echo " category : ${CATEGORY}" - echo " description : ${DESCRIPTION}" - echo " system : ${CHOST}" - echo " c flags : ${CFLAGS}" - echo " c++ flags : ${CXXFLAGS}" - echo " make flags : ${MAKEOPTS}" - echo -n " build mode : " - if [ -n "${DEBUG}" ] - then - echo "debug (large)" - else - echo "production (stripped)" - fi - echo " merge to : ${ROOT}" - echo - if [ -n "$USE" ] - then - echo "Additionally, support for the following toolkits will be enabled if necessary:" - echo - echo " ${USE}" - fi - echo -} - -#if [ -e ${PEBUILD} ] -#then -# source ${PEBUILD} -#fi -source ${EBUILD} - -#this is a little trick to define ${A} if it hasn't been defined yet -if [ "${A}" = "" ] -then - if [ "${SRC_URI}" != "" ] - then - rm -f ${T}/archives.orig - for x in ${SRC_URI} - do - echo `basename $x` >> ${T}/archives.orig - done - cat ${T}/archives.orig | sort | uniq > ${T}/archives - rm ${T}/archives.orig - export A=`cat ${T}/archives` - rm ${T}/archives - fi -fi - -if [ "${RDEPEND}" = "" ] -then - export RDEPEND=${DEPEND} -fi - - -count=1 -while [ $count -le $# ] -do - eval "myarg=\${${count}}" - case $myarg in - prerm|postrm|preinst|postinst|config) - pkg_${myarg} - ;; - unpack|compile|help|batchdigest|touch|clean|fetch|digest|pkginfo|pkgloc|unmerge|merge|package|install|rpm) - dyn_${myarg} - ;; - depend) - echo $DEPEND - echo $RDEPEND - ;; - *) - echo "Please specify a valid command." - echo - dyn_help - ;; - esac - if [ $? -ne 0 ] - then - exit 1 - fi - count=$(( $count + 1)) -done diff --git a/sys-apps/portage/files/1.5/bin/emake b/sys-apps/portage/files/1.5/bin/emake deleted file mode 100755 index 56cb3e320c76..000000000000 --- a/sys-apps/portage/files/1.5/bin/emake +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -# auto-parallel make without the annoying syntax -exec env make ${MAKEOPTS} MAKE="make ${MAKEOPTS}" "$@" diff --git a/sys-apps/portage/files/1.5/bin/emerge b/sys-apps/portage/files/1.5/bin/emerge deleted file mode 100755 index 42edf70b0bba..000000000000 --- a/sys-apps/portage/files/1.5/bin/emerge +++ /dev/null @@ -1,474 +0,0 @@ -#!/usr/bin/env spython -import os -import sys - -if os.getuid()!=0: - print "!!! emerge must be run by root." - sys.exit(1) - -import portage -import xpak -import string -import commands -import shutil - -#build our package digraph - -class depgraph: - - def __init__(self,mymode,myopts): - self.mymode=mymode - self.myopts=myopts - virts=portage.getvirtuals("/") - self.db={} - self.db["/"]={"virtuals":virts,"vartree":portage.vartree("/",virts),"porttree":portage.portagetree("/",virts),"bintree":portage.binarytree("/",virts)} - if portage.root!="/": - pr=portage.root - virts=portage.getvirtuals(pr) - self.db[pr]={"virtuals":virts,"vartree":portage.vartree(pr,virts),"porttree":portage.portagetree(pr,virts),"bintree":portage.binarytree(pr,virts)} - self.digraph=portage.digraph() - - def create(self,mybigkey=None,myparent=None): - sys.stdout.write(".") - sys.stdout.flush() - if self.digraph.hasnode(mybigkey): - #if we've already hit this node before, we're already recursing on the dependencies. - #no need to recurse again. - if myparent: - self.digraph.addnode(mybigkey,myparent) - return 1 - mytype,myroot,mykey=string.split(mybigkey) - if mytype=="binary": - if not self.db[portage.root]["bintree"].exists_specific(mykey): - print "\n\n!!!",mytype,mykey,"not found (possibly blocked by package.mask)\n" - sys.exit(1) - mytbz2=xpak.tbz2(self.db[portage.root]["bintree"].getname(mykey)) - edepend=["",string.join(mytbz2.getelements("RDEPEND")," ")] - else: - #ebuild specified - if not self.db[myroot]["porttree"].exists_specific(mykey): - print "\n\n!!!",mytype,mykey,"not found (possibly blocked by package.mask)\n" - sys.exit(1) - mydep={} - myebuild=self.db[myroot]["porttree"].getname(mykey) - edepend=portage.doebuild(myebuild,"depend",myroot,1,edebug) - if edepend==1: - print "!!! emerge aborting." - sys.exit(1) - mydep={} - #if portage.root=="/": - # mydep["/"]=edepend[0]+" "+edepend[1] - #else: - # mydep["/"],mydep[portage.root]=edepend - if myroot=="/": - mydep["/"]=edepend[0]+" "+edepend[1] - else: - mydep["/"],mydep[myroot]=edepend - self.digraph.addnode(mybigkey,myparent) - for dep in mydep.keys(): - mycheck=self.db[dep]["vartree"].depcheck(mydep[dep]) - if mycheck[0]==0: - print "!!! depgraph.create() error: string format:",mydep - return 0 - for x in mycheck[1]: - mynew=self.match(x,dep) - if not self.digraph.hasnode(mynew): - if not self.create(mynew,mybigkey): - return 0 - else: - self.digraph.addnode(mynew,mybigkey) - return 1 - - def altlist(self): - mygraph=self.digraph.copy() - dolist=["/"] - retlist=[] - for x in self.db.keys(): - self.db[x]["merge"]=[] - if x not in dolist: - dolist.append(x) - while (not mygraph.empty()): - mycurkey=mygraph.firstzero() - if not mycurkey: - print "!!! Error: circular dependencies" - sys.exit(1) - splitski=string.split(mycurkey) - self.db[splitski[1]]["merge"].append(splitski) - mygraph.delnode(mycurkey) - for x in dolist: - for y in self.db[x]["merge"]: - retlist.append(y) - return retlist - - def syscreate(self,mylines): - for x in mylines: - myline=string.join(string.split(x)) - if not len(myline): - continue - if myline[0]=="#": - continue - if "update" not in self.mymode: - mycheck=self.db[portage.root]["vartree"].depcheck(myline) - if mycheck[0]==0: - print "\n!!! Warning:",myline,"has an invalid depstring\n" - continue - if mycheck[1]==None: - continue - for x in mycheck[1]: - self.create(self.match(myline)) - else: - self.create(self.match(myline)) - - def match(self,mydep,myroot=portage.root): - myeb=self.db[portage.root]["porttree"].dep_bestmatch(mydep) - if not myeb: - print "\n!!! Error: couldn't find match for",mydep,"\n" - sys.exit(1) - if "--usepkg" in self.myopts: - mypk=self.db[portage.root]["bintree"].dep_bestmatch(mydep) - if myeb==mypk: - myk="binary "+portage.root+" "+mypk - else: - myk="ebuild "+myroot+" "+myeb - else: - myk="ebuild "+myroot+" "+myeb - return myk - - def display(self,mylist): - for x in mylist: - if self.db[x[1]]["vartree"].exists_specific(x[2]): - addl=" \x1b[33;01mR\x1b[0m " - elif self.db[x[1]]["vartree"].exists_specific_cat(x[2]): - addl=" \x1b[36;01mU\x1b[0m" - else: - addl="\x1b[32;01mN\x1b[0m " - print "["+x[0]+" "+addl+"]",x[2],"to",x[1] - - def merge(self,mylist): - returnme=0 - #above line used by --fetchonly - for x in mylist: - myroot=x[1] - print ">>> emerge",x[2],"to",x[1] - #the last argument in the portage.doebuild() tells doebuild to *not* do dep checking - #(emerge is already handling that) - y=self.db[x[1]]["porttree"].getname(x[2]) - if x[0]=="ebuild": - if "--fetchonly" in self.myopts: - retval=portage.doebuild(y,"fetch",myroot,0,edebug) - if retval: - print - print "!!! Fetch for",y,"failed, continuing..." - print - returnme=1 - elif "--buildpkg" in self.myopts: - #create pkg, then merge pkg - retval=portage.doebuild(y,"clean",myroot,0,edebug) - if retval: - print "!!! emerge aborting on ",y,"." - sys.exit(1) - retval=portage.doebuild(y,"package",myroot,0,edebug) - if retval: - print "!!! emerge aborting on ",y,"." - sys.exit(1) - #dynamically update our database - self.db[portage.root]["bintree"].inject(x[2]) - mytbz2=self.db[portage.root]["bintree"].getname(x[2]) - retval=portage.pkgmerge(mytbz2,myroot) - if retval==None: - print "!!! emerge aborting on ",y,"." - sys.exit(1) - else: - retval=portage.doebuild(y,"clean",myroot,0,edebug) - if retval: - print "!!! emerge aborting on ",y,"." - sys.exit(1) - retval=portage.doebuild(y,"merge",myroot,0,edebug) - if retval: - print "!!! emerge aborting on ",y,"." - sys.exit(1) - #dynamically update our database - else: - #merge the tbz2 - mytbz2=self.db[portage.root]["bintree"].getname(x[2]) - retval=portage.pkgmerge(mytbz2,x[1]) - if retval==None: - print "!!! emerge aborting on ",y,"." - sys.exit(1) - #need to check for errors - self.db[x[1]]["vartree"].inject(x[2]) - if "--autoclean" in self.myopts: - retval=portage.doebuild(y,"clean",myroot,0,edebug) - if retval: - print "!!! emerge aborting on ",y,"." - sys.exit(1) - #my doing an exit this way, --fetchonly can continue to try to - #fetch everything even if a particular download fails. - if "--fetchonly" in self.myopts: - if returnme: - print "\n\n!!! Some fetch errors were encountered. Please see above for details.\n\n" - sys.exit(returnme) - else: - sys.exit(0) - -def post_emerge(retval=0): - global myopts - print - if "--pretend" in myopts: - sys.exit(retval) - root=portage.root - if not os.path.isdir(root+"usr/share/info"): - print " "+root+"usr/share/info doesn't exist, skipping info regeneration." - elif not os.path.exists("/usr/bin/install-info"): - print " /usr/bin/install-info doesn't exist; skipping info regeneration." - else: - print ">>> \x1b[32;01mRegenerating GNU info directory index...\x1b[0m" - if os.path.exists(root+"usr/share/info/dir"): - os.rename(root+"usr/share/info/dir",root+"usr/share/info/dir.old") - icount=0 - for x in os.listdir(root+"usr/share/info"): - if (x[-5:]==".info") or (x[-8:]==".info.gz"): - myso=commands.getstatusoutput("/usr/bin/install-info --dir-file="+root+"usr/share/info/dir "+root+"usr/share/info/"+x)[1] - if myso!="": - print myso - icount=icount+1 - print " Processed",icount,"files." - if portage.settings["CONFIG_PROTECT"]: - print - print ">>> \x1b[32;01mNote:\x1b[0m" - print " Config file protection is enabled." - print " \x1b[32;01mdirs:\x1b[0m "+portage.settings["CONFIG_PROTECT"] - print " \x1b[32;01mmasked-out dirs:\x1b[0m",portage.settings["CONFIG_PROTECT_MASK"] - print " /etc/env.d is hard-coded; type \"emerge --help config\" more information." - print - sys.exit(retval) - -opts=["--help","--pretend","--buildpkg","--usepkg","--autoclean","--clean","--debug","--fetchonly"] -modes=["rsync","system","update","config"] -myopts=[] -mymode=[] -myfiles=[] -edebug=0 -for x in sys.argv[1:]: - if len(x)>=2: - if x[0:2]=="--": - if x in opts: - myopts.append(x) - else: - print "!!! Error:",x,"is an invalid option." - sys.exit(1) - elif x in modes: - if len(mymode)>=1: - print "!!! Error: more than one mode specified on command-line." - print "!!! Available modes:",modes - sys.exit(1) - else: - mymode.append(x) - elif os.path.exists(x): - if not x in myfiles: - myfiles.append(x) - else: - print "!!! Error:",x,"does not exist or is an invalid command-line option." - sys.exit(1) -if not portage.settings.has_key("MAINTAINER"): - if not "--autoclean" in myopts: - myopts.append("--autoclean") -if "--debug" in myopts: - edebug=1 -if "--help" in myopts: - if len(mymode)==0: - print - print "\x1b[01mYou can also type \"emerge --help system\" and \"emerge --help rsync\" for" - print "additional help.\x1b[0m" - print - print "Usage: \x1b[36;01memerge\x1b[0m [ \x1b[32;01moptions\x1b[0m ] [ \x1b[36;01mebuildfile\x1b[0m | \x1b[36;01mtbz2file\x1b[0m ] ..." - print " \x1b[36;01memerge\x1b[0m [ \x1b[32;01moptions\x1b[0m ] \x1b[36;01msystem\x1b[0m" - print " \x1b[36;01memerge\x1b[0m [ \x1b[32;01m--clean\x1b[0m ] \x1b[36;01mrsync" - print - print "Options:" - print " \x1b[32;01m--help\x1b[0m [ mode ]" - print " display this help (specify optional \"rsync\" or \"system\" for" - print " more info)" - print - print " \x1b[32;01m--debug\x1b[0m" - print " tell emerge to run the \x1b[36;01mebuild\x1b[0m command in --debug" - print " mode. In this mode, the bash build environment will run with" - print " the -x option, causing it to output verbose debug information" - print " to stdout. --debug is great for finding bash syntax errors." - print - print " \x1b[32;01m--fetchonly\x1b[0m" - print " Instead of doing any package building, just perform fetches for" - print " all packages (main package as well as all dependencies.)" - print - print " \x1b[32;01m--usepkg\x1b[0m" - print " tell emerge to use binary packages (from $DISTDIR) if they are" - print " available, thus possibly avoiding some time-consuming compiles." - print " This option is useful for CD installs; you can export" - print " DISTDIR=/mnt/cdrom/packages and then use this option to have" - print " emerge \"pull\" binary packages from the CD in order to satisfy" - print " dependencies." - print - print " \x1b[32;01m--buildpkg\x1b[0m" - print " tell emerge to build binary packages for all ebuilds processed" - print " (in addition to actually merging the packages. Useful for" - print " maintainers or if you administrate multiple Gentoo Linux" - print " systems (build once, emerge tbz2s everywhere)." - print - print " \x1b[32;01m--autoclean\x1b[0m" - print " emerge normally cleans out the package-specific temporary" - print " build directory before it starts the building a package. With" - print " --autoclean, it will also clean the directory *after* the" - print " build completes. This option is automatically enabled for" - print " normal users, but maintainers can use this option to enable" - print " autocleaning." - print - print " \x1b[32;01m--pretend\x1b[0m" - print " instead of actually performing the merge, simply display what" - print " ebuilds and tbz2s *would* have been installed if --pretend" - print " weren't used. Using --pretend is strongly recommended before" - print " installing an unfamiliar package. In the printout, N = new," - print " U = upgrading, R = replacing" - print - elif "rsync" in mymode: - print - print " \x1b[36;01memerge rsync" - print " emerge \x1b[32;01m--clean\x1b[36;01m rsync\x1b[0m" - print - print " \"emerge rsync\" initiates an rsync update with cvs.gentoo.org," - print " updating your Portage tree (typically in /usr/portage). This option" - print " will erase any changes that you have made to existing Portage files" - print " so be careful. \"emerge --clean rsync\" does the same thing as \"emerge" - print " rsync\", but files that no longer exist on our server are removed." - print - elif "system" in mymode: - print - print " \x1b[36;01memerge\x1b[0m [ \x1b[32;01moptions\x1b[0m ] \x1b[36;01msystem\x1b[0m" - print - print " \"emerge system\" is the Portage system update command. When run, it" - print " will scan the /etc/make.profile/packages file and determine what" - print " packages need to be installed so that your system meets the minimum" - print " requirements of your current system profile. Note that this doesn't" - print " necessarily bring your system up-to-date at all; instead, it just" - print " ensures that you have no missing parts. For example, if your system" - print " profile specifies that you should have sys-apps/iptables installed" - print " and you don't, then \"emerge system\" will install it (the most" - print " recent version that matches the profile spec) for you. It's always a" - print " good idea to do an \"emerge --pretend system\" before an \"emerge" - print " system\", just so you know what emerge is planning to do." - print - elif "config" in mymode: - outstuff=""" -\x1b[32;01mConfig file management support (preliminary)\x1b[0m - -By default, Portage will \x1b[32;01mnot\x1b[0m overwrite any files inside the directories listed -in the CONFIG_PROTECT variable in /etc/make.globals (which is set to /etc and -/var/qmail/control, typically.) Instead, if Portage is asked to overwrite a -file in one of these directories (or a subdirectory inside one of these -directories), it will install the file with an alternate filename, using a -._cfgXXXX_ prefix (where XXXX is a four-digit number, starting with 0000) so -that the original config file is preserved. - -The purpose of this feature is to give the administrator the option to review -any potential changes to files in these directories before they are applied. -Soon, we will have a special \"emerge config\" system that will step the -administrator through an interactive process, allowing him/her to review the -changes and selectively merge these changes into the production config files. -But right now, \"emerge config\" doesn't exist, so users will need to scan /etc -and protected dirs for any ._cfgXXXX_ files, and then manually review them and -apply any desired changes to their production files: - -# find /etc -iname ._cfg????_* - -You can disable this feature by setting CONFIG_PROTECT="" in /etc/make.conf. -Then, Portage will mercilessly auto-update your config files. Alternatively, -you can leave Config File Protection on but tell Portage that it can overwrite -files in certain specific /etc subdirectories. For example, if you wanted -Portage to automatically update your rc scripts and your wget configuration, -but didn't want any other changes made without your explicit approval, you'd -add this to /etc/make.conf: - -CONFIG_PROTECT_MASK="/etc/wget /etc/rc.d" - -""" - print outstuff - sys.exit(1) - -if "--pretend" in myopts: - print - print "These are the packages that I would merge, in order." - print - -if "rsync" in mymode: - if not os.path.exists("/usr/bin/rsync"): - print "!!! /usr/bin/rsync does not exist, so rsync support is disabled." - sys.exit(1) - rclean=0 - myportdir=portage.settings["PORTDIR"] - if myportdir[-1]=="/": - myportdir=myportdir[:-1] - if not os.path.exists(myportdir): - print ">>>",myportdir,"not found, creating it." - os.makedirs(myportdir,0755) - if "--clean" in myopts: - #we'll --delete files when we rsync - rclean=1 - mycommand="/usr/bin/rsync -rlptDv --stats --progress " - if rclean: - mycommand=mycommand+"--delete --exclude='distfiles/*' --exclude='packages/*' " - mycommand=mycommand+"rsync://cvs.gentoo.org/gentoo-x86-portage/* "+myportdir - print ">>> starting rsync with cvs.gentoo.org..." - #protect users that did not set a default umask - os.umask(022) - sys.exit(os.system(mycommand)) - -if ("system" in mymode) or ("update" in mymode): - #system profile mode - if os.path.exists(portage.root+"etc/make.profile/packages"): - pfile=portage.root+"etc/make.profile/packages" - elif os.path.exists("/etc/make.profile/packages"): - print ">>> Couldn't find",portage.root+"/etc/make.profile/packages;" - print ">>> Using /etc/make.profile/packages instead." - pfile="/etc/make.profile/packages" - elif os.path.exists(os.path.normpath(portage.settings["PORTDIR"]+"/profiles/default/packages")): - print ">>> Couldn't find",portage.root+"/etc/make.profile/packages;" - print ">>> Couldn't find /etc/make.profile/packages;" - print ">>> Found default profile in /usr/portage/profiles; using it instead." - pfile=os.path.normpath(portage.settings["PORTDIR"]+"/profiles/default/packages") - else: - print "!!! Couldn't find",portage.root+"/etc/make.profile/packages;" - print "!!! Couldn't find /etc/make.profile/packages;" - print "!!! Couldn't find /usr/portage/profiles/default/packages;" - print "\"system\" mode unavailable." - sys.exit(1) - myfile=open(pfile,"r") - mylines=myfile.readlines() - myfile.close() - mydepgraph=depgraph(mymode,myopts) - print "Calculating system dependencies", - mydepgraph.syscreate(mylines) - print " done!" - if "--pretend" in myopts: - mydepgraph.display(mydepgraph.altlist()) - else: - mydepgraph.merge(mydepgraph.altlist()) - post_emerge() -mydepgraph=depgraph(mymode,myopts) -for mypkg in myfiles: - if mypkg[-5:]==".tbz2": - mytype="binary" - mytbz2=xpak.tbz2(mypkg) - mykey=mytbz2.getelements("CATEGORY")[0]+"/"+os.path.basename(mypkg)[:-5] - elif mypkg[-7:]==".ebuild": - mytype="ebuild" - mykey=os.path.basename(os.path.abspath(mypkg+"/../.."))+"/"+os.path.basename(mypkg)[:-7] - else: - print "!!! Error:",x,"is neither an ebuild nor a .tbz2 package." - sys.exit(1) - print "Calculating dependencies", - mydepgraph.create(mytype+" "+portage.root+" "+mykey) - print " done!" - if "--pretend" in myopts: - mydepgraph.display(mydepgraph.altlist()) - else: - mydepgraph.merge(mydepgraph.altlist()) - post_emerge() diff --git a/sys-apps/portage/files/1.5/bin/env-update b/sys-apps/portage/files/1.5/bin/env-update deleted file mode 100644 index 20c3127be1b1..000000000000 --- a/sys-apps/portage/files/1.5/bin/env-update +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/spython - -import portage -portage.env_update() diff --git a/sys-apps/portage/files/1.5/bin/find-packages b/sys-apps/portage/files/1.5/bin/find-packages deleted file mode 100755 index d808dd5777d6..000000000000 --- a/sys-apps/portage/files/1.5/bin/find-packages +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - - -filelist=`sed "s/['\"]/\\\&/g"` - -for f in $filelist; do - file=`grep -r "$f ->" /var/db/pkg/*/*/CONTENTS` - file=${file#/*/*/*/*/} - file=${file%*/CONTENTS:*} - echo $file -done | sort -u - - diff --git a/sys-apps/portage/files/1.5/bin/find-requires b/sys-apps/portage/files/1.5/bin/find-requires deleted file mode 100755 index eaf720da3973..000000000000 --- a/sys-apps/portage/files/1.5/bin/find-requires +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh - -# note this works for both a.out and ELF executables -# it also auto-generates requirment lines for shell scripts - -ulimit -c 0 - -filelist=`sed "s/['\"]/\\\&/g"` -exelist=`echo $filelist | xargs -r file | grep ":.*executable" | cut -d: -f1 ` -scriptlist=`echo $filelist | xargs -r file | egrep ":.* (commands|script) " | cut -d: -f1 ` -liblist=`echo $filelist | xargs -r file | grep ":.*shared object" | cut -d : -f1 ` - -for f in $exelist; do - if [ -x $f ]; then - ldd $f | awk '/=>/ { print $1 }' - fi -done | sort -u | sed "s/['\"]/\\\&/g" | xargs -r -n 1 basename | grep -v 'libNoVersion.so' | sort -u - -for f in $liblist; do - ldd $f | awk '/=>/ { print $1 }' -done | sort -u | sed "s/['\"]/\\\&/g" | xargs -r -n 1 basename | grep -v 'libNoVersion.so' | sort -u - -for f in $scriptlist; do - if [ -x $f ]; then - head -1 $f | sed -e 's/^\#\![ ]*//' | cut -d" " -f1 - fi -done | sort -u - -#for f in $liblist $exelist ; do -# objdump -p $f | awk ' -# BEGIN { START=0; LIBNAME=""; } -# /Version References:/ { START=1; } -# /required from/ && (START==1) { -# sub(/:/, "", $3); -# LIBNAME=$3; -# } -# (START==1) && (LIBNAME!="") && ($4~/^GLIBC_*/) { print LIBNAME "(" $4 ")"; } -# /^$/ { START=0; } -# ' -#done | sort -u - diff --git a/sys-apps/portage/files/1.5/bin/fowners b/sys-apps/portage/files/1.5/bin/fowners deleted file mode 100755 index 934abc463bbe..000000000000 --- a/sys-apps/portage/files/1.5/bin/fowners +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - if [ ${#} -ne 2 ] - then - echo "${0}: two arguments needed" - return - fi - chown ${1} ${D}${2} - - - diff --git a/sys-apps/portage/files/1.5/bin/fperms b/sys-apps/portage/files/1.5/bin/fperms deleted file mode 100755 index 0a60e078ed97..000000000000 --- a/sys-apps/portage/files/1.5/bin/fperms +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - if [ ${#} -ne 2 ] - then - echo "${0}: two arguments needed" - return - fi - chmod ${1} ${D}${2} diff --git a/sys-apps/portage/files/1.5/bin/megadigest b/sys-apps/portage/files/1.5/bin/megadigest deleted file mode 100755 index df5a6422f42d..000000000000 --- a/sys-apps/portage/files/1.5/bin/megadigest +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash -source /etc/make.conf -echo -n "MD5 digest analysis started " -date -echo -for x in `find /usr/portage/ -iname *.ebuild` -do - ebuild ${x} batchdigest -done -echo -echo -n "MD5 digest analysis completed " -date diff --git a/sys-apps/portage/files/1.5/bin/megadownload b/sys-apps/portage/files/1.5/bin/megadownload deleted file mode 100755 index d21d5f07a537..000000000000 --- a/sys-apps/portage/files/1.5/bin/megadownload +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env bash -for x in `find /usr/portage/ -iname *.ebuild` -do -ebuild ${x} fetch > /tmp/portage-download.log 2>&1 -if [ $? -ne 0 ] -then - echo '!!!' couldn\'t download all files for ${x} - cat /tmp/portage-download.log - echo - echo - echo - echo - echo -fi -done diff --git a/sys-apps/portage/files/1.5/bin/megatouch b/sys-apps/portage/files/1.5/bin/megatouch deleted file mode 100755 index fac0859aac84..000000000000 --- a/sys-apps/portage/files/1.5/bin/megatouch +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env bash -DISTDIR=/usr/portage/distfiles -PORTDIR=/usr/portage -export PATH="/usr/lib/portage/bin:${PATH}" -echo -n "Source archive pruning started " -date -#will only prune files not touched for 60 days -touch ${DISTDIR}/.cleaned -d "60 days ago" -sleep 2 -cd ${PORTDIR} -for x in `find ${PORTDIR}/ -iname '*.ebuild'` -do - ebuild ${x} touch -done -if [ ! -d ${DISTDIR}-old ] -then - mkdir ${DISTDIR}-old -fi -cd ${DISTDIR} -for x in `find ! -newer .cleaned | grep ./` -do - mv $x ${DISTDIR}-old -done -echo -n "Source archive pruning completed " -date diff --git a/sys-apps/portage/files/1.5/bin/newbin b/sys-apps/portage/files/1.5/bin/newbin deleted file mode 100755 index 91e6e4c4e8df..000000000000 --- a/sys-apps/portage/files/1.5/bin/newbin +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -rm -rf ${T}/${2} -cp ${1} ${T}/${2} -dobin ${T}/${2}
\ No newline at end of file diff --git a/sys-apps/portage/files/1.5/bin/newdoc b/sys-apps/portage/files/1.5/bin/newdoc deleted file mode 100755 index 4c7286b751a4..000000000000 --- a/sys-apps/portage/files/1.5/bin/newdoc +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -rm -rf ${T}/${2} -cp ${1} ${T}/${2} -dodoc ${T}/${2} diff --git a/sys-apps/portage/files/1.5/bin/newexe b/sys-apps/portage/files/1.5/bin/newexe deleted file mode 100755 index 09e91e02f476..000000000000 --- a/sys-apps/portage/files/1.5/bin/newexe +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -rm -rf ${T}/${2} -cp ${1} ${T}/${2} -doexe ${T}/${2}
\ No newline at end of file diff --git a/sys-apps/portage/files/1.5/bin/newins b/sys-apps/portage/files/1.5/bin/newins deleted file mode 100755 index d661d9db5236..000000000000 --- a/sys-apps/portage/files/1.5/bin/newins +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -rm -rf ${T}/${2} -cp ${1} ${T}/${2} -doins ${T}/${2} diff --git a/sys-apps/portage/files/1.5/bin/newlib.a b/sys-apps/portage/files/1.5/bin/newlib.a deleted file mode 100755 index 6749b8168996..000000000000 --- a/sys-apps/portage/files/1.5/bin/newlib.a +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -rm -rf ${T}/${2} -cp ${1} ${T}/${2} -dolib.a ${T}/${2}
\ No newline at end of file diff --git a/sys-apps/portage/files/1.5/bin/newlib.so b/sys-apps/portage/files/1.5/bin/newlib.so deleted file mode 100755 index a8b9bef223ca..000000000000 --- a/sys-apps/portage/files/1.5/bin/newlib.so +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -rm -rf ${T}/${2} -cp ${1} ${T}/${2} -dolib.so ${T}/${2} diff --git a/sys-apps/portage/files/1.5/bin/newman b/sys-apps/portage/files/1.5/bin/newman deleted file mode 100755 index 029677b08afb..000000000000 --- a/sys-apps/portage/files/1.5/bin/newman +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -rm -rf ${T}/${2} -cp ${1} ${T}/${2} -doman ${T}/${2}
\ No newline at end of file diff --git a/sys-apps/portage/files/1.5/bin/newsbin b/sys-apps/portage/files/1.5/bin/newsbin deleted file mode 100755 index 5009b26ffe82..000000000000 --- a/sys-apps/portage/files/1.5/bin/newsbin +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -rm -rf ${T}/${2} -cp ${1} ${T}/${2} -dosbin ${T}/${2}
\ No newline at end of file diff --git a/sys-apps/portage/files/1.5/bin/pkglist b/sys-apps/portage/files/1.5/bin/pkglist deleted file mode 100755 index 45c0b7487409..000000000000 --- a/sys-apps/portage/files/1.5/bin/pkglist +++ /dev/null @@ -1,38 +0,0 @@ -#! /usr/bin/env python - -# Very simple program that searches the /usr/portage tree for -# ebuilds that match a key provided by the user. - -from os.path import splitext, walk, isdir -import re - -installRoot = "/var/db/pkg" - -# inelegant routine to assemble the install directory that is associated -# with a given portage directory -def getinstalldir(portagedir): - path = portagedir.split('/') - installdir = path[4] - for dir in path[5:-1]: - installdir += "/" + dir - return installdir - -# workhorse routine: for each directory look for ebuild files and -# interrogate each ebuild file to see if it matches the key and, -# if it does, also check to see if it is installed. -def visit(dummy, dirname, files): - for file in files: - (base, ext) = splitext(file) - if (ext == ".ebuild"): - installname = getinstalldir(dirname) + '/' + base - print installname - - -if __name__ == '__main__': - import sys - if (len(sys.argv) != 1): - print "Usage: pkglist" - sys.exit(1) - dummy = "" # walk requires three arguments - walk(installRoot, visit, dummy) - diff --git a/sys-apps/portage/files/1.5/bin/pkgmerge b/sys-apps/portage/files/1.5/bin/pkgmerge deleted file mode 100755 index 39f1944c2ef9..000000000000 --- a/sys-apps/portage/files/1.5/bin/pkgmerge +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/env python - -import portage -import sys -import os -import xpak -import string - -#build our package digraph - -def digraph_create(digraph,mykey,myprovides=None): - mytbz2=xpak.tbz2(bintree.getname(mykey)) - mydep=mytbz2.getelements("RDEPEND") - digraph.addnode(mykey,myprovides) - mycheck=roottree.depcheck(string.join(mydep," ")) - if mycheck[0]==0: - print "!!! Error: RDEPEND string formatted incorrectly:",mydep - return None - for x in mycheck[1]: - mymatch=bintree.dep_bestmatch(x) - if mymatch=="": - print "!!! Error: can't resolve dependency --",x - return None - if not digraph_create(digraph,mymatch,mykey): - return None - return 1 - -#main program loop -myvirtuals=portage.getvirtuals(portage.root) -roottree=portage.vartree(portage.root,myvirtuals) -bintree=portage.binarytree("/",myvirtuals) -pretend=0 -if len(sys.argv)>=2: - if sys.argv[1]=="--pretend": - print "These are the packages that I would merge, in order:" - pretend=1 - del sys.argv[1] - elif sys.argv[1]=="--help": - print "Usage: pkgmerge [--pretend] pkg1.tbz2 [pkg2.tbz2]..." - sys.exit(1) -for mypkg in sys.argv[1:]: - digraph=portage.digraph() - mytbz2=xpak.tbz2(mypkg) - mykey=mytbz2.getelements("CATEGORY")[0]+"/"+os.path.basename(mypkg)[:-5] - digraph_create(digraph,mykey) - while not digraph.empty(): - mykey=digraph.firstzero() - if not mykey: - print "!!! Error: circular dependencies" - sys.exit(1) - mytbz2=bintree.getname(mykey) - if pretend: - print mytbz2 - else: - portage.pkgmerge(mytbz2) - digraph.delnode(mykey) - diff --git a/sys-apps/portage/files/1.5/bin/pkgmerge.new b/sys-apps/portage/files/1.5/bin/pkgmerge.new deleted file mode 100755 index 0780a7dc6117..000000000000 --- a/sys-apps/portage/files/1.5/bin/pkgmerge.new +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/env python - -import portage -import sys -import os -import xpak -import string - -#beautiful directed graph functions - -def dig_addnode(digraph,mykey,myprovides): - if not digraph.has_key(mykey): - if myprovides==None: - digraph[mykey]=[0,[]] - else: - digraph[mykey]=[0,[myprovides]] - digraph[myprovides][0]=digraph[myprovides][0]+1 - return - digraph[mykey]=[digraph[mykey][0],digraph[mykey][1].append(myprovides)] - -def dig_delnode(digraph,mykey): - if not digraph.has_key(mykey): - return - for x in digraph[mykey][1]: - digraph[x][0]=digraph[x][0]-1 - del digraph[mykey] - -def dig_firstzero(digraph): - for x in digraph.keys(): - if digraph[x][0]==0: - return x - return None - -#build our package digraph - -def digraph_create(digraph,mykey,myprovides=None): - mytbz2=xpak.tbz2(bintree.getname(mykey)) - mydep=mytbz2.getelements("RDEPEND") - dig_addnode(digraph,mykey,myprovides) - mycheck=roottree.depcheck(string.join(mydep," ")) - if mycheck[0]==0: - print "!!! Error: RDEPEND string formatted incorrectly:",mydep - return None - for x in mycheck[1]: - mymatch=bintree.dep_bestmatch(x) - if mymatch=="": - print "!!! Error: can't resolve dependency --",x - return None - if not digraph_create(digraph,mymatch,mykey): - return None - return 1 - -#main program loop -myvirtuals=portage.getvirtual(portage.root) -roottree=portage.vartree(portage.root,myvirtuals) -bintree=portage.binarytree("/",myvirtuals) -pretend=0 -if len(sys.argv)>=2: - if sys.argv[1]=="--pretend": - print "These are the packages that I would merge, in order:" - pretend=1 - del sys.argv[1] - elif sys.argv[1]=="--help": - print "Usage: pkgmerge [--pretend] pkg1.tbz2 [pkg2.tbz2]..." - sys.exit(1) -for mypkg in sys.argv[1:]: - digraph={} - mytbz2=xpak.tbz2(mypkg) - mykey=mytbz2.getelements("CATEGORY")[0]+"/"+mypkg[:-5] - digraph_create(digraph,mykey) - while (len(digraph)): - mykey=dig_firstzero(digraph) - if not mykey: - print "!!! Error: circular dependencies" - sys.exit(1) - mytbz2=bintree.getname(mykey) - if pretend: - print mytbz2 - else: - portage.pkgmerge(mytbz2) - dig_delnode(digraph,mykey) - diff --git a/sys-apps/portage/files/1.5/bin/pkgname b/sys-apps/portage/files/1.5/bin/pkgname deleted file mode 100755 index 45e07b728f0d..000000000000 --- a/sys-apps/portage/files/1.5/bin/pkgname +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/spython - -import portage -import sys - -a=portage.pkgsplit(sys.argv[1]) -if a: - print a[0],a[1],a[2][1:] - sys.exit(0) -else: - print '!!! Error: package name is invalid.' - sys.exit(1) diff --git a/sys-apps/portage/files/1.5/bin/pkgsearch b/sys-apps/portage/files/1.5/bin/pkgsearch deleted file mode 100755 index cbd1fb77309c..000000000000 --- a/sys-apps/portage/files/1.5/bin/pkgsearch +++ /dev/null @@ -1,44 +0,0 @@ -#! /usr/bin/env python - -# Very simple program that searches the /usr/portage tree for -# ebuilds that match a key provided by the user. - -from os.path import splitext, walk, isdir -import re - -portageRoot = "/usr/portage" -installRoot = "/var/db/pkg" - -# inelegant routine to assemble the install directory that is associated -# with a given portage directory -def getinstalldir(portagedir): - path = portagedir.split('/') - installdir = installRoot - for dir in path[3:-1]: - installdir += "/" + dir - return installdir - -# workhorse routine: for each directory look for ebuild files and -# interrogate each ebuild file to see if it matches the key and, -# if it does, also check to see if it is installed. -def visit(key, dirname, files): - for file in files: - (base, ext) = splitext(file) - if (ext == ".ebuild"): - if (re.search(key.lower(), base.lower())): - # package found. Is it also installed? - installname = getinstalldir(dirname) + '/' + base - if (isdir(installname)): - print dirname + "/" + file + "\t (installed)" - else: - print dirname + "/" + file - - -if __name__ == '__main__': - import sys - if (len(sys.argv) != 2): - print "Usage: pkgsearch key" - sys.exit(1) - key = sys.argv[1] - walk(portageRoot, visit, key) - diff --git a/sys-apps/portage/files/1.5/bin/prepall b/sys-apps/portage/files/1.5/bin/prepall deleted file mode 100755 index b7d20b9bfcce..000000000000 --- a/sys-apps/portage/files/1.5/bin/prepall +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh - -prepallman -prepallinfo -prepallstrip - -#this should help to ensure that all (most?) shared libraries are executable -cd ${D} -for i in opt/*/lib lib usr/lib usr/X11R6/lib -do - [ -d $i ] && continue - for j in $i/*.so.* $i/*.so - do - [ -L $j ] && continue - chmod +x $j - done -done - -# Move aclocals -for i in `find ${D} -name "aclocal" -type d` -do - if [ "$i" != "" ] - then - if [ "$i" != "${D}usr/share/aclocal" ] - then - echo moving aclocal: $i - install -d ${D}usr/share/aclocal - mv ${i}/* ${D}usr/share/aclocal - rm -fr ${i} - fi - fi -done - - diff --git a/sys-apps/portage/files/1.5/bin/prepalldocs b/sys-apps/portage/files/1.5/bin/prepalldocs deleted file mode 100755 index b2ccc490709e..000000000000 --- a/sys-apps/portage/files/1.5/bin/prepalldocs +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -z=`find ${D}/usr/share/doc -not -name "*.gz" -not -name "*.js"` - -for y in ${z} -do - if [ -h ${y} ] - then - #symlink - linkto=`ls -l ${y} | sed -e "s:${D}::" | awk '{ printf ("%s.gz",$11) } '` - echo "$linkto $y.gz" - ln -sf ${linkto} ${y}.gz - rm ${y} - else - if [ -f ${y} ] - then - gzip -f -9 ${y} - fi - fi -done - - - diff --git a/sys-apps/portage/files/1.5/bin/prepallinfo b/sys-apps/portage/files/1.5/bin/prepallinfo deleted file mode 100755 index acf6fdb387d2..000000000000 --- a/sys-apps/portage/files/1.5/bin/prepallinfo +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -[ ! -d ${D}/usr/share/info ] && exit -echo "info:" -cd ${D}/usr/share/info -rm -f dir dir.info dir.info.gz -for x in ${D}/usr/share/info/* -do - [ ! -f $x ] && continue - if [ "${x##*.}" != "gz" ] - then - echo gzipping GNU info file ${x##*/} - gzip -f -9 ${x} - fi -done - - - diff --git a/sys-apps/portage/files/1.5/bin/prepallman b/sys-apps/portage/files/1.5/bin/prepallman deleted file mode 100755 index 5d37ab968f5a..000000000000 --- a/sys-apps/portage/files/1.5/bin/prepallman +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash - -for x in ${D}/opt/*/man/* ${D}/usr/share/man/* ${D}/usr/local/man/* ${D}/usr/X11R6/share/man/* -do - if [ ! -d ${x} ] - then - continue - fi - w=`echo ${x}/*` - for y in ${w} - do - if [ -L ${y} ] - then - #symlink - mylink=${y} - linkto=`readlink ${y}` - if [ "${linkto:0:1}" == "/" ] - then - #absolute path; remove any weirdly embedded ${D}'s - linkto=${linkto/${D}/} - fi - if [ "${linkto##*.}" != "gz" ] - then - linkto=${linkto}.gz - fi - if [ "${mylink##*.}" != "gz" ] - then - mylink=${mylink}.gz - fi - echo "fixing man page symlink: ${mylink##*/}" - ln -sf ${linkto} ${mylink} - if [ ${y} != ${mylink} ] - then - echo "removing old symlink: ${y##*/}" - rm ${y} - fi - elif [ -f ${y} ] - then - if [ "${y##*.}" != "gz" ] - then - gzip -f -9 ${y} - echo "gzipping man page: ${y}" - fi - fi - done -done diff --git a/sys-apps/portage/files/1.5/bin/prepallstrip b/sys-apps/portage/files/1.5/bin/prepallstrip deleted file mode 100755 index fed2fa442d24..000000000000 --- a/sys-apps/portage/files/1.5/bin/prepallstrip +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash - -if [ -n "${DEBUG}" ] -then - exit -fi -echo "strip:" -z=`find ${D} -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 -or -name "*.so" -or -name "*.so.*" \)` - -for x in $z -do - f=`file $x` - if [ "${f/*LSB executable*/1}" == "1" ] - then - echo $x - strip ${x} - fi - if [ "${f/*LSB shared object*/1}" == "1" ] - then - echo $x - strip --strip-unneeded ${x} - fi -done - - - - - - - - - - - - diff --git a/sys-apps/portage/files/1.5/bin/prepinfo b/sys-apps/portage/files/1.5/bin/prepinfo deleted file mode 100755 index 9e0e15dbc849..000000000000 --- a/sys-apps/portage/files/1.5/bin/prepinfo +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -if [ -z "$1" ] -then - rm -f ${D}usr/info/dir - gzip -f -9 ${D}usr/info/* -else - rm -f ${D}$1/info/dir - gzip -f -9 ${D}$1/info/* -fi - diff --git a/sys-apps/portage/files/1.5/bin/preplib b/sys-apps/portage/files/1.5/bin/preplib deleted file mode 100755 index 0e20886875df..000000000000 --- a/sys-apps/portage/files/1.5/bin/preplib +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -if [ -z "$1" ] -then - z=${D}usr/lib -else - z=${D}$1/lib -fi - -ldconfig -n -N ${z} diff --git a/sys-apps/portage/files/1.5/bin/preplib.so b/sys-apps/portage/files/1.5/bin/preplib.so deleted file mode 100755 index 896c7c089697..000000000000 --- a/sys-apps/portage/files/1.5/bin/preplib.so +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -if [ -n "${DEBUG}" ] -then - exit -fi -for x in $@ -do - strip --strip-unneeded ${D}${x}/*.so* -done - diff --git a/sys-apps/portage/files/1.5/bin/prepman b/sys-apps/portage/files/1.5/bin/prepman deleted file mode 100755 index 4e71c87c59aa..000000000000 --- a/sys-apps/portage/files/1.5/bin/prepman +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -if [ -z "$1" ] -then - z=${D}usr/man -else - z=${D}$1/man -fi - -for x in ${z}/* -do - for y in ${x}/* - do - if [ -h ${y} ] - then - #symlink - linkto=`ls -l ${y} | sed -e "s:${D}::" | awk '{ printf ("%s.gz",$11) } '` - echo "$linkto $y.gz" - ln -sf ${linkto} ${y}.gz - rm ${y} - else - gzip -f -9 ${y} - fi - done -done - - - diff --git a/sys-apps/portage/files/1.5/bin/prepstrip b/sys-apps/portage/files/1.5/bin/prepstrip deleted file mode 100755 index b4db5c1cd52d..000000000000 --- a/sys-apps/portage/files/1.5/bin/prepstrip +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash -if [ -n "${DEBUG}" ] -then - exit -fi -for x in $@ -do - strip ${D}${x}/* -done
\ No newline at end of file diff --git a/sys-apps/portage/files/1.5/bin/queryhost.sh b/sys-apps/portage/files/1.5/bin/queryhost.sh deleted file mode 100644 index 61213f379f07..000000000000 --- a/sys-apps/portage/files/1.5/bin/queryhost.sh +++ /dev/null @@ -1,27 +0,0 @@ - -#!/bin/sh - -hping() { - host=`echo $1 | sed -e 's:.*\://::' -e 's:/.*::'` - result=`ping -c3 -q ${host} 2>/dev/null` - if [ -n "$result" ] - then - if [ -z "`echo $result | sed 's:.*0 packets received.*:N:'`" ] - then - result=`echo $result | sed -e "s:.*= [0-9|\.]*/::" -e "s:/[0-9|\.]* ms::" | awk '{ printf ("%04i\n",(atof $1)) }'` - echo $result $1 - else - echo 9999 $1 - fi - fi -} -pingall() { - - for i in $1 - do - hping $i - done -} -pingall "$1" | sort | sed -e "s:[0-9]* ::" -#pingall "$1" - diff --git a/sys-apps/portage/files/1.5/bin/tbz2tool b/sys-apps/portage/files/1.5/bin/tbz2tool Binary files differdeleted file mode 100755 index 9286f66a5895..000000000000 --- a/sys-apps/portage/files/1.5/bin/tbz2tool +++ /dev/null diff --git a/sys-apps/portage/files/1.5/bin/use b/sys-apps/portage/files/1.5/bin/use deleted file mode 100755 index eed5d7ac7fee..000000000000 --- a/sys-apps/portage/files/1.5/bin/use +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/spython -import string -import portage -import sys - -myuse=portage.settings["USE"] -myuse=string.split(myuse) -for x in myuse: - if x==sys.argv[1]: - print x - sys.exit(0) -sys.exit(1) diff --git a/sys-apps/portage/files/1.5/bin/xpak b/sys-apps/portage/files/1.5/bin/xpak deleted file mode 100755 index 36ee0d75b649..000000000000 --- a/sys-apps/portage/files/1.5/bin/xpak +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/python - -import xpak -import sys -if len(sys.argv)!=3: - print "xpak: expecting three arguments." - sys.exit(1) -xpak.xpak(sys.argv[1],sys.argv[2]) - diff --git a/sys-apps/portage/files/1.5/cnf/make.conf b/sys-apps/portage/files/1.5/cnf/make.conf deleted file mode 100644 index 3eaba0caaad1..000000000000 --- a/sys-apps/portage/files/1.5/cnf/make.conf +++ /dev/null @@ -1,84 +0,0 @@ -# Copyright 2000 Daniel Robbins, Gentoo Technologies, Inc. -# Contains system settings for Portage system - -# Recommended USE variables -# ------------------------- -# -# USE="slang readline gpm berkdb gdbm tcpd pam libwww ssl -# lm_sensors lvm pcmcia-cs alsa -# nls mmx mitshm -# esd lcms gif sdl vorbis ogg -# gnome gtk X qt kde motif opengl mozilla" - -# Other stable USE flags -# ---------------------- -# 3dnow perl python tcltk java guile ruby mysql postgres ldap odbc -# ggi fbcon svga tex bonobo nas qtmt aalib oss arts libg++ objprelink -# -# Other experimental/unstable flags -# --------------------------------- -# directfb gd ungif gtkhtml socks5 pdflib qt-embedded jfs -# mta-tls mta-ldap mta-mysql -# -# Other build related use flags -# ----------------------------- -# pic static build bootstrap simpleinit - -# Host specific settings - -# When selecting optimization settings, you have two options: -# The more optimization you add, the less compatible your binaries -# wil become with other (inferior) processors. -# If you optimize for a Pentium, the binaries won't run on an 486, -# but will work faster on the Pentium than those optimized for i486. -# Insert: explanation about differences between march and mcpu. - -# For i386 machines w/ math coprocessor (least common denominator): - -#CHOST="i386-pc-linux-gnu" -#CFLAGS="-mcpu=i386 -march=i386 -O3 -pipe" -#CXXFLAGS="-mcpu=i386 -march=i386 -O3 -pipe" - -# For i486 machines -# ----------------- - -#CHOST="i486-pc-linux-gnu" -#CFLAGS="-mcpu=i486 -march=i486 -O3 -pipe" -#CXXFLAGS="-mcpu=i486 -march=i486 -O3 -pipe" - -# For generic Pentium/Pentium MMX -# ----------------------------------------------------- - -#CHOST="i586-pc-linux-gnu" -#CFLAGS="-mcpu=i586 -march=i586 -O3 -pipe" -#CXXFLAGS="-mcpu=i586 -march=i586 -O3 -pipe" - -# For the AMD k6-2/3, uses MMX and 3D-Now! -# Can someone verify whether k6-1 goes with Pentium MMX -# or with k6-2/3? After all it doesn't have 3DNow! -# ------------------------------------------------------ - -#CHOST="i586-pc-linux-gnu" -#CFLAGS="-mcpu=k6 -march=k6 -O3 -pipe" -#CXXFLAGS="-mcpu=k6 -march=k6 -O3 -pipe" - -# For P-Pro PII PIII and Athlon-class machines -# -------------------------------------------- - -#CHOST="i686-pc-linux-gnu" -#CFLAGS="-mcpu=i686 -march=i686 -O3 -pipe" -#CXXFLAGS="-mcpu=i686 -march=i686 -O3 -pipe" - -# ------------------------------------------------------- -# Note: there is a possibility of a special optimization -# for Athlons, i.e. -mcpu=athlon. This is available as a -# patch to the 2.9x gcc tree, and gentoo doesn't use this -# patch. It is incorporated into gcc-3 (I think) and so -# this file should be changed when we switch to gcc-3. -# ------------------------------------------------------- - -# Uncomment if you wanna use PROZILLA for download -#FETCHCOMMAND="/usr/bin/proz -s \${x} -P \${DISTDIR}" - -# Uncomment if you are a package maintainer with cvs access -#MAINTAINER="yes" diff --git a/sys-apps/portage/files/1.5/cnf/make.globals b/sys-apps/portage/files/1.5/cnf/make.globals deleted file mode 100644 index b71477871e1e..000000000000 --- a/sys-apps/portage/files/1.5/cnf/make.globals +++ /dev/null @@ -1,63 +0,0 @@ -# Copyright 2000 Daniel Robbins, Gentoo Technologies, Inc. -# System-wide defaults for the Portage system - -#proxy settings PROXY(both), or HTTP_PROXY/FTP_PROXY -#PROXY=freebox.gentoo.org:3128 -#HTTP_PROXY= -#FTP_PROXY= -GENTOO_MIRRORS="http://www.ibiblio.org/gentoo" - -# Host-type -CHOST=i686-pc-linux-gnu - -#PORTAGE_TMPDIR=${ROOT}/var/tmp -PORTAGE_TMPDIR=/var/tmp -#/var/tmp without ${ROOT} seems more appropriate - -# Directory used for the build process -BUILD_PREFIX=${PORTAGE_TMPDIR}/portage -PKG_TMPDIR=${PORTAGE_TMPDIR}/portage-pkg - -PORTDIR=/usr/portage -DISTDIR=${PORTDIR}/distfiles -PKGDIR=${PORTDIR}/packages -RPMDIR=${PORTDIR}/rpm -CURRENTFILE=${PORTDIR}/current-packages -PLATFORM=$CHOST -CONFIG_PROTECT="/etc /var/qmail/control /opt/kde2.1/share/config /opt/kde2.2/share/config /usr/share/config" - -# Options passed to make during the build process -MAKEOPTS="-j2" - -# Fetching command (5 tries, passive ftp for firewall compatibility) -FETCHCOMMAND="/usr/bin/wget -t 5 --passive-ftp \${x} -P \${DISTDIR}" -#For Prozilla (really rocks): -#FETCHCOMMAND="/usr/bin/proz -s \${x} -P \${DISTDIR}" - -# Compile programs with GNOME/SLANG extensions -USE="slang readline gpm berkdb gdbm tcpd pam libwww ssl - lm_sensors lvm pcmcia-cs alsa - nls mitshm - esd lcms gif sdl vorbis ogg - gnome gtk X qt kde motif opengl mozilla" - -# Other stable USE flags -# 3dnow perl python tcltk java guile ruby mysql postgres ldap odbc -# ggi fbcon svga tex bonobo nas qtmt aalib oss arts libg++ pda -# -# Other experimental/unstable flags -# directfb gd ungif gtkhtml socks5 pdflib qt-embedded jfs -# mta-tls mta-ldap mta-mysql -# -# Other build related use flags -# pic static build bootstrap simpleinit -# C Compiler flags - -CFLAGS="-O2 -mcpu=i686 -pipe" - -# C++ Compiler flags -CXXFLAGS=${CFLAGS} - -#Debug build -- if defined, binaries won't be stripped -#DEBUG=true - diff --git a/sys-apps/portage/files/1.5/doc/TODO b/sys-apps/portage/files/1.5/doc/TODO deleted file mode 100644 index 0afca2082303..000000000000 --- a/sys-apps/portage/files/1.5/doc/TODO +++ /dev/null @@ -1,37 +0,0 @@ -Here's a list of stuff to add/fix in Portage 1.5: - -Add a flag to force a merge even if RDEPEND settings aren't satisfied. - -Update DEPEND and RDEPEND so that we can reference the USE setting, allowing us -to depend on a package with certain functionality enabled or disabled. - -Update DEPEND and RDEPEND so that we can provide an alternative if -functionality isn't enabled, i.e.: - - foo? ( sys-apps/bar : sys-apps/meep ) - -For package installs, runtime dependencies should be calculated using the USE -setting contained in the .tbz2 metadata rather than the USE setting in -/etc/make.conf/defaults. - -/fix in/fix indd MULTIPLE support. Make Portage default to only allowing a -single version of a package installed at one time. MULTIPLE will allow users -to override this behavior: - - MULTIPLE="major" or 1 means that foo/bar-1.0 and foo/bar-2.0 can be installed together - MULTIPLE="minor" or 2 means that foo/bar-1.0, 2.0, and 2.1 can be installed together - MULTIPLE=3,4,5,etc. - MULTIPLE=0 means no restrictions (even foo/bar-1.0 and foo/bar-1.0-r1 can be installed together) - Also need to add a system-wide override option for this one. - -Add csh support to env-update - -Upgrade fetch feature to eliminate partial download problem - -Enhance /usr/sbin/ebuild so that it can recursively merge packages. Base this -on the digraph code in /usr/sbin/pkgmerge - -Add system profile support to the portage-maintain code - -Add /tmp/portage cleanup code, provide override functionality. - diff --git a/sys-apps/portage/files/1.5/man/ebuild.1 b/sys-apps/portage/files/1.5/man/ebuild.1 deleted file mode 100644 index 7d7b32298ca5..000000000000 --- a/sys-apps/portage/files/1.5/man/ebuild.1 +++ /dev/null @@ -1,121 +0,0 @@ -.TH ebuild "1" "January 2001" "portage 1.4" -.SH NAME -ebuild \- manual page for the ebuild program, the main user interface to the Portage system. -.SH SYNOPSIS -.B ebuild -\fIfile\fR \fIcommand\fR [\fIcommand\fR]... -.SH DESCRIPTION -The ebuild program is the heart of the current implementation of the Portage system. Accepting -an ebuild script and one or more commands as arguments, the ebuild program will parse the ebuild -script and execute the specified commands. Commands exist to fetch sources, unpack sources, -compile sources, install object files into a temporary directory "image", merge the image to -the local filesystem, create a bzipped tarball package out of the image, and more. -.PP -.SH OPTIONS -\fBFILE:\fR -.TP -This must be a valid ebuild script. For further information read ebuild(5). -.TP -\fBCOMMANDS:\fR -TP -\fBcheck\fR -Checks to see if all build dependencies are satisfied. -.TP -\fBclean\fR -Cleans the temporary build directory that Portage has created for this particular -ebuild file. The temporary build directory normally contains the extracted source -files as well as a possible "install image" (all the files that will be merged to -the local filesystem or stored in a package. The location of the build directory -is set by the BUILD_PREFIX variable in \fI/etc/make.defaults\fR (it defaults to \fI/tmp/portage\fR.) If you'd like to -override the BUILD_PREFIX, add the appropriate line to \fI/etc/make.conf\fR (where all -your particular customizations are supposed to go.) -.TP -Note: Currently, Portage doesn't clean up after a package has been created or merged. -This means that the BUILD_PREFIX directory will accumulate lots of things you probably -don't want and should be manually cleaned regularly ("rm -rf /tmp/portage/*" will take -care of this.) As Portage matures, a make.conf option will be added that will allow -you to control whether BUILD_PREFIX gets cleaned automatically or gets left as is. -.TP -\fBfetch\fR -Checks to see if all the sources specified in SRC_URI are available in DISTDIR (defined in \fI/etc/make.defaults\fR as -/usr/portage/distfiles) and have a valid -md5 checksum. If the sources aren't available, an attempt is made to download them from the locations specified -in SRC_URI. If multiple download locations are listed for a particular file, Portage pings each location to see -which location is closer. The Gentoo Linux mirror at ftp://ftp.ibiblio.org is always considered as a possible -download location. If for some reason the current or just-downloaded sources' md5 digests don't match those recorded -in files/digest-[package]-[version-rev], a warning is printed and ebuild exits with an error code of 1. -.TP -\fBunpack\fR -Extracts the sources to a subdirectory in the \fIbuild directory\fR (BUILD_PREFIX) -by running the \fIsrc_unpack()\fR function in the ebuild file. If no src_unpack() -function has been specified, a default src_unpack() function is used that extracts -all the files specified in SRC_URI. The sources are normally extracted to ${BUILD_PREFIX}/[package]-[version-rev]/work. -This particular directory can be referenced by using the ${WORKDIR} variable. If you're creating an ebuild, -you'll want to make sure that the S (source directory) variable defined at at the top of your ebuild script -points to the directory that contains your extracted sources. Normally, this directory is ${WORKDIR}/${P}. -The src_unpack() function is also responsible for making the appropriate patches to the sources so that -they're ready for compilation. -.TP -\fBcompile\fR -Compiles the extracted sources by running the the \fIsrc_compile()\fR function specified in the ebuild -file. When src_compile() starts, the current working directory will be set to ${S}. When src_compile() -completes, the sources should be fully compiled. -.TP -\fBinstall\fR -Installs the package to the temporary \fIinstall directory\fR -by running the \fIsrc_install()\fR function. When completed, the \fIinstall directory\fR -(${BUILD_PREFIX}/[package]-[version-rev]/image) will contain all the files that should either -be merged to the local file system or included in a binary package. -.TP -\fBqmerge\fR -This function installs all the files in the \fIinstall directory\fR -to the live filesystem. The process works as follows: first, the \fIpkg_preinst()\fR function (if specified) -is run. Then, the files are merged into the live filesystem, and the installed files' md5 digests are -recorded in \fI/var/db/pkg/[category]/[package]-[version-rev]/CONTENTS\fR. After all the files have been merged, -the \fIpkg_postinst()\fR function (if specified) is executed. -.TP -\fBmerge\fR -Normally, to merge an ebuild, you need to \fIfetch\fR, \fIunpack\fR, \fIcompile\fR, \fIinstall\fR and \fIqmerge\fR. -If you're simply interested in merging the ebuild, you can use this command, which will perform all these -steps for you, stopping along the way if a particular step doesn't complete successfully. -.TP -\fBremerge\fR -Normally, you're not allowed to merge an ebuild when you have the exact same version (down to the revision) already -installed. This command performs the same function as the \fImerge\fR command, with the exception that it allows -you to merge even if the exact same package is already on the system. -.TP -\fBunmerge\fR -This function first executes the \fIpkg_prerm\fR function (if specified.) Then it -removes all files from the live filesystem that have a valid -md5 checksum and mtime in the package contents file. Any empty directories are recursively -removed. -Finally, it runs \fIpkg_postrm\fR function (if specified.) It is safe to merge -a new version of a package first and then unmerge the old one; in fact, this is the recommended -package upgrade method. -.TP -\fBpackage\fR -This command is a lot like the \fImerge\fR command, except that after fetching, unpacking, compiling and installing, -a .tbz2 binary package tarball is created and stored in ${PKGDIR}/All (${PKGDIR} defaults to /usr/portage/packages). -A symbolic link is created in ${PKGDIR}/[category] that points to the package in ${PKGDIR}/All. -.TP -\fBrpm\fR -Builds a RedHat RPM package from the files in the temporary \fIinstall -directory\fR. At the moment, the ebuild's dependency information is not incorporated into the RPM. -.TP -.SH AUTHORS -Achim Gottinger <achim@gentoo.org> -Daniel Robbins <drobbins@gentoo.org> -.SH "SEE ALSO" -ebuild(5) make.defaults(5) make.conf(5) -.TP -The \fI/usr/sbin/ebuild\fR script. -The helper apps in \fI/usr/lib/portage/bin\fR. -.SH FILES -\fB/etc/make.conf\fR -Contains variables for the build-process and -overwrites those in make.defaults -.TP -\fB/etc/make.defaults\fR -Contains the default variables for the build-process, -you should edit \fI/etc/make.conf\fR instead. -.TP diff --git a/sys-apps/portage/files/1.5/man/ebuild.5 b/sys-apps/portage/files/1.5/man/ebuild.5 deleted file mode 100644 index 354baa97ecf3..000000000000 --- a/sys-apps/portage/files/1.5/man/ebuild.5 +++ /dev/null @@ -1,222 +0,0 @@ -.TH ebuild "18" "February 2001" "portage 1.5" -.SH NAME -ebuild \- the internal format, variables and functions in an ebuild script -.SH DESCRIPTION -The -.BR ebuild (1) -program accepts a single ebuild script as an argument. This -script contains variables and commands that specify how to download, unpack, -patch, compile, install and merge a particular software package from its original -sources. In addition to all this, the ebuild script can also contain -pre/post install/remove commands, as required. - - -.SH EXAMPLES -Here's a simple example ebuild script, : - -.DS -# Copyright 1999-2000 Gentoo Technologies, Inc. -.br -# Distributed under the terms of the GNU General Public License, v2 or later -.br -# Author Daniel Robbins <drobbins@gentoo.org> -.br -# $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/files/1.5/man/ebuild.5,v 1.3 2001/02/19 15:07:21 drobbins Exp $ -.br - -A=${P}.tar.gz -.br -S=${WORKDIR}/${P} -.br -DESCRIPTION="Super-useful stream editor" -.br -SRC_URI="ftp://alpha.gnu.org/pub/gnu/sed/${A}" -.br -DEPEND="virtual/glibc" - -src_compile() { - try ./configure --prefix=/usr --host=${CHOST} - try make ${MAKEOPTS} -.br -} - -src_install() { - into /usr - doinfo doc/sed.info - doman doc/sed.1 - into / - dobin sed/sed - dodir /usr/bin - dosym /bin/sed /usr/bin/sed - dodoc COPYING NEWS README* THANKS TODO AUTHORS BUGS ANNOUNCE -.br -} -.DE - - - -.PP -.SH VARIABLES -.TP -\fBP\fR -This variable contains the package name. This variable contains the script -name without the .ebuild extension if not explicit defined in the ebuild -script. Normaly it's safe to leave this undefined. -.TP -\fBPN\fR -Contains the name of the script without the version number. -.TP -\fBPV\fR -Contains the verion number without the revision. -.TP -\fBPR\fR -Contains the revision number or zero if no revision number exists. -.TP -\fBPF\fR -Contains the full package name \fI[PN]-[PV]_r[PR]\fR -.TP -\fBA\fR -Contains all source files required for the package. This variable must no -longer be defined because it gets autogenerated from the \fISRC_URI\fR -variabels. -.TP -\fBWORKDIR\fR -Contains the path to the package build root. -(/tmp/portage/[category]/[package]/work). \fIsrc_unpack\fR gets -executed with \fIWORKDIR\fR as the current directory. -.TP -\fBS\fR -Contains the path to the temporary \fIbuild directory\fR. This variable is used by -the functions \fIsrc_compile\fR and \fIsrc_install\fR. Both gets executed -with \fIS\fR as the current directory. -.TP -\fBD\fR -Contains the path to the temporary \fIinstall directory\fR. -(/tmp/portage/[category]/[package]/image) -.TP -\fBDESCRIPTION\fR -Should contain a short description of the package. -.TP -\fBSRC_URI\fR -Contains a list of URI's for te required source files. It can contain -multiple URI's for a single source file. The fastest location is choosen -if the file was not found at \fIGENTOO_MIRROR\fB -.TP -\fBHOMEPAGE\fR -Should contain a list of URL's for the sources main sites and other further -package dependend information. -.PP -.SH FUNCTIONS -.TP -\fBsrc_unpack\fR -This function is used to unpack all the sources in \fIA\fR to \fIWORKDIR\fR. -If not defined in the \fIebuild script\fR it calls -\fIunpack ${A}\fR. -Any patches and other pre configure/compile modifications should be done -here. -.TP -\fBsrc_compile\fR -All necessary steps for configuration and compilation should be done in -here. -.TP -\fBsrc_install\fR -Should contain everything required to install the package in the temporary -\fIinstall directory\fR. -.TP -\fBpkg_preinst pkg_postinst\fR -All modifications required on the live-filesystem before and after the -package gets merged sould be in here. -.TP -\fBpkg_prerm pkg_postrm\fR -Like the inst functions but for unmerge. -.TP -\fBconfig\fR -This function should contain optional basic configuration steps. -.PP -.SH HELPER FUNCTIONS -.TP -\fBunpack\fR \fI[list of sources] \fB -This function untars a list of sources into the current directory. -.TP -\fBdodir\fR \fI[path]\fR -Creates a directory -.TP -\fBinto\fR \fI[path]\fR -Sets the root (\fIDESTTREE\fR) for other functions like dobin, dosbin, doman, doinfo, dolib. -The default is /usr -.TP -\fBdobin\fR \fI[list of binaries]\fR -Installs a binary or a list of binaries into \fIDESTTREE\fR/bin. -Creates all neccesary dirs. -.TP -\fBdosbin\fR \fI[list of binaries]\fR -Installs a binary or a list of binaries into \fIDESTTREE\fR/sbin. -Creates all neccesary dirs. -.TP -\fBdolib dolib.a dolib.so\fR \fI[list of libraries]\fR -Installs a library or a list of librarys into \fIDESTTREE\fR/lib. -Creates all neccesary dirs. -.TP -\fBdoman\fR \fI[list of man-pages]\fR -Installs a manual-page or a list of info \fIDESTDIR\fR/man/man[1-9] -depending on the manual file ending and creates required dirs. -The files get gzipped if they aren't jet. -.TP -\fBdoinfo\fR \fI[list of info-files] \fR -Installs a info-page or a list of info \fIDESTDIR\fR/info -creates required dirs. Files gets automatic gzipped. -.TP -\fBdomo\fR \fI[list of locale-files] \fR -Installs a locale-file or a list of info -\fIDESTDIR\fR/usr/share/locale/[LANG] depending on local-file's ending and -reates required dirs. -.TP -\fBinsinto\fR \fI[path]\fR -Sets the root(\fINSDESTTREE\fR) for the doins function. -.TP -\fBdoins\fR \fI[list of files]\fR -Installs a file or a list of files into \fIINSDESTTREE\fR. This function uses -install(1). -.TP -\fBinsopts\fR \fI[options for install(1)]\fR -Can be used to define options for the install founction used in doins. The -default is \fI-m0644\fR. -.TP -\fBexeinto\fR \fI[path}\fR -Sets the root(\fEXEDESTTREE\fR) for the doexe function. -.TP -\fBdoexe\fR \fI[list of executables]\fR -Installs a executable or a list of executable into \fIEXEDESTTREE\fR. -This function uses install(1). -.TP -\fBexeopts\fR \fI[options for install(1)]\fR -Can be used to define options for the install founction used in doexe. The -default is \fI-m0755\fR. -.TP -\fBdocinto\fR \fI[path}\fR -Sets the relative subdir (\fIDOCDESTTREE\fR) used by dodoc. -.TP -\fBdodoc\fR \fI[list of document]\fR -Installs a document or a list of document into /usr/doc/[package]/\fIDOCDESTTREE\fR. -All required dirs gets created and the docs get gzipped. -.TP -\fBnewbin newsbin newlib newlib.so newlib.a newman newinfo newins newexe newdoc\fR \fI[file] [new filename]\fR -All these functions acct like the do* functions, but they only work with one -file and the file gets installed as \fI[new filename]\fR. -.PP -.SH AUTHOR -Achim Gottinger <achim@gentoo.org> -.SH "SEE ALSO" -ebuild(1) make.defaults(5) make.conf(5) -.TP -The \fI/usr/sbin/ebuild\fR script. -The helper apps in \fI/usr/lib/portage/bin\fR. -.SH FILES -\fB/etc/make.conf\fR -Contains variables for the build-process and -overwrites those in make.defaults -.TP -\fB/etc/make.defaults\fR -Contains the default variables for the build-process, -you should edit \fI/etc/make.conf\fR instead. -.TP diff --git a/sys-apps/portage/files/1.5/man/emerge.1 b/sys-apps/portage/files/1.5/man/emerge.1 deleted file mode 100644 index 10127ef2287e..000000000000 --- a/sys-apps/portage/files/1.5/man/emerge.1 +++ /dev/null @@ -1,65 +0,0 @@ -.TH emerge "1" "May 2001" "portage 1.5" -.SH NAME -ebuild \- manual page for the emerge program, the main new and enhanced interface to the Portage system. -.SH SYNOPSIS -.B emerge -[\fIoptions\fR] \fIfile\fR ... -.TP -.B emerge -[\fIoptions\fR] system -.SH DESCRIPTION -The emrge programe is the new main user interface to the portage system. It will -replace the \fIebuild\fR in most areas. It can be used to build install packages -from source or to install or build binary packages. Please take a look at the -ebuild (1) manual also. -.PP -.SH OPTIONS -\fIfile\fR -.TP -This must be a valid ebuild script or a vaild tbz2 package. For further information read ebuild(5). -.TP -\fBsystem\fR -.TP -If system is used emerge will install all packages listed in /etc/make.profile/packages and also packages that are required from those. -.TP -\fB--pretend\fR -Only shows a list of packages emerge whould install. emerge does not install the -packages. -.TP -\fB--autoclean\fR -Clean the build dir after merging the package. -.TP -\fB--usepkg\fR -emerge will install binary packages if avaliable. Otherwise it will build -from source. All binaries must be in the \fIPKGDIR\fR (default /usr/portage/packages/All) -.TP -\fB--buildpkg\fR -emerge will build a binary package for each package it builds and merges. -The package will be created in the \fIPKGDIR\fR/[category] subdir and -hardlinked to \fIPKGDIR\fR/All. -.TP -.SH AUTHOR -Achim Gottinger <achim@gentoo.org> -.SH "SEE ALSO" -ebuild(1) ebuild(5) make.defaults(5) make.conf(5) -.TP -The helper apps in \fI/usr/lib/portage/bin\fR. -.SH FILES -\fB/etc/make.conf\fR -Contains variables for the build-process and -overwrites those in make.defaults -.TP -\fB/etc/make.profile/make.defaults\fR -Contains the profile dependend variables for the build-process, -you should edit \fI/etc/make.conf\fR instead. -.TP -\fB/etc/make.profile/virtuals\fR -Contains a list of packages used to resolve virtual dependencies -.TP -\fB/etc/make.profile/package\fR -Contains a list of packages used for the base system -.TP -\fB/etc/make.globals\fR -Contains the default variables for the build-process, -you should edit \fI/etc/make.conf\fR instead. -.TP diff --git a/sys-apps/portage/files/1.5/man/make.defaults.5 b/sys-apps/portage/files/1.5/man/make.defaults.5 deleted file mode 100644 index 8acebc9a51c8..000000000000 --- a/sys-apps/portage/files/1.5/man/make.defaults.5 +++ /dev/null @@ -1,94 +0,0 @@ -.TH make.defaults "5" "January 2001" "portage 1.4-r4" -.SH NAME -ebuild \- manual page for make.defaults -.SH SYNOPSIS -.B make.defaults -.SH DESCRIPTION -This File contains various variables that are used by the \fIebuild\fR -script -.PP -.SH VARIABLES -\fBROOT\fR = \fI[path]\fR -This is the default installation target for ebuild. -.TP -\fBMAINTAINER\fR = \fI[yes|no]\fR -If you have and developer cvs access at cvs.gentoo.org -and \fIMAINTAINER\fR is set to \fI"yes"\fR, the md5 checksum files -for the sources get automatically added to the cvs-tree. -.TP -\fBPROXY HTTP_PROXY FTP_PROXY\fR = \fI[host:port]\fR -These vars are used if the sources must be downloaded from the -internet by \fIwget(1)\fR. They are only required if you use a proxy server -for internet access. Eighter define \fIPROXY\fR or -\fIPROXY_FTP\fR and \fIPROXY_HTTP\fR -.TP -\fBGENTOO_MIRRORS\fR = \fI[url]\fR -Insert your nearest \fIIBIBLIO\fR mirror here. This location is tried for -source download before the ones listed in the \fIebuild scripts\fR. -.TP -\fBCHOST\fR -This variable gets passed by the \fIebuild scripts\fR to the \fIconfigure\fR -step as \fI--host=${CHOST}\fR. So you can force the build-host with that. -.TP -\fBMAKEOPTS\fR -Use this variable if you want to use parallel make. -.TP -\fBCFLAGS CXXFLAGS\fR -Use them to controll the optimisation flags of your builds. -.TP -\fBDEBUG\fR -If defined binaries and librarys don't get stripped before \fImerge\fR -.TP -\fBPACKAGE\fR = \fI[tbz2|tgz]\fR -You can define if you want to use gzip(1) or bzip2(1) for package -compression. -.TP -\fBUSE\fR -This variable contains options that controll the build-behaviour of -several packages. More information in ebuild(5). -\fBFETCHCOMMAND\fR -This variable contains the command used for fetching package-sources from -the internet. -.TP -\fBPORTAGE_TMPDIR\fR = \fI[path]\fR -Defines the location of the temporary build directories. -.TP -\fBBUILD_PREFIX\fR = \fI[path]\fR -Defines the location of the package working directory. -.TP -\fBPKG_TMPDIR\fR = \fI[path]\fR -\fIpkgmerge(1)\fR uses this dir to extract the package before the -files get merged to the live filesystem. -.TP -\fBPORTDIR\fR = \fI[path]\fR -Defines the location of all portage dependend subdirs. -.TP -\fBDISTDIR\fR = \fI[path]\fR -Defines the location of the source-files. -.TP -\fBPKGDIR\fR = \fI[path]\fR -Defines the location of the packages. -.TP -\fBRPMDIR\fR = \fI[path]\fR -Defines the location of the RPM packages -.TP -\fBCURRENTILE\fR = \fI[path to file]\fR -Defines the file wich hold a list of all -actuall packages. -.TP -.SH AUTHOR -Achim Gottinger <achim@gentoo.org> -.SH "SEE ALSO" -ebuild(1) ebuild(5) make.conf(5) -.TP -The \fI/usr/sbin/ebuild\fR script. -The helper apps in \fI/usr/lib/portage/bin\fR. -.SH FILES -\fB/etc/make.conf\fR -Contains variables for the build-process and -overwrites those in make.defaults -.TP -\fB/etc/make.defaults\fR -Contains the default variables for the build-process, -you should edit \fI/etc/make.conf\fR instead. -.TP diff --git a/sys-apps/portage/files/1.5/man/pkglist.1 b/sys-apps/portage/files/1.5/man/pkglist.1 deleted file mode 100644 index e052cb3bbc25..000000000000 --- a/sys-apps/portage/files/1.5/man/pkglist.1 +++ /dev/null @@ -1,19 +0,0 @@ -.TH pkglist "1" "May 2001" "portage 1.5" -.SH NAME -pkglist \- manual page for the pkglist program, a program to print out a list of installed packages. -.SH SYNOPSIS -.B pkglist -.SH DESCRIPTION -The pkglist command is a command-line program that searches the /var/db/pkg tree -for .ebuild files and makes a list of what it finds. (Any ebuilds in -/var/db/pkg are necessarily installed packages). -.PP -.SH OPTIONS -\fInone\fR -.TP -This program is too simple; it has no options. -.TP -.SH AUTHOR -Grant Goodyear <grant@gentoo.org> -.SH "SEE ALSO" -ebuild(1) emerge(5) diff --git a/sys-apps/portage/files/1.5/man/pkgsearch.1 b/sys-apps/portage/files/1.5/man/pkgsearch.1 deleted file mode 100644 index 5dc16f82701b..000000000000 --- a/sys-apps/portage/files/1.5/man/pkgsearch.1 +++ /dev/null @@ -1,28 +0,0 @@ -.TH pkgsearch "1" "May 2001" "portage 1.5" -.SH NAME -pkgsearch \- manual page for the pkgsearch program, a program to search the Portage tree for a desired package. -.SH SYNOPSIS -.B pkgsearch -\fIkey\fR -.SH DESCRIPTION -The pkgsearch is a command-line program that searches the /usr/portage tree -for .ebuild files that contain the \fIkey\fR. For example, -.B pkgsearch -\fIgcc\fR -will search /usr/portage for all ebuilds that have "gcc" in the name. The -.B pkgsearch -program also indicates if a given ebuild is already installed. -Please take a look at the -ebuild (1) manual also. -.PP -.SH OPTIONS -\fIkey\fR -.TP -Search key. Note, the key is not case dependent. -.TP -.SH AUTHOR -Grant Goodyear <grant@gentoo.org> -.SH "SEE ALSO" -ebuild(1) emerge(5) -.TP -The helper apps in \fI/usr/lib/portage/bin\fR. diff --git a/sys-apps/portage/files/1.5/pym/portage.py b/sys-apps/portage/files/1.5/pym/portage.py deleted file mode 100755 index 4d46b73bfde3..000000000000 --- a/sys-apps/portage/files/1.5/pym/portage.py +++ /dev/null @@ -1,2167 +0,0 @@ -# Gentoo Linux Dependency Checking Code -# Copyright 1998-2000 Daniel Robbins, Gentoo Technologies, Inc. -# Distributed under the GNU Public License - -# TO-DO: -# (I'm adding this here because I lose or forget about all my other Portage -# TO-DO files... -# -# rewrite download system -# ----------------------- -# support partials, look into GENTOO_MIRRORS issue -# -# subpackages -# =========== -#src_install will work as normal, and will create the master image that includes -#everything in ${D}. There will be a new function, called src_subpkg that contains -#instructions for selecting files from ${D} and copying them to subpkg dirs, where -#they will get seperately packaged. The function will look something like this: -# -#src_subpkg() { -# subpkg bin -# #maybe grab should use regular expressions, not globbing? -# grab /usr/bin/* /usr/sbin/* /usr/lib/*.so -# -# subpkg dev -# grab /usr/lib/*.a (any way to say "everything but *.so"?) -#} -# -#Subpackage naming will work as follows. For a package foo-1.0, foo-1.0.tbz2 -#will be the master package and include all subpackages. foo:dev-1.0.tbz2 will -#be the development package, and foo:run-1.0.tbz2 will be a runtime package, -#etc. It should be possible to simply treat them as unique package names with -#P="foo:dev" and P="foo:run" respectively. -# -#dep resolution needs to be upgraded a bit, though. "sys-apps/foo" will depend -#on the foo master package (i.e. foo-1.0.tbz2) for backwards compatibility. However, -#it will now also be possible to depend on "sys-apps/foo:dev" or "sys-apps/foo:run", -#and the dep system needs to be upgraded so that it knows how to satisfy these -#dependencies. This should allow the new subpackages system to be integrated -#seamlessly into our existing dependency hierarchy. -# -#Note: It may also be a good idea to allow a make.conf option so that "sys-apps/foo:run" -#automatically resolves to the master package (for those who prefer complete packages -#rather than installing things piecemeal; a great idea for development boxes where many -#things will depend on "sys-apps/foo:dev" for headers, but the developer may want the -#whole enchilada. (generally, I prefer this approach, though for runtime-only systems -#subpackages make a lot of sense). -# -#new dependency functionality -#============================ -# -#Important new dep functionality: -# -# ~ IS NOW ADDED -# -#~sys-apps/foo-1.0 will match the latest rev of foo-1.0. Useful because the latest rev -#should be the most stable and reliable version. -# -#Next, sys-apps/foo-1.0* will match the latest package that starts with 1.0; so 1.0.3 will -#match. This is an excellent way to depend on libraries where you need a specific major -#or minor version, but also want to be able to use the latest "really minor" version and -#rev available. For example, if your app depends on glib-1.2: -# -#dev-libs/glib-1.2* -# -#This will match glib-1.2, glib-1.2-r1, glib-1.2.1 and glib-1.2.1.1-r1. Of these four -#examples, the last will be chosen (most recent) if all are available. However, glib-1.3 -#will not be considered for this dependency. - -import string,os -from stat import * -from commands import * -import fchksum,types -import sys -import shlex -import shutil -import xpak - -# master category list. Any new categories should be added to this list to -# ensure that they all categories are read when we check the portage directory -# for available ebuilds. - -categories=("app-admin", "app-arch", "app-cdr", "app-crypt", "app-doc", -"app-editors", "app-emulation", "app-games", "app-misc", "app-office", -"app-shells", "app-text", "dev-db", "dev-java", "dev-lang", "dev-libs", -"dev-perl", "dev-python", "dev-ruby", "dev-util", "gnome-apps", "gnome-base", -"gnome-libs", "gnome-office","kde-apps", "kde-i18n", "kde-base", "kde-libs", -"media-gfx", "media-libs", "media-sound", "media-video", "net-analyzer", -"net-apache", "net-dialup", "net-fs", "net-ftp", "net-im", "net-irc", -"net-libs", "net-mail", "net-misc", "net-news", "net-nds", "net-print", -"net-www", "packages", "sys-apps", "sys-devel", "sys-kernel", "sys-libs", -"x11-base", "x11-libs", "x11-terms", "x11-wm","virtual","dev-tcltk") - -#beautiful directed graph object - -class digraph: - def __init__(self): - self.dict={} - - def addnode(self,mykey,myparent): - # print digraph - if not self.dict.has_key(mykey): - if myparent==None: - self.dict[mykey]=[0,[]] - else: - self.dict[mykey]=[0,[myparent]] - self.dict[myparent][0]=self.dict[myparent][0]+1 - return - if not myparent in self.dict[mykey][1]: - self.dict[mykey][1].append(myparent) - self.dict[myparent][0]=self.dict[myparent][0]+1 - - def delnode(self,mykey): - if not self.dict.has_key(mykey): - return - for x in self.dict[mykey][1]: - self.dict[x][0]=self.dict[x][0]-1 - del self.dict[mykey] - - def firstzero(self): - "returns first node with zero references, or NULL if no such node exists" - for x in self.dict.keys(): - if self.dict[x][0]==0: - return x - return None - - def empty(self): - if len(self.dict)==0: - return 1 - return 0 - - def hasnode(self,mynode): - return self.dict.has_key(mynode) - - def copy(self): - mygraph=digraph() - for x in self.dict.keys(): - mygraph.dict[x]=self.dict[x][:] - return mygraph - -# valid end of version components; integers specify offset from release version -# pre=prerelease, p=patchlevel (should always be followed by an int), rc=release candidate -# all but _p (where it is required) can be followed by an optional trailing integer - -endversion={"pre":-2,"p":0,"alpha":-4,"beta":-3,"rc":-1} - -#parse /etc/env.d and generate /etc/profile.env - -def env_update(): - global root - if not os.path.exists(root+"etc/env.d"): - prevmask=os.umask(0) - os.makedirs(root+"etc/env.d",0755) - os.umask(prevmask) - fns=os.listdir(root+"etc/env.d") - fns.sort() - pos=0 - while (pos<len(fns)): - if fns[pos]<=2: - del fns[pos] - continue - if (fns[pos][0] not in string.digits) or (fns[pos][1] not in string.digits): - del fns[pos] - continue - pos=pos+1 - - specials={"PATH":[],"CLASSPATH":[],"LDPATH":[],"MANPATH":[],"INFODIR":[],"ROOTPATH":[]} - env={} - - for x in fns: - myconfig=getconfig(root+"etc/env.d/"+x) - # process PATH, CLASSPATH, LDPATH - for myspec in specials.keys(): - if myconfig.has_key(myspec): - if myspec=="LDPATH": - specials[myspec].extend(string.split(expand(myconfig[myspec]),":")) - else: - specials[myspec].append(expand(myconfig[myspec])) - del myconfig[myspec] - # process all other variables - for myenv in myconfig.keys(): - env[myenv]=expand(myconfig[myenv]) - - if os.path.exists(root+"etc/ld.so.conf"): - myld=open(root+"etc/ld.so.conf") - myldlines=myld.readlines() - myld.close() - oldld=[] - for x in myldlines: - #each line has at least one char (a newline) - if x[0]=="#": - continue - oldld.append(x[:-1]) - oldld.sort() - # os.rename(root+"etc/ld.so.conf",root+"etc/ld.so.conf.bak") - # Where is the new ld.so.conf generated? (achim) - else: - oldld=None - specials["LDPATH"].sort() - if (oldld!=specials["LDPATH"]): - #ld.so.conf needs updating and ldconfig needs to be run - newld=open(root+"etc/ld.so.conf","w") - newld.write("# ld.so.conf autogenerated by env-update; make all changes to\n") - newld.write("# contents of /etc/env.d directory\n") - for x in specials["LDPATH"]: - newld.write(x+"\n") - newld.close() - #run ldconfig here - print ">>> Regenerating "+root+"etc/ld.so.cache..." - getstatusoutput("/sbin/ldconfig -r "+root) - del specials["LDPATH"] - - outfile=open(root+"/etc/profile.env","w") - - for path in specials.keys(): - if len(specials[path])==0: - continue - outstring="export "+path+"='" - for x in specials[path][:-1]: - outstring=outstring+x+":" - outstring=outstring+specials[path][-1]+"'" - outfile.write(outstring+"\n") - #get it out of the way - del specials[path] - - #create /etc/profile.env - for x in env.keys(): - if type(env[x])!=types.StringType: - continue - outfile.write("export "+x+"='"+env[x]+"'\n") - outfile.close() - - #need to add cshrc support - -def getconfig(mycfg,tolerant=0): - mykeys={} - f=open(mycfg,'r') - lex=shlex.shlex(f) - lex.wordchars=string.digits+string.letters+"~!@#$%*_\:;?,./-+{}" - lex.quotes="\"'" - while 1: - key=lex.get_token() - if (key==''): - #normal end of file - break; - equ=lex.get_token() - if (equ==''): - #unexpected end of file - #lex.error_leader(self.filename,lex.lineno) - if not tolerant: - print "!!! Unexpected end of config file: variable",key - return None - else: - return mykeys - elif (equ!='='): - #invalid token - #lex.error_leader(self.filename,lex.lineno) - if not tolerant: - print "!!! Invalid token (not \"=\")",equ - return None - else: - return mykeys - val=lex.get_token() - if (val==''): - #unexpected end of file - #lex.error_leader(self.filename,lex.lineno) - if not tolerant: - print "!!! Unexpected end of config file: variable",key - return None - else: - return mykeys - mykeys[key]=val - return mykeys - -def expand(mystring,dictlist=[]): - """ - new variable expansion code. Removes quotes, handles \n, etc, and - will soon use the dictlist to expand ${variable} references. - This code will be used by the configfile code, as well as others (parser) - This would be a good bunch of code to port to C. - """ - mystring=" "+mystring - #in single, double quotes - insing=0 - indoub=0 - pos=1 - newstring=" " - while (pos<len(mystring)): - if (mystring[pos]=="'") and (mystring[pos-1]!="\\"): - if (indoub): - newstring=newstring+"'" - else: - insing=not insing - pos=pos+1 - continue - elif (mystring[pos]=='"') and (mystring[pos-1]!="\\"): - if (insing): - newstring=newstring+'"' - else: - indoub=not indoub - pos=pos+1 - continue - if (not insing): - #expansion time - if (mystring[pos]=="\\"): - #backslash expansion time - if (pos+1>=len(mystring)): - newstring=newstring+mystring[pos] - break - else: - a=mystring[pos+1] - pos=pos+2 - if a=='a': - newstring=newstring+chr(007) - elif a=='b': - newstring=newstring+chr(010) - elif a=='e': - newstring=newstring+chr(033) - elif (a=='f') or (a=='n'): - newstring=newstring+chr(012) - elif a=='r': - newstring=newstring+chr(015) - elif a=='t': - newstring=newstring+chr(011) - elif a=='v': - newstring=newstring+chr(013) - else: - #remove backslash only, as bash does: this takes care of \\ and \' and \" as well - newstring=newstring+mystring[pos-1:pos] - continue - elif (mystring[pos]=="$") and (mystring[pos-1]!="\\"): - pos=pos+1 - if (pos+1)>=len(mystring): - return "" - if mystring[pos]=="{": - pos=pos+1 - terminus="}" - else: - terminus=string.whitespace - myvstart=pos - while mystring[pos] not in terminus: - if (pos+1)>=len(mystring): - return "" - pos=pos+1 - myvarname=mystring[myvstart:pos] - pos=pos+1 - if len(myvarname)==0: - return "" - newstring=newstring+settings[myvarname] - else: - newstring=newstring+mystring[pos] - pos=pos+1 - else: - newstring=newstring+mystring[pos] - pos=pos+1 - return newstring[1:] - -class config: - def __init__(self): - self.origenv=os.environ.copy() - self.populated=0 - def populate(self): - if os.path.exists("/etc/make.profile/make.defaults"): - self.configlist=[self.origenv.copy(),getconfig("/etc/make.conf"),getconfig("/etc/make.profile/make.defaults"),getconfig("/etc/make.globals")] - else: - print ">>> /etc/make.profile/make.defaults not found, continuing anyway..." - self.configlist=[self.origenv.copy(),getconfig("/etc/make.conf"),getconfig("/etc/make.globals")] - self.populated=1 - - def __getitem__(self,mykey): - if not self.populated: - self.populate() - if mykey=="CONFIG_PROTECT_MASK": - #Portage needs to always auto-update these files (so that builds don't die when remerging gcc) - returnme="/etc/env.d " - else: - returnme="" - for x in self.configlist: - if x.has_key(mykey): - returnme=returnme+expand(x[mykey],self.configlist) - #without this break, it concats all settings together -- interesting! - break - return returnme - - def has_key(self,mykey): - if not self.populated: - self.populate() - for x in self.configlist: - if x.has_key(mykey): - return 1 - return 0 - def keys(self): - if not self.populated: - self.populate() - mykeys=[] - for x in self.configlist: - for y in x.keys(): - if y not in mykeys: - mykeys.append(y) - return mykeys - def __setitem__(self,mykey,myvalue): - if not self.populated: - self.populate() - self.configlist[0][mykey]=myvalue - def reset(self): - if not self.populated: - self.populate() - "reset environment to original settings" - self.configlist[0]=self.origenv.copy() - def environ(self): - "return our locally-maintained environment" - mydict={} - for x in self.keys(): - mydict[x]=self[x] - return mydict - -def spawn(mystring,debug=0): - global settings - mypid=os.fork() - if mypid==0: - mycommand="/bin/bash" - if debug: - myargs["bash","-x","-c",mystring] - else: - myargs=["bash","-c",mystring] - os.execve(mycommand,myargs,settings.environ()) - return - retval=os.waitpid(mypid,0)[1] - if (retval & 0xff)==0: - #return exit code - return (retval >> 8) - else: - #interrupted by signal - return 16 - -def doebuild(myebuild,mydo,myroot,checkdeps=1,debug=0): - global settings - if not os.path.exists(myebuild): - print "!!!",myebuild,"not found." - return 1 - if myebuild[-7:]!=".ebuild": - print "!!!",myebuild,"does not appear to be an ebuild file." - return 1 - settings.reset() - settings["PORTAGE_DEBUG"]=str(debug) - #settings["ROOT"]=root - settings["ROOT"]=myroot - settings["STARTDIR"]=os.getcwd() - settings["EBUILD"]=os.path.abspath(myebuild) - settings["O"]=os.path.dirname(settings["EBUILD"]) - settings["CATEGORY"]=os.path.basename(os.path.normpath(settings["O"]+"/..")) - #PEBUILD - settings["FILESDIR"]=settings["O"]+"/files" - settings["PF"]=os.path.basename(settings["EBUILD"])[:-7] - mysplit=pkgsplit(settings["PF"],0) - if mysplit==None: - print "!!! Error: PF is null; exiting." - return 1 - settings["P"]=mysplit[0]+"-"+mysplit[1] - settings["PN"]=mysplit[0] - settings["PV"]=mysplit[1] - settings["PR"]=mysplit[2] - if mysplit[2]=="r0": - settings["PVR"]=mysplit[1] - else: - settings["PVR"]=mysplit[1]+"-"+mysplit[2] - if settings.has_key("PATH"): - mysplit=string.split(settings["PATH"],":") - else: - mysplit=[] - if not "/usr/lib/portage/bin" in mysplit: - settings["PATH"]="/usr/lib/portage/bin:"+settings["PATH"] - - if not settings.has_key("BUILD_PREFIX"): - print "!!! Error: BUILD_PREFIX not defined." - return 1 - settings["BUILDDIR"]=settings["BUILD_PREFIX"]+"/"+settings["PF"] - if not os.path.exists(settings["BUILDDIR"]): - os.makedirs(settings["BUILDDIR"]) - settings["T"]=settings["BUILDDIR"]+"/temp" - if not os.path.exists(settings["T"]): - os.makedirs(settings["T"]) - settings["WORKDIR"]=settings["BUILDDIR"]+"/work" - settings["D"]=settings["BUILDDIR"]+"/image/" - - #initial ebuild.sh bash environment configured - if checkdeps: - myso=getstatusoutput("/usr/sbin/ebuild.sh depend") - if myso[0]!=0: - print - print - print "!!! Portage had a problem processing this file:" - print "!!!",settings["EBUILD"] - print - print myso[1] - print - print "!!! aborting." - print - return 1 - mydeps=string.split(myso[1],"\n") - if mydo=="depend": - return mydeps - elif mydo=="check": - return dep_frontend("build",myebuild,mydeps[0]) - elif mydo=="rcheck": - return dep_frontend("runtime",myebuild,mydeps[1]) - if mydo in ["merge","qmerge","unpack", "compile", "rpm", "package"]: - #optional dependency check -- if emerge is merging, this is skipped - retval=dep_frontend("build",myebuild,mydeps[0]) - if (retval): return retval - else: - if mydo in ["depend","check","rcheck"]: - print "!!! doebuild(): ",mydo,"cannot be called with checkdeps equal to zero." - return 1 - - #initial dep checks complete; time to process main commands - - if mydo=="unpack": - return spawn("/usr/sbin/ebuild.sh fetch unpack") - elif mydo=="compile": - return spawn("/usr/sbin/ebuild.sh fetch unpack compile") - elif mydo=="install": - return spawn("/usr/sbin/ebuild.sh fetch unpack compile install") - elif mydo in ["prerm","postrm","preinst","postinst","config","touch","clean","fetch","digest","batchdigest"]: - return spawn("/usr/sbin/ebuild.sh "+mydo) - elif mydo=="qmerge": - #qmerge is specifically not supposed to do a runtime dep check - return merge(settings["CATEGORY"],settings["PF"],settings["D"],settings["BUILDDIR"]+"/build-info",myroot) - elif mydo=="merge": - retval=spawn("/usr/sbin/ebuild.sh fetch unpack compile install") - if retval: return retval - if checkdeps: - retval=dep_frontend("runtime",myebuild,mydeps[1]) - if (retval): return retval - return merge(settings["CATEGORY"],settings["PF"],settings["D"],settings["BUILDDIR"]+"/build-info",myroot) - elif mydo=="unmerge": - return unmerge(settings["CATEGORY"],settings["PF"],myroot) - elif mydo=="rpm": - return spawn("/usr/sbin/ebuild.sh fetch unpack compile install rpm") - elif mydo=="package": - retval=spawn("/usr/sbin/ebuild.sh fetch") - if retval: - return retval - for x in ["","/"+settings["CATEGORY"],"/All"]: - if not os.path.exists(settings["PKGDIR"]+x): - os.makedirs(settings["PKGDIR"]+x) - pkgloc=settings["PKGDIR"]+"/All/"+settings["PF"]+".tbz2" - rebuild=0 - if os.path.exists(pkgloc): - for x in [settings["A"],settings["EBUILD"]]: - if not os.path.exists(x): - continue - if os.path.getmtime(x)>os.path.getmtime(pkgloc): - rebuild=1 - break - else: - rebuild=1 - if not rebuild: - print - print ">>> Package",settings["PF"]+".tbz2 appears to be up-to-date." - print ">>> To force rebuild, touch",os.path.basename(settings["EBUILD"]) - print - return 0 - else: - return spawn("/usr/sbin/ebuild.sh unpack compile install package") - else: - print "!!! Please specify a valid command." - return 1 - -def isdev(x): - mymode=os.stat(x)[ST_MODE] - return ( S_ISCHR(mymode) or S_ISBLK(mymode)) - -def isfifo(x): - mymode=os.stat(x)[ST_MODE] - return S_ISFIFO(mymode) - -def movefile(src,dest,unlink=1): - """moves a file from src to dest, preserving all permissions and attributes.""" - if dest=="/bin/cp": - getstatusoutput("/bin/mv /bin/cp /bin/cp.old") - a=getstatusoutput("/bin/cp.old -a "+"'"+src+"' /bin/cp") - os.unlink("/bin/cp.old") - elif dest=="/bin/bash": - a=getstatusoutput("rm /bin/bash; /bin/cp -a "+"'"+src+"' '"+dest+"'") - else: - a=getstatusoutput("/bin/cp -af "+"'"+src+"' '"+dest+"'") -# cp -a takes care of this -# mymode=os.lstat(src)[ST_MODE] -# os.chmod(dest,mymode) - if unlink: - os.unlink(src) - if a[0]==0: - return 1 - else: - return 0 - -def getmtime(x): - return `os.lstat(x)[-2]` - -def md5(x): - return string.upper(fchksum.fmd5t(x)[0]) - -def pathstrip(x,mystart): - cpref=os.path.commonprefix([x,mystart]) - return [root+x[len(cpref)+1:],x[len(cpref):]] - -def merge(mycat,mypkg,pkgloc,infloc,myroot): - mylink=dblink(mycat,mypkg,myroot) - if not mylink.exists(): - mylink.create() - #shell error code - mylink.merge(pkgloc,infloc,myroot) - -def unmerge(cat,pkg,myroot): - mylink=dblink(cat,pkg,myroot) - if mylink.exists(): - mylink.unmerge() - mylink.delete() - -def getenv(mykey,dictlist=[]): - "dictlist contains a list of dictionaries to check *before* the environment" - dictlist.append(os.environ) - for x in dictlist: - if x.has_key(mykey): - return expand(x[mykey],dictlist) - return "" - -def relparse(myver): - "converts last version part into three components" - number=0 - p1=0 - p2=0 - mynewver=string.split(myver,"_") - if len(mynewver)==2: - #an endversion - number=string.atof(mynewver[0]) - match=0 - for x in endversion.keys(): - elen=len(x) - if mynewver[1][:elen] == x: - match=1 - p1=endversion[x] - try: - p2=string.atof(mynewver[1][elen:]) - except: - p2=0 - break - if not match: - #normal number or number with letter at end - divider=len(myver)-1 - if myver[divider:] not in "1234567890": - #letter at end - p1=ord(myver[divider:]) - number=string.atof(myver[0:divider]) - else: - number=string.atof(myver) - else: - #normal number or number with letter at end - divider=len(myver)-1 - if myver[divider:] not in "1234567890": - #letter at end - p1=ord(myver[divider:]) - number=string.atof(myver[0:divider]) - else: - number=string.atof(myver) - return [number,p1,p2] - -def revverify(myrev): - if len(myrev)==0: - return 0 - if myrev[0]=="r": - try: - string.atoi(myrev[1:]) - return 1 - except: - pass - return 0 - -#returns 1 if valid version string, else 0 -# valid string in format: <v1>.<v2>...<vx>[a-z,_{endversion}[vy]] -# ververify doesn't do package rev. - -def ververify(myorigval,silent=1): - if len(myorigval)==0: - if not silent: - print "!!! Name error: package contains empty \"-\" part." - return 0 - myval=string.split(myorigval,'.') - if len(myval)==0: - if not silent: - print "!!! Name error: empty version string." - return 0 - #all but the last version must be a numeric - for x in myval[:-1]: - if not len(x): - if not silent: - print "!!! Name error in",myorigval+": two decimal points in a row" - return 0 - try: - foo=string.atoi(x) - except: - if not silent: - print "!!! Name error in",myorigval+": \""+x+"\" is not a valid version component." - return 0 - if not len(myval[-1]): - if not silent: - print "!!! Name error in",myorigval+": two decimal points in a row" - return 0 - try: - foo=string.atoi(myval[-1]) - return 1 - except: - pass - #ok, our last component is not a plain number or blank, let's continue - if myval[-1][-1] in string.lowercase: - try: - foo=string.atoi(myval[-1][:-1]) - return 1 - # 1a, 2.0b, etc. - except: - pass - #ok, maybe we have a 1_alpha or 1_beta2; let's see - #ep="endpart" - ep=string.split(myval[-1],"_") - if len(ep)!=2: - if not silent: - print "!!! Name error in",myorigval - return 0 - try: - foo=string.atoi(ep[0]) - except: - #this needs to be numeric, i.e. the "1" in "1_alpha" - if not silent: - print "!!! Name error in",myorigval+": characters before _ must be numeric" - return 0 - for mye in endversion.keys(): - if ep[1][0:len(mye)]==mye: - if len(mye)==len(ep[1]): - #no trailing numeric; ok - return 1 - else: - try: - foo=string.atoi(ep[1][len(mye):]) - return 1 - except: - #if no endversions work, *then* we return 0 - pass - if not silent: - print "!!! Name error in",myorigval - return 0 - -def isjustname(mypkg): - myparts=string.split(mypkg,'-') - for x in myparts: - if ververify(x): - return 0 - return 1 - -def isspecific(mypkg): - mysplit=string.split(mypkg,"/") - if len(mysplit)==2: - if not isjustname(mysplit[1]): - return 1 - return 0 - -# This function can be used as a package verification function, i.e. -# "pkgsplit("foo-1.2-1") will return None if foo-1.2-1 isn't a valid -# package (with version) name. If it is a valid name, pkgsplit will -# return a list containing: [ pkgname, pkgversion(norev), pkgrev ]. -# For foo-1.2-1, this list would be [ "foo", "1.2", "1" ]. For -# Mesa-3.0, this list would be [ "Mesa", "3.0", "0" ]. - -def pkgsplit(mypkg,silent=1): - myparts=string.split(mypkg,'-') - if len(myparts)<2: - if not silent: - print "!!! Name error in",mypkg+": missing a version or name part." - return None - for x in myparts: - if len(x)==0: - if not silent: - print "!!! Name error in",mypkg+": empty \"-\" part." - return None - if revverify(myparts[-1]): - if ververify(myparts[-2]): - if len(myparts)==2: - return None - else: - for x in myparts[:-2]: - if ververify(x): - return None - #names can't have versiony looking parts - return [string.join(myparts[:-2],"-"),myparts[-2],myparts[-1]] - else: - return None - - elif ververify(myparts[-1],silent): - if len(myparts)==1: - if not silent: - print "!!! Name error in",mypkg+": missing name part." - return None - else: - for x in myparts[:-1]: - if ververify(x): - if not silent: - print "!!! Name error in",mypkg+": multiple version parts." - return None - return [string.join(myparts[:-1],"-"),myparts[-1],"r0"] - else: - return None - -def catpkgsplit(mycatpkg,silent=1): - """returns [cat, pkgname, version, rev ]""" - mysplit=string.split(mycatpkg,"/") - if len(mysplit)!=2: - if not silent: - print "!!! Name error in",mycatpkg+": category or package part missing." - return None - mysplit2=pkgsplit(mysplit[1],silent) - if mysplit2==None: - return None - return [mysplit[0],mysplit2[0],mysplit2[1],mysplit2[2]] - -# vercmp: -# This takes two version strings and returns an integer to tell you whether -# the versions are the same, val1>val2 or val2>val1. - -def vercmp(val1,val2): - val1=string.split(val1,'-') - if len(val1)==2: - val1[0]=val1[0]+"."+val1[1] - val1=string.split(val1[0],'.') - #add back decimal point so that .03 does not become "3" ! - for x in val1[1:]: - x="."+x - val2=string.split(val2,'-') - if len(val2)==2: - val2[0]=val2[0]+"."+val2[1] - val2=string.split(val2[0],'.') - for x in val2[1:]: - x="."+x - if len(val2)<len(val1): - for x in range(0,len(val1)-len(val2)): - val2.append("0") - elif len(val1)<len(val2): - for x in range(0,len(val2)-len(val1)): - val1.append("0") - #The above code will extend version numbers out so they - #have the same number of digits. - myval1=[] - for x in range(0,len(val1)): - cmp1=relparse(val1[x]) - cmp2=relparse(val2[x]) - for y in range(0,3): - myret=cmp1[y]-cmp2[y] - if myret != 0: - return myret - return 0 - - -def pkgcmp(pkg1,pkg2): - """if returnval is less than zero, then pkg2 is newer than pkg2, zero if equal and positive if older.""" - mycmp=vercmp(pkg1[1],pkg2[1]) - if mycmp>0: - return 1 - if mycmp<0: - return -1 - r1=string.atoi(pkg1[2][1:]) - r2=string.atoi(pkg2[2][1:]) - if r1>r2: - return 1 - if r2>r1: - return -1 - return 0 - -def dep_parenreduce(mysplit,mypos=0): - "Accepts a list of strings, and converts '(' and ')' surrounded items to sub-lists" - while (mypos<len(mysplit)): - if (mysplit[mypos]=="("): - firstpos=mypos - mypos=mypos+1 - while (mypos<len(mysplit)): - if mysplit[mypos]==")": - mysplit[firstpos:mypos+1]=[mysplit[firstpos+1:mypos]] - mypos=firstpos - break - elif mysplit[mypos]=="(": - #recurse - mysplit=dep_parenreduce(mysplit,mypos) - mypos=mypos+1 - mypos=mypos+1 - return mysplit - -def dep_opconvert(mysplit,myuse): - "Does dependency operator conversion, such as moving '||' inside a sub-list, etc." - mypos=0 - while mypos<len(mysplit): - if type(mysplit[mypos])==types.ListType: - mysplit[mypos]=dep_opconvert(mysplit[mypos],myuse) - elif mysplit[mypos]==")": - #mismatched paren, error - return None - elif mysplit[mypos]=="||": - if (mypos+1)<len(mysplit): - if type(mysplit[mypos+1])!=types.ListType: - # || must be followed by paren'd list - return None - else: - mynew=dep_opconvert(mysplit[mypos+1],myuse) - mysplit[mypos+1]=mynew - mysplit[mypos+1][0:0]=["||"] - del mysplit[mypos] - else: - #don't end a depstring with || :) - return None - elif mysplit[mypos][-1]=="?": - #uses clause, i.e "gnome? ( foo bar )" - if (mysplit[mypos][:-1]) in myuse: - #if the package is installed, just delete the conditional - del mysplit[mypos] - else: - #the package isn't installed, delete conditional and next item - del mysplit[mypos] - del mysplit[mypos] - #we don't want to move to the next item, so we perform a quick hack - mypos=mypos-1 - mypos=mypos+1 - return mysplit - -def dep_eval(deplist): - if len(deplist)==0: - return 1 - if deplist[0]=="||": - #or list; we just need one "1" - for x in deplist[1:]: - if type(x)==types.ListType: - if dep_eval(x)==1: - return 1 - elif x==1: - return 1 - return 0 - else: - for x in deplist: - if type(x)==types.ListType: - if dep_eval(x)==0: - return 0 - elif x==0: - return 0 - return 1 - -def dep_zapdeps(unreduced,reduced): - """Takes an unreduced and reduced deplist and removes satisfied dependencies. - Returned deplist contains steps that must be taken to satisfy dependencies.""" - if unreduced[0]=="||": - if dep_eval(reduced): - #deps satisfied, return None - return None - else: - return unreduced - else: - if dep_eval(reduced): - #deps satisfied, return None - return None - else: - returnme=[] - x=0 - while x<len(reduced): - if type(reduced[x])==types.ListType: - myresult=dep_zapdeps(unreduced[x],reduced[x]) - if myresult: - returnme.append(myresult) - else: - if reduced[x]==0: - returnme.append(unreduced[x]) - x=x+1 - return returnme - -def dep_listcleanup(deplist): - "remove unnecessary clutter from deplists. Remove multiple list levels, empty lists" - newlist=[] - if (len(deplist)==1): - #remove multiple-depth lists - if (type(deplist[0])==types.ListType): - for x in deplist[0]: - if type(x)==types.ListType: - if len(x)!=0: - newlist.append(dep_listcleanup(x)) - else: - newlist.append(x) - else: - #unembed single nodes - newlist.append(deplist[0]) - else: - for x in deplist: - if type(x)==types.ListType: - if len(x)==1: - newlist.append(x[0]) - elif len(x)!=0: - newlist=newlist+dep_listcleanup(x) - else: - newlist.append(x) - return newlist - -def dep_frontend(mytype,myebuild,depstring): - """ebuild frontend for dependency system""" - if ebuild_initialized==0: - ebuild_init() - if depstring=="": - print ">>> No",mytype,"dependencies." - return 0 - if mytype=="build": - myparse=localtree.depcheck(depstring) - elif mytype=="runtime": - myparse=roottree.depcheck(depstring) - else: - print "!!! Error: dependency type",mytype,"not recognized. Exiting." - return 1 - if myparse[0]==0: - #error - print '!!! '+mytype+' dependency error:',myparse[1] - return 1 - elif myparse[1]==[]: - print '>>> '+mytype+' dependencies OK ;)' - return 0 - else: - print '!!! Some '+mytype+' dependencies must be satisfied first.' - print '!!! To view the dependency list, type "emerge --pretend',myebuild+'".' - return 1 - -# gets virtual package settings -def getvirtuals(myroot): - if not os.path.exists(myroot+"/etc/make.profile/virtuals"): - print ">>>",os.path.normpath(myroot+"/etc/make.profile/virtuals"),"does not exist. Continuing anyway..." - return {} - myfile=open(myroot+"/etc/make.profile/virtuals") - mylines=myfile.readlines() - myvirts={} - for x in mylines: - mysplit=string.split(x) - if len(mysplit)!=2: - continue - myvirts[mysplit[0]]=mysplit[1] - return myvirts - -class packagetree: - def __init__(self,virtual): - self.tree={} - self.populated=0 - self.virtual=virtual - - def populate(self): - "populates the tree with values" - populated=1 - pass - - def zap(self,mycatpkg): - "remove a catpkg from the deptree" - cps=catpkgsplit(mycatpkg,0) - mykey=cps[0]+"/"+cps[1] - if not self.tree.has_key(mykey): - return - x=0 - while x<len(self.tree[mykey]): - if self.tree[mykey][x][0]==mycatpkg: - del self.tree[mykey][x] - x=x+1 - if len(self.tree[mykey])==0: - del self.tree[mykey] - - def inject(self,mycatpkg): - "add a catpkg to the deptree" - cps=catpkgsplit(mycatpkg,0) - mykey=cps[0]+"/"+cps[1] - if not self.tree.has_key(mykey): - self.tree[mykey]=[] - self.tree[mykey].append([mycatpkg,cps]) - - def resolve_key(self,mykey): - "generates new key, taking into account virtual keys" - if not self.tree.has_key(mykey): - if self.virtual: - if self.virtual.has_key(mykey): - return self.virtual[mykey] - return mykey - - def exists_specific(self,myspec): - if not self.populated: - self.populate() - myspec=self.resolve_specific(myspec) - if not myspec: - return None - cps=catpkgsplit(myspec) - if not cps: - return None - mykey=cps[0]+"/"+cps[1] - if self.tree.has_key(mykey): - for x in self.tree[mykey]: - if x[0]==myspec: - return 1 - return 0 - - def exists_specific_cat(self,myspec): - if not self.populated: - self.populate() - myspec=self.resolve_specific(myspec) - if not myspec: - return None - cps=catpkgsplit(myspec) - if not cps: - return None - mykey=cps[0]+"/"+cps[1] - if self.tree.has_key(mykey): - return 1 - return 0 - - def resolve_specific(self,myspec): - cps=catpkgsplit(myspec) - if not cps: - return None - mykey=self.resolve_key(cps[0]+"/"+cps[1]) - mykey=mykey+"-"+cps[2] - if cps[3]!="r0": - mykey=mykey+"-"+cps[3] - return mykey - - def hasnode(self,mykey): - if not self.populated: - self.populate() - if self.tree.has_key(self.resolve_key(mykey)): - return 1 - return 0 - - def getallnodes(self): - "returns a list of all keys in our tree" - if not self.populated: - self.populate() - return self.tree.keys() - - def getnode(self,nodename): - if not self.populated: - self.populate() - nodename=self.resolve_key(nodename) - if not nodename: - return [] - if not self.tree.has_key(nodename): - return [] - return self.tree[nodename] - - def depcheck(self,depstring): - """evaluates a dependency string and returns a 2-node result list - [1, None] = ok, no dependencies - [1, ["x11-base/foobar","sys-apps/oni"] = dependencies must be satisfied - [0, * ] = parse error - """ - if not self.populated: - self.populate() - myusesplit=string.split(settings["USE"]) - mysplit=string.split(depstring) - #convert parenthesis to sublists - mysplit=dep_parenreduce(mysplit) - #mysplit can't be None here, so we don't need to check - mysplit=dep_opconvert(mysplit,myusesplit) - #if mysplit==None, then we have a parse error (paren mismatch or misplaced ||) - #up until here, we haven't needed to look at the database tree - - if mysplit==None: - return [0,"Parse Error (parenthesis mismatch or || abuse?)"] - elif mysplit==[]: - #dependencies were reduced to nothing - return [1,[]] - mysplit2=mysplit[:] - mysplit2=self.dep_wordreduce(mysplit2) - if mysplit2==None: - return [0,"Invalid token"] - myeval=dep_eval(mysplit2) - if myeval: - return [1,[]] - else: - mylist=dep_listcleanup(dep_zapdeps(mysplit,mysplit2)) - mydict={} - for x in mylist: - mydict[x]=1 - return [1,mydict.keys()] - - def dep_wordreduce(self,mydeplist): - """Calls dep_depreduce() on all the items in the deplist""" - mypos=0 - deplist=mydeplist[:] - while mypos<len(deplist): - if type(deplist[mypos])==types.ListType: - #recurse - deplist[mypos]=self.dep_wordreduce(deplist[mypos]) - else: - if deplist[mypos]=="||": - pass - else: - mydep=self.dep_depreduce(deplist[mypos]) - if mydep!=None: - deplist[mypos]=mydep - else: - #encountered invalid string - return None - mypos=mypos+1 - return deplist - - def dep_depreduce(self,mypkgdep): - if mypkgdep[0]=="!": - # !cat/pkg-v - if self.exists_specific(mypkgdep[1:]): - return 0 - else: - return 1 - elif mypkgdep[0]=="=": - # =cat/pkg-v - return self.exists_specific(mypkgdep[1:]) - elif (mypkgdep[0]=="<") or (mypkgdep[0]==">"): - # >=cat/pkg-v or <=,>,< - if mypkgdep[1]=="=": - cmpstr=mypkgdep[0:2] - cpv=mypkgdep[2:] - else: - cmpstr=mypkgdep[0] - cpv=mypkgdep[1:] - if not isspecific(cpv): - return None - mycatpkg=catpkgsplit(cpv,0) - if not mycatpkg: - #parse error - return 0 - mykey=mycatpkg[0]+"/"+mycatpkg[1] - if self.hasnode(mykey): - for x in self.getnode(mykey): - if eval("pkgcmp(x[1][1:],mycatpkg[1:])"+cmpstr+"0"): - return 1 - return 0 - elif mypkgdep[0]=="~": - if not isspecific(mypkgdep[1:]): - return None - cp=catpkgsplit(mypkgdep[1:]) - if not cp: - return 0 - mykey=cp[0]+"/"+cp[1] - if self.hasnode(mykey): - for x in self.getnode(mykey): - if pkgcmp(x[1][1:],cp[1:])>=0: - return 1 - return 0 - if not isspecific(mypkgdep): - # cat/pkg - if self.hasnode(mypkgdep): - return 1 - else: - return 0 - else: - return None - - def dep_bestmatch(self,mypkgdep): - """ - returns best match for mypkgdep in the tree. Accepts - a single depstring, such as ">foo/bar-1.0" and finds - the most recent version of foo/bar that satisfies the - dependency and returns it, i.e: "foo/bar-1.3". Works - for >,<,>=,<=,=,and general deps. Don't call with a ! - dep, since there is no good match for a ! dep. - """ - if (mypkgdep[0]=="="): - if self.exists_specific(mypkgdep[1:]): - return mypkgdep[1:] - else: - return "" - elif (mypkgdep[0]==">") or (mypkgdep[0]=="<"): - if mypkgdep[1]=="=": - cmpstr=mypkgdep[0:2] - cpv=mypkgdep[2:] - else: - cmpstr=mypkgdep[0] - cpv=mypkgdep[1:] - if not isspecific(cpv): - return "" - mycatpkg=catpkgsplit(cpv) - if not mycatpkg: - return "" - mykey=mycatpkg[0]+"/"+mycatpkg[1] - if not self.hasnode(mykey): - return "" - mynodes=[] - for x in self.getnode(mykey): - if eval("pkgcmp(x[1][1:],mycatpkg[1:])"+cmpstr+"0"): - mynodes.append(x) - #now we have a list of all nodes that qualify - if len(mynodes)==0: - return "" - bestmatch=mynodes[0] - for x in mynodes[1:]: - if pkgcmp(x[1][1:],bestmatch[1][1:])>0: - bestmatch=x - return bestmatch[0] - elif (mypkgdep[0]=="~"): - mypkg=mypkgdep[1:] - if not isspecific(mypkg): - return "" - mycp=catpkgsplit(mypkg) - if not mycp: - return "" - mykey=mycp[0]+"/"+mycp[1] - if not self.hasnode(mykey): - return "" - myrev=-1 - for x in self.getnode(mykey): - if mycp[2]!=x[1][2]: - continue - if x[1][3][1:]>myrev: - myrev=x[1][3][1:] - mymatch=x[0] - if myrev==-1: - return "" - else: - return mymatch - elif not isspecific(mypkgdep): - if not self.hasnode(mypkgdep): - return "" - mynodes=self.getnode(mypkgdep)[:] - if len(mynodes)==0: - return "" - bestmatch=mynodes[0] - for x in mynodes[1:]: - if pkgcmp(x[1][1:],bestmatch[1][1:])>0: - bestmatch=x - return bestmatch[0] - - def dep_match(self,mypkgdep): - """ - returns a list of all matches for mypkgdep in the tree. Accepts - a single depstring, such as ">foo/bar-1.0" and finds - all the versions of foo/bar that satisfy the - dependency and returns them, i.e: ["foo/bar-1.3"]. Works - for >,<,>=,<=,=,and general deps. Don't call with a ! - dep, since there is no good match for a ! dep. - """ - if (mypkgdep[0]=="="): - if self.exists_specific(mypkgdep[1:]): - return [mypkgdep[1:]] - else: - return [] - elif (mypkgdep[0]==">") or (mypkgdep[0]=="<"): - if mypkgdep[1]=="=": - cmpstr=mypkgdep[0:2] - cpv=mypkgdep[2:] - else: - cmpstr=mypkgdep[0] - cpv=mypkgdep[1:] - if not isspecific(cpv): - return [] - mycatpkg=catpkgsplit(cpv,0) - if mycatpkg==None: - #parse error - return [] - mykey=mycatpkg[0]+"/"+mycatpkg[1] - if not self.hasnode(mykey): - return [] - mynodes=[] - for x in self.getnode(mykey): - if eval("pkgcmp(x[1][1:],mycatpkg[1:])"+cmpstr+"0"): - mynodes.append(x[0]) - #now we have a list of all nodes that qualify - #since we want all nodes that match, return this list - return mynodes - elif mypkgdep[0]=="~": - #"~" implies a "bestmatch" - return self.dep_bestmatch(mypkgdep) - elif not isspecific(mypkgdep): - if not self.hasnode(mypkgdep): - return [] - mynodes=[] - for x in self.getnode(mypkgdep)[:]: - mynodes.append(x[0]) - return mynodes - -class vartree(packagetree): - "this tree will scan a var/db/pkg database located at root (passed to init)" - def __init__(self,root="/",virtual=None): - self.root=root - packagetree.__init__(self,virtual) - def populate(self): - "populates the local tree (/var/db/pkg)" - prevmask=os.umask(0) - if not os.path.isdir(self.root+"var"): - os.mkdir(self.root+"var",0755) - if not os.path.isdir(self.root+"var/db"): - os.mkdir(self.root+"var/db",0755) - if not os.path.isdir(self.root+"var/db/pkg"): - os.mkdir(self.root+"var/db/pkg",0755) - os.umask(prevmask) - dbdir=self.root+"var/db/pkg" - origdir=os.getcwd() - os.chdir(dbdir) - for x in os.listdir(os.getcwd()): - if not os.path.isdir(os.getcwd()+"/"+x): - continue - for y in os.listdir(os.getcwd()+"/"+x): - if x=="virtual": - #virtual packages don't require versions, if none is found, add a "1.0" to the end - if isjustname(y): - fullpkg=x+"/"+y+"-1.0" - else: - fullpkg=x+"/"+y - else: - fullpkg=x+"/"+y - mysplit=catpkgsplit(fullpkg,0) - if mysplit==None: - print "!!! Error:",self.root+"var/db/pkg/"+x+"/"+y,"is not a valid database entry, skipping..." - continue - mykey=x+"/"+mysplit[1] - if not self.tree.has_key(mykey): - self.tree[mykey]=[] - self.tree[mykey].append([fullpkg,mysplit]) - os.chdir(origdir) - self.populated=1 - -class portagetree(packagetree): - "this tree will scan a portage directory located at root (passed to init)" - def __init__(self,root="/",virtual=None): - self.root=root - self.portroot=settings["PORTDIR"] - packagetree.__init__(self,virtual) - def populate(self): - "populates the port tree" - origdir=os.getcwd() - os.chdir(self.portroot) - for x in categories: - if not os.path.isdir(os.getcwd()+"/"+x): - continue - for y in os.listdir(os.getcwd()+"/"+x): - if not os.path.isdir(os.getcwd()+"/"+x+"/"+y): - continue - if y=="CVS": - continue - for mypkg in os.listdir(os.getcwd()+"/"+x+"/"+y): - if mypkg[-7:] != ".ebuild": - continue - mypkg=mypkg[:-7] - mykey=x+"/"+y - fullpkg=x+"/"+mypkg - if not self.tree.has_key(mykey): - self.tree[mykey]=[] - mysplit=catpkgsplit(fullpkg,0) - if mysplit==None: - print "!!! Error:",self.portroot+"/"+x+"/"+y,"is not a valid Portage directory, skipping..." - continue - self.tree[mykey].append([fullpkg,mysplit]) - #self.populated must be set here, otherwise dep_match will cause recursive populate() calls - self.populated=1 - if os.path.exists("profiles/package.mask"): - myfile=open("profiles/package.mask","r") - mylines=myfile.readlines() - myfile.close() - deps=[] - for x in mylines: - myline=string.join(string.split(x)) - if not len(myline): - continue - if myline[0]=="#": - continue - deps.append(myline) - for x in deps: - matches=self.dep_match(x) - if matches: - for y in matches: - self.zap(y) - os.chdir(origdir) - def getdeps(self,pf): - "returns list of dependencies, if any" - if not self.populated: - self.populate() - if self.exists_specific(pf): - mysplit=catpkgsplit(pf) - if mysplit==None: - #parse error - return "" - mydepfile=self.portroot+"/"+mysplit[0]+"/"+mysplit[1]+"/files/depend-"+string.split(pf,"/")[1] - if os.path.exists(mydepfile): - myd=open(mydepfile,"r") - mydeps=myd.readlines() - myd.close() - returnme="" - for x in mydeps: - returnme=returnme+" "+x[:-1] - return returnme - return "" - def getname(self,pkgname): - "returns file location for this particular package" - if not self.populated: - self.populate() - pkgname=self.resolve_specific(pkgname) - if not pkgname: - return "" - mysplit=string.split(pkgname,"/") - psplit=pkgsplit(mysplit[1]) - return self.portroot+"/"+mysplit[0]+"/"+psplit[0]+"/"+mysplit[1]+".ebuild" - -class binarytree(packagetree): - "this tree scans for a list of all packages available in PKGDIR" - def __init__(self,root="/",virtual=None): - self.root=root - self.pkgdir=settings["PKGDIR"] - packagetree.__init__(self,virtual) - def populate(self): - "popules the binarytree" - if (not os.path.isdir(self.pkgdir)): - return 0 - for mypkg in os.listdir(self.pkgdir+"/All"): - if mypkg[-5:]!=".tbz2": - continue - mytbz2=xpak.tbz2(self.pkgdir+"/All/"+mypkg) - mycat=mytbz2.getfile("CATEGORY") - if not mycat: - #old-style or corrupt package - continue - mycat=string.strip(mycat) - fullpkg=mycat+"/"+mypkg[:-5] - cps=catpkgsplit(fullpkg,0) - if cps==None: - print "!!! Error:",mytbz2,"contains corrupt cat/pkg information, skipping..." - continue - mykey=mycat+"/"+cps[1] - if not self.tree.has_key(mykey): - self.tree[mykey]=[] - self.tree[mykey].append([fullpkg,cps]) - self.populated=1 - def getname(self,pkgname): - "returns file location for this particular package" - mysplit=string.split(pkgname,"/") - if len(mysplit)==1: - return self.pkgdir+"/All/"+self.resolve_specific(pkgname)+".tbz2" - else: - return self.pkgdir+"/All/"+mysplit[1]+".tbz2" - -class dblink: - "this class provides an interface to the standard text package database" - def __init__(self,cat,pkg,myroot): - "create a dblink object for cat/pkg. This dblink entry may or may not exist" - self.cat=cat - self.pkg=pkg - self.dbdir=myroot+"/var/db/pkg/"+cat+"/"+pkg - self.myroot=myroot - - def getpath(self): - "return path to location of db information (for >>> informational display)" - return self.dbdir - - def exists(self): - "does the db entry exist? boolean." - return os.path.exists(self.dbdir) - - def create(self): - "create the skeleton db directory structure. No contents, virtuals, provides or anything. Also will create /var/db/pkg if necessary." - if not os.path.exists(self.dbdir): - os.makedirs(self.dbdir) - - def delete(self): - "erase this db entry completely" - if not os.path.exists(self.dbdir): - return - for x in os.listdir(self.dbdir): - os.unlink(self.dbdir+"/"+x) - os.rmdir(self.dbdir) - - def clearcontents(self): - if os.path.exists(self.dbdir+"/CONTENTS"): - os.unlink(self.dbdir+"/CONTENTS") - - def getcontents(self): - if not os.path.exists(self.dbdir+"/CONTENTS"): - return None - pkgfiles={} - myc=open(self.dbdir+"/CONTENTS","r") - mylines=myc.readlines() - myc.close() - for line in mylines: - mydat=string.split(line) - # we do this so we can remove from non-root filesystems - # (use the ROOT var to allow maintenance on other partitions) - mydat[1]=os.path.normpath(root+mydat[1][1:]) - if mydat[0]=="obj": - #format: type, mtime, md5sum - pkgfiles[string.join(mydat[1:-2]," ")]=[mydat[0], mydat[-1], mydat[-2]] - elif mydat[0]=="dir": - #format: type - pkgfiles[string.join(mydat[1:])]=[mydat[0] ] - elif mydat[0]=="sym": - #format: type, mtime, dest - x=len(mydat)-1 - splitter=-1 - while(x>=0): - if mydat[x]=="->": - splitter=x - break - x=x-1 - if splitter==-1: - return None - pkgfiles[string.join(mydat[1:splitter]," ")]=[mydat[0], mydat[-1], string.join(mydat[(splitter+1):-1]," ")] - elif mydat[0]=="dev": - #format: type - pkgfiles[string.join(mydat[1:]," ")]=[mydat[0] ] - elif mydat[0]=="fif": - #format: type - pkgfiles[string.join(mydat[1:]," ")]=[mydat[0]] - else: - return None - return pkgfiles - - def unmerge(self,pkgfiles=None): - if not pkgfiles: - pkgfiles=self.getcontents() - if not pkgfiles: - return - - #do prerm script - a=doebuild(self.dbdir+"/"+self.pkg+".ebuild","prerm",self.myroot) - if a: - print "!!! pkg_prerm() script failed; exiting." - sys.exit(a) - - #we do this so we don't unmerge the ebuild file by mistake - myebuildfile=os.path.normpath(self.dbdir+"/"+self.pkg+".ebuild") - if os.path.exists(myebuildfile): - if pkgfiles.has_key(myebuildfile): - del pkgfiles[myebuildfile] - - mykeys=pkgfiles.keys() - mykeys.sort() - mykeys.reverse() - - #do some config file management prep - self.protect=[] - for x in string.split(settings["CONFIG_PROTECT"]): - ppath=os.path.normpath(self.myroot+"/"+x)+"/" - if os.path.isdir(ppath): - self.protect.append(ppath) - print ">>> Config file management enabled for",ppath - else: - print "!!! Config file management disabled for",ppath,"(not found)" - print ">>> (This is not necessarily an error)" - self.protectmask=[] - for x in string.split(settings["CONFIG_PROTECT_MASK"]): - ppath=os.path.normpath(self.myroot+"/"+x)+"/" - if os.path.isdir(ppath): - self.protectmask.append(ppath) - #if it doesn't exist, silently skip it - - for obj in mykeys: - obj=os.path.normpath(obj) - if not os.path.islink(obj): - #we skip this if we're dealing with a symlink - #because os.path.exists() will operate on the - #link target rather than the link itself. - if not os.path.exists(obj): - print "--- !found", pkgfiles[obj][0], obj - continue - if (pkgfiles[obj][0] not in ("dir","fif","dev")) and (getmtime(obj) != pkgfiles[obj][1]): - print "--- !mtime", pkgfiles[obj][0], obj - continue - if pkgfiles[obj][0]=="dir": - if not os.path.isdir(obj): - print "--- !dir ","dir", obj - continue - if os.listdir(obj): - print "--- !empty","dir", obj - continue - os.rmdir(obj) - print "<<< ","dir",obj - elif pkgfiles[obj][0]=="sym": - if not os.path.islink(obj): - print "--- !sym ","sym", obj - continue - mydest=os.readlink(obj) - if os.path.exists(os.path.normpath(self.myroot+mydest)): - if mydest != pkgfiles[obj][2]: - print "--- !destn","sym", obj - continue - os.unlink(obj) - print "<<< ","sym",obj - elif pkgfiles[obj][0]=="obj": - if not os.path.isfile(obj): - print "--- !obj ","obj", obj - continue - mymd5=md5(obj) - if mymd5 != string.upper(pkgfiles[obj][2]): - print "--- !md5 ","obj", obj - continue - unlinkme=[obj] - copyme="" - myppath="" - for ppath in self.protect: - if obj[0:len(ppath)]==ppath: - myppath=ppath - #config file management - for pmpath in self.protectmask: - if obj[0:len(pmpath)]==pmpath: - #skip, it's in the mask - myppath="" - break - if not myppath: - break - pfound=0 - pmatch=os.path.basename(obj) - pdir=os.path.dirname(obj) - if myppath: - for pfile in os.listdir(pdir): - if pfile[0:5]!="._cfg": - continue - if pfile[10:]!=pmatch: - continue - pfound=1 - if pfound: - print "--- cfg ","obj",obj - continue - os.unlink(obj) - print "<<< ","obj",obj - - elif pkgfiles[obj][0]=="fif": - if not isfifo(obj): - print "--- !fif ","fif", obj - continue - os.unlink(obj) - print "<<< ","fif",obj - elif pkgfiles[obj][0]=="dev": - if not isdev(obj): - print "--- !dev ","dev", obj - continue - os.unlink(obj) - print "<<< ","dev",obj - - #remove provides - for mycatpkg in self.getelements("PROVIDE"): - mycat,mypkg=string.split(mycatpkg,"/") - tcatpkg=self.cat+"/"+self.pkg - mylink=dblink(mycat,mypkg,self.myroot) - if not mylink.exists(): - continue - myvirts=mylink.getelements("VIRTUAL") - while tcatpkg in myvirts: - myvirts.remove(tcatpkg) - if not myvirts: - #no more virtuals; cleanup time - if mylink.isregular(): - #just zap the VIRTUAL file, this is also a normal package - os.unlink(mylink.dbdir+"/VIRTUAL") - else: - #this is a pure virtual package, remove the entire db entry - mylink.delete() - else: - mylink.setelements(myvirts,"VIRTUAL") - - #do original postrm - a=doebuild(self.dbdir+"/"+self.pkg+".ebuild","postrm",self.myroot) - if a: - print "!!! pkg_postrm() script failed; exiting." - sys.exit(a) - - def merge(self,mergeroot,inforoot,myroot,mergestart=None,outfile=None): - global prevmask - #myroot=os.environ["ROOT"] - #myroot should be set to the ROOT of where to merge to. - - if mergestart==None: - origdir=os.getcwd() - if not os.path.exists(self.dbdir): - self.create() - #open contents file if it isn't already open - mergestart=mergeroot - print ">>> Updating mtimes..." - #before merging, it's *very important* to touch all the files !!! - os.system("(cd "+mergeroot+"; for x in `find`; do touch -c $x 2>/dev/null; done)") - print ">>> Merging",self.cat+"/"+self.pkg,"to",myroot - - - #get old contents info for later unmerging - oldcontents=self.getcontents() - a=doebuild(inforoot+"/"+self.pkg+".ebuild","preinst",root) - if a: - print "!!! pkg_preinst() script failed; exiting." - sys.exit(a) - outfile=open(inforoot+"/CONTENTS","w") - - #prep for config file management - self.protect=[] - for x in string.split(settings["CONFIG_PROTECT"]): - ppath=os.path.normpath(myroot+"/"+x)+"/" - if os.path.isdir(ppath): - self.protect.append(ppath) - else: - print "!!!",ppath,"not found. Config file management disabled for this directory." - self.protectmask=[] - for x in string.split(settings["CONFIG_PROTECT_MASK"]): - ppath=os.path.normpath(myroot+"/"+x)+"/" - if os.path.isdir(ppath): - self.protectmask.append(ppath) - #if it doesn't exist, silently skip it - #back up umask, save old one in prevmask (global) - prevmask=os.umask(0) - - mergestart=mergestart - os.chdir(mergestart) - cpref=os.path.commonprefix([mergeroot,mergestart]) - relstart=mergestart[len(cpref):] - myfiles=os.listdir(mergestart) - - for x in myfiles: - relfile=relstart+"/"+x - rootfile=os.path.normpath(myroot+relfile) - #symbolic link - if os.path.islink(x): - myto=os.readlink(x) - if os.path.exists(rootfile): - if (not os.path.islink(rootfile)) and (os.path.isdir(rootfile)): - print "!!!",rootfile,"->",myto - else: - os.unlink(rootfile) - try: - os.symlink(myto,rootfile) - print ">>>",rootfile,"->",myto - outfile.write("sym "+relfile+" -> "+myto+" "+getmtime(rootfile)+"\n") - except: - print "!!!",rootfile,"->",myto - #directory - elif os.path.isdir(x): - mystat=os.stat(x) - if not os.path.exists(rootfile): - os.mkdir(rootfile) - os.chmod(rootfile,mystat[0]) - os.chown(rootfile,mystat[4],mystat[5]) - print ">>>",rootfile+"/" - else: - print "---",rootfile+"/" - outfile.write("dir "+relfile+"\n") - #enter directory, recurse - os.chdir(x) - self.merge(mergeroot,inforoot,myroot,mergestart+"/"+x,outfile) - #return to original path - os.chdir(mergestart) - #regular file - elif os.path.isfile(x): - mymd5=md5(x) - myppath="" - rootdir=os.path.dirname(rootfile) - for ppath in self.protect: - if rootfile[0:len(ppath)]==ppath: - myppath=ppath - #config file management - for pmpath in self.protectmask: - if rootfile[0:len(pmpath)]==pmpath: - #skip, it's in the mask - myppath="" - break - if not myppath: - break - moveme=1 - if os.path.exists(rootfile): - if os.path.islink(rootfile): - #this is how to cleverly avoid accidentally processing symlinks as dirs or regular files - pass - elif os.path.isdir(rootfile): - #directories do *not* get replaced by files - moveme=0 - print "!!!",rootfile - elif os.path.isfile(rootfile): - #replacing a regular file: we need to do some cfg file management here - #let's find the right filename for rootfile - if myppath!="": - #if the md5's *do* match, just copy it over (fall through to movefile(), below) - if mymd5!=md5(rootfile): - pnum=-1 - pmatch=os.path.basename(rootfile) - #format: - # ._cfg0000_foo - # 0123456789012 - mypfile="" - for pfile in os.listdir(rootdir): - if pfile[0:5]!="._cfg": - continue - if pfile[10:]!=pmatch: - continue - try: - newpnum=string.atoi(pfile[5:9]) - if newpnum>pnum: - pnum=newpnum - mypfile=pfile - except: - continue - pnum=pnum+1 - #this next line specifies the normal default rootfile (the next available ._cfgxxxx_ slot - rootfile=os.path.normpath(rootdir+"/._cfg"+string.zfill(pnum,4)+"_"+pmatch) - #but, we can override rootfile in a special case: - #if the last ._cfgxxxx_foo file's md5 matches: - if mypfile: - pmd5=md5(rootdir+"/"+mypfile) - if mymd5==pmd5: - rootfile=(rootdir+"/"+mypfile) - #then overwrite the last ._cfgxxxx_foo file rather than creating a new one - #(for cleanliness) - elif myppath: - #the file we're about to create *doesn't* exist. If it's in the protection path, we need to - #remove any stray ._cfg_ files - unlinkme=[] - pmatch=os.path.basename(rootfile) - mypfile="" - for pfile in os.listdir(rootdir): - if pfile[0:5]!="._cfg": - continue - if pfile[10:]!=pmatch: - continue - unlinkme.append(rootdir+"/"+pfile) - for ufile in unlinkme: - if os.path.isfile(ufile) and not os.path.islink(ufile): - os.unlink(ufile) - print "<<<",ufile - if moveme: - #moveme=0 is used to avoid copying on top of directories - if movefile(x,rootfile): - zing=">>>" - else: - zing="!!!" - print zing,rootfile - outfile.write("obj "+relfile+" "+mymd5+" "+getmtime(rootfile)+"\n") - elif isfifo(x): - #fifo - zing="!!!" - if not os.path.exists(rootfile): - if movefile(x,rootfile): - zing=">>>" - elif isfifo(rootfile): - os.unlink(rootfile) - if movefile(x,rootfile): - zing=">>>" - print zing+" "+rootfile - outfile.write("fif "+relfile+"\n") - else: - #device nodes, the only other possibility - if movefile(x,rootfile): - zing=">>>" - else: - zing="!!!" - print zing+" "+rootfile - outfile.write("dev "+relfile+"\n") - if mergestart==mergeroot: - #restore umask - os.umask(prevmask) - #if we opened it, close it - outfile.close() - if (oldcontents): - print ">>> Safely unmerging already-installed instance..." - self.unmerge(oldcontents) - print ">>> original instance of package unmerged safely." - - os.chdir(inforoot) - for x in os.listdir("."): - self.copyfile(x) - - #create virtual links - for mycatpkg in self.getelements("PROVIDE"): - mycat,mypkg=string.split(mycatpkg,"/") - mylink=dblink(mycat,mypkg,self.myroot) - #this will create the link if it doesn't exist - mylink.create() - myvirts=mylink.getelements("VIRTUAL") - if not mycat+"/"+mypkg in myvirts: - myvirts.append(self.cat+"/"+self.pkg) - mylink.setelements(myvirts,"VIRTUAL") - - #do postinst script - a=doebuild(self.dbdir+"/"+self.pkg+".ebuild","postinst",root) - if a: - print "!!! pkg_postinst() script failed; exiting." - sys.exit(a) - #update environment settings, library paths - env_update() - print ">>>",self.cat+"/"+self.pkg,"merged." - os.chdir(origdir) - - def getstring(self,name): - "returns contents of a file with whitespace converted to spaces" - if not os.path.exists(self.dbdir+"/"+name): - return "" - myfile=open(self.dbdir+"/"+name,"r") - mydata=string.split(myfile.read()) - myfile.close() - return string.join(mydata," ") - - def copyfile(self,fname): - if not os.path.exists(self.dbdir): - self.create() - shutil.copyfile(fname,self.dbdir+"/"+os.path.basename(fname)) - - def getfile(self,fname): - if not os.path.exists(self.dbdir+"/"+fname): - return "" - myfile=open(self.dbdir+"/"+fname,"r") - mydata=myfile.read() - myfile.close() - return mydata - - def setfile(self,fname,data): - if not os.path.exists(self.dbdir): - self.create() - myfile=open(self.dbdir+"/"+fname,"w") - myfile.write(data) - myfile.close() - - def getelements(self,ename): - if not os.path.exists(self.dbdir+"/"+ename): - return [] - myelement=open(self.dbdir+"/"+ename,"r") - mylines=myelement.readlines() - myreturn=[] - for x in mylines: - for y in string.split(x[:-1]): - myreturn.append(y) - myelement.close() - return myreturn - - def setelements(self,mylist,ename): - if not os.path.exists(self.dbdir): - self.create() - myelement=open(self.dbdir+"/"+ename,"w") - for x in mylist: - myelement.write(x+"\n") - myelement.close() - - def isregular(self): - "Is this a regular package (does it have a CATEGORY file? A dblink can be virtual *and* regular)" - return os.path.exists(self.dbdir+"/CATEGORY") - -def depgrab(myfilename,depmark): - """ - Will grab the dependency string from an ebuild file, using - depmark as a marker (normally DEPEND or RDEPEND) - """ - depstring="" - myfile=open(myfilename,"r") - mylines=myfile.readlines() - myfile.close() - pos=0 - while (pos<len(mylines)): - if mylines[pos][0:len(depmark)+1]==depmark+"=": - depstart=string.split(mylines[pos][len(depmark):],'"') - if len(depstart)==3: - depstring=depstart[1] - return string.join(string.split(depstring)," ") - elif len(depstart)==2: - depstring=depstart[1]+" " - pos=pos+1 - while 1: - mysplit=string.split(mylines[pos],'"') - depstring=depstring+mysplit[0]+" " - if len(mysplit)>1: - return string.join(string.split(depstring)," ") - pos=pos+1 - elif len(depstart)==1: - depstring=depstring+mylines[pos][len(depmark)+1:] - break - else: - break - else: - pos=pos+1 - return string.join(string.split(depstring)," ") - -def cleanup_pkgmerge(mypkg,origdir): - shutil.rmtree(settings["PKG_TMPDIR"]+"/"+mypkg) - os.chdir(origdir) - -def pkgmerge(mytbz2,myroot): - """will merge a .tbz2 file, returning a list of runtime dependencies that must be - satisfied, or None if there was a merge error. This code assumes the package - exists.""" - if mytbz2[-5:]!=".tbz2": - print "!!! Not a .tbz2 file" - return None - mypkg=os.path.basename(mytbz2)[:-5] - xptbz2=xpak.tbz2(mytbz2) - pkginfo={} - mycat=xptbz2.getfile("CATEGORY") - if not mycat: - print "!!! CATEGORY info missing from info chunk, aborting..." - return None - mycat=string.strip(mycat) - mycatpkg=mycat+"/"+mypkg - - tmploc=settings["PKG_TMPDIR"] - pkgloc=tmploc+"/"+mypkg+"/bin" - infloc=tmploc+"/"+mypkg+"/inf" - if os.path.exists(tmploc+"/"+mypkg): - shutil.rmtree(tmploc+"/"+mypkg,1) - os.makedirs(pkgloc) - os.makedirs(infloc) - print ">>> extracting info" - xptbz2.unpackinfo(infloc) - origdir=os.getcwd() - os.chdir(pkgloc) - print ">>> extracting",mypkg - notok=os.system("cat "+mytbz2+"| bzip2 -dq | tar xpf -") - if notok: - print "!!! Error extracting",mytbz2 - cleanup_pkgmerge(mypkg,origdir) - return None - #the merge takes care of pre/postinst and old instance auto-unmerge, virtual/provides updates, etc. - mylink=dblink(mycat,mypkg,myroot) - if not mylink.exists(): - mylink.create() - #shell error code - mylink.merge(pkgloc,infloc,myroot) - if not os.path.exists(infloc+"/RDEPEND"): - returnme="" - else: - #get runtime dependencies - a=open(infloc+"/RDEPEND","r") - returnme=string.join(string.split(a.read())," ") - a.close() - cleanup_pkgmerge(mypkg,origdir) - return returnme -def ebuild_init(): - "performs db/variable initialization for the ebuild system. Not required for other scripts." - global local_virts, root_virts, roottree, localtree, ebuild_initialized, root, virtuals - local_virts=getvirtuals("/") - if root=="/": - root_virts=local_virts - else: - root_virts=getvirtuals(root) - - localtree=vartree("/",local_virts) - if root=="/": - roottree=localtree - else: - roottree=vartree(root,root_virts) - ebuild_initialized=1 -root=getenv("ROOT") -if len(root)==0: - root="/" -elif root[-1]!="/": - root=root+"/" -if root != "/": - if not os.path.exists(root[:-1]): - print "!!! Error: ROOT",root,"does not exist. Please correct this." - print "!!! Exiting." - print - sys.exit(1) - elif not os.path.isdir(root[:-1]): - print "!!! Error: ROOT",root[:-1],"is not a directory. Please correct this." - print "!!! Exiting." - print - sys.exit(1) - -#create tmp and var/tmp if they don't exist; read config -os.umask(0) -if not os.path.exists(root+"tmp"): - print ">>> "+root+"tmp doesn't exist, creating it..." - os.mkdir(root+"tmp",01777) -if not os.path.exists(root+"var/tmp"): - print ">>> "+root+"var/tmp doesn't exist, creating it..." - os.mkdir(root+"var",0755) - os.mkdir(root+"var/tmp",01777) -os.umask(022) -settings=config() -ebuild_initialized=0 - - diff --git a/sys-apps/portage/files/1.5/pym/portage.py-1.5.1 b/sys-apps/portage/files/1.5/pym/portage.py-1.5.1 deleted file mode 100644 index 86aa18080d17..000000000000 --- a/sys-apps/portage/files/1.5/pym/portage.py-1.5.1 +++ /dev/null @@ -1,1990 +0,0 @@ -# Gentoo Linux Dependency Checking Code -# Copyright 1998-2000 Daniel Robbins, Gentoo Technologies, Inc. -# Distributed under the GNU Public License - -# TO-DO: -# (I'm adding this here because I lose or forget about all my other Portage -# TO-DO files... -# -# rewrite download system -# ----------------------- -# support partials, look into GENTOO_MIRRORS issue -# -# subpackages -# =========== -#src_install will work as normal, and will create the master image that includes -#everything in ${D}. There will be a new function, called src_subpkg that contains -#instructions for selecting files from ${D} and copying them to subpkg dirs, where -#they will get seperately packaged. The function will look something like this: -# -#src_subpkg() { -# subpkg bin -# #maybe grab should use regular expressions, not globbing? -# grab /usr/bin/* /usr/sbin/* /usr/lib/*.so -# -# subpkg dev -# grab /usr/lib/*.a (any way to say "everything but *.so"?) -#} -# -#Subpackage naming will work as follows. For a package foo-1.0, foo-1.0.tbz2 -#will be the master package and include all subpackages. foo:dev-1.0.tbz2 will -#be the development package, and foo:run-1.0.tbz2 will be a runtime package, -#etc. It should be possible to simply treat them as unique package names with -#P="foo:dev" and P="foo:run" respectively. -# -#dep resolution needs to be upgraded a bit, though. "sys-apps/foo" will depend -#on the foo master package (i.e. foo-1.0.tbz2) for backwards compatibility. However, -#it will now also be possible to depend on "sys-apps/foo:dev" or "sys-apps/foo:run", -#and the dep system needs to be upgraded so that it knows how to satisfy these -#dependencies. This should allow the new subpackages system to be integrated -#seamlessly into our existing dependency hierarchy. -# -#Note: It may also be a good idea to allow a make.conf option so that "sys-apps/foo:run" -#automatically resolves to the master package (for those who prefer complete packages -#rather than installing things piecemeal; a great idea for development boxes where many -#things will depend on "sys-apps/foo:dev" for headers, but the developer may want the -#whole enchilada. (generally, I prefer this approach, though for runtime-only systems -#subpackages make a lot of sense). -# -#new dependency functionality -#============================ -# -#Important new dep functionality: -# -# ~ IS NOW ADDED -# -#~sys-apps/foo-1.0 will match the latest rev of foo-1.0. Useful because the latest rev -#should be the most stable and reliable version. -# -#Next, sys-apps/foo-1.0* will match the latest package that starts with 1.0; so 1.0.3 will -#match. This is an excellent way to depend on libraries where you need a specific major -#or minor version, but also want to be able to use the latest "really minor" version and -#rev available. For example, if your app depends on glib-1.2: -# -#dev-libs/glib-1.2* -# -#This will match glib-1.2, glib-1.2-r1, glib-1.2.1 and glib-1.2.1.1-r1. Of these four -#examples, the last will be chosen (most recent) if all are available. However, glib-1.3 -#will not be considered for this dependency. - -import string,os -from stat import * -from commands import * -import fchksum,types -import sys -import shlex -import shutil -import xpak - -# master category list. Any new categories should be added to this list to -# ensure that they all categories are read when we check the portage directory -# for available ebuilds. - -categories=("app-admin", "app-arch", "app-cdr", "app-crypt", "app-doc", -"app-editors", "app-emulation", "app-games", "app-misc", "app-office", -"app-shells", "app-text", "dev-db", "dev-java", "dev-lang", "dev-libs", -"dev-perl", "dev-python", "dev-ruby", "dev-util", "gnome-apps", "gnome-base", -"gnome-libs", "gnome-office","kde-apps", "kde-i18n", "kde-base", "kde-libs", -"media-gfx", "media-libs", "media-sound", "media-video", "net-analyzer", -"net-dialup", "net-fs", "net-ftp", "net-im", "net-irc", "net-libs", "net-mail", -"net-misc", "net-news", "net-nds", "net-print", "net-www", "packages", -"sys-apps", "sys-devel", "sys-kernel", "sys-libs", "x11-base", "x11-libs", -"x11-terms", "x11-wm","virtual","dev-tcltk") - -#beautiful directed graph object - -class digraph: - def __init__(self): - self.dict={} - - def addnode(self,mykey,myparent): - # print digraph - if not self.dict.has_key(mykey): - if myparent==None: - self.dict[mykey]=[0,[]] - else: - self.dict[mykey]=[0,[myparent]] - self.dict[myparent][0]=self.dict[myparent][0]+1 - return - if not myparent in self.dict[mykey][1]: - self.dict[mykey][1].append(myparent) - self.dict[myparent][0]=self.dict[myparent][0]+1 - - def delnode(self,mykey): - if not self.dict.has_key(mykey): - return - for x in self.dict[mykey][1]: - self.dict[x][0]=self.dict[x][0]-1 - del self.dict[mykey] - - def firstzero(self): - "returns first node with zero references, or NULL if no such node exists" - for x in self.dict.keys(): - if self.dict[x][0]==0: - return x - return None - - def empty(self): - if len(self.dict)==0: - return 1 - return 0 - - def hasnode(self,mynode): - return self.dict.has_key(mynode) - - def copy(self): - mygraph=digraph() - for x in self.dict.keys(): - mygraph.dict[x]=self.dict[x][:] - return mygraph - -# valid end of version components; integers specify offset from release version -# pre=prerelease, p=patchlevel (should always be followed by an int), rc=release candidate -# all but _p (where it is required) can be followed by an optional trailing integer - -endversion={"pre":-2,"p":0,"alpha":-4,"beta":-3,"rc":-1} - -#parse /etc/env.d and generate /etc/profile.env - -def env_update(): - global root - fns=os.listdir(root+"etc/env.d") - fns.sort() - pos=0 - while (pos<len(fns)): - if fns[pos]<=2: - del fns[pos] - continue - if (fns[pos][0] not in string.digits) or (fns[pos][1] not in string.digits): - del fns[pos] - continue - pos=pos+1 - - specials={"PATH":[],"CLASSPATH":[],"LDPATH":[],"MANPATH":[],"INFODIR":[],"ROOTPATH":[]} - env={} - - for x in fns: - myconfig=getconfig(root+"etc/env.d/"+x) - # process PATH, CLASSPATH, LDPATH - for myspec in specials.keys(): - if myconfig.has_key(myspec): - if myspec=="LDPATH": - specials[myspec].extend(string.split(expand(myconfig[myspec]),":")) - else: - specials[myspec].append(expand(myconfig[myspec])) - del myconfig[myspec] - # process all other variables - for myenv in myconfig.keys(): - env[myenv]=expand(myconfig[myenv]) - - if os.path.exists(root+"etc/ld.so.conf"): - myld=open(root+"etc/ld.so.conf") - myldlines=myld.readlines() - myld.close() - oldld=[] - for x in myldlines: - #each line has at least one char (a newline) - if x[0]=="#": - continue - oldld.append(x[:-1]) - oldld.sort() - # os.rename(root+"etc/ld.so.conf",root+"etc/ld.so.conf.bak") - # Where is the new ld.so.conf generated? (achim) - else: - oldld=None - specials["LDPATH"].sort() - if (oldld!=specials["LDPATH"]): - #ld.so.conf needs updating and ldconfig needs to be run - newld=open(root+"etc/ld.so.conf","w") - newld.write("# ld.so.conf autogenerated by env-update; make all changes to\n") - newld.write("# contents of /etc/env.d directory\n") - for x in specials["LDPATH"]: - newld.write(x+"\n") - newld.close() - #run ldconfig here - print ">>> Regenerating "+root+"etc/ld.so.cache..." - getstatusoutput("/sbin/ldconfig -r "+root) - del specials["LDPATH"] - - outfile=open(root+"/etc/profile.env","w") - - for path in specials.keys(): - if len(specials[path])==0: - continue - outstring="export "+path+"='" - for x in specials[path][:-1]: - outstring=outstring+x+":" - outstring=outstring+specials[path][-1]+"'" - outfile.write(outstring+"\n") - #get it out of the way - del specials[path] - - #create /etc/profile.env - for x in env.keys(): - if type(env[x])!=types.StringType: - continue - outfile.write("export "+x+"='"+env[x]+"'\n") - outfile.close() - - #need to add cshrc support - -def getconfig(mycfg,tolerant=0): - mykeys={} - f=open(mycfg,'r') - lex=shlex.shlex(f) - lex.wordchars=string.digits+string.letters+"~!@#$%*_\:;?,./-+{}" - lex.quotes="\"'" - while 1: - key=lex.get_token() - if (key==''): - #normal end of file - break; - equ=lex.get_token() - if (equ==''): - #unexpected end of file - #lex.error_leader(self.filename,lex.lineno) - if not tolerant: - print "!!! Unexpected end of config file: variable",key - return None - else: - return mykeys - elif (equ!='='): - #invalid token - #lex.error_leader(self.filename,lex.lineno) - if not tolerant: - print "!!! Invalid token (not \"=\")",equ - return None - else: - return mykeys - val=lex.get_token() - if (val==''): - #unexpected end of file - #lex.error_leader(self.filename,lex.lineno) - if not tolerant: - print "!!! Unexpected end of config file: variable",key - return None - else: - return mykeys - mykeys[key]=val - return mykeys - -def expand(mystring,dictlist=[]): - """ - new variable expansion code. Removes quotes, handles \n, etc, and - will soon use the dictlist to expand ${variable} references. - This code will be used by the configfile code, as well as others (parser) - This would be a good bunch of code to port to C. - """ - mystring=" "+mystring - #in single, double quotes - insing=0 - indoub=0 - pos=1 - newstring=" " - while (pos<len(mystring)): - if (mystring[pos]=="'") and (mystring[pos-1]!="\\"): - if (indoub): - newstring=newstring+"'" - else: - insing=not insing - pos=pos+1 - continue - elif (mystring[pos]=='"') and (mystring[pos-1]!="\\"): - if (insing): - newstring=newstring+'"' - else: - indoub=not indoub - pos=pos+1 - continue - if (not insing): - #expansion time - if (mystring[pos]=="\\"): - #backslash expansion time - if (pos+1>=len(mystring)): - newstring=newstring+mystring[pos] - break - else: - a=mystring[pos+1] - pos=pos+2 - if a=='a': - newstring=newstring+chr(007) - elif a=='b': - newstring=newstring+chr(010) - elif a=='e': - newstring=newstring+chr(033) - elif (a=='f') or (a=='n'): - newstring=newstring+chr(012) - elif a=='r': - newstring=newstring+chr(015) - elif a=='t': - newstring=newstring+chr(011) - elif a=='v': - newstring=newstring+chr(013) - else: - #remove backslash only, as bash does: this takes care of \\ and \' and \" as well - newstring=newstring+mystring[pos-1:pos] - continue - elif (mystring[pos]=="$") and (mystring[pos-1]!="\\"): - pos=pos+1 - if (pos+1)>=len(mystring): - return "" - if mystring[pos]=="{": - pos=pos+1 - terminus="}" - else: - terminus=string.whitespace - myvstart=pos - while mystring[pos] not in terminus: - if (pos+1)>=len(mystring): - return "" - pos=pos+1 - myvarname=mystring[myvstart:pos] - pos=pos+1 - if len(myvarname)==0: - return "" - newstring=newstring+settings[myvarname] - else: - newstring=newstring+mystring[pos] - pos=pos+1 - else: - newstring=newstring+mystring[pos] - pos=pos+1 - return newstring[1:] - -class config: - def __init__(self): - self.origenv=os.environ.copy() - self.populated=0 - def populate(self): - if os.path.exists("/etc/make.profile/make.defaults"): - self.configlist=[self.origenv.copy(),getconfig("/etc/make.conf"),getconfig("/etc/make.profile/make.defaults"),getconfig("/etc/make.globals")] - else: - print ">>> /etc/make.profile/make.defaults not found, continuing anyway..." - self.configlist=[self.origenv.copy(),getconfig("/etc/make.conf"),getconfig("/etc/make.globals")] - self.populated=1 - def __getitem__(self,mykey): - if not self.populated: - self.populate() - for x in self.configlist: - if x.has_key(mykey): - return expand(x[mykey],self.configlist) - return "" - def has_key(self,mykey): - if not self.populated: - self.populate() - for x in self.configlist: - if x.has_key(mykey): - return 1 - return 0 - def keys(self): - if not self.populated: - self.populate() - mykeys=[] - for x in self.configlist: - for y in x.keys(): - if y not in mykeys: - mykeys.append(y) - return mykeys - def __setitem__(self,mykey,myvalue): - if not self.populated: - self.populate() - self.configlist[0][mykey]=myvalue - def reset(self): - if not self.populated: - self.populate() - "reset environment to original settings" - self.configlist[0]=self.origenv.copy() - def environ(self): - "return our locally-maintained environment" - mydict={} - for x in self.keys(): - mydict[x]=self[x] - return mydict - -def spawn(mystring): - global settings - mypid=os.fork() - if mypid==0: - mycommand="/bin/bash" - myargs=["bash","-c",mystring] - os.execve(mycommand,myargs,settings.environ()) - return - retval=os.waitpid(mypid,0)[1] - if (retval & 0xff)==0: - #return exit code - return (retval >> 8) - else: - #interrupted by signal - return 16 - -def doebuild(myebuild,mydo,checkdeps=1): - global settings - if not os.path.exists(myebuild): - print "!!!",myebuild,"not found." - return 1 - if myebuild[-7:]!=".ebuild": - print "!!!",myebuild,"does not appear to be an ebuild file." - return 1 - settings.reset() - settings["ROOT"]=root - settings["STARTDIR"]=os.getcwd() - settings["EBUILD"]=os.path.abspath(myebuild) - settings["O"]=os.path.dirname(settings["EBUILD"]) - settings["CATEGORY"]=os.path.basename(os.path.normpath(settings["O"]+"/..")) - #PEBUILD - settings["FILESDIR"]=settings["O"]+"/files" - settings["PF"]=os.path.basename(settings["EBUILD"])[:-7] - mysplit=pkgsplit(settings["PF"],0) - if mysplit==None: - print "!!! Error: PF is null; exiting." - return 1 - settings["P"]=mysplit[0]+"-"+mysplit[1] - settings["PN"]=mysplit[0] - settings["PV"]=mysplit[1] - settings["PR"]=mysplit[2] - if mysplit[2]=="r0": - settings["PVR"]=mysplit[1] - else: - settings["PVR"]=mysplit[1]+"-"+mysplit[2] - if settings.has_key("PATH"): - mysplit=string.split(settings["PATH"],":") - else: - mysplit=[] - if not "/usr/lib/portage/bin" in mysplit: - settings["PATH"]="/usr/lib/portage/bin:"+settings["PATH"] - - if not settings.has_key("BUILD_PREFIX"): - print "!!! Error: BUILD_PREFIX not defined." - return 1 - settings["BUILDDIR"]=settings["BUILD_PREFIX"]+"/"+settings["PF"] - if not os.path.exists(settings["BUILDDIR"]): - os.makedirs(settings["BUILDDIR"]) - settings["T"]=settings["BUILDDIR"]+"/temp" - if not os.path.exists(settings["T"]): - os.makedirs(settings["T"]) - settings["WORKDIR"]=settings["BUILDDIR"]+"/work" - settings["D"]=settings["BUILDDIR"]+"/image/" - - #initial ebuild.sh bash environment configured - if checkdeps: - mydeps=string.split(getoutput("/usr/sbin/ebuild.sh depend"),"\n") - if mydo=="depend": - return mydeps - elif mydo=="check": - return dep_frontend("build",myebuild,mydeps[0]) - elif mydo=="rcheck": - return dep_frontend("runtime",myebuild,mydeps[1]) - if mydo in ["merge","qmerge","unpack", "compile", "rpm", "package"]: - #optional dependency check -- if emerge is merging, this is skipped - retval=dep_frontend("build",myebuild,mydeps[0]) - if (retval): return retval - else: - if mydo in ["depend","check","rcheck"]: - print "!!! doebuild(): ",mydo,"cannot be called with checkdeps equal to zero." - return 1 - - #initial dep checks complete; time to process main commands - - if mydo=="unpack": - return spawn("/usr/sbin/ebuild.sh fetch unpack") - elif mydo=="compile": - return spawn("/usr/sbin/ebuild.sh fetch unpack compile") - elif mydo=="install": - return spawn("/usr/sbin/ebuild.sh fetch unpack compile install") - elif mydo in ["prerm","postrm","preinst","postinst","config","touch","clean","fetch","digest","batchdigest"]: - return spawn("/usr/sbin/ebuild.sh "+mydo) - elif mydo=="qmerge": - #qmerge is specifically not supposed to do a runtime dep check - return merge(settings["CATEGORY"],settings["PF"],settings["D"],settings["BUILDDIR"]+"/build-info") - elif mydo=="merge": - retval=spawn("/usr/sbin/ebuild.sh fetch unpack compile install") - if retval: return retval - if checkdeps: - retval=dep_frontend("runtime",myebuild,mydeps[1]) - if (retval): return retval - return merge(settings["CATEGORY"],settings["PF"],settings["D"],settings["BUILDDIR"]+"/build-info") - elif mydo=="unmerge": - return unmerge(settings["CATEGORY"],settings["PF"]) - elif mydo=="rpm": - return spawn("/usr/sbin/ebuild.sh fetch unpack compile install rpm") - elif mydo=="package": - retval=spawn("/usr/sbin/ebuild.sh fetch") - if retval: - return retval - for x in ["","/"+settings["CATEGORY"],"/All"]: - if not os.path.exists(settings["PKGDIR"]+x): - os.makedirs(settings["PKGDIR"]+x) - pkgloc=settings["PKGDIR"]+"/All/"+settings["PF"]+".tbz2" - rebuild=0 - if os.path.exists(pkgloc): - for x in [settings["A"],settings["EBUILD"]]: - if not os.path.exists(x): - continue - if os.path.getmtime(x)>os.path.getmtime(pkgloc): - rebuild=1 - break - else: - rebuild=1 - if not rebuild: - print - print ">>> Package",settings["PF"]+".tbz2 appears to be up-to-date." - print ">>> To force rebuild, touch",os.path.basename(settings["EBUILD"]) - print - return 0 - else: - return spawn("/usr/sbin/ebuild.sh unpack compile install package") - else: - print "!!! Please specify a valid command." - return 1 - -def isdev(x): - mymode=os.stat(x)[ST_MODE] - return ( S_ISCHR(mymode) or S_ISBLK(mymode)) - -def isfifo(x): - mymode=os.stat(x)[ST_MODE] - return S_ISFIFO(mymode) - -def movefile(src,dest,unlink=1): - """moves a file from src to dest, preserving all permissions and attributes.""" - if dest=="/bin/cp": - getstatusoutput("/bin/mv /bin/cp /bin/cp.old") - a=getstatusoutput("/bin/cp.old -a "+"'"+src+"' /bin/cp") - os.unlink("/bin/cp.old") - elif dest=="/bin/bash": - a=getstatusoutput("rm /bin/bash; /bin/cp -a "+"'"+src+"' '"+dest+"'") - else: - a=getstatusoutput("/bin/cp -af "+"'"+src+"' '"+dest+"'") -# cp -a takes care of this -# mymode=os.lstat(src)[ST_MODE] -# os.chmod(dest,mymode) - if unlink: - os.unlink(src) - if a[0]==0: - return 1 - else: - return 0 - -def getmtime(x): - return `os.lstat(x)[-2]` - -def md5(x): - return string.upper(fchksum.fmd5t(x)[0]) - -def pathstrip(x,mystart): - cpref=os.path.commonprefix([x,mystart]) - return [root+x[len(cpref)+1:],x[len(cpref):]] - -def merge(cat,pkg,mystart,myinfostart): - mylink=dblink(cat,pkg) - if not mylink.exists(): - mylink.create() - #shell error code - mylink.merge(mystart,myinfostart) - -def unmerge(cat,pkg): - mylink=dblink(cat,pkg) - if mylink.exists(): - mylink.unmerge() - mylink.delete() - -def getenv(mykey,dictlist=[]): - "dictlist contains a list of dictionaries to check *before* the environment" - dictlist.append(os.environ) - for x in dictlist: - if x.has_key(mykey): - return expand(x[mykey],dictlist) - return "" - -def relparse(myver): - "converts last version part into three components" - number=0 - p1=0 - p2=0 - mynewver=string.split(myver,"_") - if len(mynewver)==2: - #an endversion - number=string.atof(mynewver[0]) - match=0 - for x in endversion.keys(): - elen=len(x) - if mynewver[1][:elen] == x: - match=1 - p1=endversion[x] - try: - p2=string.atof(mynewver[1][elen:]) - except: - p2=0 - break - if not match: - #normal number or number with letter at end - divider=len(myver)-1 - if myver[divider:] not in "1234567890": - #letter at end - p1=ord(myver[divider:]) - number=string.atof(myver[0:divider]) - else: - number=string.atof(myver) - else: - #normal number or number with letter at end - divider=len(myver)-1 - if myver[divider:] not in "1234567890": - #letter at end - p1=ord(myver[divider:]) - number=string.atof(myver[0:divider]) - else: - number=string.atof(myver) - return [number,p1,p2] - -def revverify(myrev): - if len(myrev)==0: - return 0 - if myrev[0]=="r": - try: - string.atoi(myrev[1:]) - return 1 - except: - pass - return 0 - -#returns 1 if valid version string, else 0 -# valid string in format: <v1>.<v2>...<vx>[a-z,_{endversion}[vy]] -# ververify doesn't do package rev. - -def ververify(myorigval,silent=1): - if len(myorigval)==0: - if not silent: - print "!!! Name error: package contains empty \"-\" part." - return 0 - myval=string.split(myorigval,'.') - if len(myval)==0: - if not silent: - print "!!! Name error: empty version string." - return 0 - #all but the last version must be a numeric - for x in myval[:-1]: - if not len(x): - if not silent: - print "!!! Name error in",myorigval+": two decimal points in a row" - return 0 - try: - foo=string.atoi(x) - except: - if not silent: - print "!!! Name error in",myorigval+": \""+x+"\" is not a valid version component." - return 0 - if not len(myval[-1]): - if not silent: - print "!!! Name error in",myorigval+": two decimal points in a row" - return 0 - try: - foo=string.atoi(myval[-1]) - return 1 - except: - pass - #ok, our last component is not a plain number or blank, let's continue - if myval[-1][-1] in string.lowercase: - try: - foo=string.atoi(myval[-1][:-1]) - return 1 - # 1a, 2.0b, etc. - except: - pass - #ok, maybe we have a 1_alpha or 1_beta2; let's see - #ep="endpart" - ep=string.split(myval[-1],"_") - if len(ep)!=2: - if not silent: - print "!!! Name error in",myorigval - return 0 - try: - foo=string.atoi(ep[0]) - except: - #this needs to be numeric, i.e. the "1" in "1_alpha" - if not silent: - print "!!! Name error in",myorigval+": characters before _ must be numeric" - return 0 - for mye in endversion.keys(): - if ep[1][0:len(mye)]==mye: - if len(mye)==len(ep[1]): - #no trailing numeric; ok - return 1 - else: - try: - foo=string.atoi(ep[1][len(mye):]) - return 1 - except: - #if no endversions work, *then* we return 0 - pass - if not silent: - print "!!! Name error in",myorigval - return 0 - -def isjustname(mypkg): - myparts=string.split(mypkg,'-') - for x in myparts: - if ververify(x): - return 0 - return 1 - -def isspecific(mypkg): - mysplit=string.split(mypkg,"/") - if len(mysplit)==2: - if not isjustname(mysplit[1]): - return 1 - return 0 - -# This function can be used as a package verification function, i.e. -# "pkgsplit("foo-1.2-1") will return None if foo-1.2-1 isn't a valid -# package (with version) name. If it is a valid name, pkgsplit will -# return a list containing: [ pkgname, pkgversion(norev), pkgrev ]. -# For foo-1.2-1, this list would be [ "foo", "1.2", "1" ]. For -# Mesa-3.0, this list would be [ "Mesa", "3.0", "0" ]. - -def pkgsplit(mypkg,silent=1): - myparts=string.split(mypkg,'-') - if len(myparts)<2: - if not silent: - print "!!! Name error in",mypkg+": missing a version or name part." - return None - for x in myparts: - if len(x)==0: - if not silent: - print "!!! Name error in",mypkg+": empty \"-\" part." - return None - if revverify(myparts[-1]): - if ververify(myparts[-2]): - if len(myparts)==2: - return None - else: - for x in myparts[:-2]: - if ververify(x): - return None - #names can't have versiony looking parts - return [string.join(myparts[:-2],"-"),myparts[-2],myparts[-1]] - else: - return None - - elif ververify(myparts[-1],silent): - if len(myparts)==1: - if not silent: - print "!!! Name error in",mypkg+": missing name part." - return None - else: - for x in myparts[:-1]: - if ververify(x): - if not silent: - print "!!! Name error in",mypkg+": multiple version parts." - return None - return [string.join(myparts[:-1],"-"),myparts[-1],"r0"] - else: - return None - -def catpkgsplit(mycatpkg,silent=1): - """returns [cat, pkgname, version, rev ]""" - mysplit=string.split(mycatpkg,"/") - if len(mysplit)!=2: - if not silent: - print "!!! Name error in",mycatpkg+": category or package part missing." - return None - mysplit2=pkgsplit(mysplit[1],silent) - if mysplit2==None: - return None - return [mysplit[0],mysplit2[0],mysplit2[1],mysplit2[2]] - -# vercmp: -# This takes two version strings and returns an integer to tell you whether -# the versions are the same, val1>val2 or val2>val1. - -def vercmp(val1,val2): - val1=string.split(val1,'-') - if len(val1)==2: - val1[0]=val1[0]+"."+val1[1] - val1=string.split(val1[0],'.') - #add back decimal point so that .03 does not become "3" ! - for x in val1[1:]: - x="."+x - val2=string.split(val2,'-') - if len(val2)==2: - val2[0]=val2[0]+"."+val2[1] - val2=string.split(val2[0],'.') - for x in val2[1:]: - x="."+x - if len(val2)<len(val1): - for x in range(0,len(val1)-len(val2)): - val2.append("0") - elif len(val1)<len(val2): - for x in range(0,len(val2)-len(val1)): - val1.append("0") - #The above code will extend version numbers out so they - #have the same number of digits. - myval1=[] - for x in range(0,len(val1)): - cmp1=relparse(val1[x]) - cmp2=relparse(val2[x]) - for y in range(0,3): - myret=cmp1[y]-cmp2[y] - if myret != 0: - return myret - return 0 - - -def pkgcmp(pkg1,pkg2): - """if returnval is less than zero, then pkg2 is newer than pkg2, zero if equal and positive if older.""" - mycmp=vercmp(pkg1[1],pkg2[1]) - if mycmp>0: - return 1 - if mycmp<0: - return -1 - r1=string.atoi(pkg1[2][1:]) - r2=string.atoi(pkg2[2][1:]) - if r1>r2: - return 1 - if r2>r1: - return -1 - return 0 - -def dep_parenreduce(mysplit,mypos=0): - "Accepts a list of strings, and converts '(' and ')' surrounded items to sub-lists" - while (mypos<len(mysplit)): - if (mysplit[mypos]=="("): - firstpos=mypos - mypos=mypos+1 - while (mypos<len(mysplit)): - if mysplit[mypos]==")": - mysplit[firstpos:mypos+1]=[mysplit[firstpos+1:mypos]] - mypos=firstpos - break - elif mysplit[mypos]=="(": - #recurse - mysplit=dep_parenreduce(mysplit,mypos) - mypos=mypos+1 - mypos=mypos+1 - return mysplit - -def dep_opconvert(mysplit,myuse): - "Does dependency operator conversion, such as moving '||' inside a sub-list, etc." - mypos=0 - while mypos<len(mysplit): - if type(mysplit[mypos])==types.ListType: - mysplit[mypos]=dep_opconvert(mysplit[mypos],myuse) - elif mysplit[mypos]==")": - #mismatched paren, error - return None - elif mysplit[mypos]=="||": - if (mypos+1)<len(mysplit): - if type(mysplit[mypos+1])!=types.ListType: - # || must be followed by paren'd list - return None - else: - mynew=dep_opconvert(mysplit[mypos+1],myuse) - mysplit[mypos+1]=mynew - mysplit[mypos+1][0:0]=["||"] - del mysplit[mypos] - else: - #don't end a depstring with || :) - return None - elif mysplit[mypos][-1]=="?": - #uses clause, i.e "gnome? ( foo bar )" - if (mysplit[mypos][:-1]) in myuse: - #if the package is installed, just delete the conditional - del mysplit[mypos] - else: - #the package isn't installed, delete conditional and next item - del mysplit[mypos] - del mysplit[mypos] - #we don't want to move to the next item, so we perform a quick hack - mypos=mypos-1 - mypos=mypos+1 - return mysplit - -def dep_eval(deplist): - if len(deplist)==0: - return 1 - if deplist[0]=="||": - #or list; we just need one "1" - for x in deplist[1:]: - if type(x)==types.ListType: - if dep_eval(x)==1: - return 1 - elif x==1: - return 1 - return 0 - else: - for x in deplist: - if type(x)==types.ListType: - if dep_eval(x)==0: - return 0 - elif x==0: - return 0 - return 1 - -def dep_zapdeps(unreduced,reduced): - """Takes an unreduced and reduced deplist and removes satisfied dependencies. - Returned deplist contains steps that must be taken to satisfy dependencies.""" - if unreduced[0]=="||": - if dep_eval(reduced): - #deps satisfied, return None - return None - else: - return unreduced - else: - if dep_eval(reduced): - #deps satisfied, return None - return None - else: - returnme=[] - x=0 - while x<len(reduced): - if type(reduced[x])==types.ListType: - myresult=dep_zapdeps(unreduced[x],reduced[x]) - if myresult: - returnme.append(myresult) - else: - if reduced[x]==0: - returnme.append(unreduced[x]) - x=x+1 - return returnme - -def dep_listcleanup(deplist): - "remove unnecessary clutter from deplists. Remove multiple list levels, empty lists" - newlist=[] - if (len(deplist)==1): - #remove multiple-depth lists - if (type(deplist[0])==types.ListType): - for x in deplist[0]: - if type(x)==types.ListType: - if len(x)!=0: - newlist.append(dep_listcleanup(x)) - else: - newlist.append(x) - else: - #unembed single nodes - newlist.append(deplist[0]) - else: - for x in deplist: - if type(x)==types.ListType: - if len(x)==1: - newlist.append(x[0]) - elif len(x)!=0: - newlist=newlist+dep_listcleanup(x) - else: - newlist.append(x) - return newlist - -def dep_frontend(mytype,myebuild,depstring): - """ebuild frontend for dependency system""" - if ebuild_initialized==0: - ebuild_init() - if depstring=="": - print ">>> No",mytype,"dependencies." - return 0 - if mytype=="build": - myparse=localtree.depcheck(depstring) - elif mytype=="runtime": - myparse=roottree.depcheck(depstring) - else: - print "!!! Error: dependency type",mytype,"not recognized. Exiting." - return 1 - if myparse[0]==0: - #error - print '!!! '+mytype+' dependency error:',myparse[1] - return 1 - elif myparse[1]==[]: - print '>>> '+mytype+' dependencies OK ;)' - return 0 - else: - print '!!! Some '+mytype+' dependencies must be satisfied first.' - print '!!! To view the dependency list, type "emerge --pretend',myebuild+'".' - return 1 - -# gets virtual package settings -def getvirtuals(myroot): - if not os.path.exists(myroot+"/etc/make.profile/virtuals"): - print ">>>",os.path.normpath(myroot+"/etc/make.profile/virtuals"),"does not exist. Continuing anyway..." - return {} - myfile=open(myroot+"/etc/make.profile/virtuals") - mylines=myfile.readlines() - myvirts={} - for x in mylines: - mysplit=string.split(x) - if len(mysplit)!=2: - continue - myvirts[mysplit[0]]=mysplit[1] - return myvirts - -class packagetree: - def __init__(self,virtual): - self.tree={} - self.populated=0 - self.virtual=virtual - - def populate(self): - "populates the tree with values" - populated=1 - pass - - def zap(self,mycatpkg): - "remove a catpkg from the deptree" - cps=catpkgsplit(mycatpkg,0) - mykey=cps[0]+"/"+cps[1] - if not self.tree.has_key(mykey): - return - x=0 - while x<len(self.tree[mykey]): - if self.tree[mykey][x][0]==mycatpkg: - del self.tree[mykey][x] - x=x+1 - if len(self.tree[mykey])==0: - del self.tree[mykey] - - def inject(self,mycatpkg): - "add a catpkg to the deptree" - cps=catpkgsplit(mycatpkg,0) - mykey=cps[0]+"/"+cps[1] - if not self.tree.has_key(mykey): - self.tree[mykey]=[] - self.tree[mykey].append([mycatpkg,cps]) - - def resolve_key(self,mykey): - "generates new key, taking into account virtual keys" - if not self.tree.has_key(mykey): - if self.virtual: - if self.virtual.has_key(mykey): - return self.virtual[mykey] - return mykey - - def exists_specific(self,myspec): - if not self.populated: - self.populate() - myspec=self.resolve_specific(myspec) - if not myspec: - return None - cps=catpkgsplit(myspec) - if not cps: - return None - mykey=cps[0]+"/"+cps[1] - if self.tree.has_key(mykey): - for x in self.tree[mykey]: - if x[0]==myspec: - return 1 - return 0 - - def exists_specific_cat(self,myspec): - if not self.populated: - self.populate() - myspec=self.resolve_specific(myspec) - if not myspec: - return None - cps=catpkgsplit(myspec) - if not cps: - return None - mykey=cps[0]+"/"+cps[1] - if self.tree.has_key(mykey): - return 1 - return 0 - - def resolve_specific(self,myspec): - cps=catpkgsplit(myspec) - if not cps: - return None - mykey=self.resolve_key(cps[0]+"/"+cps[1]) - mykey=mykey+"-"+cps[2] - if cps[3]!="r0": - mykey=mykey+"-"+cps[3] - return mykey - - def hasnode(self,mykey): - if not self.populated: - self.populate() - if self.tree.has_key(self.resolve_key(mykey)): - return 1 - return 0 - - def getallnodes(self): - "returns a list of all keys in our tree" - if not self.populated: - self.populate() - return self.tree.keys() - - def getnode(self,nodename): - if not self.populated: - self.populate() - nodename=self.resolve_key(nodename) - if not nodename: - return [] - if not self.tree.has_key(nodename): - return [] - return self.tree[nodename] - - def depcheck(self,depstring): - """evaluates a dependency string and returns a 2-node result list - [1, None] = ok, no dependencies - [1, ["x11-base/foobar","sys-apps/oni"] = dependencies must be satisfied - [0, * ] = parse error - """ - if not self.populated: - self.populate() - myusesplit=string.split(settings["USE"]) - mysplit=string.split(depstring) - #convert parenthesis to sublists - mysplit=dep_parenreduce(mysplit) - #mysplit can't be None here, so we don't need to check - mysplit=dep_opconvert(mysplit,myusesplit) - #if mysplit==None, then we have a parse error (paren mismatch or misplaced ||) - #up until here, we haven't needed to look at the database tree - - if mysplit==None: - return [0,"Parse Error (parenthesis mismatch or || abuse?)"] - elif mysplit==[]: - #dependencies were reduced to nothing - return [1,[]] - mysplit2=mysplit[:] - mysplit2=self.dep_wordreduce(mysplit2) - if mysplit2==None: - return [0,"Invalid token"] - myeval=dep_eval(mysplit2) - if myeval: - return [1,[]] - else: - mylist=dep_listcleanup(dep_zapdeps(mysplit,mysplit2)) - mydict={} - for x in mylist: - mydict[x]=1 - return [1,mydict.keys()] - - def dep_wordreduce(self,mydeplist): - """Calls dep_depreduce() on all the items in the deplist""" - mypos=0 - deplist=mydeplist[:] - while mypos<len(deplist): - if type(deplist[mypos])==types.ListType: - #recurse - deplist[mypos]=self.dep_wordreduce(deplist[mypos]) - else: - if deplist[mypos]=="||": - pass - else: - mydep=self.dep_depreduce(deplist[mypos]) - if mydep!=None: - deplist[mypos]=mydep - else: - #encountered invalid string - return None - mypos=mypos+1 - return deplist - - def dep_depreduce(self,mypkgdep): - if mypkgdep[0]=="!": - # !cat/pkg-v - if self.exists_specific(mypkgdep[1:]): - return 0 - else: - return 1 - elif mypkgdep[0]=="=": - # =cat/pkg-v - return self.exists_specific(mypkgdep[1:]) - elif (mypkgdep[0]=="<") or (mypkgdep[0]==">"): - # >=cat/pkg-v or <=,>,< - if mypkgdep[1]=="=": - cmpstr=mypkgdep[0:2] - cpv=mypkgdep[2:] - else: - cmpstr=mypkgdep[0] - cpv=mypkgdep[1:] - if not isspecific(cpv): - return None - mycatpkg=catpkgsplit(cpv,0) - if not mycatpkg: - #parse error - return 0 - mykey=mycatpkg[0]+"/"+mycatpkg[1] - if self.hasnode(mykey): - for x in self.getnode(mykey): - if eval("pkgcmp(x[1][1:],mycatpkg[1:])"+cmpstr+"0"): - return 1 - return 0 - elif mypkgdep[0]=="~": - if not isspecific(mypkgdep[1:]): - return None - cp=catpkgsplit(mypkgdep[1:]) - if not cp: - return 0 - mykey=cp[0]+"/"+cp[1] - if self.hasnode(mykey): - for x in self.getnode(mykey): - if pkgcmp(x[1][1:],mycatpkg[1:])>=0: - return 1 - return 0 - if not isspecific(mypkgdep): - # cat/pkg - if self.hasnode(mypkgdep): - return 1 - else: - return 0 - else: - return None - - def dep_bestmatch(self,mypkgdep): - """ - returns best match for mypkgdep in the tree. Accepts - a single depstring, such as ">foo/bar-1.0" and finds - the most recent version of foo/bar that satisfies the - dependency and returns it, i.e: "foo/bar-1.3". Works - for >,<,>=,<=,=,and general deps. Don't call with a ! - dep, since there is no good match for a ! dep. - """ - if (mypkgdep[0]=="="): - if self.exists_specific(mypkgdep[1:]): - return mypkgdep[1:] - else: - return "" - elif (mypkgdep[0]==">") or (mypkgdep[0]=="<"): - if mypkgdep[1]=="=": - cmpstr=mypkgdep[0:2] - cpv=mypkgdep[2:] - else: - cmpstr=mypkgdep[0] - cpv=mypkgdep[1:] - if not isspecific(cpv): - return "" - mycatpkg=catpkgsplit(cpv) - if not mycatpkg: - return "" - mykey=mycatpkg[0]+"/"+mycatpkg[1] - if not self.hasnode(mykey): - return "" - mynodes=[] - for x in self.getnode(mykey): - if eval("pkgcmp(x[1][1:],mycatpkg[1:])"+cmpstr+"0"): - mynodes.append(x) - #now we have a list of all nodes that qualify - if len(mynodes)==0: - return "" - bestmatch=mynodes[0] - for x in mynodes[1:]: - if pkgcmp(x[1][1:],bestmatch[1][1:])>0: - bestmatch=x - return bestmatch[0] - elif (mypkgdep[0]=="~"): - mypkg=mypkgdep[1:] - if not isspecific(mypkg): - return "" - mycp=catpkgsplit(mypkg) - if not mycp: - return "" - mykey=mycp[0]+"/"+mycp[1] - if not self.hasnode(mykey): - return "" - myrev=-1 - for x in self.getnode(mykey): - if mycp[2]!=x[1][2]: - continue - if x[1][3][1:]>myrev: - myrev=x[1][3][1:] - mymatch=x[0] - if myrev==-1: - return "" - else: - return mymatch - elif not isspecific(mypkgdep): - if not self.hasnode(mypkgdep): - return "" - mynodes=self.getnode(mypkgdep)[:] - if len(mynodes)==0: - return "" - bestmatch=mynodes[0] - for x in mynodes[1:]: - if pkgcmp(x[1][1:],bestmatch[1][1:])>0: - bestmatch=x - return bestmatch[0] - - def dep_match(self,mypkgdep): - """ - returns a list of all matches for mypkgdep in the tree. Accepts - a single depstring, such as ">foo/bar-1.0" and finds - all the versions of foo/bar that satisfy the - dependency and returns them, i.e: ["foo/bar-1.3"]. Works - for >,<,>=,<=,=,and general deps. Don't call with a ! - dep, since there is no good match for a ! dep. - """ - if (mypkgdep[0]=="="): - if self.exists_specific(mypkgdep[1:]): - return [mypkgdep[1:]] - else: - return [] - elif (mypkgdep[0]==">") or (mypkgdep[0]=="<"): - if mypkgdep[1]=="=": - cmpstr=mypkgdep[0:2] - cpv=mypkgdep[2:] - else: - cmpstr=mypkgdep[0] - cpv=mypkgdep[1:] - if not isspecific(cpv): - return [] - mycatpkg=catpkgsplit(cpv,0) - if mycatpkg==None: - #parse error - return [] - mykey=mycatpkg[0]+"/"+mycatpkg[1] - if not self.hasnode(mykey): - return [] - mynodes=[] - for x in self.getnode(mykey): - if eval("pkgcmp(x[1][1:],mycatpkg[1:])"+cmpstr+"0"): - mynodes.append(x[0]) - #now we have a list of all nodes that qualify - #since we want all nodes that match, return this list - return mynodes - elif mypkgdep[0]=="~": - #"~" implies a "bestmatch" - return self.dep_bestmatch(mypkgdep) - elif not isspecific(mypkgdep): - if not self.hasnode(mypkgdep): - return [] - mynodes=[] - for x in self.getnode(mypkgdep)[:]: - mynodes.append(x[0]) - return mynodes - -class vartree(packagetree): - "this tree will scan a var/db/pkg database located at root (passed to init)" - def __init__(self,root="/",virtual=None): - self.root=root - packagetree.__init__(self,virtual) - def populate(self): - "populates the local tree (/var/db/pkg)" - if not os.path.isdir(self.root+"var"): - os.mkdir(self.root+"var",0755) - if not os.path.isdir(self.root+"var/db"): - os.mkdir(self.root+"var/db",0755) - if not os.path.isdir(self.root+"var/db/pkg"): - os.mkdir(self.root+"var/db/pkg",0755) - dbdir=self.root+"var/db/pkg" - origdir=os.getcwd() - os.chdir(dbdir) - for x in os.listdir(os.getcwd()): - if not os.path.isdir(os.getcwd()+"/"+x): - continue - for y in os.listdir(os.getcwd()+"/"+x): - if x=="virtual": - #virtual packages don't require versions, if none is found, add a "1.0" to the end - if isjustname(y): - fullpkg=x+"/"+y+"-1.0" - else: - fullpkg=x+"/"+y - else: - fullpkg=x+"/"+y - mysplit=catpkgsplit(fullpkg,0) - if mysplit==None: - print "!!! Error:",self.root+"var/db/pkg/"+x+"/"+y,"is not a valid database entry, skipping..." - continue - mykey=x+"/"+mysplit[1] - if not self.tree.has_key(mykey): - self.tree[mykey]=[] - self.tree[mykey].append([fullpkg,mysplit]) - os.chdir(origdir) - self.populated=1 - -class portagetree(packagetree): - "this tree will scan a portage directory located at root (passed to init)" - def __init__(self,root="/",virtual=None): - self.root=root - self.portroot=settings["PORTDIR"] - packagetree.__init__(self,virtual) - def populate(self): - "populates the port tree" - origdir=os.getcwd() - os.chdir(self.portroot) - for x in categories: - if not os.path.isdir(os.getcwd()+"/"+x): - continue - for y in os.listdir(os.getcwd()+"/"+x): - if not os.path.isdir(os.getcwd()+"/"+x+"/"+y): - continue - if y=="CVS": - continue - for mypkg in os.listdir(os.getcwd()+"/"+x+"/"+y): - if mypkg[-7:] != ".ebuild": - continue - mypkg=mypkg[:-7] - mykey=x+"/"+y - fullpkg=x+"/"+mypkg - if not self.tree.has_key(mykey): - self.tree[mykey]=[] - mysplit=catpkgsplit(fullpkg,0) - if mysplit==None: - print "!!! Error:",self.portroot+"/"+x+"/"+y,"is not a valid Portage directory, skipping..." - continue - self.tree[mykey].append([fullpkg,mysplit]) - #self.populated must be set here, otherwise dep_match will cause recursive populate() calls - self.populated=1 - if os.path.exists("profiles/package.mask"): - myfile=open("profiles/package.mask","r") - mylines=myfile.readlines() - myfile.close() - deps=[] - for x in mylines: - myline=string.join(string.split(x)) - if not len(myline): - continue - if myline[0]=="#": - continue - deps.append(myline) - for x in deps: - matches=self.dep_match(x) - if matches: - for y in matches: - self.zap(y) - os.chdir(origdir) - def getdeps(self,pf): - "returns list of dependencies, if any" - if not self.populated: - self.populate() - if self.exists_specific(pf): - mysplit=catpkgsplit(pf) - if mysplit==None: - #parse error - return "" - mydepfile=self.portroot+"/"+mysplit[0]+"/"+mysplit[1]+"/files/depend-"+string.split(pf,"/")[1] - if os.path.exists(mydepfile): - myd=open(mydepfile,"r") - mydeps=myd.readlines() - myd.close() - returnme="" - for x in mydeps: - returnme=returnme+" "+x[:-1] - return returnme - return "" - def getname(self,pkgname): - "returns file location for this particular package" - if not self.populated: - self.populate() - pkgname=self.resolve_specific(pkgname) - if not pkgname: - return "" - mysplit=string.split(pkgname,"/") - psplit=pkgsplit(mysplit[1]) - return self.portroot+"/"+mysplit[0]+"/"+psplit[0]+"/"+mysplit[1]+".ebuild" - -class binarytree(packagetree): - "this tree scans for a list of all packages available in PKGDIR" - def __init__(self,root="/",virtual=None): - self.root=root - self.pkgdir=settings["PKGDIR"] - packagetree.__init__(self,virtual) - def populate(self): - "popules the binarytree" - if (not os.path.isdir(self.pkgdir)): - return 0 - for mypkg in os.listdir(self.pkgdir+"/All"): - if mypkg[-5:]!=".tbz2": - continue - mytbz2=xpak.tbz2(self.pkgdir+"/All/"+mypkg) - mycat=mytbz2.getfile("CATEGORY") - if not mycat: - #old-style or corrupt package - continue - mycat=string.strip(mycat) - fullpkg=mycat+"/"+mypkg[:-5] - cps=catpkgsplit(fullpkg,0) - if cps==None: - print "!!! Error:",mytbz2,"contains corrupt cat/pkg information, skipping..." - continue - mykey=mycat+"/"+cps[1] - if not self.tree.has_key(mykey): - self.tree[mykey]=[] - self.tree[mykey].append([fullpkg,cps]) - self.populated=1 - def getname(self,pkgname): - "returns file location for this particular package" - mysplit=string.split(pkgname,"/") - if len(mysplit)==1: - return self.pkgdir+"/All/"+self.resolve_specific(pkgname)+".tbz2" - else: - return self.pkgdir+"/All/"+mysplit[1]+".tbz2" - -class dblink: - "this class provides an interface to the standard text package database" - def __init__(self,cat,pkg): - "create a dblink object for cat/pkg. This dblink entry may or may not exist" - self.cat=cat - self.pkg=pkg - self.dbdir=root+"/var/db/pkg/"+cat+"/"+pkg - - def getpath(self): - "return path to location of db information (for >>> informational display)" - return self.dbdir - - def exists(self): - "does the db entry exist? boolean." - return os.path.exists(self.dbdir) - - def create(self): - "create the skeleton db directory structure. No contents, virtuals, provides or anything. Also will create /var/db/pkg if necessary." - if not os.path.exists(self.dbdir): - os.makedirs(self.dbdir) - - def delete(self): - "erase this db entry completely" - if not os.path.exists(self.dbdir): - return - for x in os.listdir(self.dbdir): - os.unlink(self.dbdir+"/"+x) - os.rmdir(self.dbdir) - - def clearcontents(self): - if os.path.exists(self.dbdir+"/CONTENTS"): - os.unlink(self.dbdir+"/CONTENTS") - - def getcontents(self): - if not os.path.exists(self.dbdir+"/CONTENTS"): - return None - pkgfiles={} - myc=open(self.dbdir+"/CONTENTS","r") - mylines=myc.readlines() - myc.close() - for line in mylines: - mydat=string.split(line) - # we do this so we can remove from non-root filesystems - # (use the ROOT var to allow maintenance on other partitions) - mydat[1]=os.path.normpath(root+mydat[1][1:]) - if mydat[0]=="obj": - #format: type, mtime, md5sum - pkgfiles[string.join(mydat[1:-2]," ")]=[mydat[0], mydat[-1], mydat[-2]] - elif mydat[0]=="dir": - #format: type - pkgfiles[string.join(mydat[1:])]=[mydat[0] ] - elif mydat[0]=="sym": - #format: type, mtime, dest - x=len(mydat)-1 - splitter=-1 - while(x>=0): - if mydat[x]=="->": - splitter=x - break - x=x-1 - if splitter==-1: - return None - pkgfiles[string.join(mydat[1:splitter]," ")]=[mydat[0], mydat[-1], string.join(mydat[(splitter+1):-1]," ")] - elif mydat[0]=="dev": - #format: type - pkgfiles[string.join(mydat[1:]," ")]=[mydat[0] ] - elif mydat[0]=="fif": - #format: type - pkgfiles[string.join(mydat[1:]," ")]=[mydat[0]] - else: - return None - return pkgfiles - - def unmerge(self,pkgfiles=None): - if not pkgfiles: - pkgfiles=self.getcontents() - if not pkgfiles: - return - - myebuildfile=os.path.normpath(self.dbdir+"/"+self.pkg+".ebuild") - if os.path.exists(myebuildfile): - if pkgfiles.has_key(myebuildfile): - del pkgfiles[myebuildfile] - - mykeys=pkgfiles.keys() - mykeys.sort() - mykeys.reverse() - - #do prerm script - a=doebuild(self.dbdir+"/"+self.pkg+".ebuild","prerm") - if a: - print "!!! pkg_prerm() script failed; exiting." - sys.exit(a) - - for obj in mykeys: - obj=os.path.normpath(obj) - if not os.path.islink(obj): - #we skip this if we're dealing with a symlink - #because os.path.exists() will operate on the - #link target rather than the link itself. - if not os.path.exists(obj): - print "--- !found", pkgfiles[obj][0], obj - continue - if (pkgfiles[obj][0] not in ("dir","fif","dev")) and (getmtime(obj) != pkgfiles[obj][1]): - print "--- !mtime", pkgfiles[obj][0], obj - continue - if pkgfiles[obj][0]=="dir": - if not os.path.isdir(obj): - print "--- !dir ","dir", obj - continue - if os.listdir(obj): - print "--- !empty","dir", obj - continue - os.rmdir(obj) - print "<<< ","dir",obj - elif pkgfiles[obj][0]=="sym": - if not os.path.islink(obj): - print "--- !sym ","sym", obj - continue - mydest=os.readlink(obj) - if os.path.exists(os.path.normpath(root+mydest)): - if mydest != pkgfiles[obj][2]: - print "--- !destn","sym", obj - continue - os.unlink(obj) - print "<<< ","sym",obj - elif pkgfiles[obj][0]=="obj": - if not os.path.isfile(obj): - print "--- !obj ","obj", obj - continue - mymd5=md5(obj) - if mymd5 != string.upper(pkgfiles[obj][2]): - print "--- !md5 ","obj", obj - continue - os.unlink(obj) - print "<<< ","obj",obj - elif pkgfiles[obj][0]=="fif": - if not isfifo(obj): - print "--- !fif ","fif", obj - continue - os.unlink(obj) - print "<<< ","fif",obj - elif pkgfiles[obj][0]=="dev": - if not isdev(obj): - print "--- !dev ","dev", obj - continue - os.unlink(obj) - print "<<< ","dev",obj - - #remove provides - for mycatpkg in self.getelements("PROVIDE"): - mycat,mypkg=string.split(mycatpkg,"/") - tcatpkg=self.cat+"/"+self.pkg - mylink=dblink(mycat,mypkg) - if not mylink.exists(): - continue - myvirts=mylink.getelements("VIRTUAL") - while tcatpkg in myvirts: - myvirts.remove(tcatpkg) - if not myvirts: - #no more virtuals; cleanup time - if mylink.isregular(): - #just zap the VIRTUAL file, this is also a normal package - os.unlink(mylink.dbdir+"/VIRTUAL") - else: - #this is a pure virtual package, remove the entire db entry - mylink.delete() - else: - mylink.setelements(myvirts,"VIRTUAL") - - #do original postrm - a=doebuild(self.dbdir+"/"+self.pkg+".ebuild","postrm") - if a: - print "!!! pkg_postrm() script failed; exiting." - sys.exit(a) - - def merge(self,mergeroot,inforoot,mergestart=None,outfile=None): - - if mergestart==None: - origdir=os.getcwd() - if not os.path.exists(self.dbdir): - self.create() - #open contents file if it isn't already open - mergestart=mergeroot - print ">>> Updating mtimes..." - #before merging, it's *very important* to touch all the files !!! - os.system("(cd "+mergeroot+"; for x in `find`; do touch -c $x 2>/dev/null; done)") - print ">>> Merging",self.cat+"/"+self.pkg,"to",root - if not os.path.exists(root): - print "!!! Error: ROOT setting points to a non-existent directory. Exiting." - return - elif not os.path.isdir(root): - print "!!! Error: ROOT setting points to a non-directory. Exiting." - return - - #get old contents info for later unmerging - oldcontents=self.getcontents() - a=doebuild(inforoot+"/"+self.pkg+".ebuild","preinst") - if a: - print "!!! pkg_preinst() script failed; exiting." - sys.exit(a) - outfile=open(self.dbdir+"/CONTENTS","w") - - mergestart=mergestart - os.chdir(mergestart) - cpref=os.path.commonprefix([mergeroot,mergestart]) - relstart=mergestart[len(cpref):] - myfiles=os.listdir(mergestart) - - for x in myfiles: - relfile=relstart+"/"+x - rootfile=os.path.normpath(root+relfile) - #symbolic link - if os.path.islink(x): - myto=os.readlink(x) - if os.path.exists(rootfile): - if (not os.path.islink(rootfile)) and (os.path.isdir(rootfile)): - print "!!!",rootfile,"->",myto - else: - os.unlink(rootfile) - try: - os.symlink(myto,rootfile) - print "<<<",rootfile,"->",myto - outfile.write("sym "+relfile+" -> "+myto+" "+getmtime(rootfile)+"\n") - except: - print "!!!",rootfile,"->",myto - #directory - elif os.path.isdir(x): - mystat=os.stat(x) - if not os.path.exists(rootfile): - os.mkdir(rootfile) - os.chmod(rootfile,mystat[0]) - os.chown(rootfile,mystat[4],mystat[5]) - print "<<<",rootfile+"/" - else: - print "---",rootfile+"/" - outfile.write("dir "+relfile+"\n") - #enter directory, recurse - os.chdir(x) - self.merge(mergeroot,inforoot,mergestart+"/"+x,outfile) - #return to original path - os.chdir(mergestart) - elif os.path.isfile(x): - mymd5=md5(x) - if movefile(x,rootfile): - zing="<<<" - else: - zing="!!!" - - print zing+" "+rootfile - print "md5",mymd5 - if rootfile[0:5]=="/etc/": - #config file management - if os.path.basename(rootfile)[0:6]=="._cfg_": - newcfgfile=os.path.dirname(rootfile)+"/"+os.path.basename(rootfile)[6:] - if movefile(rootfile,newcfgfile,0): - #0=don't unlink original - print "cfg",newcfgfile - else: - print "!!! cfg",newcfgfile - outfile.write("obj "+relfile+" "+mymd5+" "+getmtime(rootfile)+"\n") - elif isfifo(x): - zing="!!!" - if not os.path.exists(rootfile): - if movefile(x,rootfile): - zing="<<<" - elif isfifo(rootfile): - os.unlink(rootfile) - if movefile(x,rootfile): - zing="<<<" - print zing+" "+rootfile - outfile.write("fif "+relfile+"\n") - else: - if movefile(x,rootfile): - zing="<<<" - else: - zing="!!!" - print zing+" "+rootfile - outfile.write("dev "+relfile+"\n") - - if mergestart==mergeroot: - #if we opened it, close it - outfile.close() - if (oldcontents): - print ">>> Safely unmerging already-installed instance..." - self.unmerge(oldcontents) - print ">>> original instance of package unmerged safely." - - os.chdir(inforoot) - for x in os.listdir("."): - self.copyfile(x) - - #create virtual links - for mycatpkg in self.getelements("PROVIDE"): - mycat,mypkg=string.split(mycatpkg,"/") - mylink=dblink(mycat,mypkg) - #this will create the link if it doesn't exist - mylink.create() - myvirts=mylink.getelements("VIRTUAL") - if not mycat+"/"+mypkg in myvirts: - myvirts.append(self.cat+"/"+self.pkg) - mylink.setelements(myvirts,"VIRTUAL") - - #do postinst script - a=doebuild(self.dbdir+"/"+self.pkg+".ebuild","postinst") - if a: - print "!!! pkg_postinst() script failed; exiting." - sys.exit(a) - #update environment settings, library paths - env_update() - print ">>>",self.cat+"/"+self.pkg,"merged." - os.chdir(origdir) - - def getstring(self,name): - "returns contents of a file with whitespace converted to spaces" - if not os.path.exists(self.dbdir+"/"+name): - return "" - myfile=open(self.dbdir+"/"+name,"r") - mydata=string.split(myfile.read()) - myfile.close() - return string.join(mydata," ") - - def copyfile(self,fname): - if not os.path.exists(self.dbdir): - self.create() - shutil.copyfile(fname,self.dbdir+"/"+os.path.basename(fname)) - - def getfile(self,fname): - if not os.path.exists(self.dbdir+"/"+fname): - return "" - myfile=open(self.dbdir+"/"+fname,"r") - mydata=myfile.read() - myfile.close() - return mydata - - def setfile(self,fname,data): - if not os.path.exists(self.dbdir): - self.create() - myfile=open(self.dbdir+"/"+fname,"w") - myfile.write(data) - myfile.close() - - def getelements(self,ename): - if not os.path.exists(self.dbdir+"/"+ename): - return [] - myelement=open(self.dbdir+"/"+ename,"r") - mylines=myelement.readlines() - myreturn=[] - for x in mylines: - for y in string.split(x[:-1]): - myreturn.append(y) - myelement.close() - return myreturn - - def setelements(self,mylist,ename): - if not os.path.exists(self.dbdir): - self.create() - myelement=open(self.dbdir+"/"+ename,"w") - for x in mylist: - myelement.write(x+"\n") - myelement.close() - - def isregular(self): - "Is this a regular package (does it have a CATEGORY file? A dblink can be virtual *and* regular)" - return os.path.exists(self.dbdir+"/CATEGORY") - -def depgrab(myfilename,depmark): - """ - Will grab the dependency string from an ebuild file, using - depmark as a marker (normally DEPEND or RDEPEND) - """ - depstring="" - myfile=open(myfilename,"r") - mylines=myfile.readlines() - myfile.close() - pos=0 - while (pos<len(mylines)): - if mylines[pos][0:len(depmark)+1]==depmark+"=": - depstart=string.split(mylines[pos][len(depmark):],'"') - if len(depstart)==3: - depstring=depstart[1] - return string.join(string.split(depstring)," ") - elif len(depstart)==2: - depstring=depstart[1]+" " - pos=pos+1 - while 1: - mysplit=string.split(mylines[pos],'"') - depstring=depstring+mysplit[0]+" " - if len(mysplit)>1: - return string.join(string.split(depstring)," ") - pos=pos+1 - elif len(depstart)==1: - depstring=depstring+mylines[pos][len(depmark)+1:] - break - else: - break - else: - pos=pos+1 - return string.join(string.split(depstring)," ") - -def cleanup_pkgmerge(mypkg,origdir): - shutil.rmtree(settings["PKG_TMPDIR"]+"/"+mypkg) - os.chdir(origdir) - -def pkgmerge(mytbz2): - """will merge a .tbz2 file, returning a list of runtime dependencies that must be - satisfied, or None if there was a merge error. This code assumes the package - exists.""" - if mytbz2[-5:]!=".tbz2": - print "!!! Not a .tbz2 file" - return None - mypkg=os.path.basename(mytbz2)[:-5] - xptbz2=xpak.tbz2(mytbz2) - pkginfo={} - mycat=xptbz2.getfile("CATEGORY") - if not mycat: - print "!!! CATEGORY info missing from info chunk, aborting..." - return None - mycat=string.strip(mycat) - mycatpkg=mycat+"/"+mypkg - - tmploc=settings["PKG_TMPDIR"] - pkgloc=tmploc+"/"+mypkg+"/bin" - infloc=tmploc+"/"+mypkg+"/inf" - if os.path.exists(tmploc+"/"+mypkg): - shutil.rmtree(tmploc+"/"+mypkg,1) - os.makedirs(pkgloc) - os.makedirs(infloc) - print ">>> extracting info" - xptbz2.unpackinfo(infloc) - origdir=os.getcwd() - os.chdir(pkgloc) - print ">>> extracting",mypkg - notok=os.system("cat "+mytbz2+"| bzip2 -dq | tar xpf -") - if notok: - print "!!! Error extracting",mytbz2 - cleanup_pkgmerge(mypkg,origdir) - return None - #the merge takes care of pre/postinst and old instance auto-unmerge, virtual/provides updates, etc. - merge(mycat,mypkg,pkgloc,infloc) - if not os.path.exists(infloc+"/RDEPEND"): - returnme="" - else: - #get runtime dependencies - a=open(infloc+"/RDEPEND","r") - returnme=string.join(string.split(a.read())," ") - a.close() - cleanup_pkgmerge(mypkg,origdir) - return returnme -def ebuild_init(): - "performs db/variable initialization for the ebuild system. Not required for other scripts." - global local_virts, root_virts, roottree, localtree, ebuild_initialized, root, virtuals - local_virts=getvirtuals("/") - if root=="/": - root_virts=local_virts - else: - root_virts=getvirtuals(root) - - localtree=vartree("/",local_virts) - if root=="/": - roottree=localtree - else: - roottree=vartree(root,root_virts) - ebuild_initialized=1 -root=getenv("ROOT") -if len(root)==0: - root="/" -elif root[-1]!="/": - root=root+"/" -if root != "/": - if not os.path.exists(root[:-1]): - print "!!! Error: ROOT",root,"does not exist. Please correct this." - print "!!! Exiting." - print - sys.exit(1) - elif not os.path.isdir(root[:-1]): - print "!!! Error: ROOT",root[:-1],"is not a directory. Please correct this." - print "!!! Exiting." - print - sys.exit(1) -settings=config() -ebuild_initialized=0 - - diff --git a/sys-apps/portage/files/1.5/pym/portage.py.cfg b/sys-apps/portage/files/1.5/pym/portage.py.cfg deleted file mode 100755 index 2425f16f8e6e..000000000000 --- a/sys-apps/portage/files/1.5/pym/portage.py.cfg +++ /dev/null @@ -1,2020 +0,0 @@ -# Gentoo Linux Dependency Checking Code -# Copyright 1998-2000 Daniel Robbins, Gentoo Technologies, Inc. -# Distributed under the GNU Public License - -# TO-DO: -# (I'm adding this here because I lose or forget about all my other Portage -# TO-DO files... -# -# subpackages -# =========== -#src_install will work as normal, and will create the master image that includes -#everything in ${D}. There will be a new function, called src_subpkg that contains -#instructions for selecting files from ${D} and copying them to subpkg dirs, where -#they will get seperately packaged. The function will look something like this: -# -#src_subpkg() { -# subpkg bin -# #maybe grab should use regular expressions, not globbing? -# grab /usr/bin/* /usr/sbin/* /usr/lib/*.so -# -# subpkg dev -# grab /usr/lib/*.a (any way to say "everything but *.so"?) -#} -# -#Subpackage naming will work as follows. For a package foo-1.0, foo-1.0.tbz2 -#will be the master package and include all subpackages. foo:dev-1.0.tbz2 will -#be the development package, and foo:run-1.0.tbz2 will be a runtime package, -#etc. It should be possible to simply treat them as unique package names with -#P="foo:dev" and P="foo:run" respectively. -# -#dep resolution needs to be upgraded a bit, though. "sys-apps/foo" will depend -#on the foo master package (i.e. foo-1.0.tbz2) for backwards compatibility. However, -#it will now also be possible to depend on "sys-apps/foo:dev" or "sys-apps/foo:run", -#and the dep system needs to be upgraded so that it knows how to satisfy these -#dependencies. This should allow the new subpackages system to be integrated -#seamlessly into our existing dependency hierarchy. -# -#Note: It may also be a good idea to allow a make.conf option so that "sys-apps/foo:run" -#automatically resolves to the master package (for those who prefer complete packages -#rather than installing things piecemeal; a great idea for development boxes where many -#things will depend on "sys-apps/foo:dev" for headers, but the developer may want the -#whole enchilada. (generally, I prefer this approach, though for runtime-only systems -#subpackages make a lot of sense). -# -#new dependency functionality -#============================ -# -#Important new dep functionality: -# -#~sys-apps/foo-1.0 will match the latest rev of foo-1.0. Useful because the latest rev -#should be the most stable and reliable version. -# -#Next, sys-apps/foo-1.0* will match the latest package that starts with 1.0; so 1.0.3 will -#match. This is an excellent way to depend on libraries where you need a specific major -#or minor version, but also want to be able to use the latest "really minor" version and -#rev available. For example, if your app depends on glib-1.2: -# -#dev-libs/glib-1.2* -# -#This will match glib-1.2, glib-1.2-r1, glib-1.2.1 and glib-1.2.1.1-r1. Of these four -#examples, the last will be chosen (most recent) if all are available. However, glib-1.3 -#will not be considered for this dependency. - -import string,os -from stat import * -from commands import * -import fchksum,types -import sys -import shlex -import shutil -import xpak - -# master category list. Any new categories should be added to this list to -# ensure that they all categories are read when we check the portage directory -# for available ebuilds. - -categories=("app-admin", "app-arch", "app-cdr", "app-crypt", "app-doc", -"app-editors", "app-emulation", "app-games", "app-misc", "app-office", -"app-shells", "app-text", "dev-db", "dev-java", "dev-lang", "dev-libs", -"dev-perl", "dev-python", "dev-ruby", "dev-util", "gnome-apps", "gnome-base", -"gnome-libs", "gnome-office","kde-apps", "kde-i18n", "kde-base", "kde-libs", -"media-gfx", "media-libs", "media-sound", "media-video", "net-analyzer", -"net-dialup", "net-fs", "net-ftp", "net-im", "net-irc", "net-libs", "net-mail", -"net-misc", "net-news", "net-nds", "net-print", "net-www", "packages", -"sys-apps", "sys-devel", "sys-kernel", "sys-libs", "x11-base", "x11-libs", -"x11-terms", "x11-wm","virtual") - -#beautiful directed graph object - -class digraph: - def __init__(self): - self.dict={} - - def addnode(self,mykey,myparent): - # print digraph - if not self.dict.has_key(mykey): - if myparent==None: - self.dict[mykey]=[0,[]] - else: - self.dict[mykey]=[0,[myparent]] - self.dict[myparent][0]=self.dict[myparent][0]+1 - return - if not myparent in self.dict[mykey][1]: - self.dict[mykey][1].append(myparent) - self.dict[myparent][0]=self.dict[myparent][0]+1 - - def delnode(self,mykey): - if not self.dict.has_key(mykey): - return - for x in self.dict[mykey][1]: - self.dict[x][0]=self.dict[x][0]-1 - del self.dict[mykey] - - def firstzero(self): - "returns first node with zero references, or NULL if no such node exists" - for x in self.dict.keys(): - if self.dict[x][0]==0: - return x - return None - - def empty(self): - if len(self.dict)==0: - return 1 - return 0 - - def hasnode(self,mynode): - return self.dict.has_key(mynode) - - def copy(self): - mygraph=digraph() - for x in self.dict.keys(): - mygraph.dict[x]=self.dict[x][:] - return mygraph - -# valid end of version components; integers specify offset from release version -# pre=prerelease, p=patchlevel (should always be followed by an int), rc=release candidate -# all but _p (where it is required) can be followed by an optional trailing integer - -endversion={"pre":-2,"p":0,"alpha":-4,"beta":-3,"rc":-1} - -#parse /etc/env.d and generate /etc/profile.env - -def env_update(): - global root - fns=os.listdir(root+"etc/env.d") - fns.sort() - pos=0 - while (pos<len(fns)): - if fns[pos]<=2: - del fns[pos] - continue - if (fns[pos][0] not in string.digits) or (fns[pos][1] not in string.digits): - del fns[pos] - continue - pos=pos+1 - - specials={"PATH":[],"CLASSPATH":[],"LDPATH":[],"MANPATH":[],"INFODIR":[],"ROOTPATH":[]} - env={} - - for x in fns: - myconfig=getconfig(root+"etc/env.d/"+x) - # process PATH, CLASSPATH, LDPATH - for myspec in specials.keys(): - if myconfig.has_key(myspec): - if myspec=="LDPATH": - specials[myspec].extend(string.split(expand(myconfig[myspec]),":")) - else: - specials[myspec].append(expand(myconfig[myspec])) - del myconfig[myspec] - # process all other variables - for myenv in myconfig.keys(): - env[myenv]=expand(myconfig[myenv]) - - if os.path.exists(root+"etc/ld.so.conf"): - myld=open(root+"etc/ld.so.conf") - myldlines=myld.readlines() - myld.close() - oldld=[] - for x in myldlines: - #each line has at least one char (a newline) - if x[0]=="#": - continue - oldld.append(x[:-1]) - oldld.sort() - # os.rename(root+"etc/ld.so.conf",root+"etc/ld.so.conf.bak") - # Where is the new ld.so.conf generated? (achim) - else: - oldld=None - specials["LDPATH"].sort() - if (oldld!=specials["LDPATH"]): - #ld.so.conf needs updating and ldconfig needs to be run - newld=open(root+"etc/ld.so.conf","w") - newld.write("# ld.so.conf autogenerated by env-update; make all changes to\n") - newld.write("# contents of /etc/env.d directory\n") - for x in specials["LDPATH"]: - newld.write(x+"\n") - newld.close() - #run ldconfig here - print ">>> Regenerating "+root+"etc/ld.so.cache..." - getstatusoutput("/sbin/ldconfig -r "+root) - del specials["LDPATH"] - - outfile=open(root+"/etc/profile.env","w") - - for path in specials.keys(): - if len(specials[path])==0: - continue - outstring="export "+path+"='" - for x in specials[path][:-1]: - outstring=outstring+x+":" - outstring=outstring+specials[path][-1]+"'" - outfile.write(outstring+"\n") - #get it out of the way - del specials[path] - - #create /etc/profile.env - for x in env.keys(): - if type(env[x])!=types.StringType: - continue - outfile.write("export "+x+"='"+env[x]+"'\n") - outfile.close() - - #need to add cshrc support - -def getconfig(mycfg,tolerant=0): - mykeys={} - f=open(mycfg,'r') - lex=shlex.shlex(f) - lex.wordchars=string.digits+string.letters+"~!@#$%*_\:;?,./-+{}" - lex.quotes="\"'" - while 1: - key=lex.get_token() - if (key==''): - #normal end of file - break; - equ=lex.get_token() - if (equ==''): - #unexpected end of file - #lex.error_leader(self.filename,lex.lineno) - if not tolerant: - print "!!! Unexpected end of config file: variable",key - return None - else: - return mykeys - elif (equ!='='): - #invalid token - #lex.error_leader(self.filename,lex.lineno) - if not tolerant: - print "!!! Invalid token (not \"=\")",equ - return None - else: - return mykeys - val=lex.get_token() - if (val==''): - #unexpected end of file - #lex.error_leader(self.filename,lex.lineno) - if not tolerant: - print "!!! Unexpected end of config file: variable",key - return None - else: - return mykeys - mykeys[key]=val - return mykeys - -def expand(mystring,dictlist=[]): - """ - new variable expansion code. Removes quotes, handles \n, etc, and - will soon use the dictlist to expand ${variable} references. - This code will be used by the configfile code, as well as others (parser) - This would be a good bunch of code to port to C. - """ - mystring=" "+mystring - #in single, double quotes - insing=0 - indoub=0 - pos=1 - newstring=" " - while (pos<len(mystring)): - if (mystring[pos]=="'") and (mystring[pos-1]!="\\"): - if (indoub): - newstring=newstring+"'" - else: - insing=not insing - pos=pos+1 - continue - elif (mystring[pos]=='"') and (mystring[pos-1]!="\\"): - if (insing): - newstring=newstring+'"' - else: - indoub=not indoub - pos=pos+1 - continue - if (not insing): - #expansion time - if (mystring[pos]=="\\"): - #backslash expansion time - if (pos+1>=len(mystring)): - newstring=newstring+mystring[pos] - break - else: - a=mystring[pos+1] - pos=pos+2 - if a=='a': - newstring=newstring+chr(007) - elif a=='b': - newstring=newstring+chr(010) - elif a=='e': - newstring=newstring+chr(033) - elif (a=='f') or (a=='n'): - newstring=newstring+chr(012) - elif a=='r': - newstring=newstring+chr(015) - elif a=='t': - newstring=newstring+chr(011) - elif a=='v': - newstring=newstring+chr(013) - else: - #remove backslash only, as bash does: this takes care of \\ and \' and \" as well - newstring=newstring+mystring[pos-1:pos] - continue - elif (mystring[pos]=="$") and (mystring[pos-1]!="\\"): - pos=pos+1 - if (pos+1)>=len(mystring): - return "" - if mystring[pos]=="{": - pos=pos+1 - terminus="}" - else: - terminus=string.whitespace - myvstart=pos - while mystring[pos] not in terminus: - if (pos+1)>=len(mystring): - return "" - pos=pos+1 - myvarname=mystring[myvstart:pos] - pos=pos+1 - if len(myvarname)==0: - return "" - newstring=newstring+settings[myvarname] - else: - newstring=newstring+mystring[pos] - pos=pos+1 - else: - newstring=newstring+mystring[pos] - pos=pos+1 - return newstring[1:] - -class config: - def __init__(self): - self.origenv=os.environ.copy() - self.populated=0 - def populate(self): - if os.path.exists("/etc/make.profile/make.defaults"): - self.configlist=[self.origenv.copy(),getconfig("/etc/make.conf"),getconfig("/etc/make.profile/make.defaults"),getconfig("/etc/make.globals")] - else: - print ">>> /etc/make.profile/make.defaults not found, continuing anyway..." - self.configlist=[self.origenv.copy(),getconfig("/etc/make.conf"),getconfig("/etc/make.globals")] - self.populated=1 - def __getitem__(self,mykey): - if not self.populated: - self.populate() - for x in self.configlist: - if x.has_key(mykey): - return expand(x[mykey],self.configlist) - return "" - def has_key(self,mykey): - if not self.populated: - self.populate() - for x in self.configlist: - if x.has_key(mykey): - return 1 - return 0 - def keys(self): - if not self.populated: - self.populate() - mykeys=[] - for x in self.configlist: - for y in x.keys(): - if y not in mykeys: - mykeys.append(y) - return mykeys - def __setitem__(self,mykey,myvalue): - if not self.populated: - self.populate() - self.configlist[0][mykey]=myvalue - def reset(self): - if not self.populated: - self.populate() - "reset environment to original settings" - self.configlist[0]=self.origenv.copy() - def environ(self): - "return our locally-maintained environment" - mydict={} - for x in self.keys(): - mydict[x]=self[x] - return mydict - -def spawn(mystring): - global settings - mypid=os.fork() - if mypid==0: - mycommand="/bin/bash" - myargs=["bash","-c",mystring] - os.execve(mycommand,myargs,settings.environ()) - return - retval=os.waitpid(mypid,0)[1] - if (retval & 0xff)==0: - #return exit code - return (retval >> 8) - else: - #interrupted by signal - return 16 - -def doebuild(myebuild,mydo,checkdeps=1): - global settings - if not os.path.exists(myebuild): - print "!!!",myebuild,"not found." - return 1 - if myebuild[-7:]!=".ebuild": - print "!!!",myebuild,"does not appear to be an ebuild file." - return 1 - settings.reset() - settings["ROOT"]=root - settings["STARTDIR"]=os.getcwd() - settings["EBUILD"]=os.path.abspath(myebuild) - settings["O"]=os.path.dirname(settings["EBUILD"]) - settings["CATEGORY"]=os.path.basename(os.path.normpath(settings["O"]+"/..")) - #PEBUILD - settings["FILESDIR"]=settings["O"]+"/files" - settings["PF"]=os.path.basename(settings["EBUILD"])[:-7] - mysplit=pkgsplit(settings["PF"],0) - if mysplit==None: - print "!!! Error: PF is null; exiting." - return 1 - settings["P"]=mysplit[0]+"-"+mysplit[1] - settings["PN"]=mysplit[0] - settings["PV"]=mysplit[1] - settings["PR"]=mysplit[2] - if mysplit[2]=="r0": - settings["PVR"]=mysplit[1] - else: - settings["PVR"]=mysplit[1]+"-"+mysplit[2] - if settings.has_key("PATH"): - mysplit=string.split(settings["PATH"],":") - else: - mysplit=[] - if not "/usr/lib/portage/bin" in mysplit: - settings["PATH"]="/usr/lib/portage/bin:"+settings["PATH"] - - if not settings.has_key("BUILD_PREFIX"): - print "!!! Error: BUILD_PREFIX not defined." - return 1 - settings["BUILDDIR"]=settings["BUILD_PREFIX"]+"/"+settings["PF"] - if not os.path.exists(settings["BUILDDIR"]): - os.makedirs(settings["BUILDDIR"]) - settings["T"]=settings["BUILDDIR"]+"/temp" - if not os.path.exists(settings["T"]): - os.makedirs(settings["T"]) - settings["WORKDIR"]=settings["BUILDDIR"]+"/work" - settings["D"]=settings["BUILDDIR"]+"/image/" - - #initial ebuild.sh bash environment configured - if checkdeps: - mydeps=string.split(getoutput("/usr/sbin/ebuild.sh depend"),"\n") - if mydo=="depend": - return mydeps - elif mydo=="check": - return dep_frontend("build",mydeps[0]) - elif mydo=="rcheck": - return dep_frontend("runtime",mydeps[1]) - if mydo in ["merge","qmerge","unpack", "compile", "rpm", "package"]: - #optional dependency check -- if emerge is merging, this is skipped - retval=dep_frontend("build",mydeps[0]) - if (retval): return retval - else: - if mydo in ["depend","check","rcheck"]: - print "!!! doebuild(): ",mydo,"cannot be called with checkdeps equal to zero." - return 1 - - #initial dep checks complete; time to process main commands - - if mydo=="unpack": - return spawn("/usr/sbin/ebuild.sh fetch unpack") - elif mydo=="compile": - return spawn("/usr/sbin/ebuild.sh fetch unpack compile") - elif mydo=="install": - return spawn("/usr/sbin/ebuild.sh fetch unpack compile install") - elif mydo in ["prerm","postrm","preinst","postinst","config","touch","clean","fetch","digest","batchdigest"]: - return spawn("/usr/sbin/ebuild.sh "+mydo) - elif mydo=="qmerge": - #qmerge is specifically not supposed to do a runtime dep check - return merge(settings["CATEGORY"],settings["PF"],settings["D"],settings["BUILDDIR"]+"/build-info") - elif mydo=="merge": - retval=spawn("/usr/sbin/ebuild.sh fetch unpack compile install") - if retval: return retval - if checkdeps: - retval=dep_frontend("runtime",mydeps[1]) - if (retval): return retval - return merge(settings["CATEGORY"],settings["PF"],settings["D"],settings["BUILDDIR"]+"/build-info") - elif mydo=="unmerge": - return unmerge(settings["CATEGORY"],settings["PF"]) - elif mydo=="rpm": - return spawn("/usr/sbin/ebuild.sh fetch unpack compile install rpm") - elif mydo=="package": - retval=spawn("/usr/sbin/ebuild.sh fetch") - if retval: - return retval - for x in ["","/"+settings["CATEGORY"],"/All"]: - if not os.path.exists(settings["PKGDIR"]+x): - os.makedirs(settings["PKGDIR"]+x) - pkgloc=settings["PKGDIR"]+"/All/"+settings["PF"]+".tbz2" - rebuild=0 - if os.path.exists(pkgloc): - for x in [settings["A"],settings["EBUILD"]]: - if not os.path.exists(x): - continue - if os.path.getmtime(x)>os.path.getmtime(pkgloc): - rebuild=1 - break - else: - rebuild=1 - if not rebuild: - print - print ">>> Package",settings["PF"]+".tbz2 appears to be up-to-date." - print ">>> To force rebuild, touch",os.path.basename(settings["EBUILD"]) - print - return 0 - else: - return spawn("/usr/sbin/ebuild.sh unpack compile install package") - else: - print "!!! Please specify a valid command." - return 1 - -def isdev(x): - mymode=os.stat(x)[ST_MODE] - return ( S_ISCHR(mymode) or S_ISBLK(mymode)) - -def isfifo(x): - mymode=os.stat(x)[ST_MODE] - return S_ISFIFO(mymode) - -def movefile(src,dest,unlink=1): - """moves a file from src to dest, preserving all permissions and attributes.""" - if dest=="/bin/cp": - getstatusoutput("/bin/mv /bin/cp /bin/cp.old") - a=getstatusoutput("/bin/cp.old -a "+"'"+src+"' /bin/cp") - os.unlink("/bin/cp.old") - elif dest=="/bin/bash": - a=getstatusoutput("rm /bin/bash; /bin/cp -a "+"'"+src+"' '"+dest+"'") - else: - a=getstatusoutput("/bin/cp -af "+"'"+src+"' '"+dest+"'") -# cp -a takes care of this -# mymode=os.lstat(src)[ST_MODE] -# os.chmod(dest,mymode) - if unlink: - os.unlink(src) - if a[0]==0: - return 1 - else: - return 0 - -def getmtime(x): - return `os.lstat(x)[-2]` - -def md5(x): - return string.upper(fchksum.fmd5t(x)[0]) - -def pathstrip(x,mystart): - cpref=os.path.commonprefix([x,mystart]) - return [root+x[len(cpref)+1:],x[len(cpref):]] - -def merge(cat,pkg,mystart,myinfostart): - mylink=dblink(cat,pkg) - if not mylink.exists(): - mylink.create() - #shell error code - mylink.merge(mystart,myinfostart) - -def unmerge(cat,pkg): - mylink=dblink(cat,pkg) - if mylink.exists(): - mylink.unmerge() - mylink.delete() - -def getenv(mykey,dictlist=[]): - "dictlist contains a list of dictionaries to check *before* the environment" - dictlist.append(os.environ) - for x in dictlist: - if x.has_key(mykey): - return expand(x[mykey],dictlist) - return "" - -def relparse(myver): - "converts last version part into three components" - number=0 - p1=0 - p2=0 - mynewver=string.split(myver,"_") - if len(mynewver)==2: - #an endversion - number=string.atof(mynewver[0]) - match=0 - for x in endversion.keys(): - elen=len(x) - if mynewver[1][:elen] == x: - match=1 - p1=endversion[x] - try: - p2=string.atof(mynewver[1][elen:]) - except: - p2=0 - break - if not match: - #normal number or number with letter at end - divider=len(myver)-1 - if myver[divider:] not in "1234567890": - #letter at end - p1=ord(myver[divider:]) - number=string.atof(myver[0:divider]) - else: - number=string.atof(myver) - else: - #normal number or number with letter at end - divider=len(myver)-1 - if myver[divider:] not in "1234567890": - #letter at end - p1=ord(myver[divider:]) - number=string.atof(myver[0:divider]) - else: - number=string.atof(myver) - return [number,p1,p2] - -def revverify(myrev): - if len(myrev)==0: - return 0 - if myrev[0]=="r": - try: - string.atoi(myrev[1:]) - return 1 - except: - pass - return 0 - -#returns 1 if valid version string, else 0 -# valid string in format: <v1>.<v2>...<vx>[a-z,_{endversion}[vy]] -# ververify doesn't do package rev. - -def ververify(myorigval,silent=1): - if len(myorigval)==0: - if not silent: - print "!!! Name error: package contains empty \"-\" part." - return 0 - myval=string.split(myorigval,'.') - if len(myval)==0: - if not silent: - print "!!! Name error: empty version string." - return 0 - #all but the last version must be a numeric - for x in myval[:-1]: - if not len(x): - if not silent: - print "!!! Name error in",myorigval+": two decimal points in a row" - return 0 - try: - foo=string.atoi(x) - except: - if not silent: - print "!!! Name error in",myorigval+": \""+x+"\" is not a valid version component." - return 0 - if not len(myval[-1]): - if not silent: - print "!!! Name error in",myorigval+": two decimal points in a row" - return 0 - try: - foo=string.atoi(myval[-1]) - return 1 - except: - pass - #ok, our last component is not a plain number or blank, let's continue - if myval[-1][-1] in string.lowercase: - try: - foo=string.atoi(myval[-1][:-1]) - return 1 - # 1a, 2.0b, etc. - except: - pass - #ok, maybe we have a 1_alpha or 1_beta2; let's see - #ep="endpart" - ep=string.split(myval[-1],"_") - if len(ep)!=2: - if not silent: - print "!!! Name error in",myorigval - return 0 - try: - foo=string.atoi(ep[0]) - except: - #this needs to be numeric, i.e. the "1" in "1_alpha" - if not silent: - print "!!! Name error in",myorigval+": characters before _ must be numeric" - return 0 - for mye in endversion.keys(): - if ep[1][0:len(mye)]==mye: - if len(mye)==len(ep[1]): - #no trailing numeric; ok - return 1 - else: - try: - foo=string.atoi(ep[1][len(mye):]) - return 1 - except: - #if no endversions work, *then* we return 0 - pass - if not silent: - print "!!! Name error in",myorigval - return 0 - -def isjustname(mypkg): - myparts=string.split(mypkg,'-') - for x in myparts: - if ververify(x): - return 0 - return 1 - -def isspecific(mypkg): - mysplit=string.split(mypkg,"/") - if len(mysplit)==2: - if not isjustname(mysplit[1]): - return 1 - return 0 - -# This function can be used as a package verification function, i.e. -# "pkgsplit("foo-1.2-1") will return None if foo-1.2-1 isn't a valid -# package (with version) name. If it is a valid name, pkgsplit will -# return a list containing: [ pkgname, pkgversion(norev), pkgrev ]. -# For foo-1.2-1, this list would be [ "foo", "1.2", "1" ]. For -# Mesa-3.0, this list would be [ "Mesa", "3.0", "0" ]. - -def pkgsplit(mypkg,silent=1): - myparts=string.split(mypkg,'-') - if len(myparts)<2: - if not silent: - print "!!! Name error in",mypkg+": missing a version or name part." - return None - for x in myparts: - if len(x)==0: - if not silent: - print "!!! Name error in",mypkg+": empty \"-\" part." - return None - if revverify(myparts[-1]): - if ververify(myparts[-2]): - if len(myparts)==2: - return None - else: - for x in myparts[:-2]: - if ververify(x): - return None - #names can't have versiony looking parts - return [string.join(myparts[:-2],"-"),myparts[-2],myparts[-1]] - else: - return None - - elif ververify(myparts[-1],silent): - if len(myparts)==1: - if not silent: - print "!!! Name error in",mypkg+": missing name part." - return None - else: - for x in myparts[:-1]: - if ververify(x): - if not silent: - print "!!! Name error in",mypkg+": multiple version parts." - return None - return [string.join(myparts[:-1],"-"),myparts[-1],"r0"] - else: - return None - -def catpkgsplit(mycatpkg,silent=1): - """returns [cat, pkgname, version, rev ]""" - mysplit=string.split(mycatpkg,"/") - if len(mysplit)!=2: - if not silent: - print "!!! Name error in",mycatpkg+": category or package part missing." - return None - mysplit2=pkgsplit(mysplit[1],silent) - if mysplit2==None: - return None - return [mysplit[0],mysplit2[0],mysplit2[1],mysplit2[2]] - -# vercmp: -# This takes two version strings and returns an integer to tell you whether -# the versions are the same, val1>val2 or val2>val1. - -def vercmp(val1,val2): - val1=string.split(val1,'-') - if len(val1)==2: - val1[0]=val1[0]+"."+val1[1] - val1=string.split(val1[0],'.') - #add back decimal point so that .03 does not become "3" ! - for x in val1[1:]: - x="."+x - val2=string.split(val2,'-') - if len(val2)==2: - val2[0]=val2[0]+"."+val2[1] - val2=string.split(val2[0],'.') - for x in val2[1:]: - x="."+x - if len(val2)<len(val1): - for x in range(0,len(val1)-len(val2)): - val2.append("0") - elif len(val1)<len(val2): - for x in range(0,len(val2)-len(val1)): - val1.append("0") - #The above code will extend version numbers out so they - #have the same number of digits. - myval1=[] - for x in range(0,len(val1)): - cmp1=relparse(val1[x]) - cmp2=relparse(val2[x]) - for y in range(0,3): - myret=cmp1[y]-cmp2[y] - if myret != 0: - return myret - return 0 - - -def pkgcmp(pkg1,pkg2): - """if returnval is less than zero, then pkg2 is newer than pkg2, zero if equal and positive if older.""" - mycmp=vercmp(pkg1[1],pkg2[1]) - if mycmp>0: - return 1 - if mycmp<0: - return -1 - r1=string.atoi(pkg1[2][1:]) - r2=string.atoi(pkg2[2][1:]) - if r1>r2: - return 1 - if r2>r1: - return -1 - return 0 - -def dep_parenreduce(mysplit,mypos=0): - "Accepts a list of strings, and converts '(' and ')' surrounded items to sub-lists" - while (mypos<len(mysplit)): - if (mysplit[mypos]=="("): - firstpos=mypos - mypos=mypos+1 - while (mypos<len(mysplit)): - if mysplit[mypos]==")": - mysplit[firstpos:mypos+1]=[mysplit[firstpos+1:mypos]] - mypos=firstpos - break - elif mysplit[mypos]=="(": - #recurse - mysplit=dep_parenreduce(mysplit,mypos) - mypos=mypos+1 - mypos=mypos+1 - return mysplit - -def dep_opconvert(mysplit,myuse): - "Does dependency operator conversion, such as moving '||' inside a sub-list, etc." - mypos=0 - while mypos<len(mysplit): - if type(mysplit[mypos])==types.ListType: - mysplit[mypos]=dep_opconvert(mysplit[mypos],myuse) - elif mysplit[mypos]==")": - #mismatched paren, error - return None - elif mysplit[mypos]=="||": - if (mypos+1)<len(mysplit): - if type(mysplit[mypos+1])!=types.ListType: - # || must be followed by paren'd list - return None - else: - mynew=dep_opconvert(mysplit[mypos+1],myuse) - mysplit[mypos+1]=mynew - mysplit[mypos+1][0:0]=["||"] - del mysplit[mypos] - else: - #don't end a depstring with || :) - return None - elif mysplit[mypos][-1]=="?": - #uses clause, i.e "gnome? ( foo bar )" - if (mysplit[mypos][:-1]) in myuse: - #if the package is installed, just delete the conditional - del mysplit[mypos] - else: - #the package isn't installed, delete conditional and next item - del mysplit[mypos] - del mysplit[mypos] - #we don't want to move to the next item, so we perform a quick hack - mypos=mypos-1 - mypos=mypos+1 - return mysplit - -def dep_eval(deplist): - if len(deplist)==0: - return 1 - if deplist[0]=="||": - #or list; we just need one "1" - for x in deplist[1:]: - if type(x)==types.ListType: - if dep_eval(x)==1: - return 1 - elif x==1: - return 1 - return 0 - else: - for x in deplist: - if type(x)==types.ListType: - if dep_eval(x)==0: - return 0 - elif x==0: - return 0 - return 1 - -def dep_catpkgstring(mypkgdep): - if mypkgdep[0]=="!": - if not pkgsplit(mypkgdep[1:]): - return "(invalid dependency)" - else: - return "unmerge "+mypkgdep[1:] - elif mypkgdep[0]=="=": - if not pkgsplit(mypkgdep[1:]): - return "(invalid dependency)" - else: - return "merge "+mypkgdep[1:] - elif mypkgdep[0:2]==">=": - if not pkgsplit(mypkgdep[2:]): - return "(invalid dependency)" - else: - return "merge "+mypkgdep[2:]+" or newer" - elif mypkgdep[0:2]=="<=": - if not pkgsplit(mypkgdep[2:]): - return "(invalid dependency)" - else: - return "merge "+mypkgdep[2:]+" or older" - elif mypkgdep[0]=="<": - mysplit=catpkgsplit(mypkgdep[1:]) - if mysplit==None: - return "(invalid dependency)" - else: - myret="merge "+string.join([mysplit[0],mysplit[1]],"/")+" older than version" - if mysplit[3]=="r0": - return myret+" "+mysplit[2] - else: - return myret+" "+mysplit[2]+"-"+mysplit[3] - elif mypkgdep[0]==">": - mysplit=catpkgsplit(mypkgdep[1:]) - if mysplit==None: - return "(invalid dependency)" - else: - myret="merge "+string.join([mysplit[0],mysplit[1]],"/")+" newer than version" - if mysplit[3]=="r0": - return myret+" "+mysplit[2] - else: - return myret+" "+mysplit[2]+"-"+mysplit[3] - elif not isspecific(mypkgdep): - mysplit=string.split(mypkgdep,"/") - if len(mysplit)!=2: - return "(invalid dependency)" - else: - return "merge any version of "+mypkgdep - else: - return "(invalid dependency)" - -def dep_print(deplist,mylevel=0): - "Prints out a deplist in a human-understandable format" - if (deplist==None) or (len(deplist)==0): - return - if deplist[0]=="||": - for x in deplist[1:]: - if type(x)==types.ListType: - dep_print(x,mylevel+1) - else: - print " "*(mylevel)+"|| "+dep_catpkgstring(x) - else: - for x in deplist: - if type(x)==types.ListType: - dep_print(x,mylevel+1) - else: - print " "*(mylevel)+"&& "+dep_catpkgstring(x) - - -def dep_zapdeps(unreduced,reduced): - """Takes an unreduced and reduced deplist and removes satisfied dependencies. - Returned deplist contains steps that must be taken to satisfy dependencies.""" - if unreduced[0]=="||": - if dep_eval(reduced): - #deps satisfied, return None - return None - else: - return unreduced - else: - if dep_eval(reduced): - #deps satisfied, return None - return None - else: - returnme=[] - x=0 - while x<len(reduced): - if type(reduced[x])==types.ListType: - myresult=dep_zapdeps(unreduced[x],reduced[x]) - if myresult: - returnme.append(myresult) - else: - if reduced[x]==0: - returnme.append(unreduced[x]) - x=x+1 - return returnme - -def dep_listcleanup(deplist): - "remove unnecessary clutter from deplists. Remove multiple list levels, empty lists" - newlist=[] - if (len(deplist)==1): - #remove multiple-depth lists - if (type(deplist[0])==types.ListType): - for x in deplist[0]: - if type(x)==types.ListType: - if len(x)!=0: - newlist.append(dep_listcleanup(x)) - else: - newlist.append(x) - else: - #unembed single nodes - newlist.append(deplist[0]) - else: - for x in deplist: - if type(x)==types.ListType: - if len(x)==1: - newlist.append(x[0]) - elif len(x)!=0: - newlist=newlist+dep_listcleanup(x) - else: - newlist.append(x) - return newlist - -def dep_frontend(mytype,depstring): - """ebuild frontend for dependency system""" - if ebuild_initialized==0: - ebuild_init() - if depstring=="": - print ">>> No",mytype,"dependencies." - return 0 - if mytype=="build": - myparse=localtree.depcheck(depstring) - elif mytype=="runtime": - myparse=roottree.depcheck(depstring) - else: - print "!!! Error: dependency type",mytype,"not recognized. Exiting." - return 1 - if myparse[0]==0: - #error - print '!!! '+mytype+' dependency error:',myparse[1] - return 1 - elif myparse[1]==[]: - print '>>> '+mytype+' dependencies OK ;)' - return 0 - else: - print '!!! Some '+mytype+' dependencies must be satisfied:' - print - print myparse[1] - dep_print(myparse[1]) - print -# This is the semi-working auto-ebuild stuff, disabled for now -# dep_print_resolve(myparse[1]) - return 1 - -# gets virtual package settings -def getvirtuals(myroot): - if not os.path.exists(myroot+"/etc/make.profile/virtuals"): - print ">>>",os.path.normpath(myroot+"/etc/make.profile/virtuals"),"does not exist. Continuing anyway..." - return {} - myfile=open(myroot+"/etc/make.profile/virtuals") - mylines=myfile.readlines() - myvirts={} - for x in mylines: - mysplit=string.split(x) - if len(mysplit)!=2: - continue - myvirts[mysplit[0]]=mysplit[1] - return myvirts - -class packagetree: - def __init__(self,virtual): - self.tree={} - self.populated=0 - self.virtual=virtual - - def populate(self): - "populates the tree with values" - populated=1 - pass - - def zap(self,mycatpkg): - "remove a catpkg from the deptree" - cps=catpkgsplit(mycatpkg,0) - mykey=cps[0]+"/"+cps[1] - if not self.tree.has_key(mykey): - return - x=0 - while x<len(self.tree[mykey]): - if self.tree[mykey][x][0]==mycatpkg: - del self.tree[mykey][x] - x=x+1 - if len(self.tree[mykey])==0: - del self.tree[mykey] - - def inject(self,mycatpkg): - "add a catpkg to the deptree" - cps=catpkgsplit(mycatpkg,0) - mykey=cps[0]+"/"+cps[1] - if not self.tree.has_key(mykey): - self.tree[mykey]=[] - self.tree[mykey].append([mycatpkg,cps]) - - def resolve_key(self,mykey): - "generates new key, taking into account virtual keys" - if not self.tree.has_key(mykey): - if self.virtual: - if self.virtual.has_key(mykey): - return self.virtual[mykey] - return mykey - - def exists_specific(self,myspec): - if not self.populated: - self.populate() - myspec=self.resolve_specific(myspec) - if not myspec: - return None - cps=catpkgsplit(myspec) - if not cps: - return None - mykey=cps[0]+"/"+cps[1] - if self.tree.has_key(mykey): - for x in self.tree[mykey]: - if x[0]==myspec: - return 1 - return 0 - - def exists_specific_cat(self,myspec): - if not self.populated: - self.populate() - myspec=self.resolve_specific(myspec) - if not myspec: - return None - cps=catpkgsplit(myspec) - if not cps: - return None - mykey=cps[0]+"/"+cps[1] - if self.tree.has_key(mykey): - return 1 - return 0 - - def resolve_specific(self,myspec): - cps=catpkgsplit(myspec) - if not cps: - return None - mykey=self.resolve_key(cps[0]+"/"+cps[1]) - mykey=mykey+"-"+cps[2] - if cps[3]!="r0": - mykey=mykey+"-"+cps[3] - return mykey - - def hasnode(self,mykey): - if not self.populated: - self.populate() - if self.tree.has_key(self.resolve_key(mykey)): - return 1 - return 0 - - def getallnodes(self): - "returns a list of all keys in our tree" - if not self.populated: - self.populate() - return self.tree.keys() - - def getnode(self,nodename): - if not self.populated: - self.populate() - nodename=self.resolve_key(nodename) - if not nodename: - return [] - if not self.tree.has_key(nodename): - return [] - return self.tree[nodename] - - def depcheck(self,depstring): - """evaluates a dependency string and returns a 2-node result list - [1, None] = ok, no dependencies - [1, ["x11-base/foobar","sys-apps/oni"] = dependencies must be satisfied - [0, * ] = parse error - """ - if not self.populated: - self.populate() - myusesplit=string.split(settings["USE"]) - mysplit=string.split(depstring) - #convert parenthesis to sublists - mysplit=dep_parenreduce(mysplit) - #mysplit can't be None here, so we don't need to check - mysplit=dep_opconvert(mysplit,myusesplit) - #if mysplit==None, then we have a parse error (paren mismatch or misplaced ||) - #up until here, we haven't needed to look at the database tree - - if mysplit==None: - return [0,"Parse Error (parenthesis mismatch or || abuse?)"] - elif mysplit==[]: - #dependencies were reduced to nothing - return [1,[]] - mysplit2=mysplit[:] - mysplit2=self.dep_wordreduce(mysplit2) - if mysplit2==None: - return [0,"Invalid token"] - myeval=dep_eval(mysplit2) - if myeval: - return [1,[]] - else: - mylist=dep_listcleanup(dep_zapdeps(mysplit,mysplit2)) - mydict={} - for x in mylist: - mydict[x]=1 - return [1,mydict.keys()] - - def dep_wordreduce(self,mydeplist): - """Calls dep_depreduce() on all the items in the deplist""" - mypos=0 - deplist=mydeplist[:] - while mypos<len(deplist): - if type(deplist[mypos])==types.ListType: - #recurse - deplist[mypos]=self.dep_wordreduce(deplist[mypos]) - else: - if deplist[mypos]=="||": - pass - else: - mydep=self.dep_depreduce(deplist[mypos]) - if mydep!=None: - deplist[mypos]=mydep - else: - #encountered invalid string - return None - mypos=mypos+1 - return deplist - def dep_depreduce(self,mypkgdep): - if mypkgdep[0]=="!": - # !cat/pkg-v - if self.exists_specific(mypkgdep[1:]): - return 0 - else: - return 1 - elif mypkgdep[0]=="=": - # =cat/pkg-v - return self.exists_specific(mypkgdep[1:]) - elif (mypkgdep[0]=="<") or (mypkgdep[0]==">"): - # >=cat/pkg-v or <=,>,< - if mypkgdep[1]=="=": - cmpstr=mypkgdep[0:2] - cpv=mypkgdep[2:] - else: - cmpstr=mypkgdep[0] - cpv=mypkgdep[1:] - if not isspecific(cpv): - return None - mycatpkg=catpkgsplit(cpv,0) - mykey=mycatpkg[0]+"/"+mycatpkg[1] - if self.hasnode(mykey): - if mycatpkg==None: - #parse error - return 0 - if not self.hasnode(mykey): - return 0 - for x in self.getnode(mykey): - if eval("pkgcmp(x[1][1:],mycatpkg[1:])"+cmpstr+"0"): - return 1 - return 0 - if not isspecific(mypkgdep): - # cat/pkg - if self.hasnode(mypkgdep): - return 1 - else: - return 0 - else: - return None - - def dep_bestmatch(self,mypkgdep): - """ - returns best match for mypkgdep in the tree. Accepts - a single depstring, such as ">foo/bar-1.0" and finds - the most recent version of foo/bar that satisfies the - dependency and returns it, i.e: "foo/bar-1.3". Works - for >,<,>=,<=,=,and general deps. Don't call with a ! - dep, since there is no good match for a ! dep. - """ - if (mypkgdep[0]=="="): - if self.exists_specific(mypkgdep[1:]): - return mypkgdep[1:] - else: - return "" - elif (mypkgdep[0]==">") or (mypkgdep[0]=="<"): - if mypkgdep[1]=="=": - cmpstr=mypkgdep[0:2] - cpv=mypkgdep[2:] - else: - cmpstr=mypkgdep[0] - cpv=mypkgdep[1:] - if not isspecific(cpv): - return "" - mycatpkg=catpkgsplit(cpv,0) - mykey=mycatpkg[0]+"/"+mycatpkg[1] - if not self.hasnode(mykey): - return "" - mynodes=[] - for x in self.getnode(mykey): - if eval("pkgcmp(x[1][1:],mycatpkg[1:])"+cmpstr+"0"): - mynodes.append(x) - #now we have a list of all nodes that qualify - if len(mynodes)==0: - return "" - bestmatch=mynodes[0] - for x in mynodes[1:]: - if pkgcmp(x[1][1:],bestmatch[1][1:])>0: - bestmatch=x - return bestmatch[0] - elif not isspecific(mypkgdep): - if not self.hasnode(mypkgdep): - return "" - mynodes=self.getnode(mypkgdep)[:] - if len(mynodes)==0: - return "" - bestmatch=mynodes[0] - for x in mynodes[1:]: - if pkgcmp(x[1][1:],bestmatch[1][1:])>0: - bestmatch=x - return bestmatch[0] - - def dep_match(self,mypkgdep): - """ - returns a list of all matches for mypkgdep in the tree. Accepts - a single depstring, such as ">foo/bar-1.0" and finds - all the versions of foo/bar that satisfy the - dependency and returns them, i.e: ["foo/bar-1.3"]. Works - for >,<,>=,<=,=,and general deps. Don't call with a ! - dep, since there is no good match for a ! dep. - """ - if (mypkgdep[0]=="="): - if self.exists_specific(mypkgdep[1:]): - return [mypkgdep[1:]] - else: - return [] - elif (mypkgdep[0]==">") or (mypkgdep[0]=="<"): - if mypkgdep[1]=="=": - cmpstr=mypkgdep[0:2] - cpv=mypkgdep[2:] - else: - cmpstr=mypkgdep[0] - cpv=mypkgdep[1:] - if not isspecific(cpv): - return [] - mycatpkg=catpkgsplit(cpv,0) - if mycatpkg==None: - #parse error - return [] - mykey=mycatpkg[0]+"/"+mycatpkg[1] - if not self.hasnode(mykey): - return [] - mynodes=[] - for x in self.getnode(mykey): - if eval("pkgcmp(x[1][1:],mycatpkg[1:])"+cmpstr+"0"): - mynodes.append(x[0]) - #now we have a list of all nodes that qualify - #since we want all nodes that match, return this list - return mynodes - elif not isspecific(mypkgdep): - if not self.hasnode(mypkgdep): - return [] - mynodes=[] - for x in self.getnode(mypkgdep)[:]: - mynodes.append(x[0]) - return mynodes - -class vartree(packagetree): - "this tree will scan a var/db/pkg database located at root (passed to init)" - def __init__(self,root="/",virtual=None): - self.root=root - packagetree.__init__(self,virtual) - def populate(self): - "populates the local tree (/var/db/pkg)" - if not os.path.isdir(self.root+"var"): - os.mkdir(self.root+"var",0755) - if not os.path.isdir(self.root+"var/db"): - os.mkdir(self.root+"var/db",0755) - if not os.path.isdir(self.root+"var/db/pkg"): - os.mkdir(self.root+"var/db/pkg",0755) - dbdir=self.root+"var/db/pkg" - origdir=os.getcwd() - os.chdir(dbdir) - for x in os.listdir(os.getcwd()): - if not os.path.isdir(os.getcwd()+"/"+x): - continue - for y in os.listdir(os.getcwd()+"/"+x): - if x=="virtual": - #virtual packages don't require versions, if none is found, add a "1.0" to the end - if isjustname(y): - fullpkg=x+"/"+y+"-1.0" - else: - fullpkg=x+"/"+y - else: - fullpkg=x+"/"+y - mysplit=catpkgsplit(fullpkg,0) - if mysplit==None: - print "!!! Error:",self.root+"var/db/pkg/"+x+"/"+y,"is not a valid database entry, skipping..." - continue - mykey=x+"/"+mysplit[1] - if not self.tree.has_key(mykey): - self.tree[mykey]=[] - self.tree[mykey].append([fullpkg,mysplit]) - os.chdir(origdir) - self.populated=1 - -class portagetree(packagetree): - "this tree will scan a portage directory located at root (passed to init)" - def __init__(self,root="/",virtual=None): - self.root=root - self.portroot=settings["PORTDIR"] - packagetree.__init__(self,virtual) - def populate(self): - "populates the port tree" - origdir=os.getcwd() - os.chdir(self.portroot) - for x in categories: - if not os.path.isdir(os.getcwd()+"/"+x): - continue - for y in os.listdir(os.getcwd()+"/"+x): - if not os.path.isdir(os.getcwd()+"/"+x+"/"+y): - continue - if y=="CVS": - continue - for mypkg in os.listdir(os.getcwd()+"/"+x+"/"+y): - if mypkg[-7:] != ".ebuild": - continue - mypkg=mypkg[:-7] - mykey=x+"/"+y - fullpkg=x+"/"+mypkg - if not self.tree.has_key(mykey): - self.tree[mykey]=[] - mysplit=catpkgsplit(fullpkg,0) - if mysplit==None: - print "!!! Error:",self.portroot+"/"+x+"/"+y,"is not a valid Portage directory, skipping..." - continue - self.tree[mykey].append([fullpkg,mysplit]) - #self.populated must be set here, otherwise dep_match will cause recursive populate() calls - self.populated=1 - if os.path.exists("profiles/package.mask"): - myfile=open("profiles/package.mask","r") - mylines=myfile.readlines() - myfile.close() - deps=[] - for x in mylines: - myline=string.join(string.split(x)) - if not len(myline): - continue - if myline[0]=="#": - continue - deps.append(myline) - for x in deps: - matches=self.dep_match(x) - if matches: - for y in matches: - self.zap(y) - os.chdir(origdir) - def getdeps(self,pf): - "returns list of dependencies, if any" - if not self.populated: - self.populate() - if self.exists_specific(pf): - mysplit=catpkgsplit(pf) - if mysplit==None: - #parse error - return "" - mydepfile=self.portroot+"/"+mysplit[0]+"/"+mysplit[1]+"/files/depend-"+string.split(pf,"/")[1] - if os.path.exists(mydepfile): - myd=open(mydepfile,"r") - mydeps=myd.readlines() - myd.close() - returnme="" - for x in mydeps: - returnme=returnme+" "+x[:-1] - return returnme - return "" - def getname(self,pkgname): - "returns file location for this particular package" - if not self.populated: - self.populate() - pkgname=self.resolve_specific(pkgname) - if not pkgname: - return "" - mysplit=string.split(pkgname,"/") - psplit=pkgsplit(mysplit[1]) - return self.portroot+"/"+mysplit[0]+"/"+psplit[0]+"/"+mysplit[1]+".ebuild" - -class binarytree(packagetree): - "this tree scans for a list of all packages available in PKGDIR" - def __init__(self,root="/",virtual=None): - self.root=root - self.pkgdir=settings["PKGDIR"] - packagetree.__init__(self,virtual) - def populate(self): - "popules the binarytree" - if (not os.path.isdir(self.pkgdir)): - return 0 - for mypkg in os.listdir(self.pkgdir+"/All"): - if mypkg[-5:]!=".tbz2": - continue - mytbz2=xpak.tbz2(self.pkgdir+"/All/"+mypkg) - mycat=mytbz2.getfile("CATEGORY") - if not mycat: - #old-style or corrupt package - continue - mycat=string.strip(mycat) - fullpkg=mycat+"/"+mypkg[:-5] - cps=catpkgsplit(fullpkg,0) - if cps==None: - print "!!! Error:",mytbz2,"contains corrupt cat/pkg information, skipping..." - continue - mykey=mycat+"/"+cps[1] - if not self.tree.has_key(mykey): - self.tree[mykey]=[] - self.tree[mykey].append([fullpkg,cps]) - self.populated=1 - def getname(self,pkgname): - "returns file location for this particular package" - mysplit=string.split(pkgname,"/") - if len(mysplit)==1: - return self.pkgdir+"/All/"+self.resolve_specific(pkgname)+".tbz2" - else: - return self.pkgdir+"/All/"+mysplit[1]+".tbz2" - -class dblink: - "this class provides an interface to the standard text package database" - def __init__(self,cat,pkg): - "create a dblink object for cat/pkg. This dblink entry may or may not exist" - self.cat=cat - self.pkg=pkg - self.dbdir=root+"/var/db/pkg/"+cat+"/"+pkg - - def getpath(self): - "return path to location of db information (for >>> informational display)" - return self.dbdir - - def exists(self): - "does the db entry exist? boolean." - return os.path.exists(self.dbdir) - - def create(self): - "create the skeleton db directory structure. No contents, virtuals, provides or anything. Also will create /var/db/pkg if necessary." - if not os.path.exists(self.dbdir): - os.makedirs(self.dbdir) - - def delete(self): - "erase this db entry completely" - if not os.path.exists(self.dbdir): - return - for x in os.listdir(self.dbdir): - os.unlink(self.dbdir+"/"+x) - os.rmdir(self.dbdir) - - def clearcontents(self): - if os.path.exists(self.dbdir+"/CONTENTS"): - os.unlink(self.dbdir+"/CONTENTS") - - def getcontents(self): - if not os.path.exists(self.dbdir+"/CONTENTS"): - return None - pkgfiles={} - myc=open(self.dbdir+"/CONTENTS","r") - mylines=myc.readlines() - myc.close() - for line in mylines: - mydat=string.split(line) - # we do this so we can remove from non-root filesystems - # (use the ROOT var to allow maintenance on other partitions) - mydat[1]=os.path.normpath(root+mydat[1][1:]) - if mydat[0]=="obj": - #format: type, mtime, md5sum - pkgfiles[string.join(mydat[1:-2]," ")]=[mydat[0], mydat[-1], mydat[-2]] - elif mydat[0]=="dir": - #format: type - pkgfiles[string.join(mydat[1:])]=[mydat[0] ] - elif mydat[0]=="sym": - #format: type, mtime, dest - x=len(mydat)-1 - splitter=-1 - while(x>=0): - if mydat[x]=="->": - splitter=x - break - x=x-1 - if splitter==-1: - return None - pkgfiles[string.join(mydat[1:splitter]," ")]=[mydat[0], mydat[-1], string.join(mydat[(splitter+1):-1]," ")] - elif mydat[0]=="dev": - #format: type - pkgfiles[string.join(mydat[1:]," ")]=[mydat[0] ] - elif mydat[0]=="fif": - #format: type - pkgfiles[string.join(mydat[1:]," ")]=[mydat[0]] - else: - return None - return pkgfiles - - def unmerge(self,pkgfiles=None): - if not pkgfiles: - pkgfiles=self.getcontents() - if not pkgfiles: - return - - myebuildfile=os.path.normpath(self.dbdir+"/"+self.pkg+".ebuild") - if os.path.exists(myebuildfile): - if pkgfiles.has_key(myebuildfile): - del pkgfiles[myebuildfile] - - mykeys=pkgfiles.keys() - mykeys.sort() - mykeys.reverse() - - #do prerm script - a=doebuild(self.dbdir+"/"+self.pkg+".ebuild","prerm") - if a: - print "!!! pkg_prerm() script failed; exiting." - sys.exit(a) - - for obj in mykeys: - obj=os.path.normpath(obj) - if not os.path.islink(obj): - #we skip this if we're dealing with a symlink - #because os.path.exists() will operate on the - #link target rather than the link itself. - if not os.path.exists(obj): - print "--- !found", pkgfiles[obj][0], obj - continue - if (pkgfiles[obj][0] not in ("dir","fif","dev")) and (getmtime(obj) != pkgfiles[obj][1]): - print "--- !mtime", pkgfiles[obj][0], obj - continue - if pkgfiles[obj][0]=="dir": - if not os.path.isdir(obj): - print "--- !dir ","dir", obj - continue - if os.listdir(obj): - print "--- !empty","dir", obj - continue - os.rmdir(obj) - print "<<< ","dir",obj - elif pkgfiles[obj][0]=="sym": - if not os.path.islink(obj): - print "--- !sym ","sym", obj - continue - mydest=os.readlink(obj) - if os.path.exists(os.path.normpath(root+mydest)): - if mydest != pkgfiles[obj][2]: - print "--- !destn","sym", obj - continue - os.unlink(obj) - print "<<< ","sym",obj - elif pkgfiles[obj][0]=="obj": - if not os.path.isfile(obj): - print "--- !obj ","obj", obj - continue - mymd5=md5(obj) - if mymd5 != string.upper(pkgfiles[obj][2]): - print "--- !md5 ","obj", obj - continue - os.unlink(obj) - print "<<< ","obj",obj - elif pkgfiles[obj][0]=="fif": - if not isfifo(obj): - print "--- !fif ","fif", obj - continue - os.unlink(obj) - print "<<< ","fif",obj - elif pkgfiles[obj][0]=="dev": - if not isdev(obj): - print "--- !dev ","dev", obj - continue - os.unlink(obj) - print "<<< ","dev",obj - - #remove provides - for mycatpkg in self.getelements("PROVIDE"): - mycat,mypkg=string.split(mycatpkg,"/") - tcatpkg=self.cat+"/"+self.pkg - mylink=dblink(mycat,mypkg) - if not mylink.exists(): - continue - myvirts=mylink.getelements("VIRTUAL") - while tcatpkg in myvirts: - myvirts.remove(tcatpkg) - if not myvirts: - #no more virtuals; cleanup time - if mylink.isregular(): - #just zap the VIRTUAL file, this is also a normal package - os.unlink(mylink.dbdir+"/VIRTUAL") - else: - #this is a pure virtual package, remove the entire db entry - mylink.delete() - else: - mylink.setelements(myvirts,"VIRTUAL") - - #do original postrm - a=doebuild(self.dbdir+"/"+self.pkg+".ebuild","postrm") - if a: - print "!!! pkg_postrm() script failed; exiting." - sys.exit(a) - - def merge(self,mergeroot,inforoot,mergestart=None,outfile=None): - - if mergestart==None: - origdir=os.getcwd() - if not os.path.exists(self.dbdir): - self.create() - #open contents file if it isn't already open - mergestart=mergeroot - print ">>> Updating mtimes..." - #before merging, it's *very important* to touch all the files !!! - os.system("(cd "+mergeroot+"; for x in `find`; do touch -c $x 2>/dev/null; done)") - print ">>> Merging",self.cat+"/"+self.pkg,"to",root - if not os.path.exists(root): - print "!!! Error: ROOT setting points to a non-existent directory. Exiting." - return - elif not os.path.isdir(root): - print "!!! Error: ROOT setting points to a non-directory. Exiting." - return - - #get old contents info for later unmerging - oldcontents=self.getcontents() - a=doebuild(inforoot+"/"+self.pkg+".ebuild","preinst") - if a: - print "!!! pkg_preinst() script failed; exiting." - sys.exit(a) - outfile=open(self.dbdir+"/CONTENTS","w") - - mergestart=mergestart - os.chdir(mergestart) - cpref=os.path.commonprefix([mergeroot,mergestart]) - relstart=mergestart[len(cpref):] - myfiles=os.listdir(mergestart) - - for x in myfiles: - relfile=relstart+"/"+x - rootfile=os.path.normpath(root+relfile) - #symbolic link - if os.path.islink(x): - myto=os.readlink(x) - if os.path.exists(rootfile): - if (not os.path.islink(rootfile)) and (os.path.isdir(rootfile)): - print "!!!",rootfile,"->",myto - else: - os.unlink(rootfile) - try: - os.symlink(myto,rootfile) - print "<<<",rootfile,"->",myto - outfile.write("sym "+relfile+" -> "+myto+" "+getmtime(rootfile)+"\n") - except: - print "!!!",rootfile,"->",myto - #directory - elif os.path.isdir(x): - mystat=os.stat(x) - if not os.path.exists(rootfile): - os.mkdir(rootfile) - os.chmod(rootfile,mystat[0]) - os.chown(rootfile,mystat[4],mystat[5]) - print "<<<",rootfile+"/" - else: - print "---",rootfile+"/" - outfile.write("dir "+relfile+"\n") - #enter directory, recurse - os.chdir(x) - self.merge(mergeroot,inforoot,mergestart+"/"+x,outfile) - #return to original path - os.chdir(mergestart) - elif os.path.isfile(x): - mymd5=md5(x) - if movefile(x,rootfile): - zing="<<<" - else: - zing="!!!" - - print zing+" "+rootfile - print "md5",mymd5 - if rootfile[0:5]=="/etc/": - #config file management - if os.path.basename(rootfile)[0:6]=="._cfg_": - newcfgfile=os.path.dirname(rootfile)+"/"+os.path.basename(rootfile)[6:] - if movefile(rootfile,newcfgfile,0): - #0=don't unlink original - print "cfg",newcfgfile - else: - print "!!! cfg",newcfgfile - outfile.write("obj "+relfile+" "+mymd5+" "+getmtime(rootfile)+"\n") - elif isfifo(x): - zing="!!!" - if not os.path.exists(rootfile): - if movefile(x,rootfile): - zing="<<<" - elif isfifo(rootfile): - os.unlink(rootfile) - if movefile(x,rootfile): - zing="<<<" - print zing+" "+rootfile - outfile.write("fif "+relfile+"\n") - else: - if movefile(x,rootfile): - zing="<<<" - else: - zing="!!!" - print zing+" "+rootfile - outfile.write("dev "+relfile+"\n") - - if mergestart==mergeroot: - #if we opened it, close it - outfile.close() - if (oldcontents): - print ">>> Safely unmerging already-installed instance..." - self.unmerge(oldcontents) - print ">>> original instance of package unmerged safely." - - os.chdir(inforoot) - for x in os.listdir("."): - self.copyfile(x) - - #create virtual links - for mycatpkg in self.getelements("PROVIDE"): - mycat,mypkg=string.split(mycatpkg,"/") - mylink=dblink(mycat,mypkg) - #this will create the link if it doesn't exist - mylink.create() - myvirts=mylink.getelements("VIRTUAL") - if not mycat+"/"+mypkg in myvirts: - myvirts.append(self.cat+"/"+self.pkg) - mylink.setelements(myvirts,"VIRTUAL") - - #do postinst script - a=doebuild(self.dbdir+"/"+self.pkg+".ebuild","postinst") - if a: - print "!!! pkg_postinst() script failed; exiting." - sys.exit(a) - #update environment settings, library paths - env_update() - print ">>>",self.cat+"/"+self.pkg,"merged." - os.chdir(origdir) - - def getstring(self,name): - "returns contents of a file with whitespace converted to spaces" - if not os.path.exists(self.dbdir+"/"+name): - return "" - myfile=open(self.dbdir+"/"+name,"r") - mydata=string.split(myfile.read()) - myfile.close() - return string.join(mydata," ") - - def copyfile(self,fname): - if not os.path.exists(self.dbdir): - self.create() - shutil.copyfile(fname,self.dbdir+"/"+os.path.basename(fname)) - - def getfile(self,fname): - if not os.path.exists(self.dbdir+"/"+fname): - return "" - myfile=open(self.dbdir+"/"+fname,"r") - mydata=myfile.read() - myfile.close() - return mydata - - def setfile(self,fname,data): - if not os.path.exists(self.dbdir): - self.create() - myfile=open(self.dbdir+"/"+fname,"w") - myfile.write(data) - myfile.close() - - def getelements(self,ename): - if not os.path.exists(self.dbdir+"/"+ename): - return [] - myelement=open(self.dbdir+"/"+ename,"r") - mylines=myelement.readlines() - myreturn=[] - for x in mylines: - for y in string.split(x[:-1]): - myreturn.append(y) - myelement.close() - return myreturn - - def setelements(self,mylist,ename): - if not os.path.exists(self.dbdir): - self.create() - myelement=open(self.dbdir+"/"+ename,"w") - for x in mylist: - myelement.write(x+"\n") - myelement.close() - - def isregular(self): - "Is this a regular package (does it have a CATEGORY file? A dblink can be virtual *and* regular)" - return os.path.exists(self.dbdir+"/CATEGORY") - -def depgrab(myfilename,depmark): - """ - Will grab the dependency string from an ebuild file, using - depmark as a marker (normally DEPEND or RDEPEND) - """ - depstring="" - myfile=open(myfilename,"r") - mylines=myfile.readlines() - myfile.close() - pos=0 - while (pos<len(mylines)): - if mylines[pos][0:len(depmark)+1]==depmark+"=": - depstart=string.split(mylines[pos][len(depmark):],'"') - if len(depstart)==3: - depstring=depstart[1] - return string.join(string.split(depstring)," ") - elif len(depstart)==2: - depstring=depstart[1]+" " - pos=pos+1 - while 1: - mysplit=string.split(mylines[pos],'"') - depstring=depstring+mysplit[0]+" " - if len(mysplit)>1: - return string.join(string.split(depstring)," ") - pos=pos+1 - elif len(depstart)==1: - depstring=depstring+mylines[pos][len(depmark)+1:] - break - else: - break - else: - pos=pos+1 - return string.join(string.split(depstring)," ") - -def cleanup_pkgmerge(mypkg,origdir): - shutil.rmtree(settings["PKG_TMPDIR"]+"/"+mypkg) - os.chdir(origdir) - -def pkgmerge(mytbz2): - """will merge a .tbz2 file, returning a list of runtime dependencies that must be - satisfied, or None if there was a merge error. This code assumes the package - exists.""" - if mytbz2[-5:]!=".tbz2": - print "!!! Not a .tbz2 file" - return None - mypkg=os.path.basename(mytbz2)[:-5] - xptbz2=xpak.tbz2(mytbz2) - pkginfo={} - mycat=xptbz2.getfile("CATEGORY") - if not mycat: - print "!!! CATEGORY info missing from info chunk, aborting..." - return None - mycat=string.strip(mycat) - mycatpkg=mycat+"/"+mypkg - - tmploc=settings["PKG_TMPDIR"] - pkgloc=tmploc+"/"+mypkg+"/bin" - infloc=tmploc+"/"+mypkg+"/inf" - if os.path.exists(tmploc+"/"+mypkg): - shutil.rmtree(tmploc+"/"+mypkg,1) - os.makedirs(pkgloc) - os.makedirs(infloc) - print ">>> extracting info" - xptbz2.unpackinfo(infloc) - origdir=os.getcwd() - os.chdir(pkgloc) - print ">>> extracting",mypkg - notok=os.system("cat "+mytbz2+"| bzip2 -dq | tar xpf -") - if notok: - print "!!! Error extracting",mytbz2 - cleanup_pkgmerge(mypkg,origdir) - return None - #the merge takes care of pre/postinst and old instance auto-unmerge, virtual/provides updates, etc. - merge(mycat,mypkg,pkgloc,infloc) - if not os.path.exists(infloc+"/RDEPEND"): - returnme="" - else: - #get runtime dependencies - a=open(infloc+"/RDEPEND","r") - returnme=string.join(string.split(a.read())," ") - a.close() - cleanup_pkgmerge(mypkg,origdir) - return returnme -def ebuild_init(): - "performs db/variable initialization for the ebuild system. Not required for other scripts." - global local_virts, root_virts, roottree, localtree, ebuild_initialized, root, virtuals - local_virts=getvirtuals("/") - if root=="/": - root_virts=local_virts - else: - root_virts=getvirtuals(root) - - localtree=vartree("/",local_virts) - if root=="/": - roottree=localtree - else: - roottree=vartree(root,root_virts) - ebuild_initialized=1 -root=getenv("ROOT") -if len(root)==0: - root="/" -elif root[-1]!="/": - root=root+"/" -if root != "/": - if not os.path.exists(root[:-1]): - print "!!! Error: ROOT",root,"does not exist. Please correct this." - print "!!! Exiting." - print - sys.exit(1) - elif not os.path.isdir(root[:-1]): - print "!!! Error: ROOT",root[:-1],"is not a directory. Please correct this." - print "!!! Exiting." - print - sys.exit(1) -settings=config() -ebuild_initialized=0 - - diff --git a/sys-apps/portage/files/1.5/pym/xpak.py b/sys-apps/portage/files/1.5/pym/xpak.py deleted file mode 100644 index 303c4cb2db48..000000000000 --- a/sys-apps/portage/files/1.5/pym/xpak.py +++ /dev/null @@ -1,221 +0,0 @@ -import sys -import os -import string - -def addtolist(mylist,curdir): - for x in os.listdir("."): - if os.path.isdir(x): - os.chdir(x) - addtolist(mylist,curdir+x+"/") - os.chdir("..") - else: - mylist.append(curdir+x) - -def encodeint(myint): - part1=chr((myint >> 24 ) & 0x000000ff) - part2=chr((myint >> 16 ) & 0x000000ff) - part3=chr((myint >> 8 ) & 0x000000ff) - part4=chr(myint & 0x000000ff) - return part1+part2+part3+part4 - -def decodeint(mystring): - myint=0 - myint=myint+ord(mystring[3]) - myint=myint+(ord(mystring[2]) << 8) - myint=myint+(ord(mystring[1]) << 16) - myint=myint+(ord(mystring[0]) << 24) - return myint - -def xpak(rootdir,outfile): - origdir=os.getcwd() - os.chdir(rootdir) - mylist=[] - - addtolist(mylist,"") - mylist.sort() - - #Our list index has been created - - indexglob="" - indexpos=0 - dataglob="" - datapos=0 - for x in mylist: - a=open(x,"r") - newglob=a.read() - a.close() - mydatasize=len(newglob) - indexglob=indexglob+encodeint(len(x))+x+encodeint(datapos)+encodeint(mydatasize) - indexpos=indexpos+4+len(x) - dataglob=dataglob+newglob - datapos=datapos+mydatasize - os.chdir(origdir) - outf=open(outfile,"w") - outf.write("XPAKPACK"+encodeint(len(indexglob))+encodeint(len(dataglob))) - outf.write(indexglob) - outf.write(dataglob) - outf.write("XPAKSTOP") - outf.close() - -def xsplit(infile): - myfile=open(infile,"r") - mydat=myfile.read() - myfile.close() - if mydat[0:8]!="XPAKPACK": - return - if mydat[-8:]!="XPAKSTOP": - return - indexsize=decodeint(mydat[8:12]) - datasize=decodeint(mydat[12:16]) - myfile=open(infile+".index","w") - myfile.write(mydat[16:indexsize+16]) - myfile.close() - myfile=open(infile+".dat","w") - myfile.write(mydat[indexsize+16:-8]) - myfile.close() - -def getindex(infile): - myfile=open(infile,"r") - myheader=myfile.read(16) - if myheader[0:8]!="XPAKPACK": - myfile.close() - return - indexsize=decodeint(myheader[8:12]) - myindex=myfile.read(indexsize) - myfile.close() - return myindex - -def getboth(infile): - myfile=open(infile,"r") - myheader=myfile.read(16) - if myheader[0:8]!="XPAKPACK": - myfile.close() - return - indexsize=decodeint(myheader[8:12]) - datasize=decodeint(myheader[12:16]) - myindex=myfile.read(indexsize) - mydata=myfile.read(datasize) - myfile.close() - return [myindex,mydata] - -def listindex(myindex): - myindexlen=len(myindex) - startpos=0 - while ((startpos+8)<myindexlen): - mytestlen=decodeint(myindex[startpos:startpos+4]) - print myindex[startpos+4:startpos+4+mytestlen] - startpos=startpos+mytestlen+12 - -def searchindex(myindex,myitem): - mylen=len(myitem) - myindexlen=len(myindex) - startpos=0 - while ((startpos+8)<myindexlen): - mytestlen=decodeint(myindex[startpos:startpos+4]) - if mytestlen==mylen: - if myitem==myindex[startpos+4:startpos+4+mytestlen]: - #found - datapos=decodeint(myindex[startpos+4+mytestlen:startpos+8+mytestlen]); - datalen=decodeint(myindex[startpos+8+mytestlen:startpos+12+mytestlen]); - return [datapos,datalen] - startpos=startpos+mytestlen+12 - - -def getitem(myid,myitem): - myindex=myid[0] - mydata=myid[1] - myloc=searchindex(myindex,myitem) - if not myloc: - return None - return mydata[myloc[0]:myloc[0]+myloc[1]] - -def xpand(myid,mydest): - myindex=myid[0] - mydata=myid[1] - origdir=os.getcwd() - os.chdir(mydest) - myindexlen=len(myindex) - startpos=0 - while ((startpos+8)<myindexlen): - namelen=decodeint(myindex[startpos:startpos+4]) - datapos=decodeint(myindex[startpos+4+namelen:startpos+8+namelen]); - datalen=decodeint(myindex[startpos+8+namelen:startpos+12+namelen]); - myname=myindex[startpos+4:startpos+4+namelen] - dirname=os.path.dirname(myname) - if dirname: - if not os.path.exists(dirname): - os.makedirs(dirname) - mydat=open(myname,"w") - mydat.write(mydata[datapos:datapos+datalen]) - mydat.close() - startpos=startpos+namelen+12 - os.chdir(origdir) - -class tbz2: - def __init__(self,myfile): - self.file=myfile - self.index="" - def scan(self): - a=open(self.file,"r") - a.seek(-16,2) - trailer=a.read() - if trailer[-4:]!="STOP": - a.close() - return 0 - if trailer[0:8]!="XPAKSTOP": - a.close() - return 0 - infosize=decodeint(trailer[8:12]) - a.seek(-(infosize+8),2) - header=a.read(16) - if header[0:8]!="XPAKPACK": - a.close() - return 0 - self.indexsize=decodeint(header[8:12]) - self.datasize=decodeint(header[12:16]) - self.indexpos=a.tell() - self.index=a.read(self.indexsize) - self.datapos=a.tell() - a.close() - def getfile(self,myfile): - if self.index=="": - self.scan() - myresult=searchindex(self.index,myfile) - if not myresult: - return None - a=open(self.file,"r") - a.seek(self.datapos+myresult[0],0) - myreturn=a.read(myresult[1]) - a.close() - return myreturn - def getelements(self,myfile): - mydat=self.getfile(myfile) - if not mydat: - return [] - return string.split(mydat) - def unpackinfo(self,mydest): - if self.index=="": - self.scan() - origdir=os.getcwd() - a=open(self.file,"r") - os.chdir(mydest) - startpos=0 - while ((startpos+8)<self.indexsize): - namelen=decodeint(self.index[startpos:startpos+4]) - datapos=decodeint(self.index[startpos+4+namelen:startpos+8+namelen]); - datalen=decodeint(self.index[startpos+8+namelen:startpos+12+namelen]); - myname=self.index[startpos+4:startpos+4+namelen] - dirname=os.path.dirname(myname) - if dirname: - if not os.path.exists(dirname): - os.makedirs(dirname) - mydat=open(myname,"w") - a.seek(self.datapos+datapos) - mydat.write(a.read(datalen)) - mydat.close() - startpos=startpos+namelen+12 - a.close() - os.chdir(origdir) - - - diff --git a/sys-apps/portage/files/1.5/src/tbz2tool.c b/sys-apps/portage/files/1.5/src/tbz2tool.c deleted file mode 100644 index 4760dcfc542e..000000000000 --- a/sys-apps/portage/files/1.5/src/tbz2tool.c +++ /dev/null @@ -1,225 +0,0 @@ -#include <stdio.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> -#include <errno.h> -#include <string.h> - -/*buffered reading/writing size*/ -#define BUFLEN 262144 -char *myname="tbz2tool"; -struct stat *mystat=NULL; -void *mybuf; -FILE *datafile, *dbfile, *outfile, *infile; -unsigned char endbuf[8]; -long seekto,insize; - -int exists(const char *myfile) { - int result; - result=stat(myfile,mystat); - if (result==-1) - return 0; - return 1; -} - -void writefile(FILE *src, FILE *dest) { - int count=1; - while (count) { - count=fread(mybuf, 1, BUFLEN, src); - fwrite(mybuf, 1, count, dest); - } -} - -void writefileto(FILE *src, FILE *dest, int endpos) { - int pos=ftell(src); - int thiscount; - while (pos < endpos) { - //thiscount=how much to read - thiscount=endpos-pos; - if (thiscount>BUFLEN) - thiscount=BUFLEN; - thiscount=fread(mybuf, 1, thiscount , src); - //thiscount=how much we actually did read - if (thiscount==0) - //eof -- shouldn't happen - break; - //update internal position counter - pos+=thiscount; - fwrite(mybuf, 1, thiscount, dest); - } -} - -int main(int argc, char **argv) { - if ((argc==2) && (!(strcmp(argv[1],"--help")))) - goto usage; - if (argc!=5) { - printf("%s: four arguments expected\n",myname); - goto error; - } - if (!(mystat=(struct stat *) malloc(sizeof(struct stat)))) - goto memalloc; - - if (!(mybuf=(void *) malloc(BUFLEN))) { - free(mystat); - goto memalloc; - } - - //JOIN MODE - if (!(strcmp(argv[1],"join"))) { - - //check if datafile exists - if (!(exists(argv[2]))) { - printf("%s: %s doesn't exist\n",myname,argv[2]); - free(mystat); - goto error; - } - - //check if dbfile exists - if (!(exists(argv[3]))) { - printf("%s: %s doesn't exist\n",myname,argv[3]); - free(mystat); - goto error; - } - //create end buffer for later use - endbuf[0]=((mystat->st_size) & 0xff000000) >> 24; - endbuf[1]=((mystat->st_size) & 0x00ff0000) >> 16; - endbuf[2]=((mystat->st_size) & 0x0000ff00) >> 8; - endbuf[3]=(mystat->st_size) & 0x000000ff; - endbuf[4]='S'; - endbuf[5]='T'; - endbuf[6]='O'; - endbuf[7]='P'; - - //if outfile exists, unlink first (safer) - if (exists(argv[4])) - unlink(argv[4]); - - //open datafile for reading - if ((datafile=fopen(argv[2],"r"))==NULL) { - free(mybuf); - free(mystat); - printf("%s: Error opening %s\n",myname,argv[2]); - goto error; - } - - //open dbfile for reading - if ((dbfile=fopen(argv[3],"r"))==NULL) { - fclose(datafile); - free(mybuf); - free(mystat); - printf("%s: Error opening %s\n",myname,argv[3]); - goto error; - } - - //open outfile for writing - if ((outfile=fopen(argv[4],"a"))==NULL) { - fclose(dbfile); - fclose(datafile); - free(mybuf); - free(mystat); - printf("%s: Error opening %s\n",myname,argv[4]); - goto error; - } - - writefile(datafile,outfile); - writefile(dbfile,outfile); - fwrite(endbuf,1,8,outfile); - fclose(outfile); - fclose(dbfile); - fclose(datafile); - free(mybuf); - free(mystat); - exit(0); - - //SPLIT MODE - } else if (!(strcmp(argv[1],"split"))) { - - //check if infile exists - if (!(exists(argv[2]))) { - printf("%s: %s doesn't exist\n",myname,argv[2]); - free(mystat); - goto error; - } - - //store infile size for later use - - insize=mystat->st_size; - - //if datafile exists, unlink first (safer) - if (exists(argv[3])) - unlink(argv[3]); - - //if dbfile exists, unlink first (safer) - if (exists(argv[4])) - unlink(argv[4]); - - //open infile for reading - if ((infile=fopen(argv[2],"r"))==NULL) { - free(mybuf); - free(mystat); - printf("%s: Error opening %s\n",myname,argv[2]); - goto error; - } - - //read in end buffer - fseek(infile,-8,SEEK_END); - fread(endbuf,1,8,infile); - //quick end buffer read and verification - if ( (endbuf[4]!='S') || (endbuf[5]!='T') || (endbuf[6]!='O') || (endbuf[7]!='P') ) { - fclose(infile); - free(mybuf); - free(mystat); - printf("%s: %s appears to be corrupt (end buffer invalid)\n",myname,argv[2]); - goto error; - } - - seekto=0; - seekto=seekto+endbuf[0]*256*256*256; - seekto=seekto+endbuf[1]*256*256; - seekto=seekto+endbuf[2]*256; - seekto=seekto+endbuf[3]; - - //open datafile for writing - if ((datafile=fopen(argv[3],"a"))==NULL) { - fclose(infile); - free(mybuf); - free(mystat); - printf("%s: Error opening %s\n",myname,argv[3]); - goto error; - } - - //open dbfile for writing - if ((dbfile=fopen(argv[4],"a"))==NULL) { - fclose(datafile); - fclose(infile); - free(mybuf); - free(mystat); - printf("%s: Error opening %s\n",myname,argv[4]); - goto error; - } - - rewind(infile); - writefileto(infile,datafile,insize-(seekto+8)); - fseek(infile,-(seekto+8),SEEK_END); - writefileto(infile,dbfile,insize-8); - fclose(infile); - fclose(dbfile); - fclose(datafile); - free(mybuf); - free(mystat); - exit(0); - - } else { - free(mybuf); - free(mystat); - goto usage; - } - - usage: - printf("Usage: %s join DATAFILE DBFILE OUTFILE (datafile + dbfile -> outfile)\n %s split INFILE DATAFILE DBFILE (infile -> datafile + dbfile)\n",myname,myname); -error: - exit(1); -memalloc: - printf("%s: memory allocation error\n",myname); - exit(2); -} diff --git a/sys-apps/portage/files/bin/dobin b/sys-apps/portage/files/bin/dobin deleted file mode 100755 index d3183791112d..000000000000 --- a/sys-apps/portage/files/bin/dobin +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -if [ ${#} -lt 1 ] -then - echo "${0}: at least one argument needed" - return -fi -if [ ! -d ${D}${DESTTREE}/bin ] -then - install -d ${D}${DESTTREE}/bin -fi -for x in "$@" -do - if [ -x ${x} ] - then - if [ -z "$DEBUG" ] - then - MYVAL=`file ${x} | grep "ELF"` - if [ -n "$MYVAL" ] - then - strip ${x} - fi - fi - install ${x} ${D}${DESTTREE}/bin - else - echo "${0}: ${x} is not executable or does not exist" - fi - done - diff --git a/sys-apps/portage/files/bin/dodeps b/sys-apps/portage/files/bin/dodeps deleted file mode 100755 index 892442d76be6..000000000000 --- a/sys-apps/portage/files/bin/dodeps +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/spython -from portage import * -import sys -import commands -import os -import string - -for x in sys.argv[1:]: - if isinstalled(x): - continue - mysplit=string.split(x,"/") - if len(mysplit) != 2: - print - print "!!! Error:",x,"is not a valid dependency string." - print - sys.exit(1) - if justname(mysplit[1]): - mypath="/usr/portage/"+mysplit[0]+"/"+mysplit[1] - else: - mypath="/usr/portage/"+mysplit[0]+"/"+pkgsplit(mysplit[1])[0] - myfiles=os.listdir(mypath) - print myfiles - myebuilds=[] - for y in myfiles: - if y[-7:] == ".ebuild": - myebuilds.append(y) - if len(myebuilds)>1: - newebuild=["0.0","0"] - for z in myebuilds: - esplit=pkgsplit(z[:-7]) - #not a valid version part of ebuild name, out of contention - if not esplit: - continue - #version is newer - if vercmp(esplit[1],newebuild[0])>0: - newebuild=esplit[1:] - #version is same - elif vercmp(esplit[1],newebuild[0])==0: - #rev is newer - if atoi(esplit[2][1:])>atoi(newebuild[1][1:]): - newebuild=esplit[1:] - myebuilds=esplit[0]+"-"+newebuild[0] - if newebuild[1][1:] != "0": - myebuilds=myebuilds+"-"+newebuild[1] - myebuilds=[myebuilds+".ebuild"] - print - print ">>> Hmmm... multiple ebuild files in",mypath - print ">>> Picking newest file: ",myebuilds[0] - print - print myebuilds - myout=os.system("/usr/bin/ebuild "+mypath+"/"+myebuilds[0]+" merge") - if myout != 0: - print - print "!!! Error: Autobuild of",mypath+"/"+myebuilds[0],"failed." - print - sys.exit(1) -sys.exit(0) diff --git a/sys-apps/portage/files/bin/dodir b/sys-apps/portage/files/bin/dodir deleted file mode 100755 index 9138f5c647f5..000000000000 --- a/sys-apps/portage/files/bin/dodir +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - for x in "$@" - do - install -d ${DIROPTIONS} ${D}${x} - done diff --git a/sys-apps/portage/files/bin/dodoc b/sys-apps/portage/files/bin/dodoc deleted file mode 100755 index 5343de6ec9d1..000000000000 --- a/sys-apps/portage/files/bin/dodoc +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -for x in "$@" -do -if [ -e ${x} ] -then - if [ ! -d ${D}usr/doc/${PF} ] - then - install -d ${D}usr/doc/${PF} - fi - if [ -z ${DOCDESTTREE} ] - then - install -m0644 ${x} ${D}usr/doc/${PF} - gzip -9 ${D}usr/doc/${PF}/${x##*/} - else - install -m0644 ${x} ${D}usr/doc/${PF}/${DOCDESTTREE} - gzip -9 ${D}usr/doc/${PF}/${DOCDESTTREE}/${x##*/} - fi -else - echo "${0}: ${x} does not exist." - fi -done - diff --git a/sys-apps/portage/files/bin/doexe b/sys-apps/portage/files/bin/doexe deleted file mode 100755 index c9ae3a17d432..000000000000 --- a/sys-apps/portage/files/bin/doexe +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash - mynum=${#} - if [ ${mynum} -lt 1 ] - then - echo "doexe: at least one argument needed" - return - fi - if [ ! -d ${D}${EXEDESTTREE} ] - then - install -d ${D}${EXEDESTTREE} - fi - for x in "$@" - do - if [ -L ${x} ] - then - cp ${x} ${T} - mysrc=${T}/`/usr/bin/basename ${x}` - elif [ -d ${x} ] - then - echo "doexe: warning, skipping directory ${x}" - continue - else - mysrc=${x} - fi - install ${EXEOPTIONS} ${mysrc} ${D}${EXEDESTTREE} - if [ -n "$DEBUG" ] - then - strip ${D}${EXEDESTTREE}/`/usr/bin/basename ${x}` - fi - done - - diff --git a/sys-apps/portage/files/bin/dohard b/sys-apps/portage/files/bin/dohard deleted file mode 100755 index 283f4683af8e..000000000000 --- a/sys-apps/portage/files/bin/dohard +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - if [ ${#} -ne 2 ] - then - echo "${0}: two arguments needed" - return - fi - mysrc=${1} - mydest=${2} - ln -f ${D}${mysrc} ${D}${mydest} - diff --git a/sys-apps/portage/files/bin/doinfo b/sys-apps/portage/files/bin/doinfo deleted file mode 100755 index edcc3c13cd48..000000000000 --- a/sys-apps/portage/files/bin/doinfo +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -if [ ${#} -lt 1 ] -then - echo "doinfo: at least one argument needed" - return -fi -if [ ! -d ${D}usr/info ] -then - install -d ${D}usr/info -fi -for x in "$@" -do - if [ -e ${x} ] - then - install -m0644 ${x} ${D}usr/info - gzip -9 ${D}usr/info/${x##*/} - else - echo "doinfo: ${x} does not exist" - fi -done - diff --git a/sys-apps/portage/files/bin/doins b/sys-apps/portage/files/bin/doins deleted file mode 100755 index e37f8f37f447..000000000000 --- a/sys-apps/portage/files/bin/doins +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -if [ $# -lt 1 ] -then - echo "${0}: at least one argument needed" - exit -fi -if [ ! -d ${D}${INSDESTTREE} ] - then - install -d ${D}${INSDESTTREE} -fi -for x in "$@" -do - if [ -L $x ] - then - cp $x ${T} - mysrc=${T}/`/usr/bin/basename ${x}` - elif [ -d $x ] - then - echo "doins: warning, skipping directory ${x}" - continue - else - mysrc=${x} - fi - install ${INSOPTIONS} ${mysrc} ${D}${INSDESTTREE} -done - - diff --git a/sys-apps/portage/files/bin/dolib b/sys-apps/portage/files/bin/dolib deleted file mode 100755 index 2b6dfa4b48e6..000000000000 --- a/sys-apps/portage/files/bin/dolib +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -if [ ${#} -lt 1 ] -then - echo "${0}: at least one argument needed" - return -fi -if [ ! -d ${D}${DESTTREE}/lib ] -then - install -d ${D}${DESTTREE}/lib -fi -for x in "$@" -do - if [ -e ${x} ] - then - install ${LIBOPTIONS} ${x} ${D}${DESTTREE}/lib - else - echo "${0}: ${x} does not exist" - fi -done diff --git a/sys-apps/portage/files/bin/dolib.a b/sys-apps/portage/files/bin/dolib.a deleted file mode 100755 index 24a01f68a83f..000000000000 --- a/sys-apps/portage/files/bin/dolib.a +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -if [ ${#} -lt 1 ] -then - echo "${0}: at least one argument needed" - return -fi -if [ ! -d ${D}${DESTTREE}/lib ] -then - install -d ${D}${DESTTREE}/lib -fi -for x in "$@" -do - if [ -e ${x} ] - then - install -m0644 ${x} ${D}${DESTTREE}/lib - else - echo "${0}: ${x} does not exist" - fi -done - - diff --git a/sys-apps/portage/files/bin/dolib.so b/sys-apps/portage/files/bin/dolib.so deleted file mode 100755 index 225e5a46339c..000000000000 --- a/sys-apps/portage/files/bin/dolib.so +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -if [ ${#} -lt 1 ] -then - echo "${0}: at least one argument needed" - return -fi -if [ ! -d ${D}${DESTTREE}/lib ] -then - install -d ${D}${DESTTREE}/lib -fi -for x in "$@" -do - if [ -e ${x} ] - then - if [ -n "$DEBUG" ] - then - strip --strip-unneeded ${x} - fi - install -m0755 ${x} ${D}${DESTTREE}/lib - else - echo "${0}: ${x} does not exist" - fi -done - - diff --git a/sys-apps/portage/files/bin/doman b/sys-apps/portage/files/bin/doman deleted file mode 100755 index b2734393e748..000000000000 --- a/sys-apps/portage/files/bin/doman +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -if [ ${#} -lt 1 ] -then - echo "${0}: at least one argument needed" - return -fi -myloc=$DESTTREE -if [ "$myloc" = "" ] -then - myloc=/usr -fi -for x in "$@" -do - md=${x##*.} - mandir=man${md:0:1} - if [ -e ${x} ] - then - if [ ! -d ${D}${myloc}/man/${mandir} ] - then - install -d ${D}${myloc}/man/${mandir} - fi - install -m0644 ${x} ${D}${myloc}/man/${mandir} - gzip -9 ${D}${myloc}/man/${mandir}/${x##*/} - else - echo "doman: ${x} does not exist." - fi -done diff --git a/sys-apps/portage/files/bin/domo b/sys-apps/portage/files/bin/domo deleted file mode 100755 index ef393b92a066..000000000000 --- a/sys-apps/portage/files/bin/domo +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - mynum=${#} - if [ ${mynum} -lt 1 ] - then - echo "${0}: at least one argument needed" - return - fi - if [ ! -d ${D}${DESTTREE}/share/locale ] - then - install -d ${D}${DESTTREE}/share/locale/ - fi - for x in "$@" - do - if [ -e ${x} ] - then - mytiny=${x##*/} - mydir=${D}${DESTTREE}/share/locale/${mytiny%.*}/LC_MESSAGES - if [ ! -d ${mydir} ] - then - install -d ${mydir} - fi - install -m0644 ${x} ${mydir}/${MOPREFIX}.mo - else - echo "${0}: ${x} does not exist" - fi - done - diff --git a/sys-apps/portage/files/bin/dopython b/sys-apps/portage/files/bin/dopython deleted file mode 100755 index 08991dbcd2f1..000000000000 --- a/sys-apps/portage/files/bin/dopython +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/spython - -from sys import * -import portage -import types -mycommand=argv[1]+"(" -x=2 -while (x<len(argv)): - if x==(len(argv)-1): - mycommand=mycommand+'"'+argv[x]+'"' - else: - mycommand=mycommand+'"'+argv[x]+'",' - x=x+1 -mycommand=mycommand+")" -exec("myresult="+mycommand) -if type(myresult)==types.IntType: - exit(myresult) diff --git a/sys-apps/portage/files/bin/dosbin b/sys-apps/portage/files/bin/dosbin deleted file mode 100755 index 827ef41a6175..000000000000 --- a/sys-apps/portage/files/bin/dosbin +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -if [ ${#} -lt 1 ] - then - echo "${0}: at least one argument needed" - return - fi - if [ ! -d ${D}${DESTTREE}/sbin ] - then - install -d ${D}${DESTTREE}/sbin - fi - for x in "$@" - do - if [ -x ${x} ] - then - if [ -z "$DEBUG" ] - then - MYVAL=`file ${x} | grep "ELF"` - if [ "$MYVAL" ] - then - strip ${x} - fi - fi - install -m0754 ${x} ${D}${DESTTREE}/sbin - else - echo "${0}: ${x} is not executable or does not exist" - fi - done - diff --git a/sys-apps/portage/files/bin/dosed b/sys-apps/portage/files/bin/dosed deleted file mode 100755 index cf5d1f51b010..000000000000 --- a/sys-apps/portage/files/bin/dosed +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh - - -mysed="s:${D}::g" - -for x in "$@" -do - y=${D}${x} - if [ -a "${y}" ] - then - if [ -f "${y}" ] - then - mysrc=${T}/`/usr/bin/basename ${y}` - cp ${y} ${mysrc} - sed -e "${mysed}" ${mysrc} > ${y} - else - echo "${y} is not a regular file!" - return - fi - else - mysed=${x} - fi -done diff --git a/sys-apps/portage/files/bin/dosym b/sys-apps/portage/files/bin/dosym deleted file mode 100755 index 7c0cadd1b3f9..000000000000 --- a/sys-apps/portage/files/bin/dosym +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - if [ ${#} -ne 2 ] - then - echo "${0}: two arguments needed" - return - fi - target=${1} - linkname=${2} - ln -sf ${target} ${D}${linkname} - - diff --git a/sys-apps/portage/files/bin/find-packages b/sys-apps/portage/files/bin/find-packages deleted file mode 100755 index d808dd5777d6..000000000000 --- a/sys-apps/portage/files/bin/find-packages +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - - -filelist=`sed "s/['\"]/\\\&/g"` - -for f in $filelist; do - file=`grep -r "$f ->" /var/db/pkg/*/*/CONTENTS` - file=${file#/*/*/*/*/} - file=${file%*/CONTENTS:*} - echo $file -done | sort -u - - diff --git a/sys-apps/portage/files/bin/find-requires b/sys-apps/portage/files/bin/find-requires deleted file mode 100755 index eaf720da3973..000000000000 --- a/sys-apps/portage/files/bin/find-requires +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh - -# note this works for both a.out and ELF executables -# it also auto-generates requirment lines for shell scripts - -ulimit -c 0 - -filelist=`sed "s/['\"]/\\\&/g"` -exelist=`echo $filelist | xargs -r file | grep ":.*executable" | cut -d: -f1 ` -scriptlist=`echo $filelist | xargs -r file | egrep ":.* (commands|script) " | cut -d: -f1 ` -liblist=`echo $filelist | xargs -r file | grep ":.*shared object" | cut -d : -f1 ` - -for f in $exelist; do - if [ -x $f ]; then - ldd $f | awk '/=>/ { print $1 }' - fi -done | sort -u | sed "s/['\"]/\\\&/g" | xargs -r -n 1 basename | grep -v 'libNoVersion.so' | sort -u - -for f in $liblist; do - ldd $f | awk '/=>/ { print $1 }' -done | sort -u | sed "s/['\"]/\\\&/g" | xargs -r -n 1 basename | grep -v 'libNoVersion.so' | sort -u - -for f in $scriptlist; do - if [ -x $f ]; then - head -1 $f | sed -e 's/^\#\![ ]*//' | cut -d" " -f1 - fi -done | sort -u - -#for f in $liblist $exelist ; do -# objdump -p $f | awk ' -# BEGIN { START=0; LIBNAME=""; } -# /Version References:/ { START=1; } -# /required from/ && (START==1) { -# sub(/:/, "", $3); -# LIBNAME=$3; -# } -# (START==1) && (LIBNAME!="") && ($4~/^GLIBC_*/) { print LIBNAME "(" $4 ")"; } -# /^$/ { START=0; } -# ' -#done | sort -u - diff --git a/sys-apps/portage/files/bin/fowners b/sys-apps/portage/files/bin/fowners deleted file mode 100755 index 934abc463bbe..000000000000 --- a/sys-apps/portage/files/bin/fowners +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - if [ ${#} -ne 2 ] - then - echo "${0}: two arguments needed" - return - fi - chown ${1} ${D}${2} - - - diff --git a/sys-apps/portage/files/bin/fperms b/sys-apps/portage/files/bin/fperms deleted file mode 100755 index 0a60e078ed97..000000000000 --- a/sys-apps/portage/files/bin/fperms +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - if [ ${#} -ne 2 ] - then - echo "${0}: two arguments needed" - return - fi - chmod ${1} ${D}${2} diff --git a/sys-apps/portage/files/bin/import-configsettings b/sys-apps/portage/files/bin/import-configsettings deleted file mode 100755 index 4360f1cf0704..000000000000 --- a/sys-apps/portage/files/bin/import-configsettings +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/spython -import sys,portage -for x in sys.argv[1:]: - mysetting=portage.getconfigsetting(x) - if x=="ROOT": - #make sure path ends with a "/" - if len(mysetting)==0: - mysetting="/" - elif mysetting[-1]!="/": - mysetting=mysetting+"/" - print "export "+x+"='"+mysetting+"'" - diff --git a/sys-apps/portage/files/bin/import-settings b/sys-apps/portage/files/bin/import-settings deleted file mode 100755 index 4a0f9bde6f22..000000000000 --- a/sys-apps/portage/files/bin/import-settings +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/spython -import sys,portage -for x in sys.argv[1:]: - mysetting=portage.getsetting(x) - if x=="ROOT": - #make sure path ends with a "/" - if len(mysetting)==0: - mysetting="/" - elif mysetting[-1]!="/": - mysetting=mysetting+"/" - print "export "+x+"='"+mysetting+"'" - diff --git a/sys-apps/portage/files/bin/newbin b/sys-apps/portage/files/bin/newbin deleted file mode 100755 index 91e6e4c4e8df..000000000000 --- a/sys-apps/portage/files/bin/newbin +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -rm -rf ${T}/${2} -cp ${1} ${T}/${2} -dobin ${T}/${2}
\ No newline at end of file diff --git a/sys-apps/portage/files/bin/newdoc b/sys-apps/portage/files/bin/newdoc deleted file mode 100755 index 4c7286b751a4..000000000000 --- a/sys-apps/portage/files/bin/newdoc +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -rm -rf ${T}/${2} -cp ${1} ${T}/${2} -dodoc ${T}/${2} diff --git a/sys-apps/portage/files/bin/newexe b/sys-apps/portage/files/bin/newexe deleted file mode 100755 index 09e91e02f476..000000000000 --- a/sys-apps/portage/files/bin/newexe +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -rm -rf ${T}/${2} -cp ${1} ${T}/${2} -doexe ${T}/${2}
\ No newline at end of file diff --git a/sys-apps/portage/files/bin/newins b/sys-apps/portage/files/bin/newins deleted file mode 100755 index d661d9db5236..000000000000 --- a/sys-apps/portage/files/bin/newins +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -rm -rf ${T}/${2} -cp ${1} ${T}/${2} -doins ${T}/${2} diff --git a/sys-apps/portage/files/bin/newlib.a b/sys-apps/portage/files/bin/newlib.a deleted file mode 100755 index 6749b8168996..000000000000 --- a/sys-apps/portage/files/bin/newlib.a +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -rm -rf ${T}/${2} -cp ${1} ${T}/${2} -dolib.a ${T}/${2}
\ No newline at end of file diff --git a/sys-apps/portage/files/bin/newlib.so b/sys-apps/portage/files/bin/newlib.so deleted file mode 100755 index a8b9bef223ca..000000000000 --- a/sys-apps/portage/files/bin/newlib.so +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -rm -rf ${T}/${2} -cp ${1} ${T}/${2} -dolib.so ${T}/${2} diff --git a/sys-apps/portage/files/bin/newman b/sys-apps/portage/files/bin/newman deleted file mode 100755 index 029677b08afb..000000000000 --- a/sys-apps/portage/files/bin/newman +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -rm -rf ${T}/${2} -cp ${1} ${T}/${2} -doman ${T}/${2}
\ No newline at end of file diff --git a/sys-apps/portage/files/bin/newsbin b/sys-apps/portage/files/bin/newsbin deleted file mode 100755 index 5009b26ffe82..000000000000 --- a/sys-apps/portage/files/bin/newsbin +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -rm -rf ${T}/${2} -cp ${1} ${T}/${2} -dosbin ${T}/${2}
\ No newline at end of file diff --git a/sys-apps/portage/files/bin/pkgmerge b/sys-apps/portage/files/bin/pkgmerge deleted file mode 100755 index e97c4a2ac486..000000000000 --- a/sys-apps/portage/files/bin/pkgmerge +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env python - -import portage -import sys -import os - -bintree=portage.binarytree() -def pkgmerge_recurse(mypkg): - if not os.path.exists(mypkg): - print "!!! Error:",mypkg,"not found." - return 1 - mydeps=portage.pkgmerge(mypkg) - if mydeps==None: - print "!!! Error merging this package." - return 1 - elif mydeps=="": - return - mycheck=portage.roottree.depcheck(mydeps) - if mycheck[0]==0: - print "!!! Error: RDEPEND string formatted incorrectly:",mydeps - return 1 - if mycheck[1]==None: - #no deps, package installed - return - #we have deps - for mydep in mycheck[1]: - matches=bintree.dep_match(mydep) - if len(matches)==0: - #some way to abort this package merge process is needed, like a boolean return value - print "!!! Error: can't find a package that satisfies this dependency:",mydep - return - elif len(matches)==1: - pkgmerge_recurse(bintree.getname(matches[0])) - else: - #multiple matches, prompt user, then call pkgmerge_recurse again - print "MULTIPLES! DYING" - return 1 - -for x in sys.argv[1:]: - x=os.path.abspath(x) - print x - pkgmerge_recurse(x) diff --git a/sys-apps/portage/files/bin/pmake b/sys-apps/portage/files/bin/pmake deleted file mode 100755 index bb1d4ff15cfe..000000000000 --- a/sys-apps/portage/files/bin/pmake +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -# auto-parallel make without the annoying syntax -exec make ${MAKEOPTS} MAKE="make ${MAKEOPTS}" $* diff --git a/sys-apps/portage/files/bin/prepall b/sys-apps/portage/files/bin/prepall deleted file mode 100755 index 7a32290f050a..000000000000 --- a/sys-apps/portage/files/bin/prepall +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh - -prepallman -prepallinfo -prepallstrip - -# Move aclocals - -for i in `find ${D} -name "aclocal" -type d` -do - if [ "$i" != "" ] - then - if [ "$i" != "${D}usr/share/aclocal" ] - then - echo $i - install -d ${D}usr/share/aclocal - mv ${i}/* ${D}usr/share/aclocal - rm -fr ${i} - fi - fi -done - - diff --git a/sys-apps/portage/files/bin/prepalldocs b/sys-apps/portage/files/bin/prepalldocs deleted file mode 100755 index 7daedf6aaeb1..000000000000 --- a/sys-apps/portage/files/bin/prepalldocs +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -z=`find ${D}/usr/doc -not -name "*.gz" -not -name "*.js"` - -for y in ${z} -do - if [ -h ${y} ] - then - #symlink - linkto=`ls -l ${y} | sed -e "s:${D}::" | awk '{ printf ("%s.gz",$11) } '` - echo "$linkto $y.gz" - ln -sf ${linkto} ${y}.gz - rm ${y} - else - if [ -f ${y} ] - then - gzip -f -9 ${y} - fi - fi -done - - - diff --git a/sys-apps/portage/files/bin/prepallinfo b/sys-apps/portage/files/bin/prepallinfo deleted file mode 100755 index 3b9cf959150e..000000000000 --- a/sys-apps/portage/files/bin/prepallinfo +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -z=`find ${D} -name "info" -type d` -echo "info:" -for x in ${z} -do - rm -f ${x}/dir - w=`echo ${x}/*.info*` - if [ "${w}" != "${x}"'/*.info*' ] - then - for y in ${w} - do - if [ -h ${y} ] - then - #symlink - linkto=`ls -l ${y} | sed -e "s:${D}::" | awk '{ printf ("%s.gz",$11) } '` - echo "$linkto $y.gz" - ln -sf ${linkto} ${y}.gz - rm ${y} - else - echo ${y} - gzip -f -9 ${y} - fi - done - fi -done - - - diff --git a/sys-apps/portage/files/bin/prepallman b/sys-apps/portage/files/bin/prepallman deleted file mode 100755 index 7fbdf1c9bd1e..000000000000 --- a/sys-apps/portage/files/bin/prepallman +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -z=`find ${D} -name "man?" -type d` -echo "man:" -for x in ${z} -do - w=`echo ${x}/*.?` - if [ "${w}" != "${x}"'/*.?' ] - then - for y in ${w} - do - if [ -h ${y} ] - then - #symlink - linkto=`ls -l ${y} | sed -e "s:${D}::" | awk '{ printf ("%s.gz",$11) } '` - echo "$linkto $y.gz" - ln -sf ${linkto} ${y}.gz - rm ${y} - else - gzip -f -9 ${y} - echo ${y} - fi - done - fi -done - - - diff --git a/sys-apps/portage/files/bin/prepallstrip b/sys-apps/portage/files/bin/prepallstrip deleted file mode 100755 index 02e165dea862..000000000000 --- a/sys-apps/portage/files/bin/prepallstrip +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash - - -if [ -n "${DEBUG}" ] -then - exit -fi -echo "strip:" -z=`find ${D} -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 -or -name "*.so" -or -name "*.so.*" \)` - -for x in $z -do - f=`file $x` - if [ "${f/*LSB executable*/1}" == "1" ] - then - echo $x - strip ${x} - fi - if [ "${f/*LSB shared object*/1}" == "1" ] - then - echo $x - strip --strip-unneeded ${x} - fi -done - - - - - - - - - - - - diff --git a/sys-apps/portage/files/bin/prepinfo b/sys-apps/portage/files/bin/prepinfo deleted file mode 100755 index c7d1bf80270b..000000000000 --- a/sys-apps/portage/files/bin/prepinfo +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -if [ -z "$1" ] -then - rm -f ${D}usr/info/dir - gzip -9 ${D}usr/info/* -else - rm -f ${D}$1/info/dir - gzip -9 ${D}$1/info/* -fi - diff --git a/sys-apps/portage/files/bin/preplib b/sys-apps/portage/files/bin/preplib deleted file mode 100755 index 4ea0b221f133..000000000000 --- a/sys-apps/portage/files/bin/preplib +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -if [ -z "$1" ] -then - z=${D}usr/lib -else - z=${D}$1/lib -fi - -ldconfig -n -N ${z} - - - diff --git a/sys-apps/portage/files/bin/preplib.so b/sys-apps/portage/files/bin/preplib.so deleted file mode 100755 index 896c7c089697..000000000000 --- a/sys-apps/portage/files/bin/preplib.so +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -if [ -n "${DEBUG}" ] -then - exit -fi -for x in $@ -do - strip --strip-unneeded ${D}${x}/*.so* -done - diff --git a/sys-apps/portage/files/bin/prepman b/sys-apps/portage/files/bin/prepman deleted file mode 100755 index 4e71c87c59aa..000000000000 --- a/sys-apps/portage/files/bin/prepman +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -if [ -z "$1" ] -then - z=${D}usr/man -else - z=${D}$1/man -fi - -for x in ${z}/* -do - for y in ${x}/* - do - if [ -h ${y} ] - then - #symlink - linkto=`ls -l ${y} | sed -e "s:${D}::" | awk '{ printf ("%s.gz",$11) } '` - echo "$linkto $y.gz" - ln -sf ${linkto} ${y}.gz - rm ${y} - else - gzip -f -9 ${y} - fi - done -done - - - diff --git a/sys-apps/portage/files/bin/prepstrip b/sys-apps/portage/files/bin/prepstrip deleted file mode 100755 index b4db5c1cd52d..000000000000 --- a/sys-apps/portage/files/bin/prepstrip +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash -if [ -n "${DEBUG}" ] -then - exit -fi -for x in $@ -do - strip ${D}${x}/* -done
\ No newline at end of file diff --git a/sys-apps/portage/files/bin/unpack b/sys-apps/portage/files/bin/unpack deleted file mode 100755 index aad1ad8623c8..000000000000 --- a/sys-apps/portage/files/bin/unpack +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -for x in "$@" -do - echo ">>> Unpacking ${x}" - case "${x##*.}" in - gz|tgz|Z|z) - tar xzf ${DISTDIR}/${x} - ;; - bz2|tbz2) - cat ${DISTDIR}/${x} | bzip2 -d | tar xf - - ;; - ZIP|zip) - unzip ${DISTDIR}/${x} - ;; - *) - echo '!!!'" Error: couldn't unpack ${x}: file format not recognized" - exit 1 - ;; - esac -done diff --git a/sys-apps/portage/files/bin/use b/sys-apps/portage/files/bin/use deleted file mode 100755 index babbfa8ab413..000000000000 --- a/sys-apps/portage/files/bin/use +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/spython -import string -import portage -import sys - -myuse=portage.getsetting("USE") -myuse=string.split(myuse) -for x in myuse: - if x==sys.argv[1]: - print x - sys.exit(0) -sys.exit(1) diff --git a/sys-apps/portage/files/deptest.py b/sys-apps/portage/files/deptest.py deleted file mode 100644 index 5c11650832af..000000000000 --- a/sys-apps/portage/files/deptest.py +++ /dev/null @@ -1,7 +0,0 @@ -import readline -import portage -import sys -a=portage.portagetree("/usr/portage") -while (1): - mydep=raw_input("dep> ") - print a.depcheck(mydep) diff --git a/sys-apps/portage/files/digest-portage-1.6 b/sys-apps/portage/files/digest-portage-1.6 deleted file mode 100644 index c5af4a896504..000000000000 --- a/sys-apps/portage/files/digest-portage-1.6 +++ /dev/null @@ -1 +0,0 @@ -MD5 cca489a0ccdf84bc50c0342e2e13530a portage-1.6.tar.bz2 diff --git a/sys-apps/portage/files/digest-portage-1.6.1 b/sys-apps/portage/files/digest-portage-1.6.1 deleted file mode 100644 index a96a17c034e5..000000000000 --- a/sys-apps/portage/files/digest-portage-1.6.1 +++ /dev/null @@ -1 +0,0 @@ -MD5 776a4c21fdd405e520ae1e398c0f568a portage-1.6.1.tar.bz2 diff --git a/sys-apps/portage/files/digest-portage-1.6.2 b/sys-apps/portage/files/digest-portage-1.6.2 deleted file mode 100644 index 09d7106580cc..000000000000 --- a/sys-apps/portage/files/digest-portage-1.6.2 +++ /dev/null @@ -1 +0,0 @@ -MD5 62437a3f1b2662df208b5edb6b9c6fb0 portage-1.6.2.tar.bz2 diff --git a/sys-apps/portage/files/digest-portage-1.6.3 b/sys-apps/portage/files/digest-portage-1.6.3 deleted file mode 100644 index 2100814cda62..000000000000 --- a/sys-apps/portage/files/digest-portage-1.6.3 +++ /dev/null @@ -1 +0,0 @@ -MD5 6df19f83fbf4b70bf09af9b4c6f892d2 portage-1.6.3.tar.bz2 diff --git a/sys-apps/portage/files/digest-portage-1.6.4 b/sys-apps/portage/files/digest-portage-1.6.4 deleted file mode 100644 index f5592796dd32..000000000000 --- a/sys-apps/portage/files/digest-portage-1.6.4 +++ /dev/null @@ -1 +0,0 @@ -MD5 0269da0e242cd4eb25ddff067f677090 portage-1.6.4.tar.bz2 diff --git a/sys-apps/portage/files/digest-portage-1.6.5 b/sys-apps/portage/files/digest-portage-1.6.5 deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/sys-apps/portage/files/digest-portage-1.6.5 +++ /dev/null diff --git a/sys-apps/portage/files/digest-portage-1.6.7 b/sys-apps/portage/files/digest-portage-1.6.7 deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/sys-apps/portage/files/digest-portage-1.6.7 +++ /dev/null diff --git a/sys-apps/portage/files/ebuild b/sys-apps/portage/files/ebuild deleted file mode 100644 index 2f2cdb444137..000000000000 --- a/sys-apps/portage/files/ebuild +++ /dev/null @@ -1,932 +0,0 @@ -#!/bin/bash -# Copyright 1999-2000 Daniel Robbins, Gentoo Technologies, Inc. -# Distributed under the GPL - -if [ "`whoami`" != "root" ] -then - echo "Since ebuild can modify critical system files, only root is" - echo "allowed to use the ebuild system." - exit 1 -fi - -#allow any envvars to be set like QTDIR, even if Qt was just installed -export PATH=/usr/lib/portage/bin:${PATH} -eval `import-settings PROXY HTTP_PROXY FTP_PROXY DEBUG MAKEOPTS MAINTAINER CHOST CFLAGS CXXFLAGS PORTDIR DISTDIR BUILD_PREFIX PKGDIR RPMDIR PLATFORM ROOT` -eval `import-configsettings FETCHCOMMAND PACKAGE USE GENTOO_MIRRORS PLATFORM` -source /etc/rc.d/config/functions - -initvars() { - export DESTTREE=/usr - export INSDESTTREE="" - export EXEDESTTREE="" - export DOCDESTTREE="" - export INSOPTIONS="-m0644" - export EXEOPTIONS="-m0755" - export LIBOPTIONS="-m0644" - export DIROPTIONS="-m0755" - export MOPREFIX=${PN} - export KVERS=`uname -r` -} - -initvars - -src_unpack() { - unpack ${A} -} - -src_compile() { - return -} - -src_install() - { - return - } - -pkg_preinst() - { - return - } - -pkg_postinst() - { - return - } - -pkg_prerm() - { - return - } - -pkg_postrm() - { - return - } - -try() { - eval $* - if [ $? -ne 0 ] - then - echo - echo '!!! '"ERROR: the $1 command did not complete successfully." - echo '!!! '"(\"$*\")" - echo '!!! '"Since this is a critical task, ebuild will be stopped." - echo - exit 1 - fi -} - -dyn_touch() { - local x - for x in ${A} - do - if [ -e ${DISTDIR}/${x} ] - then - touch ${DISTDIR}/${x} - fi - done -} - -dyn_digest() { - local x - if [ ! -d ${FILESDIR} ] - then - install -d ${FILESDIR} - if [ -n ${MAINTAINER} ] - then - echo ">>> adding ${FILESDIR} to CVS (just in case it isn't there)" - ( echo; cd `/usr/bin/dirname ${FILESDIR}`; cvs add `/usr/bin/basename ${FILESDIR}`; echo) - fi - fi - for x in ${A} - do - if [ ! -e ${DISTDIR}/${x} ] - then - echo '!!! Cannot compute message digests: '${x} not found - echo "error, aborting." - exit 1 - else - mymd5=`md5sum ${DISTDIR}/${x} | cut -f1 -d" "` - echo "MD5 $mymd5 $x" >> ${FILESDIR}/.digest-${PF} - fi - done - mv ${FILESDIR}/.digest-${PF} ${FILESDIR}/digest-${PF} - if [ -n "${MAINTAINER}" ] - then - echo ">>> adding digest-${PF} to CVS (just in case it isn't there)" - ( echo; cd ${FILESDIR}; cvs add digest-${PF}; echo ) - fi - echo ">>> Computed message digests." -} - -runtime_depend() { - #the echo thing is a trick to get rid of newlines - dopython portage.dep_frontend runtime "`echo ${RDEPEND}`" - if [ $? -ne 0 ] - then - exit 1 - fi -} - -build_depend() { - #the echo thing is a trick to get rid of newlines - dopython portage.dep_frontend build "`echo ${DEPEND}`" - if [ $? -ne 0 ] - then - exit 1 - fi -} - -gen_depend() { - for x in $DEPEND - do - echo "$x" >> ${FILESDIR}/depend-${PF} - done - for x in $RDEPEND - do - echo "$x" >> ${FILESDIR}/rdepend-${PF} - done - echo ">>> Completed generating dependencies for ${PF}." -} - -merge_check() { - dopython portage.merge_check "${CATEGORY}/${PF}" - if [ $? -ne 0 ] - then - echo - echo '!!!' "${PF} already merged in ${ROOT} -- unmerge first" - echo - exit 1 - fi -} - -digest_check() { - if [ ! -e ${FILESDIR}/digest-${PF} ] - then - echo '!!!'" No message digest file found." - if [ -n "$MAINTAINER" ] - then - echo '>>> Maintainer mode: auto-computing digests.' - dyn_digest - return 0 - else - echo '!!!'" Maintainer: ebuild digest to update message digests." - return 1 - fi - fi - if [ ! -e ${DISTDIR}/${1} ] - then - echo '!!!'" ${1} not found." - echo '!!!'" Ebuild fetch to retrieve files." - return 1 - fi - local mycdigest=`grep " ${1}" ${FILESDIR}/digest-${PF} | cut -f2 -d" "` - if [ -z "$mycdigest" ] - then - echo - echo '!!!'" No message digest found for ${1}." - if [ -n "$MAINTAINER" ] - then - echo '>>> Maintainer mode: auto-computing digests.' - dyn_digest - echo - return 0 - else - echo '!!!'" Maintainer: ebuild digest to update message digests." - echo - return 1 - fi - fi - local mydigest=`md5sum ${DISTDIR}/${1} | cut -f1 -d" "` - if [ "$mycdigest" != "$mydigest" ] - then - echo - echo '!!!'" ${1}: message digests do not match!" - echo '!!!'" ${1} is corrupt or incomplete" - echo ">>> md5 con ${mycdigest}" - echo ">>> md5 now ${mydigest}" - echo ">>> Please delete/redownload ${DISTDIR}/${1}" - echo - return 1 - else - echo ">>> md5 ;-) ${1}" - fi - return 0 -} - -dyn_batchdigest() { - local x - if [ ! -e ${FILESDIR}/digest-${PF} ] - then - if [ "${A}" != "" ] - then - echo "${CATEGORY}/${PF} has no digest file." - fi - exit 1 - fi - for x in ${A} - do - if [ ! -e ${DISTDIR}/${x} ] - then - echo "${CATEGORY}/${PF}:${x} does not exist in ${DISTDIR}." - continue - else - local mycdigest=`grep " ${x}" ${FILESDIR}/digest-${PF} | cut -f2 -d" "` - if [ -z "$mycdigest" ] - then - echo "${CATEGORY}/${PF}:${x} digest not yet recorded." - continue - fi - local mydigest=`md5sum ${DISTDIR}/${x} | cut -f1 -d" "` - if [ "$mycdigest" != "$mydigest" ] - then - echo "${CATEGORY}/${PF}:${x} is corrupt or has an invalid digest." - fi - fi - done -} - - -dyn_fetch() { - local y - for y in ${A} - do - if [ ! -e ${DISTDIR}/${y} ] - then - echo ">>> Fetching ${y}..." - echo - local x - local _SRC_URI - for x in ${GENTOO_MIRRORS} - do - _SRC_URI="${_SRC_URI} ${x}/distributions/gentoo/gentoo-sources/${y}" - done - _SRC_URI="${_SRC_URI} `/usr/bin/queryhost.sh "${SRC_URI}"`" - for x in ${_SRC_URI} - do - if [ ! -e ${DISTDIR}/${y} ] - then - if [ $y == ${x##*/} ] - then - echo ">>> Trying site ${x}..." - eval "${FETCHCOMMAND}" - if [ $? -ne 0 ] - then - echo '!!!'" Couldn't download ${y}." - fi - fi - fi - done - if [ ! -e ${DISTDIR}/${y} ] - then - echo '!!!'" Couldn't download ${y}. Aborting." - exit 1 - fi - echo - fi - done - for y in ${A} - do - digest_check ${y} - if [ $? -ne 0 ] - then - exit 1 - fi - done -} - -dyn_unpack() { - trap "abort_unpack" SIGINT SIGQUIT - local unpackwork="yes" - if [ -e ${WORKDIR} ] - then - local x - for x in $A $EBUILD - do - echo ">>> Checking ${x}'s mtime..." - if [ ${DISTDIR}/${x} -nt ${WORKDIR} ] - then - echo ">>> ${x} has been updated; recreating WORKDIR..." - rm -rf ${WORKDIR} - break - fi - done - echo ">>> WORKDIR is up-to-date, not unpacking. (clean to force unpack)" - unpackwork="no" - fi - if [ "$unpackwork" = "yes" ] - then - install -m0700 -d ${WORKDIR} - cd ${WORKDIR} - echo ">>> Unpacking source..." - src_unpack - echo ">>> Source unpacked." - cd .. - fi - trap SIGINT SIGQUIT -} - -dyn_clean() { - if [ -d ${WORKDIR} ] - then - rm -rf ${WORKDIR} - fi - if [ -d ${BUILDDIR}/image ] - then - rm -rf ${BUILDDIR}/image - fi - rm -rf ${BUILDDIR}/.compiled -} - -into() { - if [ $1 = "/" ] - then - export DESTTREE="" - else - export DESTTREE=$1 - if [ ! -d ${D}${DESTTREE} ] - then - install -d ${D}${DESTTREE} - fi - fi -} - -insinto() { - if [ $1 = "/" ] - then - export INSDESTTREE="" - else - export INSDESTTREE=$1 - if [ ! -d ${D}${INSDESTTREE} ] - then - install -d ${D}${INSDESTTREE} - fi - fi -} - -exeinto() { - if [ $1 = "/" ] - then - export EXEDESTTREE="" - else - export EXEDESTTREE=$1 - if [ ! -d ${D}${EXEDESTTREE} ] - then - install -d ${D}${EXEDESTTREE} - fi - fi -} -docinto() { - if [ $1 = "/" ] - then - export DOCDESTTREE="" - else - export DOCDESTTREE=$1 - if [ ! -d ${D}usr/doc/${PF}/${DOCDESTTREE} ] - then - install -d ${D}usr/doc/${PF}/${DOCDESTTREE} - fi - fi -} - -insopts() { - INSOPTIONS="" - for x in $* - do - #if we have a debug build, let's not strip anything - if [ -n "$DEBUG" ] && [ "$x" = "-s" ] - then - continue - else - INSOPTIONS="$INSOPTIONS $x" - fi - done - export INSOPTIONS -} - -diropts() { - DIROPTIONS="" - for x in $* - do - DIROPTIONS="${DIROPTIONS} $x" - done - export DIROPTIONS -} - -exeopts() { - EXEOPTIONS="" - for x in $* - do - #if we have a debug build, let's not strip anything - if [ -n "$DEBUG" ] && [ "$x" = "-s" ] - then - continue - else - EXEOPTIONS="$EXEOPTIONS $x" - fi - done - export EXEOPTIONS -} - -libopts() { - LIBOPTIONS="" - for x in $* - do - #if we have a debug build, let's not strip anything - if [ -n "$DEBUG" ] && [ "$x" = "-s" ] - then - continue - else - LIBOPTIONS="$LIBOPTIONS $x" - fi - done - export LIBOPTIONS -} - -abort_compile() { - echo - echo '*** Compilation Aborted ***' - echo - cd ${BUILDDIR} #original dir - rm -f .compiled - trap SIGINT SIGQUIT - exit 1 -} - -abort_unpack() { - echo - echo '*** Unpack Aborted ***' - echo - cd ${BUILDDIR} #original dir - rm -f .unpacked - rm -rf work - trap SIGINT SIGQUIT - exit 1 -} - -abort_package() { - echo - echo '*** Packaging Aborted ***' - echo - cd ${BUILDDIR} #original dir - rm -f .packaged - rm -f ${PKGDIR}/All/${PF}.t* - trap SIGINT SIGQUIT - exit 1 -} - -abort_image() { - echo - echo '*** Imaging Aborted ***' - echo - cd ${BUILDDIR} #original dir - rm -rf image - trap SIGINT SIGQUIT - exit 1 -} - -dyn_compile() { - trap "abort_compile" SIGINT SIGQUIT - export CFLAGS CXXFLAGS LIBCFLAGS LIBCXXFLAGS - if [ ${BUILDDIR}/.compiled -nt ${WORKDIR} ] - then - echo ">>> It appears that ${PN} is already compiled. skipping." - echo ">>> (clean to force compilation)" - trap SIGINT SIGQUIT - return - fi - if [ -d ${S} ] - then - cd ${S} - fi - src_compile - cd ${BUILDDIR} - touch .compiled - trap SIGINT SIGQUIT -} - -dyn_package() { - trap "abort_package" SIGINT SIGQUIT - local PNAME=${PF}.${PACKAGE} - cd ${BUILDDIR}/image - echo ">>> Creating ${PNAME} in ${PKGDIR}/All..." - if [ "$PACKAGE" = "tbz2" ] - then - tar cvf ${PKGDIR}/All/${PF}.tar * - bzip2 ${PKGDIR}/All/${PF}.tar - mv ${PKGDIR}/All/${PF}.tar.bz2 ${PKGDIR}/${CATEGORY}/${PNAME} - elif [ "$PACKAGE" = "tgz" ] - then - tar czvf ${PKGDIR}/All/${PNAME} * - mv ${PKGDIR}/All/${PF}.tar.gz ${PKGDIR}/${CATEGORY}/${PNAME} - else - echo '!!! Package format '${PACKAGE}' not recognized. Please correct /etc/make.conf' - exit 1 - fi - ln -sf ${PKGDIR}/${CATEGORY}/${PNAME} ${PKGDIR}/All/${PNAME} - echo ">>> Done." - cd ${BUILDDIR} - touch .packaged - trap SIGINT SIGQUIT -} - -dyn_install() { - local ROOT - trap "abort_image" SIGINT SIGQUIT - rm -rf ${BUILDDIR}/image - mkdir ${BUILDDIR}/image - if [ -d ${S} ] - then - cd ${S} - fi - echo - echo ">>> Install ${PF} into ${D} category ${CATEGORY}" - src_install - prepall - install -d -m0700 ${D}var/db/pkg/${CATEGORY}/${PF} - cp ${EBUILD} ${D}var/db/pkg/${CATEGORY}/${PF} - local x - #create provides database - for x in $PROVIDE - do - echo "$x" >> ${D}var/db/pkg/${CATEGORY}/${PF}/PROVIDE - done - for x in $DEPEND - do - echo "$x" >> ${D}/var/db/pkg/${CATEGORY}/${PF}/DEPEND - done - for x in $RDEPEND - do - echo "$x" >> ${D}/var/db/pkg/${CATEGORY}/${PF}/RDEPEND - done - echo ">>> Completed installing into ${D}" - echo - cd ${BUILDDIR} - trap SIGINT SIGQUIT -} - -dyn_merge() { - trap "" SIGINT SIGQUIT - pkg_preinst - #/usr/sbin/portage-merge - dopython portage.merge "$CATEGORY" "$PF" "$D" - cd ${BUILDDIR} - #zap it so that people don't look at a bad image and get confused - rm -rf image - pkg_postinst - trap SIGINT SIGQUIT -} - -dyn_unmerge() { - trap "" SIGINT SIGQUIT - #/usr/sbin/portage-unmerge ${PF} - dopython portage.unmerge "$CATEGORY" "$PF" - trap SIGINT_SIGQUIT -} - - -dyn_spec() { - tar czf /usr/src/redhat/SOURCES/${PF}.tar.gz ${O}/${PF}.ebuild ${O}/files - - cat <<__END1__ > ${PF}.spec -Summary: ${DESCRIPTION} -Name: ${PN} -Version: ${PV} -Release: ${PR} -Copyright: GPL -Group: portage/${CATEGORY} -Source: ${PF}.tar.gz -Buildroot: ${D} -%description -${DESCRIPTION} - -${HOMEPAGE} - -%prep -%setup -c - -%build - -%install - -%clean - -%files -/ -__END1__ - -} -dyn_rpm () { - dyn_spec - rpm -bb ${PF}.spec - - install -D /usr/src/redhat/RPMS/i386/${PN}-${PV}-${PR}.i386.rpm ${RPMDIR}/${CATEGORY}/${PN}-${PV}-${PR}.rpm -} - -dyn_help() { - echo - echo "Portage" - echo "Copyright 2000 Gentoo Technologies, Inc." - echo - echo "How to use the ebuild command:" - echo - echo "The first argument to ebuild should be an existing .ebuild file." - echo - echo "One or more of the following options can then be specified. If more" - echo "than one option is specified, each will be executed in order." - echo - echo " check : test if all dependencies get resolved" - echo " fetch : download source archive(s) and patches" - echo " unpack : unpack/patch sources (auto-fetch if needed)" - echo " compile : compile sources (auto-fetch/unpack if needed)" - echo " merge : merge image into live filesystem, recording files in db" - echo " remerge : forces merge even if the package is installed" - echo " (auto-fetch/unpack/compile if needed)" - echo " unmerge : remove package from live filesystem" - echo " package : create tarball package of type ${PACKAGE}" - echo " (will be stored in ${PKGDIR}/All)" - echo " clean : clean up all source and temporary files" - echo - echo "The following settings will be used for the ebuild process:" - echo - echo " package : ${PF}" - echo " category : ${CATEGORY}" - echo " description : ${DESCRIPTION}" - echo " system : ${CHOST}" - echo " c flags : ${CFLAGS}" - echo " c++ flags : ${CXXFLAGS}" - echo " make flags : ${MAKEOPTS}" - echo -n " build mode : " - if [ -n "${DEBUG}" ] - then - echo "debug (large)" - else - echo "production (stripped)" - fi - echo " merge to : ${ROOT}" - echo " db location : ${ROOT}var/db/pkg/${CATEGORY}/${P}/CONTENTS" - echo - if [ -n "$USE" ] - then - echo "Additionally, support for the following toolkits will be enabled if necessary:" - echo - echo " ${USE}" - fi - echo -} - -src_menu() { - MYDIR=${BUILDDIR} - local MYfoo - for MYfoo in "$@" - do - case "${MYfoo}" in - noop) - ;; - unpack) - dyn_fetch - dyn_unpack - ;; - compile) - build_depend - dyn_fetch - dyn_unpack - dyn_compile - ;; - prerm|postrm|preinst|postinst|config) - pkg_${MYfoo} - ;; - help|batchdigest|touch|clean|fetch|digest|pkginfo|pkgloc|unmerge|install) - dyn_${MYfoo} - ;; - check) - # Exit with 1 if there are unresolved dependencies - build_depend - ;; - package) - build_depend - dyn_fetch - local PNAME=${PF}.${PACKAGE} - if [ ! -d ${PKGDIR} ] - then - install -d ${PKGDIR} - fi - if [ ! -d ${PKGDIR}/All ] - then - install -d ${PKGDIR}/All - fi - if [ ! -d ${PKGDIR}/${CATEGORY} ] - then - install -d ${PKGDIR}/${CATEGORY} - fi - if [ -e ${PKGDIR}/All/${PNAME} ] - then - if [ ! -d ${PKGDIR}/${CATEGORY}/${PNAME} ] - then - ln -sf ${PKGDIR}/All/${PNAME} ${PKGDIR}/${CATEGORY}/${PNAME} - fi - local x - local dopackage - dopackage="no" - for x in ${A} ${EBUILD} - do - if [ ${x} -nt ${PKGDIR}/All/${PNAME} ] - then - dopackage="yes" - break - fi - done - if [ "$dopackage" = "no" ] - then - echo - echo ">>> Package ${PNAME} appears to be up-to-date." - echo ">>> To force rebuild, touch ${EBUILD}." - echo - continue - fi - fi - dyn_unpack - dyn_compile - dyn_install - dyn_package - ;; - - remerge) - #this is meant to merge over an existing version even if it exists - build_depend - dyn_fetch - dyn_unpack - dyn_compile - dyn_install - dyn_merge - runtime_depend - ;; - qmerge) - #this means to run only dyn_merge - dyn_merge - ;; - merge) - #merge makes sure the package isn't already merged first - merge_check - build_depend - dyn_fetch - dyn_unpack - dyn_compile - dyn_install - dyn_merge - runtime_depend - ;; - gendeps) - #create DEPEND and RDEPEND files in the same directory as the .ebuild file - #this is used for the auto dependency resolving features of ebuild - gen_depend - ;; - rpm) - build_depend - dyn_fetch - dyn_unpack - dyn_compile - dyn_install - dyn_rpm - ;; - *) - echo "Please specify a valid command." - echo - dyn_help - esac - done - cd $MYDIR -} - -#dummy value for help printouts -P=packagename - -if [ $# -lt 1 ] -then - echo - echo '!!!' "At least two arguments expected." - dyn_help - exit 1 -fi - -if [ ! -e ${1} ] -then - echo - echo '!!!' "${1} not found." - dyn_help - exit 1 -fi - -# this function sets various environment variables that are used by -# portage. For a package called "foo-1.2-r1", they would be set as -# follows: -# P=foo-1.2 -# PF=foo-1.2-r1 (r1 is the rev, or release of the ebuild script) -# PN=foo -# PV=1.2 -# PR=1 (rev is zero if unspecified) - -setp() { - if [ $# -ne 3 ] - then - echo '!!!' ${P} is not a valid package name. Exiting. - exit 1 - fi - if [ "${3}" = "0" ] - then - export PF="${1}-${2}" - else - export PF="${1}-${2}-r${3}" - fi - export P="${1}-${2}" - export PN="${1}" - export PV="${2}" - export PR="${3}" -} - -export STARTDIR=`pwd` - -if [ "${1:0:1}" = "/" ] -then - export O=`dirname ${1}` -else - tmpfoo=`dirname ${1}` - export O=`( cd ${tmpfoo}; pwd )` -fi -tmpfoo=`(cd ${O}/..;pwd)` -export CATEGORY=`/usr/bin/basename $tmpfoo` -export EBUILD=${O}/`basename ${1}` -export PEBUILD=${O}/files/${PLATFORM}.ebuild -export FILESDIR=${O}/files - -tmpfoo=`/usr/bin/basename ${1%.*}` -setp `/usr/sbin/pkgname ${tmpfoo}` - -#if [ $# -le 3 ] -#then -# dyn_help -# exit 1 -#fi - -#source ${1} -#if [ -e ${PEBUILD} ] -#then -# source ${PEBUILD} -#fi - -if [ ! -z ${BUILD_PREFIX} ] -then - export BUILDDIR=${BUILD_PREFIX}/${PF} -else - export BUILDDIR=${O} -fi -if [ ! -d ${BUILDDIR} ] -then - install -d ${BUILDDIR} -fi - -export T=${BUILDDIR}/temp -if [ ! -d ${T} ] -then - install -d ${T} -fi -export WORKDIR=${BUILDDIR}/work -export D=${BUILDDIR}/image -dlen=$(( ${#D} -1 )) -if [ "${D:${dlen}:1}" != "/" ] -then - export D=${D}/ -fi - -source ${1} -if [ -e ${PEBUILD} ] -then - source ${PEBUILD} -fi - -#set up dependency variables correctly... -if [ "$RDEPEND" = "" ] -then - RDEPEND="$DEPEND" -fi - -#auto-generate ${A} based on ${SRC_URI} if ${A} isn't defined... -if [ "${A}" = "" ] -then - export SRC_URI - eval `dopython portage.gen_archnames` -fi - -foo=2 -while [ $foo -le $# ] -do -eval "src_menu \${${foo}}" -if [ $? -ne 0 ] -then - echo "***error***" - exit 1 -fi -foo=$(( $foo + 1)) -done - - diff --git a/sys-apps/portage/files/ebuild-mine b/sys-apps/portage/files/ebuild-mine deleted file mode 100644 index 162f0c6a4d3b..000000000000 --- a/sys-apps/portage/files/ebuild-mine +++ /dev/null @@ -1,1250 +0,0 @@ -#!/bin/bash -# Copyright 1999-2000 Daniel Robbins, Gentoo Technologies, Inc. -# Distributed under the GPL - -# stuff to add: -# DISTDIR, WORKDIR (WRKDIR) support (relocatable) -# PATCHDIR support for src_unpack (to get to patches distributed with the -# port rather than auto-downloaded. Maybe make it another target ??? nah -# CATEGORIES - place package in /usr/src/packages/All, symlink from -# /usr/src/sys/packages/${CATEGORY} for cd-rom distribution -# add BUILD_DEPENDS -# add RUN_DEPENDS -# add LIB_DEPENDS ? (make dependency as library-generic as possible) -# add -# possibly add PREFIX support -# add post-install and post-deinstall (for calling ldconfig, install-int) - -export PROXY -export HTTP_PROXY -export FTP_PROXY - -if [ "`whoami`" != "root" ] -then - echo "Since ebuild can modify critical system files, only root is" - echo "allowed to use the ebuild system." - exit 1 -fi - -source /etc/make.conf - -initvars() { - #fix up ROOT path so that it always has a / after it - local rlen - rlen=$(( ${#ROOT} -1 )) - if [ "${ROOT:${rlen}:1}" != "/" ] - then - export ROOT=${ROOT}/ - fi - - - DESTTREE=/usr - INSDESTTREE="" - EXEDESTTREE="" - DOCDESTTREE="" - INSOPTIONS="-m0644" - if [ -n "$DEBUG" ] - then - EXEOPTIONS="-m0755" - else - EXEOPTIONS="-m0755 -s" - fi - LIBOPTIONS="-m0644" - MOPREFIX=${P%-*} - KVERS=`uname -r` -} - -initvars - -src_unpack() - { - unpack ${A} - } - -src_compile() - { - return - } - -src_install() - { - return - } - -pkg_preinst() - { - return - } - -pkg_postinst() - { - return - } - -pkg_prerm() - { - return - } - -pkg_postrm() - { - return - } - -bz2unpack() - { - tar -x --use=bzip2 -f $1 - } - -gzunpack() - { - tar xzf $1 - } - -pmake() - { - make ${MAKEOPTS} MAKE="make ${MAKEOPTS}" $* - } - -use() -{ - local x - for x in "$USE" - do - if [ "${1}" = "${x}" ] - then - echo "${x}" - return - fi - return - done -} - -dyn_digest() { - local x - if [ ! -d ${FILESDIR} ] - then - install -d ${FILESDIR} - fi - rm -f ${FILESDIR}/digest - for x in ${A} - do - if [ ! -e ${DISTDIR}/${x} ] - then - echo '!!! Cannot compute message digests: '${x} not found - echo "error, aborting." - exit 1 - else - mymd5=`md5sum ${DISTDIR}/${x} | cut -f1 -d" "` - echo "MD5 $mymd5 $x" >> ${FILESDIR}/digest - fi - done - echo ">>> Computed message digests." -} - -digest_check() { - if [ ! -e ${FILESDIR}/digest ] - then - echo '!!!'" No message digest file found." - echo '!!!'" Maintainer: ebuild digest to update message digests." - return 1 - fi - if [ ! -e ${DISTDIR}/${1} ] - then - echo '!!!'" ${1} not found." - echo '!!!'" Ebuild fetch to retrieve files." - return 1 - fi - local mycdigest=`grep " ${1}" ${FILESDIR}/digest | cut -f2 -d" "` - if [ -z "$mycdigest" ] - then - echo - echo '!!!'" No message digest found for ${1}." - echo '!!!'" Maintainer: ebuild digest to update message digests." - echo - return 1 - fi - local mydigest=`md5sum ${DISTDIR}/${1} | cut -f1 -d" "` - if [ "$mycdigest" != "$mydigest" ] - then - echo - echo '!!!'" ${1}: message digests do not match!" - echo '!!!'" ${1} is corrupt or incomplete" - echo ">>> md5 con ${mycdigest}" - echo ">>> md5 now ${mydigest}" - echo ">>> Please delete/redownload ${DISTDIR}/${1}" - echo - return 1 - else - echo ">>> md5 ;-) ${1}" - fi - return 0 -} - - -dyn_fetch() { - local y - for y in ${A} - do - if [ ! -e ${DISTDIR}/${y} ] - then - echo ">>> Fetching ${y}..." - echo - local x - local _SRC_URI - _SRC_URI=`/usr/bin/queryhost.sh "${SRC_URI}"` - for x in ${_SRC_URI} - do - if [ $y == ${x##*/} ] - then - echo ">>> Trying site ${x}..." - eval ${FETCHCOMMAND} - if [ $? -ne 0 ] - then - echo '!!!'" Couldn't download ${y}. Aborting." - exit 1 - fi - fi - done - echo - fi - done - for y in ${A} - do - digest_check ${y} - if [ $? -ne 0 ] - then - exit 1 - fi - done -} - -dyn_unpack() { - trap "abort_unpack" SIGINT SIGQUIT - local unpackwork="yes" - if [ -e ${WORKDIR} ] - then - local x - for x in $A $EBUILD - do - echo ">>> Checking ${x}'s mtime..." - if [ ${DISTDIR}/${x} -nt ${WORKDIR} ] - then - echo ">>> ${x} has been updated; recreating WORKDIR..." - rm -rf ${WORKDIR} - break - fi - done - echo ">>> WORKDIR is up-to-date, not unpacking. (clean to force unpack)" - unpackwork="no" - fi - if [ "$unpackwork" = "yes" ] - then - install -m0700 -d ${WORKDIR} - cd ${WORKDIR} - echo ">>> Unpacking source..." - src_unpack - echo ">>> Source unpacked." - cd .. - fi - trap SIGINT SIGQUIT -} - -unpack() { - local x - for x in "$@" - do - echo ${x} - case "${x##*.}" in - gz) - gzunpack ${DISTDIR}/${x} - ;; - tgz) - gzunpack ${DISTDIR}/${x} - ;; - Z) - gzunpack ${DISTDIR}/${x} - ;; - bz2) - bz2unpack ${DISTDIR}/${x} - ;; - tbz2) - bz2unpack ${DISTDIR}/${x} - ;; - *) - echo "Archive format not recognized." - exit - ;; - esac - done -} - - -dyn_clean() { - if [ -d ${WORKDIR} ] - then - rm -rf ${WORKDIR} - fi - if [ -d ${BUILDDIR}/image ] - then - rm -rf ${BUILDDIR}/image - fi - rm -rf ${BUILDDIR}/.compiled -} - -into() { - if [ $1 = "/" ] - then - DESTTREE="" - else - DESTTREE=$1 - if [ ! -d ${D}${DESTTREE} ] - then - install -d ${D}${DESTTREE} - fi - fi -} - -insinto() { - if [ $1 = "/" ] - then - INSDESTTREE="" - else - INSDESTTREE=$1 - if [ ! -d ${D}${INSDESTTREE} ] - then - install -d ${D}${INSDESTTREE} - fi - fi -} - -exeinto() { - if [ $1 = "/" ] - then - EXEDESTTREE="" - else - EXEDESTTREE=$1 - if [ ! -d ${D}${EXEDESTTREE} ] - then - install -d ${D}${EXEDESTTREE} - fi - fi -} -docinto() { - if [ $1 = "/" ] - then - DOCDESTTREE="" - else - DOCDESTTREE=$1 - if [ ! -d ${D}usr/doc/${P}/${DOCDESTTREE} ] - then - install -d ${D}usr/doc/${P}/${DOCDESTTREE} - fi - fi -} -dodoc() { - local x - for x in "$@" - do - if [ -e ${x} ] - then - if [ ! -d ${D}/usr/doc/${P} ] - then - install -d ${D}/usr/doc/${P} - fi - if [ -z ${DOCDESTTREE} ] - then - install -m0644 ${x} ${D}/usr/doc/${P} - gzip -9 ${D}/usr/doc/${P}/${x##*/} - else - install -m0644 ${x} ${D}usr/doc/${P}/${DOCDESTTREE} - gzip -9 ${D}usr/doc/${P}/${DOCDESTTREE}/${x##*/} - fi - else - echo "${0}: ${x} does not exist." - fi - done -} - -prepstrip() { - if [ -n "${DEBUG}" ] - then - return - fi - local x - for x in $@ - do - strip ${D}${x}/* - done -} - -preplib.so() { - if [ -n "${DEBUG}" ] - then - return - fi - local x - for x in $@ - do - strip --strip-unneeded ${D}${x}/*.so* - done -} - -prepinfo() { - if [ -z "$1" ] - then - rm -f ${D}/usr/info/dir - gzip -9 ${D}/usr/info/* - else - rm -f ${D}/$1/info/dir - gzip -9 ${D}/$1/info/* - fi -} - -prepman() { - local x - local y - if [ -z "$1" ] ; then z=${D}/usr/man ; else z=${D}/$1/man ; fi - for x in ${z}/* - do - local y - for y in ${x}/* - do - if [ -h ${y} ] - then - #symlink - local linkto=`ls -l ${y} | sed -e "s:${D}::" | awk '{ printf ("%s.gz",$11) } '` - echo "$linkto $y.gz" - ln -sf ${linkto} ${y}.gz - rm ${y} - else - gzip -f -9 ${y} - fi - done - done -} - - -doman() { - local mynum=${#} - if [ ${mynum} -lt 1 ] - then - echo "${0}: at least one argument needed" - return - fi - local myloc=$DESTTREE - if [ "$myloc" = "" ] - then - myloc=/usr - fi - local x - for x in "$@" - do - local md=${x##*.} - local mandir - mandir=man${md:0:1} - if [ -e ${x} ] - then - if [ ! -d ${D}${myloc}/man/${mandir} ] - then - install -d ${D}${myloc}/man/${mandir} - fi - install -m0644 ${x} ${D}${myloc}/man/${mandir} - gzip -9 ${D}${myloc}/man/${mandir}/${x##*/} - else - echo "${0}: ${x} does not exist." - fi - done -} - -doinfo() { - local mynum=${#} - if [ ${mynum} -lt 1 ] - then - echo "${0}: at least one argument needed" - return - fi - if [ ! -d ${D}/usr/info ] - then - install -d ${D}/usr/info - fi - local x - for x in "$@" - do - if [ -e ${x} ] - then - install -m0644 ${x} ${D}/usr/info - gzip -9 ${D}/usr/info/${x##*/} - else - echo "${0}: ${x} does not exist" - fi - done -} - -dolib() { - local mynum=${#} - if [ ${mynum} -lt 1 ] - then - echo "${0}: at least one argument needed" - return - fi - if [ ! -d ${D}${DESTTREE}/lib ] - then - install -d ${D}${DESTTREE}/lib - fi - local x - for x in "$@" - do - if [ -e ${x} ] - then - install ${LIBOPTIONS} ${x} ${D}${DESTTREE}/lib - else - echo "${0}: ${x} does not exist" - fi - done -} - -#To be used for dynamic .so libraries -dolib.so() { - local mynum=${#} - if [ ${mynum} -lt 1 ] - then - echo "${0}: at least one argument needed" - return - fi - if [ ! -d ${D}${DESTTREE}/lib ] - then - install -d ${D}${DESTTREE}/lib - fi - local x - for x in "$@" - do - if [ -e ${x} ] - then - install -m0755 ${x} ${D}${DESTTREE}/lib - if [ -z "$DEBUG" ] - then - strip --strip-unneeded ${D}${DESTTREE}/lib/${x##*/} - fi - else - echo "${0}: ${x} does not exist" - fi - done -} - -#To be used for static .a libraries -dolib.a() { - local mynum=${#} - if [ ${mynum} -lt 1 ] - then - echo "${0}: at least one argument needed" - return - fi - if [ ! -d ${D}${DESTTREE}/lib ] - then - install -d ${D}${DESTTREE}/lib - fi - local x - for x in "$@" - do - if [ -e ${x} ] - then - install -m0644 ${x} ${D}${DESTTREE}/lib - else - echo "${0}: ${x} does not exist" - fi - done -} - -dobin() { - local mynum=${#} - if [ ${mynum} -lt 1 ] - then - echo "${0}: at least one argument needed" - return - fi - if [ ! -d ${D}${DESTTREE}/bin ] - then - install -d ${D}${DESTTREE}/bin - fi - local x - for x in "$@" - do - if [ -x ${x} ] - then - if [ -z "$DEBUG" ] - then - local MYVAL - MYVAL=`file ${x} | grep "executable"` - if [ -n "$MYVAL" ] - then - strip ${x} - fi - fi - install ${x} ${D}${DESTTREE}/bin - else - echo "${0}: ${x} is not executable or does not exist" - fi - done -} - -dosbin() { - local mynum=${#} - if [ ${mynum} -lt 1 ] - then - echo "${0}: at least one argument needed" - return - fi - if [ ! -d ${D}${DESTTREE}/sbin ] - then - install -d ${D}${DESTTREE}/sbin - fi - local x - for x in "$@" - do - if [ -x ${x} ] - then - if [ -z "$DEBUG" ] - then - local MYVAL=`file ${x} | grep "executable"` - if [ "$MYVAL" ] - then - strip ${x} - fi - fi - install -m0754 ${x} ${D}${DESTTREE}/sbin - else - echo "${0}: ${x} is not executable or does not exist" - fi - done -} - -#symlink -dosym() { - if [ ${#} -ne 2 ] - then - echo "${0}: two arguments needed" - return - fi - local target=${1} - local linkname=${2} - ln -sf ${target} ${D}${linkname} -} - -#hard link -dohard() { - if [ ${#} -ne 2 ] - then - echo "${0}: two arguments needed" - return - fi - local mysrc=${1} - local mydest=${2} - ln -f ${D}${mysrc} ${D}${mydest} -} - -#mkdir -dodir() { - if [ ${#} -ne 1 ] - then - echo "${0}: one argument needed" - return - fi - install -d ${D}${1} -} - -fperms() { - if [ ${#} -ne 2 ] - then - echo "${0}: two arguments needed" - return - fi - chmod ${1} ${D}/${2} -} - -fowners() { - if [ ${#} -ne 2 ] - then - echo "${0}: two arguments needed" - return - fi - chown ${1} ${D}/${2} -} - - -insopts() { - INSOPTIONS="" - for x in $* - do - #if we have a debug build, let's not strip anything - if [ -n "$DEBUG" ] && [ "$x" = "-s" ] - then - continue - else - INSOPTIONS="$INSOPTIONS $x" - fi - done -} - -doins() { - local mynum=${#} - if [ ${mynum} -lt 1 ] - then - echo "${0}: at least one argument needed" - return - fi - if [ ! -d ${D}${INSDESTTREE} ] - then - install -d ${D}${INSDESTTREE} - fi - local x - for x in "$@" - do - if [ -L $x ] - then - cp $x ${WORKDIR} - install ${INSOPTIONS} ${WORKDIR}/${x##*/} ${D}${INSDESTTREE} - else - install ${INSOPTIONS} ${x} ${D}${INSDESTTREE} - fi - done -} - -newdoc() { - rm -rf ${T}/${2} - cp ${1} ${T}/${2} - dodoc ${T}/${2} -} - -newman() { - rm -rf ${T}/${2} - cp ${1} ${T}/${2} - doman ${T}/${2} -} - -newexe() { - rm -rf ${T}/${2} - cp ${1} ${T}/${2} - doexe ${T}/${2} -} - -newbin() { - rm -rf ${T}/${2} - cp ${1} ${T}/${2} - dobin ${T}/${2} -} - -newlib.so() { - rm -rf ${T}/${2} - cp ${1} ${T}/${2} - dolib.so ${T}/${2} -} - -newlib.a() { - rm -rf ${T}/${2} - cp ${1} ${T}/${2} - dolib.a ${T}/${2} -} - -newsbin() { - rm -rf ${T}/${2} - cp ${1} ${T}/${2} - dosbin ${T}/${2} -} - -newins() { - rm -rf ${T}/${2} - cp ${1} ${T}/${2} - doins ${T}/${2} -} - -donewins() { - local mynum=${#} - if [ ${mynum} -lt 1 ] - then - echo "${0}: at least one argument needed" - return - fi - if [ ! -d ${D}${INSDESTTREE} ] - then - install -d ${D}${INSDESTTREE} - fi - install -D ${INSOPTIONS} ${1} ${D}${INSDESTTREE}/${2} - -} - -exeopts() { - EXEOPTIONS="" - for x in $* - do - #if we have a debug build, let's not strip anything - if [ -n "$DEBUG" ] && [ "$x" = "-s" ] - then - continue - else - EXEOPTIONS="$EXEOPTIONS $x" - fi - done -} - -libopts() { - LIBOPTIONS="" - for x in $* - do - #if we have a debug build, let's not strip anything - if [ -n "$DEBUG" ] && [ "$x" = "-s" ] - then - continue - else - LIBOPTIONS="$LIBOPTIONS $x" - fi - done -} - -doexe() { - local mynum=${#} - if [ ${mynum} -lt 1 ] - then - echo "${0}: at least one argument needed" - return - fi - if [ ! -d ${D}${EXEDESTTREE} ] - then - install -d ${D}${EXEDESTTREE} - fi - local x - for x in "$@" - do - install ${EXEOPTIONS} ${x} ${D}${EXEDESTTREE} - done -} - -domo() { - local mynum=${#} - if [ ${mynum} -lt 1 ] - then - echo "${0}: at least one argument needed" - return - fi - if [ ! -d ${D}${DESTTREE}/share/locale ] - then - install -d ${D}${DESTTREE}/share/locale/ - fi - local x - for x in "$@" - do - if [ -e ${x} ] - then - local mytiny=${x##*/} - local mydir=${D}${DESTTREE}/share/locale/${mytiny%.*}/LC_MESSAGES - if [ ! -d ${mydir} ] - then - install -d ${mydir} - fi - install -m0644 ${x} ${mydir}/${MOPREFIX}.mo - else - echo "${0}: ${x} does not exist" - fi - done -} - -abort_compile() { - echo - echo '*** Compilation Aborted ***' - echo - cd ${BUILDDIR} #original dir - rm -f .compiled - trap SIGINT SIGQUIT - exit 1 -} - -abort_unpack() { - echo - echo '*** Unpack Aborted ***' - echo - cd ${BUILDDIR} #original dir - rm -f .unpacked - rm -rf work - trap SIGINT SIGQUIT - exit 1 -} - -abort_package() { - echo - echo '*** Packaging Aborted ***' - echo - cd ${BUILDDIR} #original dir - rm -f .packaged - rm -f ${PKGDIR}/All/${P}.t* - trap SIGINT SIGQUIT - exit 1 -} - -abort_image() { - echo - echo '*** Imaging Aborted ***' - echo - cd ${BUILDDIR} #original dir - rm -rf image - trap SIGINT SIGQUIT - exit 1 -} - -dyn_compile() { - trap "abort_compile" SIGINT SIGQUIT - export CFLAGS CXXFLAGS LIBCFLAGS LIBCXXFLAGS - if [ ${BUILDDIR}/.compiled -nt ${WORKDIR} ] - then - echo ">>> It appears that ${P} is already compiled. skipping." - echo ">>> (clean to force compilation)" - trap SIGINT SIGQUIT - return - fi - cd ${S} - src_compile - cd ${BUILDDIR} - touch .compiled - trap SIGINT SIGQUIT -} - -dyn_pkginfo() { - local PNAME=${P}.${PACKAGE} - echo ${P} ${PKGDIR}/All ${PKGDIR}/All/${PNAME} -} - -dyn_package() { - trap "abort_package" SIGINT SIGQUIT - cd ${BUILDDIR}/image - local PNAME=${P}.${PACKAGE} - echo ">>> Creating ${PNAME} in ${PKGDIR}/All..." - if [ ! -e ${PKGDIR} ] - then - mkdir ${PKGDIR} - fi - if [ ! -e ${PKGDIR}/All ] - then - mkdir ${PKGDIR}/All - fi - if [ "$PACKAGE" = "tbz2" ] - then - tar cvf ${PKGDIR}/All/${P}.tar * - bzip2 ${PKGDIR}/All/${P}.tar - mv ${PKGDIR}/All/${P}.tar.bz2 ${PKGDIR}/All/${PNAME} - elif [ "$PACKAGE" = "tgz" ] - then - tar czvf ${PKGDIR}/All/${PNAME} * - else - echo '!!! Package format '${PACKAGE}' not recognized. Please correct /etc/make.conf' - exit 1 - fi - if [ ! -e ${PKGDIR}/${CATEGORY} ] - then - mkdir ${PKGDIR}/${CATEGORY} - fi - ln -sf ${PKGDIR}/All/${PNAME} ${PKGDIR}/${CATEGORY}/${PNAME} - echo ">>> Done." - cd ${BUILDDIR} - touch .packaged - trap SIGINT SIGQUIT -} - -dyn_install() { - trap "abort_image" SIGINT SIGQUIT - rm -rf ${BUILDDIR}/image - mkdir ${BUILDDIR}/image - cd ${S} - echo - echo ">>> Install ${P} into ${D}" - src_install - install -d -m0700 ${D}/var/db/pkg/${P} - cp ${STARTDIR}/${EBUILD} ${D}/var/db/pkg/${P} - echo ">>> Completed installing into ${D}" - echo - cd ${BUILDDIR} - trap SIGINT SIGQUIT -} - -dyn_merge() { - trap "" SIGINT SIGQUIT - #not interruptible, so that the db doesn't get garbled - if [ -d ${ROOT}/var/db/pkg/${P} ] - then - echo - echo '!!!' "${P} already merged -- unmerge first" - echo - exit 1 - fi - echo - pkg_preinst - /usr/sbin/merge.py - cd ${BUILDDIR} - #zap it so that people don't look at a bad image and get confused - rm -rf image - pkg_postinst - trap SIGINT SIGQUIT -} - -dyn_unmerge() { - trap "" SIGINT SIGQUIT - #stub unmerge function for now - cd ${BUILDDIR} - /usr/sbin/unmerge.py ${P} - if [ $? -ne 0 ] - then - exit - fi - trap SIGINT_SIGQUIT -} - -dyn_spec() { - - tar czf /usr/src/redhat/SOURCES/${P}.tar.gz ${P}.* files - - local V - - V=${P#${O##*/}*} - V=${V/[!digit]/} - V=${V/-/.} - - cat <<__END1__ > ${P}.spec -Summary: ${DESCRIPTION} -Name: ${O##*/} -Version: ${V} -Release: 1 -Copyright: GPL -Group: portage/${CATEGORY} -Source: ${P}.tar.gz -Buildroot: ${D} -%description -${DESCRIPTION} - -%prep -%setup -c -ebuild ${P}.ebuild unpack - -%build -ebuild ${P}.ebuild compile - -%install -ebuild ${P}.ebuild install - -%clean -ebuild ${P}.ebuild clean - -%files -/ -__END1__ - -} -dyn_rpm () { - dyn_spec - rpm -bb ${P}.spec - local V - - V=${P#${O##*/}*} - V=${V/[!digit]/} - V=${V/-/.} - local W - W="portage/${CATEGORY}" - - install -D /usr/src/redhat/RPMS/i386/${O##*/}-${V}-1.i386.rpm ${RPMDIR}/${W}/${O##*/}-${V}.rpm -} - -dyn_help() { - echo - echo "Portage v1.1" - echo "Copyright 2000 Gentoo Technologies, Inc." - echo - echo "How to use the ebuild command:" - echo - echo "The first argument to ebuild should be an existing .ebuild file." - echo - echo "One or more of the following options can then be specified. If more" - echo "than one option is specified, each will be executed in order." - echo - echo " fetch : download source archive(s) and patches" - echo " unpack : unpack/patch sources (auto-fetch if needed)" - echo " compile : compile sources (auto-fetch/unpack if needed)" - echo " merge : merge image into live filesystem, recording files in db" - echo " (auto-fetch/unpack/compile if needed)" - echo " unmerge : remove package from live filesystem" - echo " clean : clean up all source and temporary files" - echo " clean-image : clean image directory only" - echo - echo "The following settings will be used for the ebuild process:" - echo - echo " package : ${P}" "( \${P} )" - echo " description : ${DESCRIPTION}" - echo " system : ${CHOST}" "( \${CHOST} )" - echo " c flags : ${CFLAGS}" "( \${CFLAGS} )" - echo " c++ flags : ${CXXFLAGS}" "( \${CXXFLAGS} )" - echo " make flags : ${MAKEOPTS}" "( \${MAKEOPTS} )" - echo -n " build mode : " - if [ -n "${DEBUG}" ] - then - echo "debug (large)" - else - echo "production (stripped)" - fi - echo " merge to : ${ROOT}" "( \${ROOT} )" - echo " db location : ${ROOT}var/db/pkg/${P}/CONTENTS" - echo - if [ -n "$USE" ] - then - echo "Additionally, support for the following toolkits will be enabled if necessary:" - echo - echo " ${USE}" - fi - echo -} - -src_menu() { - MYDIR=${BUILDDIR} - if [ "$1" = "p" ] - then - echo ${P} - exit 0 - fi - - local MYfoo - for MYfoo in "$@" - do - case "${MYfoo}" in - noop) - ;; - unpack) - dyn_fetch - dyn_unpack - ;; - compile) - dyn_fetch - dyn_unpack - dyn_compile - ;; - prerm|postrm|preinst|postinst) - pkg_${MYfoo} - ;; - help|install|clean|fetch|digest|pkginfo|pkgloc|spec|rpm) - dyn_${MYfoo} - ;; - package) - dyn_fetch - dyn_unpack - dyn_compile - dyn_install - dyn_package - ;; - merge) - dyn_fetch - dyn_unpack - dyn_compile - dyn_install - dyn_merge - ;; - *) - echo "Please specify a valid command." - echo - dyn_help - esac - done - cd $MYDIR -} - -#dummy value for help printouts -P=packagename - -if [ $# -lt 2 ] -then - echo - echo '!!!' "At least two arguments expected." - dyn_help - exit 1 -fi - -if [ ! -e ${1} ] -then - echo - echo '!!!' "${1} not found." - dyn_help - exit 1 -fi - -export STARTDIR=`pwd` -export O=`dirname ${STARTDIR}/${1}` -export EBUILD=${1} -export PEBUILD=${O}/files/${PLATFORM}.ebuild -export FILESDIR=${O}/files - -source ${1} -if [ -e ${PEBUILD} ] -then - source ${PEBUILD} -fi - -if [ -z "$FETCHCOMMAND" ] -then - FETCHCOMMAND="/usr/bin/wget --passive-ftp \${x} -P \${DISTDIR}" -fi - -if [ ! -z ${BUILD_PREFIX} ] -then - export BUILDDIR=${BUILD_PREFIX}/${CATEGORY}/${P} -else - export BUILDDIR=${O} -fi -if [ ! -d ${BUILDDIR} ] -then - install -d ${BUILDDIR} -fi - -export T=${BUILDDIR}/temp -if [ ! -d ${T} ] -then - install -d ${T} -fi -export WORKDIR=${BUILDDIR}/work -export D=${BUILDDIR}/image -dlen=$(( ${#D} -1 )) -if [ "${D:${dlen}:1}" != "/" ] -then - export D=${D}/ -fi - -if [ -z ${DISTDIR} ] -then - export DISTDIR=/usr/portage/distfiles -fi -if [ -z ${PKGDIR} ] -then - export PKGDIR=/usr/portage/packages -fi - -source ${1} -if [ -e ${PEBUILD} ] -then - source ${PEBUILD} -fi - -export P - -# Set Perl-Installation Enviroment - -for i in ARCHLIB PRIVLIB BIN MAN1DIR MAN3DIR SCRIPT SITEARCH SITELIB -do - install=`echo $i | awk '{ printf "%s%s","install",tolower($1) }'` - install=`perl "-V:$install" | sed -e "s:.*/image/\(.*\)'\;:\1:"` - PERLINSTALL=`echo INSTALL$i=$D$install $PERLINSTALL` -done -export PERLINSTALL - -foo=2 -while [ $foo -le $# ] -do -eval "src_menu \${${foo}}" -if [ $? -ne 0 ] -then - echo "***error***" - exit 1 -fi -foo=$(( $foo + 1)) -done diff --git a/sys-apps/portage/files/ebuild-pete b/sys-apps/portage/files/ebuild-pete deleted file mode 100644 index 9c3608de6a9b..000000000000 --- a/sys-apps/portage/files/ebuild-pete +++ /dev/null @@ -1,991 +0,0 @@ -#!/bin/bash -# Copyright 1999-2000 Daniel Robbins, Gentoo Technologies, Inc. -# Distributed under the GPL - -if [ "`whoami`" != "root" ] -then - echo "Since ebuild can modify critical system files, only root is" - echo "allowed to use the ebuild system." - exit 1 -fi - -#allow any envvars to be set like QTDIR, even if Qt was just installed -export PATH=/usr/lib/portage/bin:${PATH} -eval `import-settings PROXY HTTP_PROXY FTP_PROXY DEBUG MAKEOPTS MAINTAINER CHOST CFLAGS CXXFLAGS PORTDIR DISTDIR BUILD_PREFIX PKGDIR RPMDIR PLATFORM ROOT INTERACTIVE OPTIONS` -eval `import-configsettings FETCHCOMMAND PACKAGE USE GENTOO_MIRRORS PLATFORM` -source /etc/rc.d/config/functions - -initvars() { - export DESTTREE=/usr - export INSDESTTREE="" - export EXEDESTTREE="" - export DOCDESTTREE="" - export INSOPTIONS="-m0644" - export EXEOPTIONS="-m0755" - export LIBOPTIONS="-m0644" - export DIROPTIONS="-m0755" - export MOPREFIX=${PN} - export KVERS=`uname -r` -} - -initvars - -src_unpack() { - unpack ${A} -} - -src_compile() { - return -} - -src_install() - { - return - } - -pkg_preinst() - { - return - } - -pkg_postinst() - { - return - } - -pkg_prerm() - { - return - } - -pkg_postrm() - { - return - } - -try() { - eval $* - if [ $? -ne 0 ] - then - echo - echo '!!! '"ERROR: the $1 command did not complete successfully." - echo '!!! '"(\"$*\")" - echo '!!! '"Since this is a critical task, ebuild will be stopped." - echo - exit 1 - fi -} - -dyn_touch() { - local x - for x in ${A} - do - if [ -e ${DISTDIR}/${x} ] - then - touch ${DISTDIR}/${x} - fi - done -} - -dyn_digest() { - local x - if [ ! -d ${FILESDIR} ] - then - install -d ${FILESDIR} - if [ -n ${MAINTAINER} ] - then - echo ">>> adding ${FILESDIR} to CVS (just in case it isn't there)" - ( echo; cd `/usr/bin/dirname ${FILESDIR}`; cvs add `/usr/bin/basename ${FILESDIR}`; echo) - fi - fi - for x in ${A} - do - if [ ! -e ${DISTDIR}/${x} ] - then - echo '!!! Cannot compute message digests: '${x} not found - echo "error, aborting." - exit 1 - else - mymd5=`md5sum ${DISTDIR}/${x} | cut -f1 -d" "` - echo "MD5 $mymd5 $x" >> ${FILESDIR}/.digest-${PF} - fi - done - mv ${FILESDIR}/.digest-${PF} ${FILESDIR}/digest-${PF} - if [ -n "${MAINTAINER}" ] - then - echo ">>> adding digest-${PF} to CVS (just in case it isn't there)" - ( echo; cd ${FILESDIR}; cvs add digest-${PF}; echo ) - fi - echo ">>> Computed message digests." -} - -runtime_depend() { - #the echo thing is a trick to get rid of newlines - dopython portage.dep_frontend runtime "`echo ${RDEPEND}`" - if [ $? -ne 0 ] - then - exit 1 - fi -} - -build_depend() { - #the echo thing is a trick to get rid of newlines - dopython portage.dep_frontend build "`echo ${DEPEND}`" - if [ $? -ne 0 ] - then - exit 1 - fi -} - -gen_depend() { - for x in $DEPEND - do - echo "$x" >> ${FILESDIR}/depend-${PF} - done - for x in $RDEPEND - do - echo "$x" >> ${FILESDIR}/rdepend-${PF} - done - echo ">>> Completed generating dependencies for ${PF}." -} - -merge_check() { - dopython portage.merge_check "${CATEGORY}/${PF}" - if [ $? -ne 0 ] - then - echo - echo '!!!' "${PF} already merged in ${ROOT} -- unmerge first" - echo - exit 1 - fi -} - -digest_check() { - if [ ! -e ${FILESDIR}/digest-${PF} ] - then - echo '!!!'" No message digest file found." - if [ -n "$MAINTAINER" ] - then - echo '>>> Maintainer mode: auto-computing digests.' - dyn_digest - return 0 - else - echo '!!!'" Maintainer: ebuild digest to update message digests." - return 1 - fi - fi - if [ ! -e ${DISTDIR}/${1} ] - then - echo '!!!'" ${1} not found." - echo '!!!'" Ebuild fetch to retrieve files." - return 1 - fi - local mycdigest=`grep " ${1}" ${FILESDIR}/digest-${PF} | cut -f2 -d" "` - if [ -z "$mycdigest" ] - then - echo - echo '!!!'" No message digest found for ${1}." - if [ -n "$MAINTAINER" ] - then - echo '>>> Maintainer mode: auto-computing digests.' - dyn_digest - echo - return 0 - else - echo '!!!'" Maintainer: ebuild digest to update message digests." - echo - return 1 - fi - fi - local mydigest=`md5sum ${DISTDIR}/${1} | cut -f1 -d" "` - if [ "$mycdigest" != "$mydigest" ] - then - echo - echo '!!!'" ${1}: message digests do not match!" - echo '!!!'" ${1} is corrupt or incomplete" - echo ">>> md5 con ${mycdigest}" - echo ">>> md5 now ${mydigest}" - echo ">>> Please delete/redownload ${DISTDIR}/${1}" - echo - return 1 - else - echo ">>> md5 ;-) ${1}" - fi - return 0 -} - -dyn_batchdigest() { - local x - if [ ! -e ${FILESDIR}/digest-${PF} ] - then - if [ "${A}" != "" ] - then - echo "${CATEGORY}/${PF} has no digest file." - fi - exit 1 - fi - for x in ${A} - do - if [ ! -e ${DISTDIR}/${x} ] - then - echo "${CATEGORY}/${PF}:${x} does not exist in ${DISTDIR}." - continue - else - local mycdigest=`grep " ${x}" ${FILESDIR}/digest-${PF} | cut -f2 -d" "` - if [ -z "$mycdigest" ] - then - echo "${CATEGORY}/${PF}:${x} digest not yet recorded." - continue - fi - local mydigest=`md5sum ${DISTDIR}/${x} | cut -f1 -d" "` - if [ "$mycdigest" != "$mydigest" ] - then - echo "${CATEGORY}/${PF}:${x} is corrupt or has an invalid digest." - fi - fi - done -} - - -dyn_fetch() { - local y - for y in ${A} - do - if [ ! -e ${DISTDIR}/${y} ] - then - echo ">>> Fetching ${y}..." - echo - local x - local _SRC_URI - for x in ${GENTOO_MIRRORS} - do - _SRC_URI="${_SRC_URI} ${x}/distributions/gentoo/gentoo-sources/${y}" - done - _SRC_URI="${_SRC_URI} `/usr/bin/queryhost.sh "${SRC_URI}"`" - for x in ${_SRC_URI} - do - if [ ! -e ${DISTDIR}/${y} ] - then - if [ $y == ${x##*/} ] - then - echo ">>> Trying site ${x}..." - eval "${FETCHCOMMAND}" - if [ $? -ne 0 ] - then - echo '!!!'" Couldn't download ${y}." - fi - fi - fi - done - if [ ! -e ${DISTDIR}/${y} ] - then - echo '!!!'" Couldn't download ${y}. Aborting." - exit 1 - fi - echo - fi - done - for y in ${A} - do - digest_check ${y} - if [ $? -ne 0 ] - then - exit 1 - fi - done -} - -dyn_unpack() { - trap "abort_unpack" SIGINT SIGQUIT - local unpackwork="yes" - if [ -e ${WORKDIR} ] - then - local x - for x in $A $EBUILD - do - echo ">>> Checking ${x}'s mtime..." - if [ ${DISTDIR}/${x} -nt ${WORKDIR} ] - then - echo ">>> ${x} has been updated; recreating WORKDIR..." - rm -rf ${WORKDIR} - break - fi - done - echo ">>> WORKDIR is up-to-date, not unpacking. (clean to force unpack)" - unpackwork="no" - fi - if [ "$unpackwork" = "yes" ] - then - install -m0700 -d ${WORKDIR} - cd ${WORKDIR} - echo ">>> Unpacking source..." - src_unpack - echo ">>> Source unpacked." - cd .. - fi - trap SIGINT SIGQUIT -} - -dyn_setoptions() { - local option option_name option_value - - echo ">>> Setting options... - - if [ -s ${BUILDDIR}/OPTIONS ] - then - echo ">>> Options have already been set." - echo ">>> Clean to remove these options." - else - # the options following -o are in the form: - # name[=value][,name[=value][,name[=value]...]] - # the name and value should only contain the characters [a-z_] - # convert commas to spaces - trimmed_options="$( echo ${OPTIONS} | sed -e 's/,\+/ /' )" - - for option in ${trimmed_options} - do - echo "${option}" | sed 's,=, ,' | read option_name option_value - - # if no value is given for an option, then we set it to "yes" - if [ "${option_value}" = "" ] - then - option_value=yes - fi - echo "${option_name}=${option_value}" >> ${BUILDDIR}/OPTIONS - done - fi -} - -dyn_clean() { - if [ -d ${WORKDIR} ] - then - rm -rf ${WORKDIR} - fi - if [ -d ${BUILDDIR}/image ] - then - rm -rf ${BUILDDIR}/image - fi - rm -rf ${BUILDDIR}/.compiled - rm -f ${BUILDDIR}/OPTIONS -} - -into() { - if [ $1 = "/" ] - then - export DESTTREE="" - else - export DESTTREE=$1 - if [ ! -d ${D}${DESTTREE} ] - then - install -d ${D}${DESTTREE} - fi - fi -} - -insinto() { - if [ $1 = "/" ] - then - export INSDESTTREE="" - else - export INSDESTTREE=$1 - if [ ! -d ${D}${INSDESTTREE} ] - then - install -d ${D}${INSDESTTREE} - fi - fi -} - -exeinto() { - if [ $1 = "/" ] - then - export EXEDESTTREE="" - else - export EXEDESTTREE=$1 - if [ ! -d ${D}${EXEDESTTREE} ] - then - install -d ${D}${EXEDESTTREE} - fi - fi -} -docinto() { - if [ $1 = "/" ] - then - export DOCDESTTREE="" - else - export DOCDESTTREE=$1 - if [ ! -d ${D}usr/doc/${PF}/${DOCDESTTREE} ] - then - install -d ${D}usr/doc/${PF}/${DOCDESTTREE} - fi - fi -} - -insopts() { - INSOPTIONS="" - for x in $* - do - #if we have a debug build, let's not strip anything - if [ -n "$DEBUG" ] && [ "$x" = "-s" ] - then - continue - else - INSOPTIONS="$INSOPTIONS $x" - fi - done - export INSOPTIONS -} - -diropts() { - DIROPTIONS="" - for x in $* - do - DIROPTIONS="${DIROPTIONS} $x" - done - export DIROPTIONS -} - -exeopts() { - EXEOPTIONS="" - for x in $* - do - #if we have a debug build, let's not strip anything - if [ -n "$DEBUG" ] && [ "$x" = "-s" ] - then - continue - else - EXEOPTIONS="$EXEOPTIONS $x" - fi - done - export EXEOPTIONS -} - -libopts() { - LIBOPTIONS="" - for x in $* - do - #if we have a debug build, let's not strip anything - if [ -n "$DEBUG" ] && [ "$x" = "-s" ] - then - continue - else - LIBOPTIONS="$LIBOPTIONS $x" - fi - done - export LIBOPTIONS -} - -abort_compile() { - echo - echo '*** Compilation Aborted ***' - echo - cd ${BUILDDIR} #original dir - rm -f .compiled - trap SIGINT SIGQUIT - exit 1 -} - -abort_unpack() { - echo - echo '*** Unpack Aborted ***' - echo - cd ${BUILDDIR} #original dir - rm -f .unpacked - rm -rf work - trap SIGINT SIGQUIT - exit 1 -} - -abort_package() { - echo - echo '*** Packaging Aborted ***' - echo - cd ${BUILDDIR} #original dir - rm -f .packaged - rm -f ${PKGDIR}/All/${PF}.t* - trap SIGINT SIGQUIT - exit 1 -} - -abort_image() { - echo - echo '*** Imaging Aborted ***' - echo - cd ${BUILDDIR} #original dir - rm -rf image - trap SIGINT SIGQUIT - exit 1 -} - -dyn_compile() { - trap "abort_compile" SIGINT SIGQUIT - export CFLAGS CXXFLAGS LIBCFLAGS LIBCXXFLAGS - if [ ${BUILDDIR}/.compiled -nt ${WORKDIR} ] - then - echo ">>> It appears that ${PN} is already compiled. skipping." - echo ">>> (clean to force compilation)" - trap SIGINT SIGQUIT - return - fi - if [ -d ${S} ] - then - cd ${S} - fi - src_compile - cd ${BUILDDIR} - touch .compiled - trap SIGINT SIGQUIT -} - -dyn_package() { - trap "abort_package" SIGINT SIGQUIT - local PNAME=${PF}.${PACKAGE} - cd ${BUILDDIR}/image - echo ">>> Creating ${PNAME} in ${PKGDIR}/All..." - if [ "$PACKAGE" = "tbz2" ] - then - tar cvf ${PKGDIR}/All/${PF}.tar * - bzip2 ${PKGDIR}/All/${PF}.tar - mv ${PKGDIR}/All/${PF}.tar.bz2 ${PKGDIR}/${CATEGORY}/${PNAME} - elif [ "$PACKAGE" = "tgz" ] - then - tar czvf ${PKGDIR}/All/${PNAME} * - mv ${PKGDIR}/All/${PF}.tar.gz ${PKGDIR}/${CATEGORY}/${PNAME} - else - echo '!!! Package format '${PACKAGE}' not recognized. Please correct /etc/make.conf' - exit 1 - fi - ln -sf ${PKGDIR}/${CATEGORY}/${PNAME} ${PKGDIR}/All/${PNAME} - echo ">>> Done." - cd ${BUILDDIR} - touch .packaged - trap SIGINT SIGQUIT -} - -dyn_install() { - local ROOT - trap "abort_image" SIGINT SIGQUIT - rm -rf ${BUILDDIR}/image - mkdir ${BUILDDIR}/image - if [ -d ${S} ] - then - cd ${S} - fi - echo - echo ">>> Install ${PF} into ${D} category ${CATEGORY}" - src_install - prepall - install -d -m0700 ${D}var/db/pkg/${CATEGORY}/${PF} - cp ${EBUILD} ${D}var/db/pkg/${CATEGORY}/${PF} - local x - #create provides database - for x in $PROVIDE - do - echo "$x" >> ${D}var/db/pkg/${CATEGORY}/${PF}/PROVIDE - done - for x in $DEPEND - do - echo "$x" >> ${D}/var/db/pkg/${CATEGORY}/${PF}/DEPEND - done - for x in $RDEPEND - do - echo "$x" >> ${D}/var/db/pkg/${CATEGORY}/${PF}/RDEPEND - done - echo ">>> Completed installing into ${D}" - echo - cd ${BUILDDIR} - trap SIGINT SIGQUIT -} - -dyn_merge() { - trap "" SIGINT SIGQUIT - pkg_preinst - #/usr/sbin/portage-merge - dopython portage.merge "$CATEGORY" "$PF" "$D" - cd ${BUILDDIR} - #zap it so that people don't look at a bad image and get confused - rm -rf image - pkg_postinst - trap SIGINT SIGQUIT -} - -dyn_unmerge() { - trap "" SIGINT SIGQUIT - #/usr/sbin/portage-unmerge ${PF} - dopython portage.unmerge "$CATEGORY" "$PF" - trap SIGINT_SIGQUIT -} - - -dyn_spec() { - tar czf /usr/src/redhat/SOURCES/${PF}.tar.gz ${O}/${PF}.ebuild ${O}/files - - cat <<__END1__ > ${PF}.spec -Summary: ${DESCRIPTION} -Name: ${PN} -Version: ${PV} -Release: ${PR} -Copyright: GPL -Group: portage/${CATEGORY} -Source: ${PF}.tar.gz -Buildroot: ${D} -%description -${DESCRIPTION} - -${HOMEPAGE} - -%prep -%setup -c - -%build - -%install - -%clean - -%files -/ -__END1__ - -} -dyn_rpm () { - dyn_spec - rpm -bb ${PF}.spec - - install -D /usr/src/redhat/RPMS/i386/${PN}-${PV}-${PR}.i386.rpm ${RPMDIR}/${CATEGORY}/${PN}-${PV}-${PR}.rpm -} - -dyn_help() { - echo - echo "Portage" - echo "Copyright 2000 Gentoo Technologies, Inc." - echo - echo "How to use the ebuild command:" - echo - echo "ebuild [-i] [-o options] {packagename.ebuild} [command [command ...]]" - echo - echo "The first argument after any switches to ebuild should be an existing" - echo ".ebuild file." - echo - echo "One or more of the following switches can be used." - echo - echo " -i : puts ebuild into interactive mode" - echo " this allows interactive configuration of the package" - echo " -o options : set package options" - echo - echo "One or more of the following commands can then be specified. If more" - echo "than one command is specified, each will be executed in order." - echo - echo " query : query package options and other information" - echo " check : test if all dependencies get resolved" - echo " fetch : download source archive(s) and patches" - echo " unpack : unpack/patch sources (auto-fetch if needed) and set - echo " options" - echo " compile : compile sources (auto-fetch/unpack if needed)" - echo " merge : merge image into live filesystem, recording files in db" - echo " remerge : forces merge even if the package is installed" - echo " (auto-fetch/unpack/compile if needed)" - echo " unmerge : remove package from live filesystem" - echo " package : create tarball package of type ${PACKAGE}" - echo " (will be stored in ${PKGDIR}/All)" - echo " clean : clean up all source and temporary files" - echo - echo "The following variables will be used for the ebuild process:" - echo - echo " package : ${PF}" - echo " category : ${CATEGORY}" - echo " description : ${DESCRIPTION}" - echo " system : ${CHOST}" - echo " c flags : ${CFLAGS}" - echo " c++ flags : ${CXXFLAGS}" - echo " make flags : ${MAKEOPTS}" - echo -n " build mode : " - if [ -n "${DEBUG}" ] - then - echo "debug (large)" - else - echo "production (stripped)" - fi - echo " merge to : ${ROOT}" - echo " db location : ${ROOT}var/db/pkg/${CATEGORY}/${P}/CONTENTS" - echo - if [ -n "$USE" ] - then - echo "Additionally, support for the following toolkits will be enabled if necessary:" - echo - echo " ${USE}" - fi - echo -} - -src_menu() { - MYDIR=${BUILDDIR} - local MYfoo - for MYfoo in "$@" - do - case "${MYfoo}" in - noop) - ;; - unpack) - dyn_fetch - dyn_unpack - dyn_setoptions - ;; - compile) - build_depend - dyn_fetch - dyn_unpack - dyn_compile - ;; - prerm|postrm|preinst|postinst|config) - pkg_${MYfoo} - ;; - help|batchdigest|touch|clean|fetch|digest|pkginfo|pkgloc|unmerge|install) - dyn_${MYfoo} - ;; - check) - # Exit with 1 if there are unresolved dependencies - build_depend - ;; - package) - build_depend - dyn_fetch - local PNAME=${PF}.${PACKAGE} - if [ ! -d ${PKGDIR} ] - then - install -d ${PKGDIR} - fi - if [ ! -d ${PKGDIR}/All ] - then - install -d ${PKGDIR}/All - fi - if [ ! -d ${PKGDIR}/${CATEGORY} ] - then - install -d ${PKGDIR}/${CATEGORY} - fi - if [ -e ${PKGDIR}/All/${PNAME} ] - then - if [ ! -d ${PKGDIR}/${CATEGORY}/${PNAME} ] - then - ln -sf ${PKGDIR}/All/${PNAME} ${PKGDIR}/${CATEGORY}/${PNAME} - fi - local x - local dopackage - dopackage="no" - for x in ${A} ${EBUILD} - do - if [ ${x} -nt ${PKGDIR}/All/${PNAME} ] - then - dopackage="yes" - break - fi - done - if [ "$dopackage" = "no" ] - then - echo - echo ">>> Package ${PNAME} appears to be up-to-date." - echo ">>> To force rebuild, touch ${EBUILD}." - echo - continue - fi - fi - dyn_unpack - dyn_compile - dyn_install - dyn_package - ;; - - remerge) - #this is meant to merge over an existing version even if it exists - build_depend - dyn_fetch - dyn_unpack - dyn_compile - dyn_install - dyn_merge - runtime_depend - ;; - qmerge) - #this means to run only dyn_merge - dyn_merge - ;; - merge) - #merge makes sure the package isn't already merged first - merge_check - build_depend - dyn_fetch - dyn_unpack - dyn_compile - dyn_install - dyn_merge - runtime_depend - ;; - gendeps) - #create DEPEND and RDEPEND files in the same directory as the .ebuild file - #this is used for the auto dependency resolving features of ebuild - gen_depend - ;; - rpm) - build_depend - dyn_fetch - dyn_unpack - dyn_compile - dyn_install - dyn_rpm - ;; - *) - echo "Please specify a valid command." - echo - dyn_help - esac - done - cd $MYDIR -} - -#dummy value for help printouts -P=packagename - -while [ "${1:0:1}" = "-" ]; do - case "${1}" in - -i) - INTERACTIVE=y - ;; - -o) - OPTIONS="${OPTIONS},${2}" - shift - ;; - -*) - echo "Unknown option $1" - echo - dyn_help - ;; - esac - shift -done - -if [ $# -lt 1 ] -then - echo - echo '!!!' "At least two arguments expected." - dyn_help - exit 1 -fi - -if [ ! -e ${1} ] -then - echo - echo '!!!' "${1} not found." - dyn_help - exit 1 -fi - -# this function sets various environment variables that are used by -# portage. For a package called "foo-1.2-r1", they would be set as -# follows: -# P=foo-1.2 -# PF=foo-1.2-r1 (r1 is the rev, or release of the ebuild script) -# PN=foo -# PV=1.2 -# PR=1 (rev is zero if unspecified) - -setp() { - if [ $# -ne 3 ] - then - echo '!!!' ${P} is not a valid package name. Exiting. - exit 1 - fi - if [ "${3}" = "0" ] - then - export PF="${1}-${2}" - else - export PF="${1}-${2}-r${3}" - fi - export P="${1}-${2}" - export PN="${1}" - export PV="${2}" - export PR="${3}" -} - -export STARTDIR=`pwd` - -if [ "${1:0:1}" = "/" ] -then - export O=`dirname ${1}` -else - tmpfoo=`dirname ${1}` - export O=`( cd ${tmpfoo}; pwd )` -fi -tmpfoo=`(cd ${O}/..;pwd)` -export CATEGORY=`/usr/bin/basename $tmpfoo` -export EBUILD=${O}/`basename ${1}` -export PEBUILD=${O}/files/${PLATFORM}.ebuild -export FILESDIR=${O}/files - -tmpfoo=`/usr/bin/basename ${1%.*}` -setp `/usr/sbin/pkgname ${tmpfoo}` - -#if [ $# -le 3 ] -#then -# dyn_help -# exit 1 -#fi - -#source ${1} -#if [ -e ${PEBUILD} ] -#then -# source ${PEBUILD} -#fi - -if [ ! -z ${BUILD_PREFIX} ] -then - export BUILDDIR=${BUILD_PREFIX}/${PF} -else - export BUILDDIR=${O} -fi -if [ ! -d ${BUILDDIR} ] -then - install -d ${BUILDDIR} -fi - -export T=${BUILDDIR}/temp -if [ ! -d ${T} ] -then - install -d ${T} -fi -export WORKDIR=${BUILDDIR}/work -export D=${BUILDDIR}/image -dlen=$(( ${#D} -1 )) -if [ "${D:${dlen}:1}" != "/" ] -then - export D=${D}/ -fi - -source ${1} -if [ -e ${PEBUILD} ] -then - source ${PEBUILD} -fi - -#set up dependency variables correctly... -if [ "$RDEPEND" = "" ] -then - RDEPEND="$DEPEND" -fi - -#auto-generate ${A} based on ${SRC_URI} if ${A} isn't defined... -if [ "${A}" = "" ] -then - export SRC_URI - eval `dopython portage.gen_archnames` -fi - -foo=2 -while [ $foo -le $# ] -do -eval "src_menu \${${foo}}" -if [ $? -ne 0 ] -then - echo "***error***" - exit 1 -fi -foo=$(( $foo + 1)) -done diff --git a/sys-apps/portage/files/env-update b/sys-apps/portage/files/env-update deleted file mode 100755 index 20c3127be1b1..000000000000 --- a/sys-apps/portage/files/env-update +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/spython - -import portage -portage.env_update() diff --git a/sys-apps/portage/files/make.conf b/sys-apps/portage/files/make.conf deleted file mode 100644 index f773cc113e07..000000000000 --- a/sys-apps/portage/files/make.conf +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright 2000 Daniel Robbins, Gentoo Technologies, Inc. -# Contains system settings for Portage system - -USE="gnome bonobo X qt kde esd berkdb gdbm readline libg++ gpm tcpd slang ssl postgres mysql ldap odbc glibc22" diff --git a/sys-apps/portage/files/make.defaults b/sys-apps/portage/files/make.defaults deleted file mode 100644 index 9db74c6959f1..000000000000 --- a/sys-apps/portage/files/make.defaults +++ /dev/null @@ -1,52 +0,0 @@ -# Copyright 2000 Daniel Robbins, Gentoo Technologies, Inc. -# System-wide defaults for the Portage system - -ROOT="/" - -MAINTAINER="yes" - -#proxy settings PROXY(both), or HTTP_PROXY/FTP_PROXY -#PROXY=freebox.gentoo.org:3128 -#HTTP_PROXY= -#FTP_PROXY= -GENTOO_MIRRORS="ftp://ftp.ibiblio.org/pub/Linux" - -# Host-type -CHOST=i686-pc-linux-gnu - -PORTAGE_TMPDIR=/tmp -# Directory used for the build process -BUILD_PREFIX=${PORTAGE_TMPDIR}/portage -PKG_TMPDIR=${PORTAGE_TMPDIR}/portage-pkg - -PORTDIR=/usr/portage -DISTDIR=${PORTDIR}/distfiles -PKGDIR=${PORTDIR}/packages -RPMDIR=${PORTDIR}/rpm -CURRENTFILE=${PORTDIR}/current-packages -PLATFORM=$CHOST - -# Options passed to make during the build process -MAKEOPTS="-j2" - -# Fetching command (5 tries, passive ftp for firewall compatibility) -FETCHCOMMAND="/usr/bin/wget -t 5 --passive-ftp \${x} -P \${DISTDIR}" -# Compile programs with GNOME/SLANG extensions -#USE="gnome bonobo X qt kde" -#USE="3dnow mmx esd" -#USE="berkdb gdbm readline libg++ gpm tcpd slang" -#USE="ssl postgres mysql ldap odbc" -#USE="tex" -USE="slang" - -# C Compiler flags -CFLAGS="-O2 -mpentium" - -# C++ Compiler flags -CXXFLAGS=${CFLAGS} - -#Debug build -- if defined, binaries won't be stripped -#DEBUG=true - -#Package Mode - tbz2 or tgz (what binary package mode) -PACKAGE=tbz2 diff --git a/sys-apps/portage/files/megadigest b/sys-apps/portage/files/megadigest deleted file mode 100755 index df5a6422f42d..000000000000 --- a/sys-apps/portage/files/megadigest +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash -source /etc/make.conf -echo -n "MD5 digest analysis started " -date -echo -for x in `find /usr/portage/ -iname *.ebuild` -do - ebuild ${x} batchdigest -done -echo -echo -n "MD5 digest analysis completed " -date diff --git a/sys-apps/portage/files/megadownload b/sys-apps/portage/files/megadownload deleted file mode 100755 index 0932835539f8..000000000000 --- a/sys-apps/portage/files/megadownload +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash -for x in `find /usr/portage/ -iname *.ebuild` -do -/usr/sbin/ebuild ${x} fetch digest -if [ $? -ne 0 ] -then - echo '!!!' couldn\'t download all files for ${x} >> /tmp/portage-download.log -else - echo ${x} >> /tmp/portage-download.log -fi -done diff --git a/sys-apps/portage/files/megatouch b/sys-apps/portage/files/megatouch deleted file mode 100755 index c1f8baae7c0d..000000000000 --- a/sys-apps/portage/files/megatouch +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash -export PATH="/usr/lib/portage/bin:${PATH}" -eval `import-settings DISTDIR PORTDIR` -echo -n "Source archive pruning started " -date -touch ${DISTDIR}/.cleaned -sleep 1 -cd ${PORTDIR} -for x in `find ${PORTDIR}/ -iname '*.ebuild'` -do - echo "touching files for ${x}" - ebuild ${x} touch -done -if [ ! -d ${DISTDIR}-old ] -then - mkdir ${DISTDIR}-old -fi -cd ${DISTDIR} -for x in `find ! -newer .cleaned | grep ./` -do - mv $x ${DISTDIR}-old -done -du -k ${DISTDIR} -du -k ${DISTDIR}-old -echo -n "Source archive pruning completed " -date diff --git a/sys-apps/portage/files/merge b/sys-apps/portage/files/merge deleted file mode 100644 index 0370ca926620..000000000000 --- a/sys-apps/portage/files/merge +++ /dev/null @@ -1,109 +0,0 @@ -#!/usr/bin/env python - -import os -from commands import * -import string,md5,shutil - -mystart=os.path.normpath(os.environ["D"]) -mypackage=os.environ["PF"] -mycategory=os.environ["CATEGORY"] -myroot=os.environ["ROOT"] - -os.chdir(mystart) -print -print ">>> Merging contents of",mystart,"into live filesystem at "+myroot -print ">>> Recording merged files to "+myroot+"var/db/pkg/"+mycategory+"/"+mypackage+"/CONTENTS" -def prepare_db(): - if not os.path.isdir(myroot+"var/db"): - os.mkdir(myroot+"var/db",0755) - if not os.path.isdir(myroot+"var/db/pkg"): - os.mkdir(myroot+"/var/db/pkg",0755) - if not os.path.isdir(myroot+"var/db/pkg/"+mycategory): - os.mkdir(myroot+"/var/db/pkg/"+mycategory,0755) - if not os.path.isdir(myroot+"var/db/pkg/"+mycategory+"/"+mypackage): - os.mkdir(myroot+"var/db/pkg/"+mycategory+"/"+mypackage,0755) - -def movefile(src,dest): - shutil.copyfile(src,dest) - shutil.copystat(src,dest) - mystat=os.stat(src) - os.chown(dest,mystat[4],mystat[5]) - os.unlink(src) - return 1 - -def md5digest(x): - hexmap=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"] - m=md5.new() - mydata="" - myfile=open(x) - while (1): - #do 256K reads for enhanced performance - mydata=myfile.read(262144) - if mydata=="": - break - m.update(mydata) - myfile.close() - asciidigest="" - for mydigit in m.digest(): - asciidigest=asciidigest+hexmap[((ord(mydigit) & 0xf0) >> 4)]+hexmap[(ord(mydigit) & 0xf)] - return asciidigest - -def getmtime(x): - return `os.lstat(x)[-2]` - -def pathstrip(x): - cpref=os.path.commonprefix([x,mystart]) - return [myroot+x[len(cpref)+1:],x[len(cpref):]] - -def mergefiles(): - mycurpath=os.getcwd() - myfiles=os.listdir(mycurpath) - for x in myfiles: - floc=pathstrip(os.path.normpath(mycurpath+"/"+x)) - if os.path.islink(x): - myto=os.readlink(x) - if os.path.exists(floc[0]): - if os.path.isdir(floc[0]): - print "!!!",floc[0],"->",myto - else: - os.unlink(floc[0]) - try: - os.symlink(myto,floc[0]) - print "<<<",floc[0],"->",myto - outfile.write("sym "+floc[1]+" -> "+myto+" "+getmtime(floc[0])+"\n") - except: - print "!!!",floc[0],"->",myto - elif os.path.isfile(x): - mymd5=md5digest(mycurpath+"/"+x) - if movefile(x,pathstrip(mycurpath)[0]+"/"+x): - zing="<<<" - else: - zing="!!!" - - print zing+" "+floc[0] - print "md5",mymd5 - outfile.write("obj "+floc[1]+" "+mymd5+" "+getmtime(floc[0])+"\n") - elif os.path.isdir(x): - mystat=os.stat(x) - if not os.path.exists(floc[0]): - os.mkdir(floc[0]) - os.chmod(floc[0],mystat[0]) - os.chown(floc[0],mystat[4],mystat[5]) - print "<<<",floc[0]+"/" - else: - print "---",floc[0]+"/" - #mtime doesn't mean much for directories -- we don't store it - outfile.write("dir "+floc[1]+"\n") - mywd=os.getcwd() - os.chdir(x) - mergefiles() - os.chdir(mywd) - - -prepare_db() -outfile=open(myroot+"var/db/pkg/"+mycategory+"/"+mypackage+"/CONTENTS","w") -mergefiles() -print -print ">>>",mypackage,"installed." -print -outfile.close() diff --git a/sys-apps/portage/files/new/dobin b/sys-apps/portage/files/new/dobin deleted file mode 100755 index d3183791112d..000000000000 --- a/sys-apps/portage/files/new/dobin +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -if [ ${#} -lt 1 ] -then - echo "${0}: at least one argument needed" - return -fi -if [ ! -d ${D}${DESTTREE}/bin ] -then - install -d ${D}${DESTTREE}/bin -fi -for x in "$@" -do - if [ -x ${x} ] - then - if [ -z "$DEBUG" ] - then - MYVAL=`file ${x} | grep "ELF"` - if [ -n "$MYVAL" ] - then - strip ${x} - fi - fi - install ${x} ${D}${DESTTREE}/bin - else - echo "${0}: ${x} is not executable or does not exist" - fi - done - diff --git a/sys-apps/portage/files/new/dodeps b/sys-apps/portage/files/new/dodeps deleted file mode 100755 index 1bb8a3b7ee99..000000000000 --- a/sys-apps/portage/files/new/dodeps +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/env python -from portage import * -import sys -import commands -import os -import string - -for x in sys.argv[1:]: - if isinstalled(x): - continue - mysplit=string.split(x,"/") - if len(mysplit) != 2: - print - print "!!! Error:",x,"is not a valid dependency string." - print - sys.exit(1) - if justname(mysplit[1]): - mypath="/usr/portage/"+mysplit[0]+"/"+mysplit[1] - else: - mypath="/usr/portage/"+mysplit[0]+"/"+pkgsplit(mysplit[1])[0] - myfiles=os.listdir(mypath) - print myfiles - myebuilds=[] - for y in myfiles: - if y[-7:] == ".ebuild": - myebuilds.append(y) - if len(myebuilds)>1: - newebuild=["0.0","0"] - for z in myebuilds: - esplit=pkgsplit(z[:-7]) - #not a valid version part of ebuild name, out of contention - if not esplit: - continue - #version is newer - if vercmp(esplit[1],newebuild[0])>0: - newebuild=esplit[1:] - #version is same - elif vercmp(esplit[1],newebuild[0])==0: - #rev is newer - if atoi(esplit[2][1:])>atoi(newebuild[1][1:]): - newebuild=esplit[1:] - myebuilds=esplit[0]+"-"+newebuild[0] - if newebuild[1][1:] != "0": - myebuilds=myebuilds+"-"+newebuild[1] - myebuilds=[myebuilds+".ebuild"] - print - print ">>> Hmmm... multiple ebuild files in",mypath - print ">>> Picking newest file: ",myebuilds[0] - print - print myebuilds - myout=os.system("/usr/sbin/ebuild "+mypath+"/"+myebuilds[0]+" merge") - if myout != 0: - print - print "!!! Error: Autobuild of",mypath+"/"+myebuilds[0],"failed." - print - sys.exit(1) -sys.exit(0)
\ No newline at end of file diff --git a/sys-apps/portage/files/new/dodir b/sys-apps/portage/files/new/dodir deleted file mode 100755 index 5b7e8997a996..000000000000 --- a/sys-apps/portage/files/new/dodir +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - for x in "$@" - do - install -d ${D}${x} - done diff --git a/sys-apps/portage/files/new/dodoc b/sys-apps/portage/files/new/dodoc deleted file mode 100755 index 5343de6ec9d1..000000000000 --- a/sys-apps/portage/files/new/dodoc +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -for x in "$@" -do -if [ -e ${x} ] -then - if [ ! -d ${D}usr/doc/${PF} ] - then - install -d ${D}usr/doc/${PF} - fi - if [ -z ${DOCDESTTREE} ] - then - install -m0644 ${x} ${D}usr/doc/${PF} - gzip -9 ${D}usr/doc/${PF}/${x##*/} - else - install -m0644 ${x} ${D}usr/doc/${PF}/${DOCDESTTREE} - gzip -9 ${D}usr/doc/${PF}/${DOCDESTTREE}/${x##*/} - fi -else - echo "${0}: ${x} does not exist." - fi -done - diff --git a/sys-apps/portage/files/new/doexe b/sys-apps/portage/files/new/doexe deleted file mode 100755 index c9ae3a17d432..000000000000 --- a/sys-apps/portage/files/new/doexe +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash - mynum=${#} - if [ ${mynum} -lt 1 ] - then - echo "doexe: at least one argument needed" - return - fi - if [ ! -d ${D}${EXEDESTTREE} ] - then - install -d ${D}${EXEDESTTREE} - fi - for x in "$@" - do - if [ -L ${x} ] - then - cp ${x} ${T} - mysrc=${T}/`/usr/bin/basename ${x}` - elif [ -d ${x} ] - then - echo "doexe: warning, skipping directory ${x}" - continue - else - mysrc=${x} - fi - install ${EXEOPTIONS} ${mysrc} ${D}${EXEDESTTREE} - if [ -n "$DEBUG" ] - then - strip ${D}${EXEDESTTREE}/`/usr/bin/basename ${x}` - fi - done - - diff --git a/sys-apps/portage/files/new/dohard b/sys-apps/portage/files/new/dohard deleted file mode 100755 index 283f4683af8e..000000000000 --- a/sys-apps/portage/files/new/dohard +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - if [ ${#} -ne 2 ] - then - echo "${0}: two arguments needed" - return - fi - mysrc=${1} - mydest=${2} - ln -f ${D}${mysrc} ${D}${mydest} - diff --git a/sys-apps/portage/files/new/doinfo b/sys-apps/portage/files/new/doinfo deleted file mode 100755 index edcc3c13cd48..000000000000 --- a/sys-apps/portage/files/new/doinfo +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -if [ ${#} -lt 1 ] -then - echo "doinfo: at least one argument needed" - return -fi -if [ ! -d ${D}usr/info ] -then - install -d ${D}usr/info -fi -for x in "$@" -do - if [ -e ${x} ] - then - install -m0644 ${x} ${D}usr/info - gzip -9 ${D}usr/info/${x##*/} - else - echo "doinfo: ${x} does not exist" - fi -done - diff --git a/sys-apps/portage/files/new/dolib b/sys-apps/portage/files/new/dolib deleted file mode 100755 index 2b6dfa4b48e6..000000000000 --- a/sys-apps/portage/files/new/dolib +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -if [ ${#} -lt 1 ] -then - echo "${0}: at least one argument needed" - return -fi -if [ ! -d ${D}${DESTTREE}/lib ] -then - install -d ${D}${DESTTREE}/lib -fi -for x in "$@" -do - if [ -e ${x} ] - then - install ${LIBOPTIONS} ${x} ${D}${DESTTREE}/lib - else - echo "${0}: ${x} does not exist" - fi -done diff --git a/sys-apps/portage/files/new/dolib.a b/sys-apps/portage/files/new/dolib.a deleted file mode 100755 index 24a01f68a83f..000000000000 --- a/sys-apps/portage/files/new/dolib.a +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -if [ ${#} -lt 1 ] -then - echo "${0}: at least one argument needed" - return -fi -if [ ! -d ${D}${DESTTREE}/lib ] -then - install -d ${D}${DESTTREE}/lib -fi -for x in "$@" -do - if [ -e ${x} ] - then - install -m0644 ${x} ${D}${DESTTREE}/lib - else - echo "${0}: ${x} does not exist" - fi -done - - diff --git a/sys-apps/portage/files/new/dolib.so b/sys-apps/portage/files/new/dolib.so deleted file mode 100755 index 551179f6d408..000000000000 --- a/sys-apps/portage/files/new/dolib.so +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -if [ ${#} -lt 1 ] -then - echo "${0}: at least one argument needed" - return -fi -if [ ! -d ${D}${DESTTREE}/lib ] -then - install -d ${D}${DESTTREE}/lib -fi -for x in "$@" -do - if [ -e ${x} ] - then - if [ -n "$DEBUG" ] - then - strip --strip-unneeded ${x} - fi - install -m0644 ${x} ${D}${DESTTREE}/lib - else - echo "${0}: ${x} does not exist" - fi -done - - diff --git a/sys-apps/portage/files/new/doman b/sys-apps/portage/files/new/doman deleted file mode 100755 index b2734393e748..000000000000 --- a/sys-apps/portage/files/new/doman +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -if [ ${#} -lt 1 ] -then - echo "${0}: at least one argument needed" - return -fi -myloc=$DESTTREE -if [ "$myloc" = "" ] -then - myloc=/usr -fi -for x in "$@" -do - md=${x##*.} - mandir=man${md:0:1} - if [ -e ${x} ] - then - if [ ! -d ${D}${myloc}/man/${mandir} ] - then - install -d ${D}${myloc}/man/${mandir} - fi - install -m0644 ${x} ${D}${myloc}/man/${mandir} - gzip -9 ${D}${myloc}/man/${mandir}/${x##*/} - else - echo "doman: ${x} does not exist." - fi -done diff --git a/sys-apps/portage/files/new/domo b/sys-apps/portage/files/new/domo deleted file mode 100755 index ef393b92a066..000000000000 --- a/sys-apps/portage/files/new/domo +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - mynum=${#} - if [ ${mynum} -lt 1 ] - then - echo "${0}: at least one argument needed" - return - fi - if [ ! -d ${D}${DESTTREE}/share/locale ] - then - install -d ${D}${DESTTREE}/share/locale/ - fi - for x in "$@" - do - if [ -e ${x} ] - then - mytiny=${x##*/} - mydir=${D}${DESTTREE}/share/locale/${mytiny%.*}/LC_MESSAGES - if [ ! -d ${mydir} ] - then - install -d ${mydir} - fi - install -m0644 ${x} ${mydir}/${MOPREFIX}.mo - else - echo "${0}: ${x} does not exist" - fi - done - diff --git a/sys-apps/portage/files/new/dopython b/sys-apps/portage/files/new/dopython deleted file mode 100755 index 148d39cc480e..000000000000 --- a/sys-apps/portage/files/new/dopython +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env /usr/lib/portage/bin/python - -from sys import * -import portage -import types -mycommand=argv[1]+"(" -x=2 -while (x<len(argv)): - if x==(len(argv)-1): - mycommand=mycommand+'"'+argv[x]+'"' - else: - mycommand=mycommand+'"'+argv[x]+'",' - x=x+1 -mycommand=mycommand+")" -exec("myresult="+mycommand) -if type(myresult)==types.IntType: - exit(myresult) diff --git a/sys-apps/portage/files/new/dosbin b/sys-apps/portage/files/new/dosbin deleted file mode 100755 index 827ef41a6175..000000000000 --- a/sys-apps/portage/files/new/dosbin +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -if [ ${#} -lt 1 ] - then - echo "${0}: at least one argument needed" - return - fi - if [ ! -d ${D}${DESTTREE}/sbin ] - then - install -d ${D}${DESTTREE}/sbin - fi - for x in "$@" - do - if [ -x ${x} ] - then - if [ -z "$DEBUG" ] - then - MYVAL=`file ${x} | grep "ELF"` - if [ "$MYVAL" ] - then - strip ${x} - fi - fi - install -m0754 ${x} ${D}${DESTTREE}/sbin - else - echo "${0}: ${x} is not executable or does not exist" - fi - done - diff --git a/sys-apps/portage/files/new/dosed b/sys-apps/portage/files/new/dosed deleted file mode 100755 index cf5d1f51b010..000000000000 --- a/sys-apps/portage/files/new/dosed +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh - - -mysed="s:${D}::g" - -for x in "$@" -do - y=${D}${x} - if [ -a "${y}" ] - then - if [ -f "${y}" ] - then - mysrc=${T}/`/usr/bin/basename ${y}` - cp ${y} ${mysrc} - sed -e "${mysed}" ${mysrc} > ${y} - else - echo "${y} is not a regular file!" - return - fi - else - mysed=${x} - fi -done diff --git a/sys-apps/portage/files/new/dosym b/sys-apps/portage/files/new/dosym deleted file mode 100755 index 7c0cadd1b3f9..000000000000 --- a/sys-apps/portage/files/new/dosym +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - if [ ${#} -ne 2 ] - then - echo "${0}: two arguments needed" - return - fi - target=${1} - linkname=${2} - ln -sf ${target} ${D}${linkname} - - diff --git a/sys-apps/portage/files/new/ebuild b/sys-apps/portage/files/new/ebuild deleted file mode 100755 index 03282f1b7f04..000000000000 --- a/sys-apps/portage/files/new/ebuild +++ /dev/null @@ -1,974 +0,0 @@ -#!/bin/bash -# Copyright 1999-2000 Daniel Robbins, Gentoo Technologies, Inc. -# Distributed under the GPL - -if [ ! -f "/usr/lib/portage/bin/python" ] -then - cp /usr/bin/python /usr/lib/portage/bin/python -fi - -if [ "`whoami`" != "root" ] -then - echo "Since ebuild can modify critical system files, only root is" - echo "allowed to use the ebuild system." - exit 1 -fi - -#allow any envvars to be set like QTDIR, even if Qt was just installed -source /etc/profile -export PATH=/usr/lib/portage/bin:${PATH} -eval `import-settings PROXY HTTP_PROXY FTP_PROXY DEBUG MAKEOPTS MAINTAINER CHOST CFLAGS CXXFLAGS PORTDIR DISTDIR BUILD_PREFIX PKGDIR RPMDIR PLATFORM ROOT` -eval `import-configsettings FETCHCOMMAND PACKAGE USE GENTOO_MIRRORS PLATFORM` - -initvars() { - export DESTTREE=/usr - export INSDESTTREE="" - export EXEDESTTREE="" - export DOCDESTTREE="" - export INSOPTIONS="-m0644" - export EXEOPTIONS="-m0755" - export LIBOPTIONS="-m0644" - export MOPREFIX=${PN} - export KVERS=`uname -r` -} - -initvars - -src_unpack() { - unpack ${A} -} - -src_compile() { - return -} - -src_install() - { - return - } - -pkg_preinst() - { - return - } - -pkg_postinst() - { - return - } - -pkg_prerm() - { - return - } - -pkg_postrm() - { - return - } - -try() { - eval $* - if [ $? -ne 0 ] - then - echo - echo '!!! '"ERROR: the $1 command did not complete successfully." - echo '!!! '"(\"$*\")" - echo '!!! '"Since this is a critical task, ebuild will be stopped." - echo - exit 1 - fi -} - -dyn_touch() { - local x - for x in ${A} - do - if [ -e ${DISTDIR}/${x} ] - then - touch ${DISTDIR}/${x} - fi - done -} - -dyn_digest() { - local x - if [ ! -d ${FILESDIR} ] - then - install -d ${FILESDIR} - if [ -n ${MAINTAINER} ] - then - echo ">>> adding ${FILESDIR} to CVS (just in case it isn't there)" - ( echo; cd `/usr/bin/dirname ${FILESDIR}`; cvs add `/usr/bin/basename ${FILESDIR}`; echo) - fi - fi - for x in ${A} - do - if [ ! -e ${DISTDIR}/${x} ] - then - echo '!!! Cannot compute message digests: '${x} not found - echo "error, aborting." - exit 1 - else - mymd5=`md5sum ${DISTDIR}/${x} | cut -f1 -d" "` - echo "MD5 $mymd5 $x" >> ${FILESDIR}/.digest-${PF} - fi - done - mv ${FILESDIR}/.digest-${PF} ${FILESDIR}/digest-${PF} - if [ -n "${MAINTAINER}" ] - then - echo ">>> adding digest-${PF} to CVS (just in case it isn't there)" - ( echo; cd ${FILESDIR}; cvs add digest-${PF}; echo ) - fi - echo ">>> Computed message digests." -} - -runtime_depend() { - #the echo thing is a trick to get rid of newlines - dopython portage.dep_frontend runtime "`echo ${RDEPEND}`" - if [ $? -ne 0 ] - then - exit 1 - fi -} - -build_depend() { - #the echo thing is a trick to get rid of newlines - dopython portage.dep_frontend build "`echo ${DEPEND}`" - if [ $? -ne 0 ] - then - exit 1 - fi -} - -gen_depend() { - for x in $DEPEND - do - echo "$x" >> ${FILESDIR}/depend-${PF} - done - for x in $RDEPEND - do - echo "$x" >> ${FILESDIR}/rdepend-${PF} - done - echo ">>> Completed generating dependencies for ${PF}." -} - -merge_check() { - dopython portage.merge_check "${CATEGORY}/${PF}" - if [ $? -ne 0 ] - then - echo - echo '!!!' "${PF} already merged in ${ROOT} -- unmerge first" - echo - exit 1 - fi -} - -digest_check() { - if [ ! -e ${FILESDIR}/digest-${PF} ] - then - echo '!!!'" No message digest file found." - if [ -n "$MAINTAINER" ] - then - echo '>>> Maintainer mode: auto-computing digests.' - dyn_digest - return 0 - else - echo '!!!'" Maintainer: ebuild digest to update message digests." - return 1 - fi - fi - if [ ! -e ${DISTDIR}/${1} ] - then - echo '!!!'" ${1} not found." - echo '!!!'" Ebuild fetch to retrieve files." - return 1 - fi - local mycdigest=`grep " ${1}" ${FILESDIR}/digest-${PF} | cut -f2 -d" "` - if [ -z "$mycdigest" ] - then - echo - echo '!!!'" No message digest found for ${1}." - if [ -n "$MAINTAINER" ] - then - echo '>>> Maintainer mode: auto-computing digests.' - dyn_digest - echo - return 0 - else - echo '!!!'" Maintainer: ebuild digest to update message digests." - echo - return 1 - fi - fi - local mydigest=`md5sum ${DISTDIR}/${1} | cut -f1 -d" "` - if [ "$mycdigest" != "$mydigest" ] - then - echo - echo '!!!'" ${1}: message digests do not match!" - echo '!!!'" ${1} is corrupt or incomplete" - echo ">>> md5 con ${mycdigest}" - echo ">>> md5 now ${mydigest}" - echo ">>> Please delete/redownload ${DISTDIR}/${1}" - echo - return 1 - else - echo ">>> md5 ;-) ${1}" - fi - return 0 -} - -dyn_batchdigest() { - local x - if [ ! -e ${FILESDIR}/digest-${PF} ] - then - if [ "${A}" != "" ] - then - echo "${CATEGORY}/${PF} has no digest file." - fi - exit 1 - fi - for x in ${A} - do - if [ ! -e ${DISTDIR}/${x} ] - then - echo "${CATEGORY}/${PF}:${x} does not exist in ${DISTDIR}." - continue - else - local mycdigest=`grep " ${x}" ${FILESDIR}/digest-${PF} | cut -f2 -d" "` - if [ -z "$mycdigest" ] - then - echo "${CATEGORY}/${PF}:${x} digest not yet recorded." - continue - fi - local mydigest=`md5sum ${DISTDIR}/${x} | cut -f1 -d" "` - if [ "$mycdigest" != "$mydigest" ] - then - echo "${CATEGORY}/${PF}:${x} is corrupt or has an invalid digest." - fi - fi - done -} - - -dyn_fetch() { - local y - for y in ${A} - do - if [ ! -e ${DISTDIR}/${y} ] - then - echo ">>> Fetching ${y}..." - echo - local x - local _SRC_URI - for x in ${GENTOO_MIRRORS} - do - _SRC_URI="${_SRC_URI} ${x}/distributions/gentoo/gentoo-sources/${y}" - done - _SRC_URI="${_SRC_URI} `/usr/bin/queryhost.sh "${SRC_URI}"`" - for x in ${_SRC_URI} - do - if [ ! -e ${DISTDIR}/${y} ] - then - if [ $y == ${x##*/} ] - then - echo ">>> Trying site ${x}..." - echo x: ${x} - echo distdir: ${DISTDIR} - echo fetchcommand: ${FETCHCOMMAND} - eval "${FETCHCOMMAND}" - if [ $? -ne 0 ] - then - echo '!!!'" Couldn't download ${y}." - fi - fi - fi - done - if [ ! -e ${DISTDIR}/${y} ] - then - echo '!!!'" Couldn't download ${y}. Aborting." - exit 1 - fi - echo - fi - done - for y in ${A} - do - digest_check ${y} - if [ $? -ne 0 ] - then - exit 1 - fi - done -} - -dyn_unpack() { - trap "abort_unpack" SIGINT SIGQUIT - local unpackwork="yes" - if [ -e ${WORKDIR} ] - then - local x - for x in $A $EBUILD - do - echo ">>> Checking ${x}'s mtime..." - if [ ${DISTDIR}/${x} -nt ${WORKDIR} ] - then - echo ">>> ${x} has been updated; recreating WORKDIR..." - rm -rf ${WORKDIR} - break - fi - done - echo ">>> WORKDIR is up-to-date, not unpacking. (clean to force unpack)" - unpackwork="no" - fi - if [ "$unpackwork" = "yes" ] - then - install -m0700 -d ${WORKDIR} - cd ${WORKDIR} - echo ">>> Unpacking source..." - src_unpack - echo ">>> Source unpacked." - cd .. - fi - trap SIGINT SIGQUIT -} - -dyn_clean() { - if [ -d ${WORKDIR} ] - then - rm -rf ${WORKDIR} - fi - if [ -d ${BUILDDIR}/image ] - then - rm -rf ${BUILDDIR}/image - fi - rm -rf ${BUILDDIR}/.compiled -} - -into() { - if [ $1 = "/" ] - then - export DESTTREE="" - else - export DESTTREE=$1 - if [ ! -d ${D}${DESTTREE} ] - then - install -d ${D}${DESTTREE} - fi - fi -} - -insinto() { - if [ $1 = "/" ] - then - export INSDESTTREE="" - else - export INSDESTTREE=$1 - if [ ! -d ${D}${INSDESTTREE} ] - then - install -d ${D}${INSDESTTREE} - fi - fi -} - -exeinto() { - if [ $1 = "/" ] - then - export EXEDESTTREE="" - else - export EXEDESTTREE=$1 - if [ ! -d ${D}${EXEDESTTREE} ] - then - install -d ${D}${EXEDESTTREE} - fi - fi -} -docinto() { - if [ $1 = "/" ] - then - export DOCDESTTREE="" - else - export DOCDESTTREE=$1 - if [ ! -d ${D}usr/doc/${PF}/${DOCDESTTREE} ] - then - install -d ${D}usr/doc/${PF}/${DOCDESTTREE} - fi - fi -} - -insopts() { - INSOPTIONS="" - for x in $* - do - #if we have a debug build, let's not strip anything - if [ -n "$DEBUG" ] && [ "$x" = "-s" ] - then - continue - else - INSOPTIONS="$INSOPTIONS $x" - fi - done - export INSOPTIONS -} - -doins() { - local mynum=${#} - if [ ${mynum} -lt 1 ] - then - echo "${0}: at least one argument needed" - return - fi - if [ ! -d ${D}${INSDESTTREE} ] - then - install -d ${D}${INSDESTTREE} - fi - local x - local mysrc - for x in "$@" - do - if [ -L $x ] - then - cp $x ${T} - mysrc=${T}/`/usr/bin/basename ${x}` - elif [ -d $x ] - then - echo "doins: warning, skipping directory ${x}" - continue - else - mysrc=${x} - fi - install ${INSOPTIONS} ${mysrc} ${D}${INSDESTTREE} - done -} - -donewins() { - local mynum=${#} - if [ ${mynum} -lt 1 ] - then - echo "${0}: at least one argument needed" - return - fi - if [ ! -d ${D}${INSDESTTREE} ] - then - install -d ${D}${INSDESTTREE} - fi - install -D ${INSOPTIONS} ${1} ${D}${INSDESTTREE}/${2} - -} - -exeopts() { - EXEOPTIONS="" - for x in $* - do - #if we have a debug build, let's not strip anything - if [ -n "$DEBUG" ] && [ "$x" = "-s" ] - then - continue - else - EXEOPTIONS="$EXEOPTIONS $x" - fi - done - export EXEOPTIONS -} - -libopts() { - LIBOPTIONS="" - for x in $* - do - #if we have a debug build, let's not strip anything - if [ -n "$DEBUG" ] && [ "$x" = "-s" ] - then - continue - else - LIBOPTIONS="$LIBOPTIONS $x" - fi - done - export LIBOPTIONS -} - -abort_compile() { - echo - echo '*** Compilation Aborted ***' - echo - cd ${BUILDDIR} #original dir - rm -f .compiled - trap SIGINT SIGQUIT - exit 1 -} - -abort_unpack() { - echo - echo '*** Unpack Aborted ***' - echo - cd ${BUILDDIR} #original dir - rm -f .unpacked - rm -rf work - trap SIGINT SIGQUIT - exit 1 -} - -abort_package() { - echo - echo '*** Packaging Aborted ***' - echo - cd ${BUILDDIR} #original dir - rm -f .packaged - rm -f ${PKGDIR}/All/${PF}.t* - trap SIGINT SIGQUIT - exit 1 -} - -abort_image() { - echo - echo '*** Imaging Aborted ***' - echo - cd ${BUILDDIR} #original dir - rm -rf image - trap SIGINT SIGQUIT - exit 1 -} - -dyn_compile() { - trap "abort_compile" SIGINT SIGQUIT - export CFLAGS CXXFLAGS LIBCFLAGS LIBCXXFLAGS - if [ ${BUILDDIR}/.compiled -nt ${WORKDIR} ] - then - echo ">>> It appears that ${PN} is already compiled. skipping." - echo ">>> (clean to force compilation)" - trap SIGINT SIGQUIT - return - fi - if [ -d ${S} ] - then - cd ${S} - fi - src_compile - cd ${BUILDDIR} - touch .compiled - trap SIGINT SIGQUIT -} - -dyn_package() { - trap "abort_package" SIGINT SIGQUIT - local PNAME=${PF}.${PACKAGE} - cd ${BUILDDIR}/image - echo ">>> Creating ${PNAME} in ${PKGDIR}/All..." - if [ "$PACKAGE" = "tbz2" ] - then - tar cvf ${PKGDIR}/All/${PF}.tar * - bzip2 ${PKGDIR}/All/${PF}.tar - mv ${PKGDIR}/All/${PF}.tar.bz2 ${PKGDIR}/All/${PNAME} - elif [ "$PACKAGE" = "tgz" ] - then - tar czvf ${PKGDIR}/All/${PNAME} * - else - echo '!!! Package format '${PACKAGE}' not recognized. Please correct /etc/make.conf' - exit 1 - fi - ln -sf ${PKGDIR}/All/${PNAME} ${PKGDIR}/${CATEGORY}/${PNAME} - echo ">>> Done." - cd ${BUILDDIR} - touch .packaged - trap SIGINT SIGQUIT -} - -dyn_install() { - local ROOT - trap "abort_image" SIGINT SIGQUIT - rm -rf ${BUILDDIR}/image - mkdir ${BUILDDIR}/image - if [ -d ${S} ] - then - cd ${S} - fi - echo - echo ">>> Install ${PF} into ${D} category ${CATEGORY}" - src_install - prepall - install -d -m0700 ${D}var/db/pkg/${CATEGORY}/${PF} - cp ${STARTDIR}/${EBUILD} ${D}var/db/pkg/${CATEGORY}/${PF} - local x - #create provides database - for x in $PROVIDE - do - echo "$x" >> ${D}var/db/pkg/${CATEGORY}/${PF}/PROVIDE - done - for x in $DEPEND - do - echo "$x" >> ${D}/var/db/pkg/${CATEGORY}/${PF}/DEPEND - done - for x in $RDEPEND - do - echo "$x" >> ${D}/var/db/pkg/${CATEGORY}/${PF}/RDEPEND - done - echo ">>> Completed installing into ${D}" - echo - cd ${BUILDDIR} - trap SIGINT SIGQUIT -} - -dyn_merge() { - trap "" SIGINT SIGQUIT - pkg_preinst - #/usr/sbin/portage-merge - dopython portage.merge "$CATEGORY" "$PF" "$D" - cd ${BUILDDIR} - #zap it so that people don't look at a bad image and get confused - rm -rf image - pkg_postinst - trap SIGINT SIGQUIT -} - -dyn_unmerge() { - trap "" SIGINT SIGQUIT - #/usr/sbin/portage-unmerge ${PF} - dopython portage.unmerge "$CATEGORY" "$PF" - trap SIGINT_SIGQUIT -} - - -dyn_spec() { - tar czf /usr/src/redhat/SOURCES/${PF}.tar.gz ${O}/${PF}.ebuild ${O}/files - - cat <<__END1__ > ${PF}.spec -Summary: ${DESCRIPTION} -Name: ${PN} -Version: ${PV} -Release: ${PR} -Copyright: GPL -Group: portage/${CATEGORY} -Source: ${PF}.tar.gz -Buildroot: ${D} -%description -${DESCRIPTION} - -${HOMEPAGE} - -%prep -%setup -c - -%build - -%install - -%clean - -%files -/ -__END1__ - -} -dyn_rpm () { - dyn_spec - rpm -bb ${PF}.spec - - install -D /usr/src/redhat/RPMS/i386/${PN}-${PV}-${PR}.i386.rpm ${RPMDIR}/${CATEGORY}/${PN}-${PV}-${PR}.rpm -} - -dyn_help() { - echo - echo "Portage" - echo "Copyright 2000 Gentoo Technologies, Inc." - echo - echo "How to use the ebuild command:" - echo - echo "The first argument to ebuild should be an existing .ebuild file." - echo - echo "One or more of the following options can then be specified. If more" - echo "than one option is specified, each will be executed in order." - echo - echo " check : test if all dependencies get resolved" - echo " fetch : download source archive(s) and patches" - echo " unpack : unpack/patch sources (auto-fetch if needed)" - echo " compile : compile sources (auto-fetch/unpack if needed)" - echo " merge : merge image into live filesystem, recording files in db" - echo " remerge : forces merge even if the package is installed" - echo " (auto-fetch/unpack/compile if needed)" - echo " unmerge : remove package from live filesystem" - echo " package : create tarball package of type ${PACKAGE}" - echo " (will be stored in ${PKGDIR}/All)" - echo " clean : clean up all source and temporary files" - echo - echo "The following settings will be used for the ebuild process:" - echo - echo " package : ${PF}" - echo " category : ${CATEGORY}" - echo " description : ${DESCRIPTION}" - echo " system : ${CHOST}" - echo " c flags : ${CFLAGS}" - echo " c++ flags : ${CXXFLAGS}" - echo " make flags : ${MAKEOPTS}" - echo -n " build mode : " - if [ -n "${DEBUG}" ] - then - echo "debug (large)" - else - echo "production (stripped)" - fi - echo " merge to : ${ROOT}" - echo " db location : ${ROOT}var/db/pkg/${CATEGORY}/${P}/CONTENTS" - echo - if [ -n "$USE" ] - then - echo "Additionally, support for the following toolkits will be enabled if necessary:" - echo - echo " ${USE}" - fi - echo -} - -src_menu() { - MYDIR=${BUILDDIR} - local MYfoo - for MYfoo in "$@" - do - case "${MYfoo}" in - noop) - ;; - unpack) - dyn_fetch - dyn_unpack - ;; - compile) - build_depend - dyn_fetch - dyn_unpack - dyn_compile - ;; - prerm|postrm|preinst|postinst|config) - pkg_${MYfoo} - ;; - help|batchdigest|touch|clean|fetch|digest|pkginfo|pkgloc|unmerge|install) - dyn_${MYfoo} - ;; - check) - # Exit with 1 if there are unresolved dependencies - build_depend - ;; - package) - build_depend - dyn_fetch - local PNAME=${PF}.${PACKAGE} - if [ ! -d ${PKGDIR} ] - then - install -d ${PKGDIR} - fi - if [ ! -d ${PKGDIR}/All ] - then - install -d ${PKGDIR}/All - fi - if [ ! -d ${PKGDIR}/${CATEGORY} ] - then - install -d ${PKGDIR}/${CATEGORY} - fi - if [ -e ${PKGDIR}/All/${PNAME} ] - then - if [ ! -d ${PKGDIR}/${CATEGORY}/${PNAME} ] - then - ln -sf ${PKGDIR}/All/${PNAME} ${PKGDIR}/${CATEGORY}/${PNAME} - fi - local x - local dopackage - dopackage="no" - for x in ${A} ${EBUILD} - do - if [ ${x} -nt ${PKGDIR}/All/${PNAME} ] - then - dopackage="yes" - break - fi - done - if [ "$dopackage" = "no" ] - then - echo - echo ">>> Package ${PNAME} appears to be up-to-date." - echo ">>> To force rebuild, touch ${EBUILD}." - echo - continue - fi - fi - dyn_unpack - dyn_compile - dyn_install - dyn_package - ;; - - remerge) - #this is meant to merge over an existing version even if it exists - build_depend - dyn_fetch - dyn_unpack - dyn_compile - dyn_install - dyn_merge - runtime_depend - ;; - qmerge) - #this means to run only dyn_merge - dyn_merge - ;; - merge) - #merge makes sure the package isn't already merged first - merge_check - build_depend - dyn_fetch - dyn_unpack - dyn_compile - dyn_install - dyn_merge - runtime_depend - ;; - gendeps) - #create DEPEND and RDEPEND files in the same directory as the .ebuild file - #this is used for the auto dependency resolving features of ebuild - gen_depend - ;; - rpm) - build_depend - dyn_fetch - dyn_unpack - dyn_compile - dyn_install - dyn_rpm - ;; - *) - echo "Please specify a valid command." - echo - dyn_help - esac - done - cd $MYDIR -} - -#dummy value for help printouts -P=packagename - -if [ $# -lt 1 ] -then - echo - echo '!!!' "At least two arguments expected." - dyn_help - exit 1 -fi - -if [ ! -e ${1} ] -then - echo - echo '!!!' "${1} not found." - dyn_help - exit 1 -fi - -# this function sets various environment variables that are used by -# portage. For a package called "foo-1.2-r1", they would be set as -# follows: -# P=foo-1.2 -# PF=foo-1.2-r1 (r1 is the rev, or release of the ebuild script) -# PN=foo -# PV=1.2 -# PR=1 (rev is zero if unspecified) - -setp() { - if [ $# -ne 3 ] - then - echo '!!!' ${P} is not a valid package name. Exiting. - exit 1 - fi - if [ "${3}" = "0" ] - then - export PF="${1}-${2}" - else - export PF="${1}-${2}-r${3}" - fi - export P="${1}-${2}" - export PN="${1}" - export PV="${2}" - export PR="${3}" -} - -export STARTDIR=`pwd` - -if [ "${1:0:1}" = "/" ] -then - export O=`dirname ${1}` -else - tmpfoo=`dirname ${1}` - export O=`( cd ${tmpfoo}; pwd )` -fi -tmpfoo=`(cd ${O}/..;pwd)` -export CATEGORY=`/usr/bin/basename $tmpfoo` -export EBUILD=${1} -export PEBUILD=${O}/files/${PLATFORM}.ebuild -export FILESDIR=${O}/files - -tmpfoo=`/usr/bin/basename ${1%.*}` -setp `/usr/sbin/pkgname ${tmpfoo}` - -#if [ $# -le 3 ] -#then -# dyn_help -# exit 1 -#fi - -#source ${1} -#if [ -e ${PEBUILD} ] -#then -# source ${PEBUILD} -#fi - -if [ ! -z ${BUILD_PREFIX} ] -then - export BUILDDIR=${BUILD_PREFIX}/${PF} -else - export BUILDDIR=${O} -fi -if [ ! -d ${BUILDDIR} ] -then - install -d ${BUILDDIR} -fi - -export T=${BUILDDIR}/temp -if [ ! -d ${T} ] -then - install -d ${T} -fi -export WORKDIR=${BUILDDIR}/work -export D=${BUILDDIR}/image -dlen=$(( ${#D} -1 )) -if [ "${D:${dlen}:1}" != "/" ] -then - export D=${D}/ -fi - -source ${1} -if [ -e ${PEBUILD} ] -then - source ${PEBUILD} -fi - -#set up dependency variables correctly... -if [ "$RDEPEND" = "" ] -then - RDEPEND="$DEPEND" -fi - -#auto-generate ${A} based on ${SRC_URI} if ${A} isn't defined... -if [ "${A}" = "" ] -then - export SRC_URI - eval `dopython portage.gen_archnames` -fi - -foo=2 -while [ $foo -le $# ] -do -eval "src_menu \${${foo}}" -if [ $? -ne 0 ] -then - echo "***error***" - exit 1 -fi -foo=$(( $foo + 1)) -done - - diff --git a/sys-apps/portage/files/new/find-packages b/sys-apps/portage/files/new/find-packages deleted file mode 100755 index d808dd5777d6..000000000000 --- a/sys-apps/portage/files/new/find-packages +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - - -filelist=`sed "s/['\"]/\\\&/g"` - -for f in $filelist; do - file=`grep -r "$f ->" /var/db/pkg/*/*/CONTENTS` - file=${file#/*/*/*/*/} - file=${file%*/CONTENTS:*} - echo $file -done | sort -u - - diff --git a/sys-apps/portage/files/new/find-requires b/sys-apps/portage/files/new/find-requires deleted file mode 100755 index eaf720da3973..000000000000 --- a/sys-apps/portage/files/new/find-requires +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh - -# note this works for both a.out and ELF executables -# it also auto-generates requirment lines for shell scripts - -ulimit -c 0 - -filelist=`sed "s/['\"]/\\\&/g"` -exelist=`echo $filelist | xargs -r file | grep ":.*executable" | cut -d: -f1 ` -scriptlist=`echo $filelist | xargs -r file | egrep ":.* (commands|script) " | cut -d: -f1 ` -liblist=`echo $filelist | xargs -r file | grep ":.*shared object" | cut -d : -f1 ` - -for f in $exelist; do - if [ -x $f ]; then - ldd $f | awk '/=>/ { print $1 }' - fi -done | sort -u | sed "s/['\"]/\\\&/g" | xargs -r -n 1 basename | grep -v 'libNoVersion.so' | sort -u - -for f in $liblist; do - ldd $f | awk '/=>/ { print $1 }' -done | sort -u | sed "s/['\"]/\\\&/g" | xargs -r -n 1 basename | grep -v 'libNoVersion.so' | sort -u - -for f in $scriptlist; do - if [ -x $f ]; then - head -1 $f | sed -e 's/^\#\![ ]*//' | cut -d" " -f1 - fi -done | sort -u - -#for f in $liblist $exelist ; do -# objdump -p $f | awk ' -# BEGIN { START=0; LIBNAME=""; } -# /Version References:/ { START=1; } -# /required from/ && (START==1) { -# sub(/:/, "", $3); -# LIBNAME=$3; -# } -# (START==1) && (LIBNAME!="") && ($4~/^GLIBC_*/) { print LIBNAME "(" $4 ")"; } -# /^$/ { START=0; } -# ' -#done | sort -u - diff --git a/sys-apps/portage/files/new/fowners b/sys-apps/portage/files/new/fowners deleted file mode 100755 index 934abc463bbe..000000000000 --- a/sys-apps/portage/files/new/fowners +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - if [ ${#} -ne 2 ] - then - echo "${0}: two arguments needed" - return - fi - chown ${1} ${D}${2} - - - diff --git a/sys-apps/portage/files/new/fperms b/sys-apps/portage/files/new/fperms deleted file mode 100755 index 0a60e078ed97..000000000000 --- a/sys-apps/portage/files/new/fperms +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - if [ ${#} -ne 2 ] - then - echo "${0}: two arguments needed" - return - fi - chmod ${1} ${D}${2} diff --git a/sys-apps/portage/files/new/import-configsettings b/sys-apps/portage/files/new/import-configsettings deleted file mode 100755 index a4dec32fb1bc..000000000000 --- a/sys-apps/portage/files/new/import-configsettings +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env python -import sys,portage -for x in sys.argv[1:]: - mysetting=portage.getconfigsetting(x) - if x=="ROOT": - #make sure path ends with a "/" - if len(mysetting)==0: - mysetting="/" - elif mysetting[-1]!="/": - mysetting=mysetting+"/" - print "export "+x+"='"+mysetting+"'" - diff --git a/sys-apps/portage/files/new/import-settings b/sys-apps/portage/files/new/import-settings deleted file mode 100755 index b36dee8a74fa..000000000000 --- a/sys-apps/portage/files/new/import-settings +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env python -import sys,portage -for x in sys.argv[1:]: - mysetting=portage.getsetting(x) - if x=="ROOT": - #make sure path ends with a "/" - if len(mysetting)==0: - mysetting="/" - elif mysetting[-1]!="/": - mysetting=mysetting+"/" - print "export "+x+"='"+mysetting+"'" - diff --git a/sys-apps/portage/files/new/megadigest b/sys-apps/portage/files/new/megadigest deleted file mode 100755 index df5a6422f42d..000000000000 --- a/sys-apps/portage/files/new/megadigest +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash -source /etc/make.conf -echo -n "MD5 digest analysis started " -date -echo -for x in `find /usr/portage/ -iname *.ebuild` -do - ebuild ${x} batchdigest -done -echo -echo -n "MD5 digest analysis completed " -date diff --git a/sys-apps/portage/files/new/megadownload b/sys-apps/portage/files/new/megadownload deleted file mode 100755 index 68f411363b1e..000000000000 --- a/sys-apps/portage/files/new/megadownload +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash -for x in `find /usr/portage/ -iname *.ebuild` -do -/usr/bin/ebuild ${x} fetch digest -if [ $? -ne 0 ] -then - echo '!!!' couldn\'t download all files for ${x} >> /tmp/portage-download.log -else - echo ${x} >> /tmp/portage-download.log -fi -done diff --git a/sys-apps/portage/files/new/megatouch b/sys-apps/portage/files/new/megatouch deleted file mode 100755 index c1f8baae7c0d..000000000000 --- a/sys-apps/portage/files/new/megatouch +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash -export PATH="/usr/lib/portage/bin:${PATH}" -eval `import-settings DISTDIR PORTDIR` -echo -n "Source archive pruning started " -date -touch ${DISTDIR}/.cleaned -sleep 1 -cd ${PORTDIR} -for x in `find ${PORTDIR}/ -iname '*.ebuild'` -do - echo "touching files for ${x}" - ebuild ${x} touch -done -if [ ! -d ${DISTDIR}-old ] -then - mkdir ${DISTDIR}-old -fi -cd ${DISTDIR} -for x in `find ! -newer .cleaned | grep ./` -do - mv $x ${DISTDIR}-old -done -du -k ${DISTDIR} -du -k ${DISTDIR}-old -echo -n "Source archive pruning completed " -date diff --git a/sys-apps/portage/files/new/newbin b/sys-apps/portage/files/new/newbin deleted file mode 100755 index 91e6e4c4e8df..000000000000 --- a/sys-apps/portage/files/new/newbin +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -rm -rf ${T}/${2} -cp ${1} ${T}/${2} -dobin ${T}/${2}
\ No newline at end of file diff --git a/sys-apps/portage/files/new/newdoc b/sys-apps/portage/files/new/newdoc deleted file mode 100755 index 4c7286b751a4..000000000000 --- a/sys-apps/portage/files/new/newdoc +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -rm -rf ${T}/${2} -cp ${1} ${T}/${2} -dodoc ${T}/${2} diff --git a/sys-apps/portage/files/new/newexe b/sys-apps/portage/files/new/newexe deleted file mode 100755 index 09e91e02f476..000000000000 --- a/sys-apps/portage/files/new/newexe +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -rm -rf ${T}/${2} -cp ${1} ${T}/${2} -doexe ${T}/${2}
\ No newline at end of file diff --git a/sys-apps/portage/files/new/newins b/sys-apps/portage/files/new/newins deleted file mode 100755 index d661d9db5236..000000000000 --- a/sys-apps/portage/files/new/newins +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -rm -rf ${T}/${2} -cp ${1} ${T}/${2} -doins ${T}/${2} diff --git a/sys-apps/portage/files/new/newlib.a b/sys-apps/portage/files/new/newlib.a deleted file mode 100755 index 6749b8168996..000000000000 --- a/sys-apps/portage/files/new/newlib.a +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -rm -rf ${T}/${2} -cp ${1} ${T}/${2} -dolib.a ${T}/${2}
\ No newline at end of file diff --git a/sys-apps/portage/files/new/newlib.so b/sys-apps/portage/files/new/newlib.so deleted file mode 100755 index a8b9bef223ca..000000000000 --- a/sys-apps/portage/files/new/newlib.so +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -rm -rf ${T}/${2} -cp ${1} ${T}/${2} -dolib.so ${T}/${2} diff --git a/sys-apps/portage/files/new/newman b/sys-apps/portage/files/new/newman deleted file mode 100755 index 029677b08afb..000000000000 --- a/sys-apps/portage/files/new/newman +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -rm -rf ${T}/${2} -cp ${1} ${T}/${2} -doman ${T}/${2}
\ No newline at end of file diff --git a/sys-apps/portage/files/new/newsbin b/sys-apps/portage/files/new/newsbin deleted file mode 100755 index 5009b26ffe82..000000000000 --- a/sys-apps/portage/files/new/newsbin +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -rm -rf ${T}/${2} -cp ${1} ${T}/${2} -dosbin ${T}/${2}
\ No newline at end of file diff --git a/sys-apps/portage/files/new/pkgmerge b/sys-apps/portage/files/new/pkgmerge deleted file mode 100755 index e1f5a1024fed..000000000000 --- a/sys-apps/portage/files/new/pkgmerge +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/env python - -import portage -import sys -import os -import string -import shutil - -def cleanup(): - print ">>> Cleaning up temporary storage." - shutil.rmtree("/tmp/portage-pkg/"+mypkg,1) - -for x in sys.argv[1:]: - x=os.path.abspath(x) - #make sure pkg exists - - if not os.path.exists(x): - print "!!! Error:",x,"not found." - continue - - #get extension, package name - - mps=string.split(os.path.basename(x),".") - myextension=mps[-1] - mypkg=string.join(mps[:-1],".") - del mps - - if myextension != "tbz2": - print "!!! Error:",x,"is not a tbz2 file." - continue - - mypkgsplit=portage.pkgsplit(mypkg) - if mypkgsplit==None: - print "!!! Error:",x,"does not have a valid name." - continue - - if not os.path.exists("/tmp/portage-pkg"): - os.mkdir("/tmp/portage-pkg") - if os.path.exists("/tmp/portage-pkg/"+mypkg): - shutil.rmtree("/tmp/portage-pkg/"+mypkg,1) - os.mkdir("/tmp/portage-pkg/"+mypkg) - os.chdir("/tmp/portage-pkg/"+mypkg) - - print ">>> extracting",mypkg - unpacknotok=os.system("cat "+x+"| bzip2 -d | tar xf -") - if unpacknotok: - print "!!! Error extracting",x - cleanup() - continue - - #get category - mycat=os.listdir("var/db/pkg")[0] - - #exact version of package is already installed - - if portage.roottree.exists_specific(mycat+"/"+mypkg): - print "!!! Error:",mypkg,"is already installed. Unmerge first." - cleanup() - continue - rdepfile="var/db/pkg/"+mycat+"/"+mypkg+"/"+"RDEPEND" - if os.path.exists(rdepfile): - a=open(rdepfile,"r") - myrlines=a.readlines() - rdep="" - for x in myrlines: - rdep=rdep+" "+x[:-1] - if (portage.dep_frontend("runtime",rdep))!=0: - cleanup() - sys.exit(1) - portage.doebuild("var/db/pkg/"+mycat+"/"+mypkg+"/"+mypkg+".ebuild","preinst") - portage.merge(mycat,mypkg,os.getcwd()) - portage.doebuild(portage.root+"var/db/pkg/"+mycat+"/"+mypkg+"/"+mypkg+".ebuild","postinst") - cleanup() -print ">>> Done." diff --git a/sys-apps/portage/files/new/pmake b/sys-apps/portage/files/new/pmake deleted file mode 100755 index bb1d4ff15cfe..000000000000 --- a/sys-apps/portage/files/new/pmake +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -# auto-parallel make without the annoying syntax -exec make ${MAKEOPTS} MAKE="make ${MAKEOPTS}" $* diff --git a/sys-apps/portage/files/new/portage-maintain b/sys-apps/portage/files/new/portage-maintain deleted file mode 100755 index 8b6438182a74..000000000000 --- a/sys-apps/portage/files/new/portage-maintain +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env python - -import os -import portage -import string -import sys - -installeddict=portage.port_insttree() -currentdict=portage.port_currtree() -portagedict=portage.port_porttree() - -for mypkg in installeddict.keys(): - #if there is one installed version, and one recommended version, and they both - #are the same version, don't list the package. This package is up-to-date. - if (len(installeddict[mypkg])==1) and currentdict.has_key(mypkg): - if len(currentdict[mypkg])==1: - if portage.pkgcmp(currentdict[mypkg][0][1][1:],installeddict[mypkg][0][1][1:])==0: - continue - print "Package",mypkg - print "Installed version(s):" - for inspkg in installeddict[mypkg]: - print " ",inspkg[0] - # print available portage versions, labelling one as the recommended version - print "Available versions:" - if portagedict.has_key(mypkg): - for curpkg in portagedict[mypkg]: - print " ",curpkg[0] - else: - print " ","(none)" - print "Recommended version:" - if currentdict.has_key(mypkg): - for curpkg in currentdict[mypkg]: - print " ",curpkg[0] - else: - print " ","(none)" - print - -print "System (important) packages not installed:" -print -for x in currentdict.keys(): - if currentdict[x][0][1][0][0:4]=="sys-": - #required package - if not installeddict.has_key(x): - print x -print diff --git a/sys-apps/portage/files/new/portage-merge b/sys-apps/portage/files/new/portage-merge deleted file mode 100755 index 3c17cc358b4d..000000000000 --- a/sys-apps/portage/files/new/portage-merge +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env /usr/lib/portage/bin/python - -import portage,os - -portage.merge(os.environ["CATEGORY"],os.environ["PF"],os.path.normpath(os.environ["D"])) - diff --git a/sys-apps/portage/files/new/portage-unmerge b/sys-apps/portage/files/new/portage-unmerge deleted file mode 100755 index 7e2b78f835c2..000000000000 --- a/sys-apps/portage/files/new/portage-unmerge +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env /usr/lib/portage/bin/python - -import sys -import portage -import string -import os - -for x in sys.argv[1:]: - mysplit=string.split(x,"/") - portage.unmerge(mysplit[0],mysplit[1]) - diff --git a/sys-apps/portage/files/new/portage.py b/sys-apps/portage/files/new/portage.py deleted file mode 100755 index d21f5e492f94..000000000000 --- a/sys-apps/portage/files/new/portage.py +++ /dev/null @@ -1,1726 +0,0 @@ -#!/usr/bin/env python -# -# Gentoo Linux Dependency Checking Code -# Copyright 1998-2000 Daniel Robbins, Gentoo Technologies, Inc. -# Distributed under the GNU Public License -# Version 1.0 7/31/2000 -# -# Version comparison: Functionality -# -# Exactly what version numbers and letters does this versioning code -# recognize, and which tags are considered later versions than others? -# Take a look at these version number examples: -# -# 4.5 > 4.0 (you knew this one!) -# 4.0 == 4 (probably knew this one too) -# 4.0.1 < 4.0.2 -# 4.0.0.1 < 4.0.2 -# -# Build (revision) Numbers: -# -# Build (or revision) numbers can be specified along with the last digit -# in a version string, for example: -# -# 4.5b (Revision b of version 4.5, *not* 4.5 beta) -# 4.5c > 4.5b -# 1.2.3a > 1.2.3 -# 9.8.0z > 9.8 -# 9a.5b *ILLEGAL* --- Build numbers can only immediately follow the *last* -# digit in a version, so the "9a" is illegal -# -# Alpha, Beta, and Pre -# -# Functionality has been added to support alpha, beta and pre prefixes. -# They are specified by placing an underscore "_" immediately after the last -# digit, and then specifying "alpha","beta",or "pre". They are always branched -# off the last digit in a version. In addition, an optional build (revision) number -# can immediately follow an "alpha", "beta" or "pre" -# -# More examples: -# -# 4.5_pre6 > 4.5_beta6 > 4.5_alpha6 ( pre is closer to release than a beta ) -# 4.5_pre < 4.5pre1 < 4.5pre2 ( without a build number, a "0 build" is assumed ) -# 2.9_alpha > 2.8 -# 3.4beta *ILLEGAL* (no "_" betweeen last digit and "beta") -# 3.4.beta *ILLEGAL* ("beta" must immediately follow a digit and a "_") -# 3.4_beta (Correct) -# -# The versioning functionality will provide adequate support for a variety of -# numbering schemes, and will allow them to interoperate together. Of course, -# we cannot support every wacky versioning scheme. Our versioning supports -# the vast majority of packages, however. - -import string,os -from commands import * -import md5 -from stat import * -import fchksum,types -import sys -# parsever: -# This function accepts an 'inter-period chunk' such as -# "3","4","3_beta5", or "2b" and returns an array of three -# integers. "3_beta5" returns [ 3, -2, 5 ] -# These values are used to determine which package is -# newer. - -# master category list. Any new categories should be added to this list to ensure that they all categories are read -# when we check the portage directory for available ebuilds. - -categories=("app-admin", "app-arch", "app-cdr", "app-doc", "app-editors", "app-emulation", "app-games", "app-misc", - "app-office", "app-shells", "app-text", "dev-db", "dev-java", "dev-lang", "dev-libs", "dev-perl", - "dev-python", "dev-ruby", "dev-util", "gnome-apps", "gnome-base", "gnome-libs", - "gnome-office","kde-apps", "kde-base", "kde-libs", "media-gfx", "media-libs", "media-sound", "media-video", - "net-analyzer", "net-dialup", "net-fs", "net-ftp", "net-irc", "net-libs", "net-mail", "net-misc", "net-nds", - "net-print", "net-www", "packages", "sys-apps", "sys-devel", "sys-kernel", "sys-libs", "x11-base", "x11-libs", - "x11-terms", "x11-wm","virtual") - -def gen_archnames(): - "generate archive names from URL list" - myurls=os.environ["SRC_URI"] - a=string.split(myurls) - returnme="" - for x in a: - returnme=returnme+" "+string.split(x,"/")[-1] - print "A='"+returnme[1:]+"'" - -def doebuild(myebuild,mydo): - return os.system("/usr/bin/ebuild "+myebuild+" "+mydo) - -def isdev(x): - mymode=os.stat(x)[ST_MODE] - return ( S_ISCHR(mymode) or S_ISBLK(mymode)) - -def isfifo(x): - mymode=os.stat(x)[ST_MODE] - return S_ISFIFO(mymode) - -def movefile(src,dest): - """moves a file from src to dest, preserving all permissions and attributes.""" - if dest=="/bin/cp": - getstatusoutput("/bin/mv /bin/cp /bin/cp.old") - a=getstatusoutput("/bin/cp.old -a "+"'"+src+"' /bin/cp") - os.unlink("/bin/cp.old") - else: - if os.path.exists(dest): - os.unlink(dest) - a=getstatusoutput("/bin/cp -a "+"'"+src+"' '"+dest+"'") - mymode=os.lstat(src)[ST_MODE] - os.chmod(dest,mymode) - os.unlink(src) - if a[0]==0: - return 1 - else: - return 0 - -def getmtime(x): - return `os.lstat(x)[-2]` - -def md5(x): - return string.upper(fchksum.fmd5t(x)[0]) - -def prep_dbdir(): - if not os.path.isdir(root+"var"): - os.mkdir(root+"var",0755) - if not os.path.isdir(root+"var/db"): - os.mkdir(root+"var/db",0755) - if not os.path.isdir(root+"var/db/pkg"): - os.mkdir(root+"var/db/pkg",0755) - -def pathstrip(x,mystart): - cpref=os.path.commonprefix([x,mystart]) - return [root+x[len(cpref)+1:],x[len(cpref):]] - -def pkgscript(x,myebuildfile): - myresult=getstatusoutput("/usr/bin/ebuild "+myebuildfile+" "+x) - if myresult[0] or myresult[1]: - print - if myresult[0]: - print "Error code from",pkgname,x,"script --",myresult[0] - if myresult[1]: - print "Output from",myebuildfile,x,"script:" - print - print myresult[1] - -def mergefiles(outfile,mystart): - mycurpath=os.getcwd() - myfiles=os.listdir(mycurpath) - for x in myfiles: - floc=pathstrip(os.path.normpath(mycurpath+"/"+x),mystart) - if os.path.islink(x): - myto=os.readlink(x) - if os.path.exists(floc[0]): - if (not os.path.islink(floc[0])) and (os.path.isdir(floc[0])): - print "!!!",floc[0],"->",myto - else: - os.unlink(floc[0]) - try: - os.symlink(myto,floc[0]) - print "<<<",floc[0],"->",myto - outfile.write("sym "+floc[1]+" -> "+myto+" "+getmtime(floc[0])+"\n") - except: - print "!!!",floc[0],"->",myto - elif os.path.isdir(x): - mystat=os.stat(x) - if not os.path.exists(floc[0]): - os.mkdir(floc[0]) - os.chmod(floc[0],mystat[0]) - os.chown(floc[0],mystat[4],mystat[5]) - print "<<<",floc[0]+"/" - else: - print "---",floc[0]+"/" - #mtime doesn't mean much for directories -- we don't store it - outfile.write("dir "+floc[1]+"\n") - mywd=os.getcwd() - os.chdir(x) - mergefiles(outfile,mystart) - os.chdir(mywd) - elif os.path.isfile(x): - mymd5=md5(mycurpath+"/"+x) - if movefile(x,pathstrip(mycurpath,mystart)[0]+"/"+x): - zing="<<<" - else: - zing="!!!" - - print zing+" "+floc[0] - print "md5",mymd5 - outfile.write("obj "+floc[1]+" "+mymd5+" "+getmtime(floc[0])+"\n") - elif isfifo(x): - zing="!!!" - if not os.path.exists(pathstrip(mycurpath,mystart)[0]+"/"+x): - if movefile(x,pathstrip(mycurpath,mystart)[0]+"/"+x): - zing="<<<" - elif isfifo(pathstrip(mycurpath,mystart)[0]+"/"+x): - os.unlink(pathstrip(mycurpath,mystart)[0]+"/"+x) - if movefile(x,pathstrip(mycurpath,mystart)[0]+"/"+x): - zing="<<<" - print zing+" "+floc[0] - outfile.write("fif "+floc[1]+"\n") - else: - if movefile(x,pathstrip(mycurpath,mystart)[0]+"/"+x): - zing="<<<" - else: - zing="!!!" - print zing+" "+floc[0] - outfile.write("dev "+floc[1]+"\n") - -def merge(mycategory,mypackage,mystart): - mystart=os.path.normpath(mystart) - os.chdir(mystart) - print - print ">>> Merging contents of",mystart,"to "+root - print ">>> Logging merge to "+root+"var/db/pkg/"+mycategory+"/"+mypackage+"/CONTENTS" - if not os.path.exists(root): - os.makedirs(root,0700) - elif not os.path.isdir(root): - print "!!! Error: ROOT setting points to a non-directory. Exiting." - return - prep_dbdir() - if not os.path.isdir(root+"var/db/pkg/"+mycategory): - os.mkdir(root+"var/db/pkg/"+mycategory,0755) - if not os.path.isdir(root+"var/db/pkg/"+mycategory+"/"+mypackage): - os.mkdir(root+"var/db/pkg/"+mycategory+"/"+mypackage,0755) - contentsfile=root+"var/db/pkg/"+mycategory+"/"+mypackage+"/CONTENTS" - if os.path.exists(contentsfile): - os.unlink(contentsfile) - outfile=open(contentsfile,"w") - mergefiles(outfile,mystart) - outfile.close() - - #begin provides/virtual package code - mypfn=root+"var/db/pkg/"+mycategory+"/"+mypackage+"/PROVIDE" - if os.path.exists(mypfn): - #this package provides some (possibly virtual) packages - mypfile=open(mypfn,"r") - myprovides=mypfile.readlines() - mypfile.close() - for x in myprovides: - #remove trailing newline - x=x[:-1] - mypsplit=string.split(x,"/") - if len(mypsplit)!=2: - print "!!! Invalid PROVIDE string:",x - sys.exit(1) - providesdir=root+"var/db/pkg/"+x - if os.path.exists(providesdir): - #if there's a non-virtual package there, we won't overwrite it - #if it's a virtual package, we'll claim it as our own - if not os.path.exists(providesdir+"/VIRTUAL"): - #non-virtual, skip it - print ">>> Existing package",x,"is non-virtual; skipping" - continue - if not os.path.exists(providesdir): - if not os.path.exists(root+"var/db/pkg/"+mypsplit[0]): - os.mkdir(root+"var/db/pkg/"+mypsplit[0]) - os.mkdir(providesdir) - #create empty contents file - mytouch=open(providesdir+"/CONTENTS","w") - mytouch.close() - #create virtual file containing name of this package - myvirtual=open(providesdir+"/VIRTUAL","a") - myvirtual.write(mycategory+"/"+mypackage+"\n") - myvirtual.close() - #end provides/virtual package code - - print - print ">>>",mypackage,"merged." - print - -def unmerge(category,pkgname): - if os.path.isdir(os.path.normpath(root+"var/db/pkg/"+category+"/"+pkgname)): - if root=="/": - print "Unmerging",pkgname+"..." - else: - print "Unmerging",pkgname,"from",root+"..." - print - else: - print pkgname,"not installed" - return - try: - contents=open(os.path.normpath(root+"var/db/pkg/"+category+"/"+pkgname+"/CONTENTS")) - except: - print "Error -- could not open CONTENTS file for", pkgname+". Aborting." - return - - #begin virtual/provides package code - mypname=root+"var/db/pkg/"+category+"/"+pkgname+"/PROVIDE" - if os.path.exists(mypname): - mypfile=open(mypname,"r") - myprovides=mypfile.readlines() - mypfile.close() - pos=0 - for x in myprovides: - #zap trailing newline - x=x[:-1] - if len(x)==0: - continue - #zap virtual packages - if os.path.isdir(root+"var/db/pkg/"+x): - if os.path.exists(root+"var/db/pkg/"+x+"/VIRTUAL"): - #this is a virtual package, we can zap it if it contains our package name - myvirtual=open(root+"var/db/pkg/"+x+"/VIRTUAL","r") - myvpkgnames=myvirtual.readlines()[:] - newnames=[] - found=0 - pos=0 - while pos<len(myvpkgnames): - if myvpkgnames[pos][:-1] == category+"/"+pkgname: - found=1 - else: - newnames.append(myvpkgnames[pos]) - pos=pos+1 - if found==0: - print ">>> Virtual package",x,"does not appear to be registered to us, skipping." - continue - if len(newnames)==0: - os.unlink(root+"var/db/pkg/"+x+"/VIRTUAL") - zapme=os.listdir(root+"var/db/pkg/"+x) - for y in zapme: - os.unlink(root+"var/db/pkg/"+x+"/"+y) - os.rmdir(root+"var/db/pkg/"+x) - #virtual package removed - else: - myvirt=open(root+"var/db/pkg/"+x+"/VIRTUAL","w") - for y in newnames: - myvirt.write(y) - myvirt.close() - #claim on virtual package removed, virtual package kept. - else: - print ">>>",x,"(provided by",category+"/"+pkgname+") is not a virtual package, keeping." - continue - #end virtual/provides package code - - pkgfiles={} - for line in contents.readlines(): - mydat=string.split(line) - # we do this so we can remove from non-root filesystems - # (use the ROOT var to allow maintenance on other partitions) - mydat[1]=os.path.normpath(root+mydat[1][1:]) - if mydat[0]=="obj": - #format: type, mtime, md5sum - pkgfiles[string.join(mydat[1:-2]," ")]=[mydat[0], mydat[-1], mydat[-2]] - elif mydat[0]=="dir": - #format: type - pkgfiles[string.join(mydat[1:])]=[mydat[0] ] - elif mydat[0]=="sym": - #format: type, mtime, dest - x=len(mydat)-1 - splitter=-1 - while(x>=0): - if mydat[x]=="->": - splitter=x - break - x=x-1 - if splitter==-1: - #invalid symlink format - print "CONTENTS symlink error!" - return - - pkgfiles[string.join(mydat[1:splitter]," ")]=[mydat[0], mydat[-1], string.join(mydat[(splitter+1):-1]," ")] - elif mydat[0]=="dev": - #format: type - pkgfiles[string.join(mydat[1:]," ")]=[mydat[0] ] - elif mydat[0]=="fif": - #format: type - pkgfiles[string.join(mydat[1:]," ")]=[mydat[0]] - else: - print "Error -- CONTENTS file for", pkgname, "is corrupt." - print ">>> "+line - return - # we don't want to automatically remove the ebuild file listed - # in the CONTENTS file. We'll do after everything else has - # completed successfully. - myebuildfile=os.path.normpath(root+"var/db/pkg/"+category+"/"+pkgname+"/"+pkgname+".ebuild") - if os.path.exists(myebuildfile): - if pkgfiles.has_key(myebuildfile): - del pkgfiles[myebuildfile] - else: - myebuildfile=None - - mykeys=pkgfiles.keys() - mykeys.sort() - mykeys.reverse() - - #prerm script - if myebuildfile: - pkgscript("prerm",myebuildfile) - - for obj in mykeys: - obj=os.path.normpath(obj) - if not os.path.islink(obj): - #we skip this if we're dealing with a symlink - #because os.path.exists() will operate on the - #link target rather than the link itself. - if not os.path.exists(obj): - print "--- !found", pkgfiles[obj][0], obj - continue - if (pkgfiles[obj][0] not in ("dir","fif","dev")) and (getmtime(obj) != pkgfiles[obj][1]): - print "--- !mtime", pkgfiles[obj][0], obj - continue - if pkgfiles[obj][0]=="dir": - if not os.path.isdir(obj): - print "--- !dir ","dir", obj - continue - if os.listdir(obj): - print "--- !empty","dir", obj - continue - os.rmdir(obj) - print "<<< ","dir",obj - elif pkgfiles[obj][0]=="sym": - if not os.path.islink(obj): - print "--- !sym ","sym", obj - continue - mydest=os.readlink(obj) - if os.path.exists(os.path.normpath(root+mydest)): - if mydest != pkgfiles[obj][2]: - print "--- !destn","sym", obj - continue - os.unlink(obj) - print "<<< ","sym",obj - elif pkgfiles[obj][0]=="obj": - if not os.path.isfile(obj): - print "--- !obj ","obj", obj - continue - mymd5=md5(obj) - if mymd5 != string.upper(pkgfiles[obj][2]): - print "--- !md5 ","obj", obj - continue - os.unlink(obj) - print "<<< ","obj",obj - elif pkgfiles[obj][0]=="fif": - if not isfifo(obj): - print "--- !fif ","fif", obj - continue - os.unlink(obj) - print "<<< ","fif",obj - elif pkgfiles[obj][0]=="dev": - if not isdev(obj): - print "--- !dev ","dev", obj - continue - os.unlink(obj) - print "<<< ","dev",obj - - #postrm script - if myebuildfile: - pkgscript("postrm",myebuildfile) - #recursive cleanup - for thing in os.listdir(root+"var/db/pkg/"+category+"/"+pkgname): - os.unlink(root+"var/db/pkg/"+category+"/"+pkgname+"/"+thing) - os.rmdir(root+"var/db/pkg/"+category+"/"+pkgname) - print - if root=="/": - print pkgname,"unmerged." - else: - print pkgname,"unmerged from",root+"." - -def getenv(mykey): - if os.environ.has_key(mykey): - return os.environ[mykey] - return "" - -def getconfigsetting(mykey,recdepth=0): - """perform bash-like basic variable expansion, recognizing ${foo} and $bar""" - if recdepth>10: - return "" - #avoid infinite recursion - global configdefaults, cdcached - global configsettings, cscached - if configsettings.has_key(mykey): - mystring=configsettings[mykey] - elif configdefaults.has_key(mykey): - mystring=configdefaults[mykey] - else: - return "" - if (len(mystring)==0): - return "" - if mystring[0]=="'": - #single-quoted, no expansion - return mystring[1:-1] - newstring="" - pos=0 - while (pos<len(mystring)): - if mystring[pos]=='\\': - if (pos+1)>=len(mystring): - #we're at the end of the string - return "" #error - a=mystring[pos+1] - pos=pos+2 - if a=='a': - newstring=newstring+chr(007) - elif a=='b': - newstring=newstring+chr(010) - elif a=='e': - newstring=newstring+chr(033) - elif a=='f': - newstring=newstring+chr(012) - elif a=='r': - newstring=newstring+chr(015) - elif a=='t': - newstring=newstring+chr(011) - elif a=='v': - newstring=newstring+chr(013) - elif a=="'": - newstring=newstring+"'" - else: - newstring=newstring+mystring[pos-1:pos] - elif mystring[pos]=="$": - #variable expansion - if (pos+1)>=len(mystring): - #we're at the end of the string, error - return "" - if mystring[pos+1]=="{": - newpos=pos+1 - while newpos<len(mystring) and mystring[newpos]!="}": - newpos=newpos+1 - if newpos>=len(mystring): - return "" # ending } not found - varname=mystring[pos+2:newpos] - if len(varname)==0: - return "" #zero-length variable, error - newstring=newstring+getsetting(varname,recdepth+1) - pos=newpos+1 - else: - newpos=pos+1 - while newpos<len(mystring) and (mystring[newpos] not in string.whitespace): - newpos=newpos+1 - if newpos>=len(mystring): - varname=mystring[pos+1:] - else: - varname=mystring[pos+1:newpos] - pos=newpos - if len(varname)==0: - return "" #zero-length variable, error - newstring=newstring+getsetting(varname,recdepth+1) - #recurse - else: - newstring=newstring+mystring[pos] - pos=pos+1 - return newstring -def getsetting(mykey,recdepth=0): - """perform bash-like basic variable expansion, recognizing ${foo} and $bar""" - if recdepth>10: - return "" - #avoid infinite recursion - global configdefaults, cdcached - global configsettings, cscached - if os.environ.has_key(mykey): - mystring=os.environ[mykey] - elif configsettings.has_key(mykey): - mystring=configsettings[mykey] - elif configdefaults.has_key(mykey): - mystring=configdefaults[mykey] - else: - return "" - if (len(mystring)==0): - return "" - if mystring[0]=="'": - #single-quoted, no expansion - return mystring[1:-1] - newstring="" - pos=0 - while (pos<len(mystring)): - if mystring[pos]=='\\': - if (pos+1)>=len(mystring): - #we're at the end of the string - return "" #error - a=mystring[pos+1] - pos=pos+2 - if a=='a': - newstring=newstring+chr(007) - elif a=='b': - newstring=newstring+chr(010) - elif a=='e': - newstring=newstring+chr(033) - elif a=='f': - newstring=newstring+chr(012) - elif a=='r': - newstring=newstring+chr(015) - elif a=='t': - newstring=newstring+chr(011) - elif a=='v': - newstring=newstring+chr(013) - elif a=="'": - newstring=newstring+"'" - else: - newstring=newstring+mystring[pos-1:pos] - elif mystring[pos]=="$": - #variable expansion - if (pos+1)>=len(mystring): - #we're at the end of the string, error - return "" - if mystring[pos+1]=="{": - newpos=pos+1 - while newpos<len(mystring) and mystring[newpos]!="}": - newpos=newpos+1 - if newpos>=len(mystring): - return "" # ending } not found - varname=mystring[pos+2:newpos] - if len(varname)==0: - return "" #zero-length variable, error - newstring=newstring+getsetting(varname,recdepth+1) - pos=newpos+1 - else: - newpos=pos+1 - while newpos<len(mystring) and (mystring[newpos] not in string.whitespace): - newpos=newpos+1 - if newpos>=len(mystring): - varname=mystring[pos+1:] - else: - varname=mystring[pos+1:newpos] - pos=newpos - if len(varname)==0: - return "" #zero-length variable, error - newstring=newstring+getsetting(varname,recdepth+1) - #recurse - else: - newstring=newstring+mystring[pos] - pos=pos+1 - return newstring - -def getconfig(mycfg): - myconfigfile=open(mycfg,"r") - myconfiglines=myconfigfile.readlines() - myconfigfile.close() - myconfigdict={} - for x in myconfiglines: - #strip whitespace - x=string.strip(x) - #skip comment or blank line - if (len(x)==0): - continue - if (x[0]=="#"): - continue - myparts=string.split(x,"=") - if myparts<2: - continue - #invalid line, no equals sign - mykey=string.strip(myparts[0]) - myvalue=string.strip(string.join(myparts[1:],"=")) - if myvalue[0]=='"': - if myvalue[-1]=='"': - myvalue=myvalue[1:-1] - else: - continue - #no closing double-quote! - elif myvalue[0]=="'": - if myvalue[-1]=="'": - pass - else: - continue - #no closing single-quote! - if len(myvalue)>0: - myconfigdict[mykey]=myvalue - return myconfigdict - -def relparse(myver): - number=0 - p1=0 - p2=0 - mynewver=string.split(myver,"_") - if len(mynewver)==2: - #alpha,beta or pre - number=string.atof(mynewver[0]) - if "beta" == mynewver[1][:4]: - p1=-3 - try: - p2=string.atof(mynewver[1][4:]) - except: - p2=0 - elif "alpha" == mynewver[1][:5]: - p1=-4 - try: - p2=string.atof(mynewver[1][5:]) - except: - p2=0 - elif "pre" ==mynewver[1][:3]: - p1=-2 - try: - p2=string.atof(mynewver[1][3:]) - except: - p2=0 - elif "rc" ==mynewver[1][:2]: - p1=-1 - try: - p2=string.atof(mynewver[1][2:]) - except: - p2=0 - - elif "p" ==mynewver[1][:1]: - try: - p1=string.atoi(mynewver[1][1:]) - except: - p1=0 - else: - #normal number or number with letter at end - divider=len(myver)-1 - if myver[divider:] not in "1234567890": - #letter at end - p1=ord(myver[divider:]) - number=string.atof(myver[0:divider]) - else: - number=string.atof(myver) - return [number,p1,p2] - - -def revverify(myrev): - if len(myrev)==0: - return 0 - if myrev[0]=="r": - try: - string.atoi(myrev[1:]) - return 1 - except: - pass - return 0 - -#returns 1 if valid version string, else 0 -# valid string in format: <v1>.<v2>...<vx>[a-z,_{alpha,beta,pre}[vy]] -# ververify doesn't do package rev. - -def ververify(myval): - global ERRVER - ERRVER="" - myval=string.split(myval,'.') - for x in myval[1:]: - x="."+x - for x in myval[:-1]: - try: - foo=string.atof(x) - except: - ERRVER=x+" is not a valid version component." - return 0 - try: - string.atof(myval[-1]) - return 1 - except: - pass - if myval[-1][-1] in "abcdefghijklmnopqrstuvwxyz": - try: - string.atof(myval[-1][:-1]) - # if we got here, it's something like .02a - return 1 - except: - pass - splits=string.split(myval[-1],"_") - if len(splits)!=2: - #not a valid _alpha, _beta, _pre or _p, so fail - ERRVER="Too many or too few \"_\" characters." - return 0 - try: - string.atof(splits[0]) - except: - #something like .asldfkj_alpha1 which is invalid :) - ERRVER=splits[0]+" is not a valid number." - return 0 - valid=["alpha","beta","p","rc","pre"] - for x in valid: - if splits[1][0:len(x)]==x: - firpart=x - secpart=splits[1][len(x):] - ok=1 - if not ok: - ERRVER='Did not find an "alpha", "beta", "pre" or "p" after trailing "_"' - return 0 - if len(secpart)==0: - if firpart=="p": - #patchlevel requires an int - ERRVER='"p" (patchlevel) requires a trailing integer (i.e. "p3")' - return 0 - else: - #alpha, beta and pre don't require an int - return 1 - try: - string.atoi(secpart) - return 1 - #the int after the "alpha", "beta" or "pre" was ok - except: - ERRVER=secpart+" is not a valid integer." - return 0 - #invalid number! - -def isjustname(mypkg): - myparts=string.split(mypkg,'-') - for x in myparts: - if ververify(x): - return 0 - return 1 - -def isspecific(mypkg): - mysplit=string.split(mypkg,"/") - if len(mysplit)==2: - if not isjustname(mysplit[1]): - return 1 - return 0 - -# This function can be used as a package verification function, i.e. -# "pkgsplit("foo-1.2-1") will return None if foo-1.2-1 isn't a valid -# package (with version) name. If it is a valid name, pkgsplit will -# return a list containing: [ pkgname, pkgversion(norev), pkgrev ]. -# For foo-1.2-1, this list would be [ "foo", "1.2", "1" ]. For -# Mesa-3.0, this list would be [ "Mesa", "3.0", "0" ]. - -def pkgsplit(mypkg): - global ERRPKG - ERRPKG="" - myparts=string.split(mypkg,'-') - if len(myparts)<2: - ERRPKG="Not enough \"-\" characters." - return None - if revverify(myparts[-1]): - if ververify(myparts[-2]): - if len(myparts)==2: - ERRPKG="Found rev and version, but no package name." - return None - else: - for x in myparts[:-2]: - if ververify(x): - ERRPKG=x+" shouldn't look like a version part." - return None - #names can't have versiony looking parts - return [string.join(myparts[:-2],"-"),myparts[-2],myparts[-1]] - else: - ERRPKG="Found revision but "+myparts[-2]+" does not appear to be a valid version." - return None - - elif ververify(myparts[-1]): - if len(myparts)==1: - ERRPKG="Found version, but no package name." - return None - else: - for x in myparts[:-1]: - if ververify(x): - ERRPKG=x+" shouldn't look like a version part." - return None - return [string.join(myparts[:-1],"-"),myparts[-1],"r0"] - else: - ERRPKG=myparts[-1]+" doesn't appear to be a version or rev string." - return None - -def catpkgsplit(mycatpkg): - """returns [cat, pkgname, version, rev ]""" - mysplit=string.split(mycatpkg,"/") - if len(mysplit)!=2: - return None - mysplit2=pkgsplit(mysplit[1]) - if mysplit2==None: - return None - return [mysplit[0],mysplit2[0],mysplit2[1],mysplit2[2]] - -# vercmp: -# This takes two version strings and returns an integer to tell you whether -# the versions are the same, val1>val2 or val2>val1. - -def vercmp(val1,val2): - val1=string.split(val1,'-') - if len(val1)==2: - val1[0]=val1[0]+"."+val1[1] - val1=string.split(val1[0],'.') - #add back decimal point so that .03 does not become "3" ! - for x in val1[1:]: - x="."+x - val2=string.split(val2,'-') - if len(val2)==2: - val2[0]=val2[0]+"."+val2[1] - val2=string.split(val2[0],'.') - for x in val2[1:]: - x="."+x - if len(val2)<len(val1): - for x in range(0,len(val1)-len(val2)): - val2.append("0") - elif len(val1)<len(val2): - for x in range(0,len(val2)-len(val1)): - val1.append("0") - #The above code will extend version numbers out so they - #have the same number of digits. - myval1=[] - for x in range(0,len(val1)): - cmp1=relparse(val1[x]) - cmp2=relparse(val2[x]) - for y in range(0,3): - myret=cmp1[y]-cmp2[y] - if myret != 0: - return myret - return 0 - - -def pkgcmp(pkg1,pkg2): - """if returnval is less than zero, then pkg2 is newer than pkg2, zero if equal and positive if older.""" - mycmp=vercmp(pkg1[1],pkg2[1]) - if mycmp>0: - return 1 - if mycmp<0: - return -1 - r1=string.atoi(pkg1[2][1:]) - r2=string.atoi(pkg2[2][1:]) - if r1>r2: - return 1 - if r2>r1: - return -1 - return 0 - -def getgeneral(mycatpkg): - """Takes a specific catpkg and returns the general version. getgeneral("foo/bar-1.0") returns "foo/bar""" - mysplit=catpkgsplit(mycatpkg) - if not mysplit: - return None - else: - return string.join([mysplit[0],mysplit[1]],"/") - -def dep_depreduce(mypkgdep): - global inst - #installcache holds a cached dictionary containing all installed packages - if not installcache: - installcache=port_insttree() - #initialize cache - - if mypkgdep[0]=="!": - #this is an exact package match - if isinstalled(mypkgdep[1:]): - return 0 - else: - return 1 - elif mypkgdep[0]=="=": - #this is an exact package match - if isspecific(mypkgdep[1:]): - if isinstalled(mypkgdep[1:]): - return 1 - else: - return 0 - else: - return None - elif mypkgdep[0:2]==">=": - #this needs to check against multiple packages - if not isspecific(mypkgdep[2:]): - return None - if isinstalled(getgeneral(mypkgdep[2:])): - mycatpkg=catpkgsplit(mypkgdep[2:]) - mykey=mycatpkg[0]+"/"+mycatpkg[1] - if not installcache.has_key(mykey): - return 0 - for x in installcache[mykey]: - if pkgcmp(x[1][1:],mycatpkg[1:])>=0: - return 1 - return 0 - elif mypkgdep[0:2]=="<=": - #this needs to check against multiple packages - if not isspecific(mypkgdep[2:]): - return None - if isinstalled(getgeneral(mypkgdep[2:])): - mycatpkg=catpkgsplit(mypkgdep[2:]) - mykey=mycatpkg[0]+"/"+mycatpkg[1] - if not installcache.has_key(mykey): - return 0 - for x in installcache[mykey]: - if pkgcmp(x[1][1:],mycatpkg[1:])<=0: - return 1 - return 0 - elif mypkgdep[0]=="<": - #this needs to check against multiple packages - if not isspecific(mypkgdep[2:]): - return None - if isinstalled(getgeneral(mypkgdep[2:])): - mycatpkg=catpkgsplit(mypkgdep[2:]) - mykey=mycatpkg[0]+"/"+mycatpkg[1] - if not installcache.has_key(mykey): - return 0 - for x in installcache[mykey]: - if pkgcmp(x[1][1:],mycatpkg[1:])<0: - return 1 - return 0 - elif mypkgdep[0]==">": - #this needs to check against multiple packages - if not isspecific(mypkgdep[2:]): - return None - if isinstalled(getgeneral(mypkgdep[2:])): - mycatpkg=catpkgsplit(mypkgdep[2:]) - mykey=mycatpkg[0]+"/"+mycatpkg[1] - if not installcache.has_key(mykey): - return 0 - for x in installcache[mykey]: - if pkgcmp(x[1][1:],mycatpkg[1:])<0: - return 1 - return 0 - if not isspecific(mypkgdep): - if isinstalled(mypkgdep): - return 1 - else: - return 0 - else: - return None - -def dep_parenreduce(mysplit,mypos=0): - "Accepts a list of strings, and converts '(' and ')' surrounded items to sub-lists" - while (mypos<len(mysplit)): - if (mysplit[mypos]=="("): - firstpos=mypos - mypos=mypos+1 - while (mypos<len(mysplit)): - if mysplit[mypos]==")": - mysplit[firstpos:mypos+1]=[mysplit[firstpos+1:mypos]] - mypos=firstpos - break - elif mysplit[mypos]=="(": - #recurse - mysplit=dep_parenreduce(mysplit,mypos) - mypos=mypos+1 - mypos=mypos+1 - return mysplit - -def dep_opconvert(mysplit,myuse): - "Does dependency operator conversion, such as moving '||' inside a sub-list, etc." - mypos=0 - while mypos<len(mysplit): - if type(mysplit[mypos])==types.ListType: - mysplit[mypos]=dep_opconvert(mysplit[mypos],myuse) - elif mysplit[mypos]==")": - #mismatched paren, error - return None - elif mysplit[mypos]=="||": - if (mypos+1)<len(mysplit): - if type(mysplit[mypos+1])!=types.ListType: - # || must be followed by paren'd list - return None - else: - mynew=dep_opconvert(mysplit[mypos+1],myuse) - mysplit[mypos+1]=mynew - mysplit[mypos+1][0:0]=["||"] - del mysplit[mypos] - else: - #don't end a depstring with || :) - return None - elif mysplit[mypos][-1]=="?": - #uses clause, i.e "gnome? ( foo bar )" - if (mysplit[mypos][:-1]) in myuse: - #if the package is installed, just delete the conditional - del mysplit[mypos] - else: - #the package isn't installed, delete conditional and next item - del mysplit[mypos] - del mysplit[mypos] - mypos=mypos+1 - return mysplit - -def dep_wordreduce(mydeplist): - """Calls dep_depreduce() on all the items in the deplist""" - mypos=0 - deplist=mydeplist[:] - while mypos<len(deplist): - if type(deplist[mypos])==types.ListType: - #recurse - deplist[mypos]=dep_wordreduce(deplist[mypos]) - else: - if deplist[mypos]=="||": - pass - else: - mydep=dep_depreduce(deplist[mypos]) - if mydep!=None: - deplist[mypos]=mydep - else: - #encountered invalid string - return None - mypos=mypos+1 - return deplist - -def dep_eval(deplist): - if len(deplist)==0: - return 1 - if deplist[0]=="||": - #or list; we just need one "1" - for x in deplist[1:]: - if type(x)==types.ListType: - if dep_eval(x)==1: - return 1 - elif x==1: - return 1 - return 0 - else: - for x in deplist: - if type(x)==types.ListType: - if dep_eval(x)==0: - return 0 - elif x==0: - return 0 - return 1 - -def dep_catpkgstring(mypkgdep): - if mypkgdep[0]=="!": - if not pkgsplit(mypkgdep[1:]): - return "(invalid dependency)" - else: - return "unmerge "+mypkgdep[1:] - elif mypkgdep[0]=="=": - if not pkgsplit(mypkgdep[1:]): - return "(invalid dependency)" - else: - return "merge "+mypkgdep[1:] - elif mypkgdep[0:2]==">=": - if not pkgsplit(mypkgdep[2:]): - return "(invalid dependency)" - else: - return "merge "+mypkgdep[2:]+" or newer" - elif mypkgdep[0:2]=="<=": - if not pkgsplit(mypkgdep[2:]): - return "(invalid dependency)" - else: - return "merge "+mypkgdep[2:]+" or older" - elif mypkgdep[0]=="<": - mysplit=catpkgsplit(mypkgdep[1:]) - if mysplit==None: - return "(invalid dependency)" - else: - myret="merge "+string.join([mysplit[0],mysplit[1]],"/")+" older than version" - if mysplit[3]=="r0": - return myret+" "+mysplit[2] - else: - return myret+" "+mysplit[2]+"-"+mysplit[3] - elif mypkgdep[0]==">": - mysplit=catpkgsplit(mypkgdep[1:]) - if mysplit==None: - return "(invalid dependency)" - else: - myret="merge "+string.join([mysplit[0],mysplit[1]],"/")+" newer than version" - if mysplit[3]=="r0": - return myret+" "+mysplit[2] - else: - return myret+" "+mysplit[2]+"-"+mysplit[3] - elif not isspecific(mypkgdep): - mysplit=string.split(mypkgdep,"/") - if len(mysplit)!=2: - return "(invalid dependency)" - else: - return "merge any version of "+mypkgdep - else: - return "(invalid dependency)" - -def dep_print(deplist,mylevel=0): - "Prints out a deplist in a human-understandable format" - if (deplist==None) or (len(deplist)==0): - return - if deplist[0]=="||": - for x in deplist[1:]: - if type(x)==types.ListType: - dep_print(x,mylevel+1) - else: - print " "*(mylevel)+"|| "+dep_catpkgstring(x) - else: - for x in deplist: - if type(x)==types.ListType: - dep_print(x,mylevel+1) - else: - print " "*(mylevel)+"&& "+dep_catpkgstring(x) - -def dep_print_resolve(deplist): - "Prints out list of things to do" - if (deplist==None) or (len(deplist)==0): - return - if deplist[0]=="||": - for x in deplist[1:]: - if type(x)==types.ListType: - dep_print(x) - else: - print "|| "+dep_catpkgstring(x)+' ('+porttree.dep_bestmatch(x)+')' - return - else: - for x in deplist: - if type(x)==types.ListType: - dep_print_resolve(x) - else: - mymatch=porttree.dep_bestmatch(x) - if mymatch=="": - print "!! "+dep_catpkgstring(x) - return - else: - print "Best match is",mymatch - mysplit=catpkgsplit(mymatch) - myebuild=getsetting("PORTDIR")+"/"+mysplit[0]+"/"+mysplit[1]+"/"+string.split(mymatch,"/")[1]+".ebuild" - print "ebuild file is",myebuild - result=doebuild(myebuild,"merge") - if result: - #error - print "STOPPING deep merge!" - sys.exit(1) - myebuild=getsetting("PORTDIR")+"/"+getsetting("CATEGORY")+"/"+getsetting("PN")+"/"+getsetting("PF")+".ebuild" - result=doebuild(myebuild,"merge") - return result -def dep_zapdeps(unreduced,reduced): - """Takes an unreduced and reduced deplist and removes satisfied dependencies. - Returned deplist contains steps that must be taken to satisfy dependencies.""" - if unreduced[0]=="||": - if dep_eval(reduced): - #deps satisfied, return None - return None - else: - return unreduced - else: - if dep_eval(reduced): - #deps satisfied, return None - return None - else: - returnme=[] - x=0 - while x<len(reduced): - if type(reduced[x])==types.ListType: - myresult=dep_zapdeps(unreduced[x],reduced[x]) - if myresult: - returnme.append(myresult) - else: - if reduced[x]==0: - returnme.append(unreduced[x]) - x=x+1 - return returnme - -def dep_listcleanup(deplist): - "remove unnecessary clutter from deplists. Remove multiple list levels, empty lists" - newlist=[] - if (len(deplist)==1): - #remove multiple-depth lists - if (type(deplist[0])==types.ListType): - for x in deplist[0]: - if type(x)==types.ListType: - if len(x)!=0: - newlist.append(dep_listcleanup(x)) - else: - newlist.append(x) - else: - #unembed single nodes - newlist.append(deplist[0]) - else: - for x in deplist: - if type(x)==types.ListType: - if len(x)==1: - newlist.append(x[0]) - elif len(x)!=0: - newlist.append(dep_listcleanup(x)) - else: - newlist.append(x) - return newlist - -def dep_parse(depstring): - "Evaluates a dependency string" - myusesplit=string.split(getsetting("USE")) - mysplit=string.split(depstring) - #convert parenthesis to sublists - mysplit=dep_parenreduce(mysplit) - #mysplit can't be None here, so we don't need to check - mysplit=dep_opconvert(mysplit,myusesplit) - #if mysplit==None, then we have a parse error (paren mismatch or misplaced ||) - if mysplit==None: - return [0,"Parse Error (parenthesis mismatch or || abuse?)"] - mysplit2=mysplit[:] - mysplit2=dep_wordreduce(mysplit2) - if mysplit2==None: - return [0,"Invalid token"] - myeval=dep_eval(mysplit2) - if myeval: - return [1,None] - else: - return [1,dep_listcleanup(dep_zapdeps(mysplit,mysplit2))] - -def merge_check(mycatpkg): - if roottree.exists_specific(mycatpkg): - return 1 - return 0 - -def dep_frontend(mytype,depstring): - """shell frontend for dependency system""" - if depstring=="": - print ">>> No",mytype,"dependencies." - return 0 - if mytype=="build": - myparse=localtree.depcheck(depstring) - elif mytype=="runtime": - myparse=roottree.depcheck(depstring) - else: - print "!!! Error: dependency type",mytype,"not recognized. Exiting." - sys.exit(1) - if myparse[0]==0: - #error - print '!!! '+mytype+' dependency error:',myparse[1] - return 1 - elif myparse[1]==None: - print '>>> '+mytype+' dependencies OK ;)' - return 0 - else: - print '!!! Some '+mytype+' dependencies must be satisfied:' - print - dep_print(myparse[1]) - print - dep_print_resolve(myparse[1]) - return 1 - -def port_currtree(): - """ - This function builds a dictionary of current (recommended) packages on the system, - based on the contents of CURRENTFILE. Dictionary format is: - mydict["cat/pkg"]=[ - ["cat/fullpkgname",["cat","pkg","ver","rev"] - ["cat/fullpkgname",["cat","pkg","ver2","rev2"] - ] - """ - currentdict={} - currentfile=getsetting("CURRENTFILE") - if not os.path.isfile(currentfile): - return - mycurrent=open(currentfile,"r") - mylines=mycurrent.readlines() - for x in mylines: - if x[:2]!="./": - continue - myline=string.split(string.strip(x)[2:-7],"/") - if len(myline)!=3: - continue - fullpkg=string.join([myline[0],myline[2]],"/") - mysplit=catpkgsplit(fullpkg) - mykey=mysplit[0]+"/"+mysplit[1] - if not currentdict.has_key(mykey): - currentdict[mykey]=[] - currentdict[mykey].append([fullpkg,mysplit]) - mycurrent.close() - return currentdict - - -def port_insttree(): - """ - This function builds a dictionary of installed packages on the system, based on - the contents of /var/db/pkg Dictionary format is: - mydict["cat/pkg"]=[ - ["cat/fullpkgname",["cat","pkg","ver","rev"] - ["cat/fullpkgname",["cat","pkg","ver2","rev2"] - ] - """ - installeddict={} - dbdir="/var/db/pkg" - prep_dbdir() - origdir=os.getcwd() - os.chdir(dbdir) - for x in os.listdir(os.getcwd()): - if not os.path.isdir(os.getcwd()+"/"+x): - continue - for y in os.listdir(os.getcwd()+"/"+x): - if x=="virtual": - #virtual packages don't require versions, if none is found, add a "1.0" to the end - if isjustname(y): - fullpkg=x+"/"+y+"-1.0" - else: - fullpkg=x+"/"+y - else: - fullpkg=x+"/"+y - mysplit=catpkgsplit(fullpkg) - mykey=x+"/"+mysplit[1] - if not installeddict.has_key(mykey): - installeddict[mykey]=[] - installeddict[mykey].append([fullpkg,mysplit]) - os.chdir(origdir) - return installeddict - -def port_porttree(): - """ - This function builds a dictionary of available ebuilds in the portage tree. - Dictionary format is: - mydict["cat/pkg"]=[ - ["cat/fullpkgname",["cat","pkg","ver","rev"] - ["cat/fullpkgname",["cat","pkg","ver2","rev2"] - ] - """ - portagedict={} - mydir=getsetting("PORTDIR") - if not os.path.isdir(mydir): - return - origdir=os.getcwd() - os.chdir(mydir) - for x in categories: - if not os.path.isdir(os.getcwd()+"/"+x): - continue - for y in os.listdir(os.getcwd()+"/"+x): - if not os.path.isdir(os.getcwd()+"/"+x+"/"+y): - continue - if y=="CVS": - continue - for mypkg in os.listdir(os.getcwd()+"/"+x+"/"+y): - if mypkg[-7:] != ".ebuild": - continue - mypkg=mypkg[:-7] - mykey=x+"/"+y - fullpkg=x+"/"+mypkg - if not portagedict.has_key(mykey): - portagedict[mykey]=[] - portagedict[mykey].append([fullpkg,catpkgsplit(fullpkg)]) - os.chdir(origdir) - return portagedict - -class packagetree: - def __init__(self): - self.tree={} - self.populated=0 - def populate(self): - "populates the tree with values" - populated=1 - pass - def exists_specific(self,catpkg): - if not self.populated: - self.populate() - "this function tells you whether or not a specific package is installed" - cpsplit=catpkgsplit(catpkg) - if cpsplit==None: - return None - if not self.tree.has_key(cpsplit[0]+"/"+cpsplit[1]): - return 0 - for x in self.tree[cpsplit[0]+"/"+cpsplit[1]]: - if x[0]==catpkg: - return 1 - return 0 - def exists_node(self,nodename): - if not self.populated: - self.populate() - if self.tree.has_key(nodename): - return 1 - return 0 - def getnodes(self,nodename): - if not self.populated: - self.populate() - if self.tree.has_key(nodename): - return self.tree[nodename] - return [] - def depcheck(self,depstring): - "evaluates a dependency string and returns a 2-node result list" - if not self.populated: - self.populate() - myusesplit=string.split(getsetting("USE")) - mysplit=string.split(depstring) - #convert parenthesis to sublists - mysplit=dep_parenreduce(mysplit) - #mysplit can't be None here, so we don't need to check - mysplit=dep_opconvert(mysplit,myusesplit) - #if mysplit==None, then we have a parse error (paren mismatch or misplaced ||) - #up until here, we haven't needed to look at the database tree - - if mysplit==None: - return [0,"Parse Error (parenthesis mismatch or || abuse?)"] - elif mysplit==[]: - #dependencies were reduced to nothing - return [1,None] - mysplit2=mysplit[:] - mysplit2=self.dep_wordreduce(mysplit2) - if mysplit2==None: - return [0,"Invalid token"] - myeval=dep_eval(mysplit2) - if myeval: - return [1,None] - else: - return [1,dep_listcleanup(dep_zapdeps(mysplit,mysplit2))] - def dep_wordreduce(self,mydeplist): - """Calls dep_depreduce() on all the items in the deplist""" - mypos=0 - deplist=mydeplist[:] - while mypos<len(deplist): - if type(deplist[mypos])==types.ListType: - #recurse - deplist[mypos]=self.dep_wordreduce(deplist[mypos]) - else: - if deplist[mypos]=="||": - pass - else: - mydep=self.dep_depreduce(deplist[mypos]) - if mydep!=None: - deplist[mypos]=mydep - else: - #encountered invalid string - return None - mypos=mypos+1 - return deplist - def dep_depreduce(self,mypkgdep): - if mypkgdep[0]=="!": - # !cat/pkg-v - if self.exists_specific(mypkgdep[1:]): - return 0 - else: - return 1 - elif mypkgdep[0]=="=": - # =cat/pkg-v - return self.exists_specific(mypkgdep[1:]) - elif (mypkgdep[0]=="<") or (mypkgdep[0]==">"): - # >=cat/pkg-v or <=,>,< - if mypkgdep[1]=="=": - cmpstr=mypkgdep[0:2] - cpv=mypkgdep[2:] - else: - cmpstr=mypkgdep[0] - cpv=mypkgdep[1:] - if not isspecific(cpv): - return None - if self.exists_node(getgeneral(cpv)): - mycatpkg=catpkgsplit(cpv) - mykey=mycatpkg[0]+"/"+mycatpkg[1] - if not self.exists_node(mykey): - return 0 - for x in self.getnodes(mykey): - if eval("pkgcmp(x[1][1:],mycatpkg[1:])"+cmpstr+"0"): - return 1 - return 0 - if not isspecific(mypkgdep): - # cat/pkg - if self.exists_node(mypkgdep): - return 1 - else: - return 0 - else: - return None - def dep_bestmatch(self,mypkgdep): - """ - returns best match for mypkgdep in the tree. Accepts - a single depstring, such as ">foo/bar-1.0" and finds - the most recent version of foo/bar that satisfies the - dependency and returns it, i.e: "foo/bar-1.3". Works - for >,<,>=,<=,=,and general deps. Don't call with a ! - dep, since there is no good match for a ! dep. - """ - if (mypkgdep[0]=="="): - if self.exists_specific(mypkgdep[1:]): - return mypkgdep[1:] - else: - return "" - elif (mypkgdep[0]==">") or (mypkgdep[0]=="<"): - if mypkgdep[1]=="=": - cmpstr=mypkgdep[0:2] - cpv=mypkgdep[2:] - else: - cmpstr=mypkgdep[0] - cpv=mypkgdep[1:] - if not isspecific(cpv): - return "" - mycatpkg=catpkgsplit(cpv) - mykey=mycatpkg[0]+"/"+mycatpkg[1] - if not self.exists_node(mykey): - return "" - mynodes=[] - for x in self.getnodes(mykey): - if eval("pkgcmp(x[1][1:],mycatpkg[1:])"+cmpstr+"0"): - mynodes.append(x) - #now we have a list of all nodes that qualify - if len(mynodes)==0: - return "" - bestmatch=mynodes[0] - for x in mynodes[1:]: - if pkgcmp(x[1][1:],bestmatch[1][1:])>0: - bestmatch=x - return bestmatch[0] - elif not isspecific(mypkgdep): - if not self.exists_node(mypkgdep): - return "" - mynodes=self.getnodes(mypkgdep)[:] - if len(mynodes)==0: - return "" - bestmatch=mynodes[0] - for x in mynodes[1:]: - if pkgcmp(x[1][1:],bestmatch[1][1:])>0: - bestmatch=x - return bestmatch[0] - -class vartree(packagetree): - "this tree will scan a var/db/pkg database located at root (passed to init)" - def __init__(self,root): - self.root=root - packagetree.__init__(self) - def populate(self): - "populates the local tree (/var/db/pkg)" - if not os.path.isdir(self.root+"var"): - os.mkdir(self.root+"var",0755) - if not os.path.isdir(self.root+"var/db"): - os.mkdir(self.root+"var/db",0755) - if not os.path.isdir(self.root+"var/db/pkg"): - os.mkdir(self.root+"var/db/pkg",0755) - dbdir=self.root+"var/db/pkg" - origdir=os.getcwd() - os.chdir(dbdir) - for x in os.listdir(os.getcwd()): - if not os.path.isdir(os.getcwd()+"/"+x): - continue - for y in os.listdir(os.getcwd()+"/"+x): - if x=="virtual": - #virtual packages don't require versions, if none is found, add a "1.0" to the end - if isjustname(y): - fullpkg=x+"/"+y+"-1.0" - else: - fullpkg=x+"/"+y - else: - fullpkg=x+"/"+y - mysplit=catpkgsplit(fullpkg) - mykey=x+"/"+mysplit[1] - if not self.tree.has_key(mykey): - self.tree[mykey]=[] - self.tree[mykey].append([fullpkg,mysplit]) - os.chdir(origdir) - self.populated=1 - -class portagetree(packagetree): - "this tree will scan a portage directory located at root (passed to init)" - def __init__(self,root): - self.root=root - packagetree.__init__(self) - def populate(self): - "populates the port tree" - origdir=os.getcwd() - os.chdir(self.root) - for x in categories: - if not os.path.isdir(os.getcwd()+"/"+x): - continue - for y in os.listdir(os.getcwd()+"/"+x): - if not os.path.isdir(os.getcwd()+"/"+x+"/"+y): - continue - if y=="CVS": - continue - for mypkg in os.listdir(os.getcwd()+"/"+x+"/"+y): - if mypkg[-7:] != ".ebuild": - continue - mypkg=mypkg[:-7] - mykey=x+"/"+y - fullpkg=x+"/"+mypkg - if not self.tree.has_key(mykey): - self.tree[mykey]=[] - self.tree[mykey].append([fullpkg,catpkgsplit(fullpkg)]) - os.chdir(origdir) - self.populated=1 - def getdeps(self,pf): - "returns list of dependencies, if any" - if not self.populated: - self.populate() - if self.exists_specific(pf): - mysplit=catpkgsplit(pf) - mydepfile=self.root+"/"+mysplit[0]+"/"+mysplit[1]+"/files/depend-"+string.split(pf,"/")[1] - if os.path.exists(mydepfile): - myd=open(mydepfile,"r") - mydeps=myd.readlines() - myd.close() - returnme="" - for x in mydeps: - returnme=returnme+" "+x[:-1] - return returnme - return "" - -class currenttree(packagetree): - "this tree will scan a current package file located at root (passed to init)" - def __init__(self,root): - self.root=root - packagetree.__init__(self) - def populate(self): - "populates the current tree" - mycurrent=open(self.root,"r") - mylines=mycurrent.readlines() - for x in mylines: - if x[:2]!="./": - continue - myline=string.split(string.strip(x)[2:-7],"/") - if len(myline)!=3: - continue - fullpkg=string.join([myline[0],myline[2]],"/") - mysplit=catpkgsplit(fullpkg) - mykey=mysplit[0]+"/"+mysplit[1] - if not self.tree.has_key(mykey): - self.tree[mykey]=[] - self.tree[mykey].append([fullpkg,mysplit]) - mycurrent.close() - self.populated=1 - -def depgrab(myfilename,depmark): - """ - Will grab the dependency string from an ebuild file, using - depmark as a marker (normally DEPEND or RDEPEND) - """ - depstring="" - myfile=open(myfilename,"r") - mylines=myfile.readlines() - myfile.close() - pos=0 - while (pos<len(mylines)): - if mylines[pos][0:len(depmark)]==depmark: - depstart=string.split(mylines[pos][len(depmark):],'"') - if len(depstart)==3: - depstring=depstart[1] - return string.join(string.split(depstring)," ") - elif len(depstart)==2: - depstring=depstart[1]+" " - pos=pos+1 - while 1: - mysplit=string.split(mylines[pos],'"') - depstring=depstring+mysplit[0]+" " - if len(mysplit)>1: - return string.join(string.split(depstring)," ") - pos=pos+1 - else: - pos=pos+1 - return string.join(string.split(depstring)," ") - -def init(): - global root, ERRPKG, ERRVER, configdefaults, configsettings, currtree, roottree, localtree, porttree - configdefaults=getconfig("/etc/make.defaults") - configsettings=getconfig("/etc/make.conf") - root=getsetting("ROOT") - if len(root)==0: - root="/" - elif root[-1]!="/": - root=root+"/" - if root != "/": - if not os.path.exists(root[:-1]): - print "!!! Error: ROOT",root,"does not exist. Please correct this." - print "!!! Exiting." - print - sys.exit(1) - elif not os.path.isdir(root[:-1]): - print "!!! Error: ROOT",root[:-1],"is not a directory. Please correct this." - print "!!! Exiting." - print - sys.exit(1) - #packages installed locally (for build dependencies) - localtree=vartree("/") - if root=="/": - #root is local, and build dep database is the runtime dep database - roottree=localtree - else: - #root is non-local, initialize non-local database as roottree - roottree=vartree(root) - porttree=portagetree(getsetting("PORTDIR")) - currtree=currenttree(getsetting("CURRENTFILE")) - #package database is now initialized and ready, cap'n! - ERRPKG="" - ERRVER="" - installcache=None -init() diff --git a/sys-apps/portage/files/new/prepall b/sys-apps/portage/files/new/prepall deleted file mode 100755 index 7a32290f050a..000000000000 --- a/sys-apps/portage/files/new/prepall +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh - -prepallman -prepallinfo -prepallstrip - -# Move aclocals - -for i in `find ${D} -name "aclocal" -type d` -do - if [ "$i" != "" ] - then - if [ "$i" != "${D}usr/share/aclocal" ] - then - echo $i - install -d ${D}usr/share/aclocal - mv ${i}/* ${D}usr/share/aclocal - rm -fr ${i} - fi - fi -done - - diff --git a/sys-apps/portage/files/new/prepalldocs b/sys-apps/portage/files/new/prepalldocs deleted file mode 100755 index 7daedf6aaeb1..000000000000 --- a/sys-apps/portage/files/new/prepalldocs +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -z=`find ${D}/usr/doc -not -name "*.gz" -not -name "*.js"` - -for y in ${z} -do - if [ -h ${y} ] - then - #symlink - linkto=`ls -l ${y} | sed -e "s:${D}::" | awk '{ printf ("%s.gz",$11) } '` - echo "$linkto $y.gz" - ln -sf ${linkto} ${y}.gz - rm ${y} - else - if [ -f ${y} ] - then - gzip -f -9 ${y} - fi - fi -done - - - diff --git a/sys-apps/portage/files/new/prepallinfo b/sys-apps/portage/files/new/prepallinfo deleted file mode 100755 index 3b9cf959150e..000000000000 --- a/sys-apps/portage/files/new/prepallinfo +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -z=`find ${D} -name "info" -type d` -echo "info:" -for x in ${z} -do - rm -f ${x}/dir - w=`echo ${x}/*.info*` - if [ "${w}" != "${x}"'/*.info*' ] - then - for y in ${w} - do - if [ -h ${y} ] - then - #symlink - linkto=`ls -l ${y} | sed -e "s:${D}::" | awk '{ printf ("%s.gz",$11) } '` - echo "$linkto $y.gz" - ln -sf ${linkto} ${y}.gz - rm ${y} - else - echo ${y} - gzip -f -9 ${y} - fi - done - fi -done - - - diff --git a/sys-apps/portage/files/new/prepallman b/sys-apps/portage/files/new/prepallman deleted file mode 100755 index 7fbdf1c9bd1e..000000000000 --- a/sys-apps/portage/files/new/prepallman +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -z=`find ${D} -name "man?" -type d` -echo "man:" -for x in ${z} -do - w=`echo ${x}/*.?` - if [ "${w}" != "${x}"'/*.?' ] - then - for y in ${w} - do - if [ -h ${y} ] - then - #symlink - linkto=`ls -l ${y} | sed -e "s:${D}::" | awk '{ printf ("%s.gz",$11) } '` - echo "$linkto $y.gz" - ln -sf ${linkto} ${y}.gz - rm ${y} - else - gzip -f -9 ${y} - echo ${y} - fi - done - fi -done - - - diff --git a/sys-apps/portage/files/new/prepallstrip b/sys-apps/portage/files/new/prepallstrip deleted file mode 100755 index 02e165dea862..000000000000 --- a/sys-apps/portage/files/new/prepallstrip +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash - - -if [ -n "${DEBUG}" ] -then - exit -fi -echo "strip:" -z=`find ${D} -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 -or -name "*.so" -or -name "*.so.*" \)` - -for x in $z -do - f=`file $x` - if [ "${f/*LSB executable*/1}" == "1" ] - then - echo $x - strip ${x} - fi - if [ "${f/*LSB shared object*/1}" == "1" ] - then - echo $x - strip --strip-unneeded ${x} - fi -done - - - - - - - - - - - - diff --git a/sys-apps/portage/files/new/prepinfo b/sys-apps/portage/files/new/prepinfo deleted file mode 100755 index c7d1bf80270b..000000000000 --- a/sys-apps/portage/files/new/prepinfo +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -if [ -z "$1" ] -then - rm -f ${D}usr/info/dir - gzip -9 ${D}usr/info/* -else - rm -f ${D}$1/info/dir - gzip -9 ${D}$1/info/* -fi - diff --git a/sys-apps/portage/files/new/preplib b/sys-apps/portage/files/new/preplib deleted file mode 100755 index 4ea0b221f133..000000000000 --- a/sys-apps/portage/files/new/preplib +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -if [ -z "$1" ] -then - z=${D}usr/lib -else - z=${D}$1/lib -fi - -ldconfig -n -N ${z} - - - diff --git a/sys-apps/portage/files/new/preplib.so b/sys-apps/portage/files/new/preplib.so deleted file mode 100755 index 896c7c089697..000000000000 --- a/sys-apps/portage/files/new/preplib.so +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -if [ -n "${DEBUG}" ] -then - exit -fi -for x in $@ -do - strip --strip-unneeded ${D}${x}/*.so* -done - diff --git a/sys-apps/portage/files/new/prepman b/sys-apps/portage/files/new/prepman deleted file mode 100755 index 4e71c87c59aa..000000000000 --- a/sys-apps/portage/files/new/prepman +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -if [ -z "$1" ] -then - z=${D}usr/man -else - z=${D}$1/man -fi - -for x in ${z}/* -do - for y in ${x}/* - do - if [ -h ${y} ] - then - #symlink - linkto=`ls -l ${y} | sed -e "s:${D}::" | awk '{ printf ("%s.gz",$11) } '` - echo "$linkto $y.gz" - ln -sf ${linkto} ${y}.gz - rm ${y} - else - gzip -f -9 ${y} - fi - done -done - - - diff --git a/sys-apps/portage/files/new/prepstrip b/sys-apps/portage/files/new/prepstrip deleted file mode 100755 index b4db5c1cd52d..000000000000 --- a/sys-apps/portage/files/new/prepstrip +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash -if [ -n "${DEBUG}" ] -then - exit -fi -for x in $@ -do - strip ${D}${x}/* -done
\ No newline at end of file diff --git a/sys-apps/portage/files/new/unpack b/sys-apps/portage/files/new/unpack deleted file mode 100755 index aad1ad8623c8..000000000000 --- a/sys-apps/portage/files/new/unpack +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -for x in "$@" -do - echo ">>> Unpacking ${x}" - case "${x##*.}" in - gz|tgz|Z|z) - tar xzf ${DISTDIR}/${x} - ;; - bz2|tbz2) - cat ${DISTDIR}/${x} | bzip2 -d | tar xf - - ;; - ZIP|zip) - unzip ${DISTDIR}/${x} - ;; - *) - echo '!!!'" Error: couldn't unpack ${x}: file format not recognized" - exit 1 - ;; - esac -done diff --git a/sys-apps/portage/files/new/use b/sys-apps/portage/files/new/use deleted file mode 100755 index 1df40a762382..000000000000 --- a/sys-apps/portage/files/new/use +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/lib/portage/bin/python -import string -import portage -import sys - -myuse=portage.getsetting("USE") -myuse=string.split(myuse) -for x in myuse: - if x==sys.argv[1]: - print x - sys.exit(0) -sys.exit(1) diff --git a/sys-apps/portage/files/newbin/dodoc b/sys-apps/portage/files/newbin/dodoc deleted file mode 100755 index 8453066eefb7..000000000000 --- a/sys-apps/portage/files/newbin/dodoc +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -for x in "$@" -do -if [ -e ${x} ] -then - if [ ! -d ${D}usr/share/doc/${PF} ] - then - install -d ${D}usr/share/doc/${PF} - fi - if [ -z ${DOCDESTTREE} ] - then - install -m0644 ${x} ${D}usr/share/doc/${PF} - gzip -9 ${D}usr/share/doc/${PF}/${x##*/} - else - install -m0644 ${x} ${D}usr/share/doc/${PF}/${DOCDESTTREE} - gzip -9 ${D}usr/share/doc/${PF}/${DOCDESTTREE}/${x##*/} - fi -else - echo "${0}: ${x} does not exist." - fi -done - diff --git a/sys-apps/portage/files/newbin/doinfo b/sys-apps/portage/files/newbin/doinfo deleted file mode 100755 index ae3ce736abd1..000000000000 --- a/sys-apps/portage/files/newbin/doinfo +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -if [ ${#} -lt 1 ] -then - echo "doinfo: at least one argument needed" - return -fi -if [ ! -d ${D}usr/share/info ] -then - install -d ${D}usr/share/info -fi -for x in "$@" -do - if [ -e ${x} ] - then - install -m0644 ${x} ${D}usr/share/info - gzip -9 ${D}usr/share/info/${x##*/} - else - echo "doinfo: ${x} does not exist" - fi -done - diff --git a/sys-apps/portage/files/newbin/doman b/sys-apps/portage/files/newbin/doman deleted file mode 100755 index 15b805194e08..000000000000 --- a/sys-apps/portage/files/newbin/doman +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -if [ ${#} -lt 1 ] -then - echo "${0}: at least one argument needed" - return -fi -myloc=$DESTTREE -if [ "$myloc" = "" ] -then - myloc=/usr -fi -for x in "$@" -do - md=${x##*.} - mandir=man${md:0:1} - if [ -e ${x} ] - then - if [ ! -d ${D}${myloc}/share/man/${mandir} ] - then - install -d ${D}${myloc}/share/man/${mandir} - fi - install -m0644 ${x} ${D}${myloc}/share/man/${mandir} - gzip -9 ${D}${myloc}/share/man/${mandir}/${x##*/} - else - echo "doman: ${x} does not exist." - fi -done diff --git a/sys-apps/portage/files/newbin/ebuild b/sys-apps/portage/files/newbin/ebuild deleted file mode 100755 index 9341878739c2..000000000000 --- a/sys-apps/portage/files/newbin/ebuild +++ /dev/null @@ -1,931 +0,0 @@ -#!/bin/bash -# Copyright 1999-2000 Daniel Robbins, Gentoo Technologies, Inc. -# Distributed under the GPL - -if [ "`whoami`" != "root" ] -then - echo "Since ebuild can modify critical system files, only root is" - echo "allowed to use the ebuild system." - exit 1 -fi - -#allow any envvars to be set like QTDIR, even if Qt was just installed -export PATH=/usr/lib/portage/bin:${PATH} -eval `import-settings PROXY HTTP_PROXY FTP_PROXY DEBUG MAKEOPTS MAINTAINER CHOST CFLAGS CXXFLAGS PORTDIR DISTDIR BUILD_PREFIX PKGDIR RPMDIR PLATFORM ROOT` -eval `import-configsettings FETCHCOMMAND PACKAGE USE GENTOO_MIRRORS PLATFORM` -source /etc/rc.d/config/functions - -initvars() { - export DESTTREE=/usr - export INSDESTTREE="" - export EXEDESTTREE="" - export DOCDESTTREE="" - export INSOPTIONS="-m0644" - export EXEOPTIONS="-m0755" - export LIBOPTIONS="-m0644" - export DIROPTIONS="-m0755" - export MOPREFIX=${PN} - export KVERS=`uname -r` -} - -initvars - -src_unpack() { - unpack ${A} -} - -src_compile() { - return -} - -src_install() - { - return - } - -pkg_preinst() - { - return - } - -pkg_postinst() - { - return - } - -pkg_prerm() - { - return - } - -pkg_postrm() - { - return - } - -try() { - eval $* - if [ $? -ne 0 ] - then - echo - echo '!!! '"ERROR: the $1 command did not complete successfully." - echo '!!! '"(\"$*\")" - echo '!!! '"Since this is a critical task, ebuild will be stopped." - echo - exit 1 - fi -} - -dyn_touch() { - local x - for x in ${A} - do - if [ -e ${DISTDIR}/${x} ] - then - touch ${DISTDIR}/${x} - fi - done -} - -dyn_digest() { - local x - if [ ! -d ${FILESDIR} ] - then - install -d ${FILESDIR} - if [ -n ${MAINTAINER} ] - then - echo ">>> adding ${FILESDIR} to CVS (just in case it isn't there)" - ( echo; cd `/usr/bin/dirname ${FILESDIR}`; cvs add `/usr/bin/basename ${FILESDIR}`; echo) - fi - fi - for x in ${A} - do - if [ ! -e ${DISTDIR}/${x} ] - then - echo '!!! Cannot compute message digests: '${x} not found - echo "error, aborting." - exit 1 - else - mymd5=`md5sum ${DISTDIR}/${x} | cut -f1 -d" "` - echo "MD5 $mymd5 $x" >> ${FILESDIR}/.digest-${PF} - fi - done - mv ${FILESDIR}/.digest-${PF} ${FILESDIR}/digest-${PF} - if [ -n "${MAINTAINER}" ] - then - echo ">>> adding digest-${PF} to CVS (just in case it isn't there)" - ( echo; cd ${FILESDIR}; cvs add digest-${PF}; echo ) - fi - echo ">>> Computed message digests." -} - -runtime_depend() { - #the echo thing is a trick to get rid of newlines - dopython portage.dep_frontend runtime "`echo ${RDEPEND}`" - if [ $? -ne 0 ] - then - exit 1 - fi -} - -build_depend() { - #the echo thing is a trick to get rid of newlines - dopython portage.dep_frontend build "`echo ${DEPEND}`" - if [ $? -ne 0 ] - then - exit 1 - fi -} - -gen_depend() { - for x in $DEPEND - do - echo "$x" >> ${FILESDIR}/depend-${PF} - done - for x in $RDEPEND - do - echo "$x" >> ${FILESDIR}/rdepend-${PF} - done - echo ">>> Completed generating dependencies for ${PF}." -} - -merge_check() { - dopython portage.merge_check "${CATEGORY}/${PF}" - if [ $? -ne 0 ] - then - echo - echo '!!!' "${PF} already merged in ${ROOT} -- unmerge first" - echo - exit 1 - fi -} - -digest_check() { - if [ ! -e ${FILESDIR}/digest-${PF} ] - then - echo '!!!'" No message digest file found." - if [ -n "$MAINTAINER" ] - then - echo '>>> Maintainer mode: auto-computing digests.' - dyn_digest - return 0 - else - echo '!!!'" Maintainer: ebuild digest to update message digests." - return 1 - fi - fi - if [ ! -e ${DISTDIR}/${1} ] - then - echo '!!!'" ${1} not found." - echo '!!!'" Ebuild fetch to retrieve files." - return 1 - fi - local mycdigest=`grep " ${1}" ${FILESDIR}/digest-${PF} | cut -f2 -d" "` - if [ -z "$mycdigest" ] - then - echo - echo '!!!'" No message digest found for ${1}." - if [ -n "$MAINTAINER" ] - then - echo '>>> Maintainer mode: auto-computing digests.' - dyn_digest - echo - return 0 - else - echo '!!!'" Maintainer: ebuild digest to update message digests." - echo - return 1 - fi - fi - local mydigest=`md5sum ${DISTDIR}/${1} | cut -f1 -d" "` - if [ "$mycdigest" != "$mydigest" ] - then - echo - echo '!!!'" ${1}: message digests do not match!" - echo '!!!'" ${1} is corrupt or incomplete" - echo ">>> md5 con ${mycdigest}" - echo ">>> md5 now ${mydigest}" - echo ">>> Please delete/redownload ${DISTDIR}/${1}" - echo - return 1 - else - echo ">>> md5 ;-) ${1}" - fi - return 0 -} - -dyn_batchdigest() { - local x - if [ ! -e ${FILESDIR}/digest-${PF} ] - then - if [ "${A}" != "" ] - then - echo "${CATEGORY}/${PF} has no digest file." - fi - exit 1 - fi - for x in ${A} - do - if [ ! -e ${DISTDIR}/${x} ] - then - echo "${CATEGORY}/${PF}:${x} does not exist in ${DISTDIR}." - continue - else - local mycdigest=`grep " ${x}" ${FILESDIR}/digest-${PF} | cut -f2 -d" "` - if [ -z "$mycdigest" ] - then - echo "${CATEGORY}/${PF}:${x} digest not yet recorded." - continue - fi - local mydigest=`md5sum ${DISTDIR}/${x} | cut -f1 -d" "` - if [ "$mycdigest" != "$mydigest" ] - then - echo "${CATEGORY}/${PF}:${x} is corrupt or has an invalid digest." - fi - fi - done -} - - -dyn_fetch() { - local y - for y in ${A} - do - if [ ! -e ${DISTDIR}/${y} ] - then - echo ">>> Fetching ${y}..." - echo - local x - local _SRC_URI - for x in ${GENTOO_MIRRORS} - do - _SRC_URI="${_SRC_URI} ${x}/distributions/gentoo/gentoo-sources/${y}" - done - _SRC_URI="${_SRC_URI} `/usr/bin/queryhost.sh "${SRC_URI}"`" - for x in ${_SRC_URI} - do - if [ ! -e ${DISTDIR}/${y} ] - then - if [ $y == ${x##*/} ] - then - echo ">>> Trying site ${x}..." - eval "${FETCHCOMMAND}" - if [ $? -ne 0 ] - then - echo '!!!'" Couldn't download ${y}." - fi - fi - fi - done - if [ ! -e ${DISTDIR}/${y} ] - then - echo '!!!'" Couldn't download ${y}. Aborting." - exit 1 - fi - echo - fi - done - for y in ${A} - do - digest_check ${y} - if [ $? -ne 0 ] - then - exit 1 - fi - done -} - -dyn_unpack() { - trap "abort_unpack" SIGINT SIGQUIT - local unpackwork="yes" - if [ -e ${WORKDIR} ] - then - local x - for x in $A $EBUILD - do - echo ">>> Checking ${x}'s mtime..." - if [ ${DISTDIR}/${x} -nt ${WORKDIR} ] - then - echo ">>> ${x} has been updated; recreating WORKDIR..." - rm -rf ${WORKDIR} - break - fi - done - echo ">>> WORKDIR is up-to-date, not unpacking. (clean to force unpack)" - unpackwork="no" - fi - if [ "$unpackwork" = "yes" ] - then - install -m0700 -d ${WORKDIR} - cd ${WORKDIR} - echo ">>> Unpacking source..." - src_unpack - echo ">>> Source unpacked." - cd .. - fi - trap SIGINT SIGQUIT -} - -dyn_clean() { - if [ -d ${WORKDIR} ] - then - rm -rf ${WORKDIR} - fi - if [ -d ${BUILDDIR}/image ] - then - rm -rf ${BUILDDIR}/image - fi - rm -rf ${BUILDDIR}/.compiled -} - -into() { - if [ $1 = "/" ] - then - export DESTTREE="" - else - export DESTTREE=$1 - if [ ! -d ${D}${DESTTREE} ] - then - install -d ${D}${DESTTREE} - fi - fi -} - -insinto() { - if [ $1 = "/" ] - then - export INSDESTTREE="" - else - export INSDESTTREE=$1 - if [ ! -d ${D}${INSDESTTREE} ] - then - install -d ${D}${INSDESTTREE} - fi - fi -} - -exeinto() { - if [ $1 = "/" ] - then - export EXEDESTTREE="" - else - export EXEDESTTREE=$1 - if [ ! -d ${D}${EXEDESTTREE} ] - then - install -d ${D}${EXEDESTTREE} - fi - fi -} -docinto() { - if [ $1 = "/" ] - then - export DOCDESTTREE="" - else - export DOCDESTTREE=$1 - if [ ! -d ${D}usr/share/doc/${PF}/${DOCDESTTREE} ] - then - install -d ${D}usr/share/doc/${PF}/${DOCDESTTREE} - fi - fi -} - -insopts() { - INSOPTIONS="" - for x in $* - do - #if we have a debug build, let's not strip anything - if [ -n "$DEBUG" ] && [ "$x" = "-s" ] - then - continue - else - INSOPTIONS="$INSOPTIONS $x" - fi - done - export INSOPTIONS -} - -diropts() { - DIROPTIONS="" - for x in $* - do - DIROPTIONS="${DIROPTIONS} $x" - done - export DIROPTIONS -} - -exeopts() { - EXEOPTIONS="" - for x in $* - do - #if we have a debug build, let's not strip anything - if [ -n "$DEBUG" ] && [ "$x" = "-s" ] - then - continue - else - EXEOPTIONS="$EXEOPTIONS $x" - fi - done - export EXEOPTIONS -} - -libopts() { - LIBOPTIONS="" - for x in $* - do - #if we have a debug build, let's not strip anything - if [ -n "$DEBUG" ] && [ "$x" = "-s" ] - then - continue - else - LIBOPTIONS="$LIBOPTIONS $x" - fi - done - export LIBOPTIONS -} - -abort_compile() { - echo - echo '*** Compilation Aborted ***' - echo - cd ${BUILDDIR} #original dir - rm -f .compiled - trap SIGINT SIGQUIT - exit 1 -} - -abort_unpack() { - echo - echo '*** Unpack Aborted ***' - echo - cd ${BUILDDIR} #original dir - rm -f .unpacked - rm -rf work - trap SIGINT SIGQUIT - exit 1 -} - -abort_package() { - echo - echo '*** Packaging Aborted ***' - echo - cd ${BUILDDIR} #original dir - rm -f .packaged - rm -f ${PKGDIR}/All/${PF}.t* - trap SIGINT SIGQUIT - exit 1 -} - -abort_image() { - echo - echo '*** Imaging Aborted ***' - echo - cd ${BUILDDIR} #original dir - rm -rf image - trap SIGINT SIGQUIT - exit 1 -} - -dyn_compile() { - trap "abort_compile" SIGINT SIGQUIT - export CFLAGS CXXFLAGS LIBCFLAGS LIBCXXFLAGS - if [ ${BUILDDIR}/.compiled -nt ${WORKDIR} ] - then - echo ">>> It appears that ${PN} is already compiled. skipping." - echo ">>> (clean to force compilation)" - trap SIGINT SIGQUIT - return - fi - if [ -d ${S} ] - then - cd ${S} - fi - src_compile - cd ${BUILDDIR} - touch .compiled - trap SIGINT SIGQUIT -} - -dyn_package() { - trap "abort_package" SIGINT SIGQUIT - local PNAME=${PF}.${PACKAGE} - cd ${BUILDDIR}/image - echo ">>> Creating ${PNAME} in ${PKGDIR}/All..." - if [ "$PACKAGE" = "tbz2" ] - then - tar cvf ${PKGDIR}/All/${PF}.tar * - bzip2 ${PKGDIR}/All/${PF}.tar - mv ${PKGDIR}/All/${PF}.tar.bz2 ${PKGDIR}/All/${PNAME} - elif [ "$PACKAGE" = "tgz" ] - then - tar czvf ${PKGDIR}/All/${PNAME} * - else - echo '!!! Package format '${PACKAGE}' not recognized. Please correct /etc/make.conf' - exit 1 - fi - ln -sf ${PKGDIR}/All/${PNAME} ${PKGDIR}/${CATEGORY}/${PNAME} - echo ">>> Done." - cd ${BUILDDIR} - touch .packaged - trap SIGINT SIGQUIT -} - -dyn_install() { - local ROOT - trap "abort_image" SIGINT SIGQUIT - rm -rf ${BUILDDIR}/image - mkdir ${BUILDDIR}/image - if [ -d ${S} ] - then - cd ${S} - fi - echo - echo ">>> Install ${PF} into ${D} category ${CATEGORY}" - src_install - prepall - install -d -m0700 ${D}var/db/pkg/${CATEGORY}/${PF} - cp ${EBUILD} ${D}var/db/pkg/${CATEGORY}/${PF} - local x - #create provides database - for x in $PROVIDE - do - echo "$x" >> ${D}var/db/pkg/${CATEGORY}/${PF}/PROVIDE - done - for x in $DEPEND - do - echo "$x" >> ${D}/var/db/pkg/${CATEGORY}/${PF}/DEPEND - done - for x in $RDEPEND - do - echo "$x" >> ${D}/var/db/pkg/${CATEGORY}/${PF}/RDEPEND - done - echo ">>> Completed installing into ${D}" - echo - cd ${BUILDDIR} - trap SIGINT SIGQUIT -} - -dyn_merge() { - trap "" SIGINT SIGQUIT - pkg_preinst - #/usr/sbin/portage-merge - dopython portage.merge "$CATEGORY" "$PF" "$D" - cd ${BUILDDIR} - #zap it so that people don't look at a bad image and get confused - rm -rf image - pkg_postinst - trap SIGINT SIGQUIT -} - -dyn_unmerge() { - trap "" SIGINT SIGQUIT - #/usr/sbin/portage-unmerge ${PF} - dopython portage.unmerge "$CATEGORY" "$PF" - trap SIGINT_SIGQUIT -} - - -dyn_spec() { - tar czf /usr/src/redhat/SOURCES/${PF}.tar.gz ${O}/${PF}.ebuild ${O}/files - - cat <<__END1__ > ${PF}.spec -Summary: ${DESCRIPTION} -Name: ${PN} -Version: ${PV} -Release: ${PR} -Copyright: GPL -Group: portage/${CATEGORY} -Source: ${PF}.tar.gz -Buildroot: ${D} -%description -${DESCRIPTION} - -${HOMEPAGE} - -%prep -%setup -c - -%build - -%install - -%clean - -%files -/ -__END1__ - -} -dyn_rpm () { - dyn_spec - rpm -bb ${PF}.spec - - install -D /usr/src/redhat/RPMS/i386/${PN}-${PV}-${PR}.i386.rpm ${RPMDIR}/${CATEGORY}/${PN}-${PV}-${PR}.rpm -} - -dyn_help() { - echo - echo "Portage" - echo "Copyright 2000 Gentoo Technologies, Inc." - echo - echo "How to use the ebuild command:" - echo - echo "The first argument to ebuild should be an existing .ebuild file." - echo - echo "One or more of the following options can then be specified. If more" - echo "than one option is specified, each will be executed in order." - echo - echo " check : test if all dependencies get resolved" - echo " fetch : download source archive(s) and patches" - echo " unpack : unpack/patch sources (auto-fetch if needed)" - echo " compile : compile sources (auto-fetch/unpack if needed)" - echo " merge : merge image into live filesystem, recording files in db" - echo " remerge : forces merge even if the package is installed" - echo " (auto-fetch/unpack/compile if needed)" - echo " unmerge : remove package from live filesystem" - echo " package : create tarball package of type ${PACKAGE}" - echo " (will be stored in ${PKGDIR}/All)" - echo " clean : clean up all source and temporary files" - echo - echo "The following settings will be used for the ebuild process:" - echo - echo " package : ${PF}" - echo " category : ${CATEGORY}" - echo " description : ${DESCRIPTION}" - echo " system : ${CHOST}" - echo " c flags : ${CFLAGS}" - echo " c++ flags : ${CXXFLAGS}" - echo " make flags : ${MAKEOPTS}" - echo -n " build mode : " - if [ -n "${DEBUG}" ] - then - echo "debug (large)" - else - echo "production (stripped)" - fi - echo " merge to : ${ROOT}" - echo " db location : ${ROOT}var/db/pkg/${CATEGORY}/${P}/CONTENTS" - echo - if [ -n "$USE" ] - then - echo "Additionally, support for the following toolkits will be enabled if necessary:" - echo - echo " ${USE}" - fi - echo -} - -src_menu() { - MYDIR=${BUILDDIR} - local MYfoo - for MYfoo in "$@" - do - case "${MYfoo}" in - noop) - ;; - unpack) - dyn_fetch - dyn_unpack - ;; - compile) - build_depend - dyn_fetch - dyn_unpack - dyn_compile - ;; - prerm|postrm|preinst|postinst|config) - pkg_${MYfoo} - ;; - help|batchdigest|touch|clean|fetch|digest|pkginfo|pkgloc|unmerge|install) - dyn_${MYfoo} - ;; - check) - # Exit with 1 if there are unresolved dependencies - build_depend - ;; - package) - build_depend - dyn_fetch - local PNAME=${PF}.${PACKAGE} - if [ ! -d ${PKGDIR} ] - then - install -d ${PKGDIR} - fi - if [ ! -d ${PKGDIR}/All ] - then - install -d ${PKGDIR}/All - fi - if [ ! -d ${PKGDIR}/${CATEGORY} ] - then - install -d ${PKGDIR}/${CATEGORY} - fi - if [ -e ${PKGDIR}/All/${PNAME} ] - then - if [ ! -d ${PKGDIR}/${CATEGORY}/${PNAME} ] - then - ln -sf ${PKGDIR}/All/${PNAME} ${PKGDIR}/${CATEGORY}/${PNAME} - fi - local x - local dopackage - dopackage="no" - for x in ${A} ${EBUILD} - do - if [ ${x} -nt ${PKGDIR}/All/${PNAME} ] - then - dopackage="yes" - break - fi - done - if [ "$dopackage" = "no" ] - then - echo - echo ">>> Package ${PNAME} appears to be up-to-date." - echo ">>> To force rebuild, touch ${EBUILD}." - echo - continue - fi - fi - dyn_unpack - dyn_compile - dyn_install - dyn_package - ;; - - remerge) - #this is meant to merge over an existing version even if it exists - build_depend - dyn_fetch - dyn_unpack - dyn_compile - dyn_install - dyn_merge - runtime_depend - ;; - qmerge) - #this means to run only dyn_merge - dyn_merge - ;; - merge) - #merge makes sure the package isn't already merged first - merge_check - build_depend - dyn_fetch - dyn_unpack - dyn_compile - dyn_install - dyn_merge - runtime_depend - ;; - gendeps) - #create DEPEND and RDEPEND files in the same directory as the .ebuild file - #this is used for the auto dependency resolving features of ebuild - gen_depend - ;; - rpm) - build_depend - dyn_fetch - dyn_unpack - dyn_compile - dyn_install - dyn_rpm - ;; - *) - echo "Please specify a valid command." - echo - dyn_help - esac - done - cd $MYDIR -} - -#dummy value for help printouts -P=packagename - -if [ $# -lt 1 ] -then - echo - echo '!!!' "At least two arguments expected." - dyn_help - exit 1 -fi - -if [ ! -e ${1} ] -then - echo - echo '!!!' "${1} not found." - dyn_help - exit 1 -fi - -# this function sets various environment variables that are used by -# portage. For a package called "foo-1.2-r1", they would be set as -# follows: -# P=foo-1.2 -# PF=foo-1.2-r1 (r1 is the rev, or release of the ebuild script) -# PN=foo -# PV=1.2 -# PR=1 (rev is zero if unspecified) - -setp() { - if [ $# -ne 3 ] - then - echo '!!!' ${P} is not a valid package name. Exiting. - exit 1 - fi - if [ "${3}" = "0" ] - then - export PF="${1}-${2}" - else - export PF="${1}-${2}-r${3}" - fi - export P="${1}-${2}" - export PN="${1}" - export PV="${2}" - export PR="${3}" -} - -export STARTDIR=`pwd` - -if [ "${1:0:1}" = "/" ] -then - export O=`dirname ${1}` -else - tmpfoo=`dirname ${1}` - export O=`( cd ${tmpfoo}; pwd )` -fi -tmpfoo=`(cd ${O}/..;pwd)` -export CATEGORY=`/usr/bin/basename $tmpfoo` -export EBUILD=${O}/`basename ${1}` -export PEBUILD=${O}/files/${PLATFORM}.ebuild -export FILESDIR=${O}/files - -tmpfoo=`/usr/bin/basename ${1%.*}` -setp `/usr/sbin/pkgname ${tmpfoo}` - -#if [ $# -le 3 ] -#then -# dyn_help -# exit 1 -#fi - -#source ${1} -#if [ -e ${PEBUILD} ] -#then -# source ${PEBUILD} -#fi - -if [ ! -z ${BUILD_PREFIX} ] -then - export BUILDDIR=${BUILD_PREFIX}/${PF} -else - export BUILDDIR=${O} -fi -if [ ! -d ${BUILDDIR} ] -then - install -d ${BUILDDIR} -fi - -export T=${BUILDDIR}/temp -if [ ! -d ${T} ] -then - install -d ${T} -fi -export WORKDIR=${BUILDDIR}/work -export D=${BUILDDIR}/image -dlen=$(( ${#D} -1 )) -if [ "${D:${dlen}:1}" != "/" ] -then - export D=${D}/ -fi - -source ${1} -if [ -e ${PEBUILD} ] -then - source ${PEBUILD} -fi - -#set up dependency variables correctly... -if [ "$RDEPEND" = "" ] -then - RDEPEND="$DEPEND" -fi - -#auto-generate ${A} based on ${SRC_URI} if ${A} isn't defined... -if [ "${A}" = "" ] -then - export SRC_URI - eval `dopython portage.gen_archnames` -fi - -foo=2 -while [ $foo -le $# ] -do -eval "src_menu \${${foo}}" -if [ $? -ne 0 ] -then - echo "***error***" - exit 1 -fi -foo=$(( $foo + 1)) -done - - diff --git a/sys-apps/portage/files/newbin/prepalldocs b/sys-apps/portage/files/newbin/prepalldocs deleted file mode 100755 index b2ccc490709e..000000000000 --- a/sys-apps/portage/files/newbin/prepalldocs +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -z=`find ${D}/usr/share/doc -not -name "*.gz" -not -name "*.js"` - -for y in ${z} -do - if [ -h ${y} ] - then - #symlink - linkto=`ls -l ${y} | sed -e "s:${D}::" | awk '{ printf ("%s.gz",$11) } '` - echo "$linkto $y.gz" - ln -sf ${linkto} ${y}.gz - rm ${y} - else - if [ -f ${y} ] - then - gzip -f -9 ${y} - fi - fi -done - - - diff --git a/sys-apps/portage/files/newbin/prepman b/sys-apps/portage/files/newbin/prepman deleted file mode 100755 index 4e71c87c59aa..000000000000 --- a/sys-apps/portage/files/newbin/prepman +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -if [ -z "$1" ] -then - z=${D}usr/man -else - z=${D}$1/man -fi - -for x in ${z}/* -do - for y in ${x}/* - do - if [ -h ${y} ] - then - #symlink - linkto=`ls -l ${y} | sed -e "s:${D}::" | awk '{ printf ("%s.gz",$11) } '` - echo "$linkto $y.gz" - ln -sf ${linkto} ${y}.gz - rm ${y} - else - gzip -f -9 ${y} - fi - done -done - - - diff --git a/sys-apps/portage/files/pkgdepend-test b/sys-apps/portage/files/pkgdepend-test deleted file mode 100755 index e4e459d1251b..000000000000 --- a/sys-apps/portage/files/pkgdepend-test +++ /dev/null @@ -1,117 +0,0 @@ -#!/usr/bin/env python - -from portage import * -#import dbtools - -def testsame(my1,my2): - print my1,"and",my2,"have", - a=pkgsame(my1,my2) - if a: - print "the same package name" - else: - print "different package names" - -testsame("Mesa-3.02b","Mesa-6") -testsame("foob-3.212.9_alpha","foob") -testsame("foob-3.212.9_alpha","fo0ob") - -# Test driver code: -# Play around with it to get the feel of how it works - -def testcmp(my1,my2): - a=vercmp(my1,my2) - print my1, - if a==0: - print "=", - elif a<0: - print "<", - else: - print ">", - print my2 - -testcmp("3.1","3.2") -testcmp("3.2","3.1") -testcmp("3.2","3.2a") -testcmp("3.1_alpha6","3.2") -testcmp("3.2_alpha","3.1") -testcmp("3.3.2","3.2a") -testcmp("3.1","3.1.0.2") -testcmp("3.1","3.1_pre") -testcmp("3.1_alpha1","3.1_alpha2") - -def testver(myv): - print "Is",myv,"valid?", - if ververify(myv): - print "Yes" - else: - print "No" - -testver("foo") -testver("4foo") -testver("4foo4") -testver("4foo4.4") -testver("4.b") -testver("3.4") -testver("3.4b") -testver("3.4_alpha1") -testver("1.2.3.6.70.3.4_beta10") -testver("1_alpha") -testver("2_pre50") -testver("3.4_") -testver("3.4ba") -testver("3.4_alpha1a") -testver("1.2.3.6.70.3.4__beta10") -testver("1alpha") -testver("2._pre50") - -def ver_expsplit(dep): - #fields: [ notflag, pkgname, equalflag, less/greaterthanflag ] - if dep[0:2]==">=": - return [0,dep[2:],1,1] - if dep[0:2]=="<=": - return [0,dep[2:],1,-1] - if dep[0]==">": - return [0,dep[1:],0,1] - if dep[0]=="<": - return [0,dep[1:],0,-1] - if dep[0]=="!": - return [1,dep[1:]] - #equal condition - return [0,dep,1,0] - -print pkg("Mesa-3.0_beta6") -print ver("Mesa-3.0_beta6") - -""" - -def ver_dbcmp(cmp): - a=ver_expsplit(cmp) - newver=ver(a[1]) - newpkg=pkg(a[1]) - if not dbtools.pkgexists(newpkg): - return a[0] - print "package found" - if newver=="": - return not a[0] - oldver=dbtools.pkgversion(newpkg) - mycmp=vercmp(oldver,newver) - print "oldver mycmp",oldver,mycmp - if a[0]==1: - if mycmp==0: - return 0 - else: - return 1 - if mycmp==0: - return a[2] - elif mycmp<0: - if a[3]<0: - return 1 - else: - return 0 - else: - if a[3]>0: - return 1 - else: - return 0 - -""" diff --git a/sys-apps/portage/files/pkgname b/sys-apps/portage/files/pkgname deleted file mode 100755 index 9f0dc4dff006..000000000000 --- a/sys-apps/portage/files/pkgname +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/spython - -import portage -import sys - -a=portage.pkgsplit(sys.argv[1]) -if a: - print a[0],a[1],a[2][1:] - sys.exit(0) -else: - sys.stderr.write(portage.ERRVER+"\n") - sys.stderr.write(portage.ERRPKG+"\n") - sys.exit(1) diff --git a/sys-apps/portage/files/portage-maintain b/sys-apps/portage/files/portage-maintain deleted file mode 100755 index f2801e0dd364..000000000000 --- a/sys-apps/portage/files/portage-maintain +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/spython - -import os -import portage -import string -import sys - -installeddict=portage.port_insttree() -currentdict=portage.port_currtree() -portagedict=portage.port_porttree() - -for mypkg in installeddict.keys(): - #if there is one installed version, and one recommended version, and they both - #are the same version, don't list the package. This package is up-to-date. - if (len(installeddict[mypkg])==1) and currentdict.has_key(mypkg): - if len(currentdict[mypkg])==1: - if portage.pkgcmp(currentdict[mypkg][0][1][1:],installeddict[mypkg][0][1][1:])==0: - continue - print "Package",mypkg - print "Installed version(s):" - for inspkg in installeddict[mypkg]: - print " ",inspkg[0] - # print available portage versions, labelling one as the recommended version - print "Available versions:" - if portagedict.has_key(mypkg): - for curpkg in portagedict[mypkg]: - print " ",curpkg[0] - else: - print " ","(none)" - print "Recommended version:" - if currentdict.has_key(mypkg): - for curpkg in currentdict[mypkg]: - print " ",curpkg[0] - else: - print " ","(none)" - print - -print "System (important) packages not installed:" -print -for x in currentdict.keys(): - if currentdict[x][0][1][0][0:4]=="sys-": - #required package - if not installeddict.has_key(x): - print x -print diff --git a/sys-apps/portage/files/portage-merge b/sys-apps/portage/files/portage-merge deleted file mode 100755 index 926561e2a456..000000000000 --- a/sys-apps/portage/files/portage-merge +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/spython - -import portage,os - -portage.merge(os.environ["CATEGORY"],os.environ["PF"],os.path.normpath(os.environ["D"])) - diff --git a/sys-apps/portage/files/portage-unmerge b/sys-apps/portage/files/portage-unmerge deleted file mode 100755 index 89859eb91c9d..000000000000 --- a/sys-apps/portage/files/portage-unmerge +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/spython - -import sys -import portage -import string -import os - -for x in sys.argv[1:]: - mysplit=string.split(x,"/") - portage.unmerge(mysplit[0],mysplit[1]) - diff --git a/sys-apps/portage/files/portage.py b/sys-apps/portage/files/portage.py deleted file mode 100644 index c8350c4cc964..000000000000 --- a/sys-apps/portage/files/portage.py +++ /dev/null @@ -1,1903 +0,0 @@ -#!/usr/bin/env python -# -# Gentoo Linux Dependency Checking Code -# Copyright 1998-2000 Daniel Robbins, Gentoo Technologies, Inc. -# Distributed under the GNU Public License -# Version 1.0 7/31/2000 -# -# Version comparison: Functionality -# -# Exactly what version numbers and letters does this versioning code -# recognize, and which tags are considered later versions than others? -# Take a look at these version number examples: -# -# 4.5 > 4.0 (you knew this one!) -# 4.0 == 4 (probably knew this one too) -# 4.0.1 < 4.0.2 -# 4.0.0.1 < 4.0.2 -# -# Build (revision) Numbers: -# -# Build (or revision) numbers can be specified along with the last digit -# in a version string, for example: -# -# 4.5b (Revision b of version 4.5, *not* 4.5 beta) -# 4.5c > 4.5b -# 1.2.3a > 1.2.3 -# 9.8.0z > 9.8 -# 9a.5b *ILLEGAL* --- Build numbers can only immediately follow the *last* -# digit in a version, so the "9a" is illegal -# -# Alpha, Beta, and Pre -# -# Functionality has been added to support alpha, beta and pre prefixes. -# They are specified by placing an underscore "_" immediately after the last -# digit, and then specifying "alpha","beta",or "pre". They are always branched -# off the last digit in a version. In addition, an optional build (revision) number -# can immediately follow an "alpha", "beta" or "pre" -# -# More examples: -# -# 4.5_pre6 > 4.5_beta6 > 4.5_alpha6 ( pre is closer to release than a beta ) -# 4.5_pre < 4.5pre1 < 4.5pre2 ( without a build number, a "0 build" is assumed ) -# 2.9_alpha > 2.8 -# 3.4beta *ILLEGAL* (no "_" betweeen last digit and "beta") -# 3.4.beta *ILLEGAL* ("beta" must immediately follow a digit and a "_") -# 3.4_beta (Correct) -# -# The versioning functionality will provide adequate support for a variety of -# numbering schemes, and will allow them to interoperate together. Of course, -# we cannot support every wacky versioning scheme. Our versioning supports -# the vast majority of packages, however. - -import string,os -from commands import * -from stat import * -import fchksum,types -import sys -import shlex -import shutil - -# parsever: -# This function accepts an 'inter-period chunk' such as -# "3","4","3_beta5", or "2b" and returns an array of three -# integers. "3_beta5" returns [ 3, -2, 5 ] -# These values are used to determine which package is -# newer. - -# master category list. Any new categories should be added to this list to ensure that they all categories are read -# when we check the portage directory for available ebuilds. - -categories=("app-admin", "app-arch", "app-cdr", "app-doc", "app-editors", "app-emulation", "app-games", "app-misc", - "app-office", "app-shells", "app-text", "dev-db", "dev-java", "dev-lang", "dev-libs", "dev-perl", - "dev-python", "dev-ruby", "dev-util", "gnome-apps", "gnome-base", "gnome-libs", - "gnome-office","kde-apps", "kde-base", "kde-libs", "media-gfx", "media-libs", "media-sound", "media-video", - "net-analyzer", "net-dialup", "net-fs", "net-ftp", "net-irc", "net-libs", "net-mail", "net-misc", "net-nds", - "net-print", "net-www", "packages", "sys-apps", "sys-devel", "sys-kernel", "sys-libs", "x11-base", "x11-libs", - "x11-terms", "x11-wm","virtual","x11-misc") - -#parse /etc/env.d and generate /etc/profile.env - -def env_update(): - global root - fns=os.listdir(root+"etc/env.d") - fns.sort() - pos=0 - while (pos<len(fns)): - if fns[pos]<=2: - del fns[pos] - continue - if (fns[pos][0] not in string.digits) or (fns[pos][1] not in string.digits): - del fns[pos] - continue - pos=pos+1 - - specials={"PATH":[],"CLASSPATH":[],"LDPATH":[],"MANPATH":[],"INFODIR":[],"ROOTPATH":[]} - env={} - - for x in fns: - myconfig=configfile(root+"etc/env.d/"+x) - # process PATH, CLASSPATH, LDPATH - for myspec in specials.keys(): - if myconfig.has_key(myspec): - if myspec=="LDPATH": - specials[myspec].extend(string.split(myconfig.get_key(myspec),":")) - else: - specials[myspec].append(myconfig.get_key(myspec)) - myconfig.del_key(myspec) - # process all other variables - for myenv in myconfig.all_keys(): - env[myenv]=myconfig.get_key(myenv) - - if os.path.exists(root+"etc/ld.so.conf"): - myld=open(root+"etc/ld.so.conf") - myldlines=myld.readlines() - myld.close() - oldld=[] - for x in myldlines: - #each line has at least one char (a newline) - if x[0]=="#": - continue - oldld.append(x[:-1]) - oldld.sort() - # os.rename(root+"etc/ld.so.conf",root+"etc/ld.so.conf.bak") - # Where is the new ld.so.conf generated? (achim) - else: - oldld=None - specials["LDPATH"].sort() - if (oldld!=specials["LDPATH"]): - #ld.so.conf needs updating and ldconfig needs to be run - newld=open(root+"etc/ld.so.conf","w") - newld.write("# ld.so.conf autogenerated by env-update; make all changes to\n") - newld.write("# contents of /etc/env.d directory\n") - for x in specials["LDPATH"]: - newld.write(x+"\n") - newld.close() - #run ldconfig here - print ">>> Regenerating "+root+"etc/ld.so.cache..." - getstatusoutput("/sbin/ldconfig -r "+root) - del specials["LDPATH"] - - outfile=open(root+"/etc/profile.env","w") - - for path in specials.keys(): - if len(specials[path])==0: - continue - outstring="export "+path+"='" - for x in specials[path][:-1]: - outstring=outstring+x+":" - outstring=outstring+specials[path][-1]+"'" - outfile.write(outstring+"\n") - #get it out of the way - del specials[path] - - #create /etc/profile.env - for x in env.keys(): - if type(env[x])!=types.StringType: - continue - outfile.write("export "+x+"='"+env[x]+"'\n") - outfile.close() - - #need to add cshrc support - -#new configfile reading code using shlex -class configfile: - def __init__(self,cfgfile): - self.keys={} - self.filename=cfgfile - f=open(cfgfile,'r') - lex=shlex.shlex(f) - lex.wordchars=string.digits+string.letters+"~!@#$%*_\:;?,./-+{}" - lex.quotes="\"'" - while 1: - key=lex.get_token() - if (key==''): - #normal end of file - break; - equ=lex.get_token() - if (equ==''): - #unexpected end of file - #lex.error_leader(self.filename,lex.lineno) - print "!!! Unexpected end of config file: variable",key - return None - elif (equ!='='): - #invalid token - #lex.error_leader(self.filename,lex.lineno) - print "!!! Invalid token (not \"=\")",equ - return None - val=lex.get_token() - if (val==''): - #unexpected end of file - #lex.error_leader(self.filename,lex.lineno) - print "!!! Unexpected end of config file: variable",key - return None - self.keys[key]=val - def get_key(self,mykey): - if self.keys.has_key(mykey): - return self.keys[mykey] - else: - return "" - def has_key(self,mykey): - return self.keys.has_key(mykey) - def set_key(self,mykey,myval): - self.keys[mykey]=myval - def del_key(self,mykey): - if self.keys.has_key(mykey): - del self.keys[mykey] - def all_keys(self): - return self.keys.keys() - -def var_expand(mystring,dictlist=[]): - """ - new variable expansion code. Removes quotes, handles \n, etc, and - will soon use the dictlist to expand ${variable} references. - This code will be used by the configfile code, as well as others (parser) - This would be a good bunch of code to port to C. - """ - mystring=" "+mystring - #in single, double quotes - insing=0 - indoub=0 - pos=1 - newstring="" - while (pos<len(mystring)): - if (mystring[pos]=="'") and (mystring[pos-1]!="\\"): - if (indoub): - newstring=newstring+"'" - else: - insing=not insing - pos=pos+1 - continue - elif (mystring[pos]=='"') and (mystring[pos-1]!="\\"): - if (insing): - newstring=newstring+'"' - else: - indoub=not indoub - pos=pos+1 - continue - if (not insing): - #expansion time - if (mystring[pos]=="\\"): - #backslash expansion time - if (pos+1>=len(mystring)): - newstring=newstring+mystring[pos] - break - else: - a=mystring[pos+1] - pos=pos+2 - if a=='a': - newstring=newstring+chr(007) - elif a=='b': - newstring=newstring+chr(010) - elif a=='e': - newstring=newstring+chr(033) - elif (a=='f') or (a=='n'): - newstring=newstring+chr(012) - elif a=='r': - newstring=newstring+chr(015) - elif a=='t': - newstring=newstring+chr(011) - elif a=='v': - newstring=newstring+chr(013) - else: - #remove backslash only, as bash does: this takes care of \\ and \' and \" as well - newstring=newstring+mystring[pos-1:pos] - continue - else: - newstring=newstring+mystring[pos] - pos=pos+1 - else: - newstring=newstring+mystring[pos] - pos=pos+1 - return newstring - -def gen_archnames(): - "generate archive names from URL list" - myurls=getenv("SRC_URI") - a=string.split(myurls) - returnme="" - for x in a: - returnme=returnme+" "+string.split(x,"/")[-1] - print "A='"+returnme[1:]+"'" - -def doebuild(myebuild,mydo): - return os.system("/usr/bin/ebuild "+myebuild+" "+mydo) - -def isdev(x): - mymode=os.stat(x)[ST_MODE] - return ( S_ISCHR(mymode) or S_ISBLK(mymode)) - -def isfifo(x): - mymode=os.stat(x)[ST_MODE] - return S_ISFIFO(mymode) - -def movefile(src,dest): - """moves a file from src to dest, preserving all permissions and attributes.""" - if dest=="/bin/cp": - getstatusoutput("/bin/mv /bin/cp /bin/cp.old") - a=getstatusoutput("/bin/cp.old -a "+"'"+src+"' /bin/cp") - os.unlink("/bin/cp.old") - elif dest=="/bin/bash": - a=getstatusoutput("rm /bin/bash; /bin/cp -a "+"'"+src+"' '"+dest+"'") - else: - a=getstatusoutput("/bin/cp -af "+"'"+src+"' '"+dest+"'") -# cp -a takes care of this -# mymode=os.lstat(src)[ST_MODE] -# os.chmod(dest,mymode) - os.unlink(src) - if a[0]==0: - return 1 - else: - return 0 - -def getmtime(x): - return `os.lstat(x)[-2]` - -def md5(x): - return string.upper(fchksum.fmd5t(x)[0]) - -def prep_dbdir(): - if not os.path.isdir(root+"var"): - os.mkdir(root+"var",0755) - if not os.path.isdir(root+"var/db"): - os.mkdir(root+"var/db",0755) - if not os.path.isdir(root+"var/db/pkg"): - os.mkdir(root+"var/db/pkg",0755) - -def pathstrip(x,mystart): - cpref=os.path.commonprefix([x,mystart]) - return [root+x[len(cpref)+1:],x[len(cpref):]] - -def pkgscript(x,myebuildfile): - myresult=getstatusoutput("/usr/bin/ebuild "+myebuildfile+" "+x) - if myresult[0] or myresult[1]: - print - if myresult[0]: - print "Error code from",pkgname,x,"script --",myresult[0] - if myresult[1]: - print "Output from",myebuildfile,x,"script:" - print - print myresult[1] - -def mergefiles(outfile,mystart): - mycurpath=os.getcwd() - myfiles=os.listdir(mycurpath) - for x in myfiles: - floc=pathstrip(os.path.normpath(mycurpath+"/"+x),mystart) - if os.path.islink(x): - myto=os.readlink(x) - if os.path.exists(floc[0]): - if (not os.path.islink(floc[0])) and (os.path.isdir(floc[0])): - print "!!!",floc[0],"->",myto - else: - os.unlink(floc[0]) - try: - os.symlink(myto,floc[0]) - print "<<<",floc[0],"->",myto - outfile.write("sym "+floc[1]+" -> "+myto+" "+getmtime(floc[0])+"\n") - except: - print "!!!",floc[0],"->",myto - elif os.path.isdir(x): - mystat=os.stat(x) - if not os.path.exists(floc[0]): - os.mkdir(floc[0]) - os.chmod(floc[0],mystat[0]) - os.chown(floc[0],mystat[4],mystat[5]) - print "<<<",floc[0]+"/" - else: - print "---",floc[0]+"/" - #mtime doesn't mean much for directories -- we don't store it - outfile.write("dir "+floc[1]+"\n") - mywd=os.getcwd() - os.chdir(x) - mergefiles(outfile,mystart) - os.chdir(mywd) - elif os.path.isfile(x): - mymd5=md5(mycurpath+"/"+x) - if movefile(x,pathstrip(mycurpath,mystart)[0]+"/"+x): - zing="<<<" - else: - zing="!!!" - - print zing+" "+floc[0] - print "md5",mymd5 - outfile.write("obj "+floc[1]+" "+mymd5+" "+getmtime(floc[0])+"\n") - elif isfifo(x): - zing="!!!" - if not os.path.exists(pathstrip(mycurpath,mystart)[0]+"/"+x): - if movefile(x,pathstrip(mycurpath,mystart)[0]+"/"+x): - zing="<<<" - elif isfifo(pathstrip(mycurpath,mystart)[0]+"/"+x): - os.unlink(pathstrip(mycurpath,mystart)[0]+"/"+x) - if movefile(x,pathstrip(mycurpath,mystart)[0]+"/"+x): - zing="<<<" - print zing+" "+floc[0] - outfile.write("fif "+floc[1]+"\n") - else: - if movefile(x,pathstrip(mycurpath,mystart)[0]+"/"+x): - zing="<<<" - else: - zing="!!!" - print zing+" "+floc[0] - outfile.write("dev "+floc[1]+"\n") - -def merge(mycategory,mypackage,mystart): - mystart=os.path.normpath(mystart) - os.chdir(mystart) - print - print ">>> Merging contents of",mystart,"to "+root - print ">>> Logging merge to "+root+"var/db/pkg/"+mycategory+"/"+mypackage+"/CONTENTS" - if not os.path.exists(root): - os.makedirs(root,0700) - elif not os.path.isdir(root): - print "!!! Error: ROOT setting points to a non-directory. Exiting." - return - prep_dbdir() - if not os.path.isdir(root+"var/db/pkg/"+mycategory): - os.mkdir(root+"var/db/pkg/"+mycategory,0755) - if not os.path.isdir(root+"var/db/pkg/"+mycategory+"/"+mypackage): - os.mkdir(root+"var/db/pkg/"+mycategory+"/"+mypackage,0755) - contentsfile=root+"var/db/pkg/"+mycategory+"/"+mypackage+"/CONTENTS" - if os.path.exists(contentsfile): - os.unlink(contentsfile) - outfile=open(contentsfile,"w") - mergefiles(outfile,mystart) - outfile.close() - - #begin provides/virtual package code - mypfn=root+"var/db/pkg/"+mycategory+"/"+mypackage+"/PROVIDE" - if os.path.exists(mypfn): - #this package provides some (possibly virtual) packages - mypfile=open(mypfn,"r") - myprovides=mypfile.readlines() - mypfile.close() - for x in myprovides: - #remove trailing newline - x=x[:-1] - mypsplit=string.split(x,"/") - if len(mypsplit)!=2: - print "!!! Invalid PROVIDE string:",x - sys.exit(1) - providesdir=root+"var/db/pkg/"+x - if os.path.exists(providesdir): - #if there's a non-virtual package there, we won't overwrite it - #if it's a virtual package, we'll claim it as our own - if not os.path.exists(providesdir+"/VIRTUAL"): - #non-virtual, skip it - print ">>> Existing package",x,"is non-virtual; skipping" - continue - if not os.path.exists(providesdir): - if not os.path.exists(root+"var/db/pkg/"+mypsplit[0]): - os.mkdir(root+"var/db/pkg/"+mypsplit[0]) - os.mkdir(providesdir) - #create empty contents file - mytouch=open(providesdir+"/CONTENTS","w") - mytouch.close() - #create virtual file containing name of this package - myvirtual=open(providesdir+"/VIRTUAL","a") - myvirtual.write(mycategory+"/"+mypackage+"\n") - myvirtual.close() - #end provides/virtual package code - #update environment settings, library paths - env_update() - print - print ">>>",mypackage,"merged." - print - -def unmerge(category,pkgname): - if os.path.isdir(os.path.normpath(root+"var/db/pkg/"+category+"/"+pkgname)): - if root=="/": - print "Unmerging",pkgname+"..." - else: - print "Unmerging",pkgname,"from",root+"..." - print - else: - print pkgname,"not installed" - return - try: - contents=open(os.path.normpath(root+"var/db/pkg/"+category+"/"+pkgname+"/CONTENTS")) - except: - print "Error -- could not open CONTENTS file for", pkgname+". Aborting." - return - - #begin virtual/provides package code - mypname=root+"var/db/pkg/"+category+"/"+pkgname+"/PROVIDE" - if os.path.exists(mypname): - mypfile=open(mypname,"r") - myprovides=mypfile.readlines() - mypfile.close() - pos=0 - for x in myprovides: - #zap trailing newline - x=x[:-1] - if len(x)==0: - continue - #zap virtual packages - if os.path.isdir(root+"var/db/pkg/"+x): - if os.path.exists(root+"var/db/pkg/"+x+"/VIRTUAL"): - #this is a virtual package, we can zap it if it contains our package name - myvirtual=open(root+"var/db/pkg/"+x+"/VIRTUAL","r") - myvpkgnames=myvirtual.readlines()[:] - newnames=[] - found=0 - pos=0 - while pos<len(myvpkgnames): - if myvpkgnames[pos][:-1] == category+"/"+pkgname: - found=1 - else: - newnames.append(myvpkgnames[pos]) - pos=pos+1 - if found==0: - print ">>> Virtual package",x,"does not appear to be registered to us, skipping." - continue - if len(newnames)==0: - os.unlink(root+"var/db/pkg/"+x+"/VIRTUAL") - zapme=os.listdir(root+"var/db/pkg/"+x) - for y in zapme: - os.unlink(root+"var/db/pkg/"+x+"/"+y) - os.rmdir(root+"var/db/pkg/"+x) - #virtual package removed - else: - myvirt=open(root+"var/db/pkg/"+x+"/VIRTUAL","w") - for y in newnames: - myvirt.write(y) - myvirt.close() - #claim on virtual package removed, virtual package kept. - else: - print ">>>",x,"(provided by",category+"/"+pkgname+") is not a virtual package, keeping." - continue - #end virtual/provides package code - - pkgfiles={} - for line in contents.readlines(): - mydat=string.split(line) - # we do this so we can remove from non-root filesystems - # (use the ROOT var to allow maintenance on other partitions) - mydat[1]=os.path.normpath(root+mydat[1][1:]) - if mydat[0]=="obj": - #format: type, mtime, md5sum - pkgfiles[string.join(mydat[1:-2]," ")]=[mydat[0], mydat[-1], mydat[-2]] - elif mydat[0]=="dir": - #format: type - pkgfiles[string.join(mydat[1:])]=[mydat[0] ] - elif mydat[0]=="sym": - #format: type, mtime, dest - x=len(mydat)-1 - splitter=-1 - while(x>=0): - if mydat[x]=="->": - splitter=x - break - x=x-1 - if splitter==-1: - #invalid symlink format - print "CONTENTS symlink error!" - return - - pkgfiles[string.join(mydat[1:splitter]," ")]=[mydat[0], mydat[-1], string.join(mydat[(splitter+1):-1]," ")] - elif mydat[0]=="dev": - #format: type - pkgfiles[string.join(mydat[1:]," ")]=[mydat[0] ] - elif mydat[0]=="fif": - #format: type - pkgfiles[string.join(mydat[1:]," ")]=[mydat[0]] - else: - print "Error -- CONTENTS file for", pkgname, "is corrupt." - print ">>> "+line - return - # we don't want to automatically remove the ebuild file listed - # in the CONTENTS file. We'll do after everything else has - # completed successfully. - myebuildfile=os.path.normpath(root+"var/db/pkg/"+category+"/"+pkgname+"/"+pkgname+".ebuild") - if os.path.exists(myebuildfile): - if pkgfiles.has_key(myebuildfile): - del pkgfiles[myebuildfile] - else: - myebuildfile=None - - mykeys=pkgfiles.keys() - mykeys.sort() - mykeys.reverse() - - #prerm script - if myebuildfile: - pkgscript("prerm",myebuildfile) - - for obj in mykeys: - obj=os.path.normpath(obj) - if not os.path.islink(obj): - #we skip this if we're dealing with a symlink - #because os.path.exists() will operate on the - #link target rather than the link itself. - if not os.path.exists(obj): - print "--- !found", pkgfiles[obj][0], obj - continue - if (pkgfiles[obj][0] not in ("dir","fif","dev")) and (getmtime(obj) != pkgfiles[obj][1]): - print "--- !mtime", pkgfiles[obj][0], obj - continue - if pkgfiles[obj][0]=="dir": - if not os.path.isdir(obj): - print "--- !dir ","dir", obj - continue - if os.listdir(obj): - print "--- !empty","dir", obj - continue - os.rmdir(obj) - print "<<< ","dir",obj - elif pkgfiles[obj][0]=="sym": - if not os.path.islink(obj): - print "--- !sym ","sym", obj - continue - mydest=os.readlink(obj) - if os.path.exists(os.path.normpath(root+mydest)): - if mydest != pkgfiles[obj][2]: - print "--- !destn","sym", obj - continue - os.unlink(obj) - print "<<< ","sym",obj - elif pkgfiles[obj][0]=="obj": - if not os.path.isfile(obj): - print "--- !obj ","obj", obj - continue - mymd5=md5(obj) - if mymd5 != string.upper(pkgfiles[obj][2]): - print "--- !md5 ","obj", obj - continue - os.unlink(obj) - print "<<< ","obj",obj - elif pkgfiles[obj][0]=="fif": - if not isfifo(obj): - print "--- !fif ","fif", obj - continue - os.unlink(obj) - print "<<< ","fif",obj - elif pkgfiles[obj][0]=="dev": - if not isdev(obj): - print "--- !dev ","dev", obj - continue - os.unlink(obj) - print "<<< ","dev",obj - - #postrm script - if myebuildfile: - pkgscript("postrm",myebuildfile) - #recursive cleanup - for thing in os.listdir(root+"var/db/pkg/"+category+"/"+pkgname): - os.unlink(root+"var/db/pkg/"+category+"/"+pkgname+"/"+thing) - os.rmdir(root+"var/db/pkg/"+category+"/"+pkgname) - print - if root=="/": - print pkgname,"unmerged." - else: - print pkgname,"unmerged from",root+"." - -def getenv(mykey): - if os.environ.has_key(mykey): - return os.environ[mykey] - return "" - -def getconfigsetting(mykey,recdepth=0): - """perform bash-like basic variable expansion, recognizing ${foo} and $bar""" - if recdepth>10: - return "" - #avoid infinite recursion - global configdefaults, cdcached - global configsettings, cscached - if configsettings.has_key(mykey): - mystring=configsettings[mykey] - elif configdefaults.has_key(mykey): - mystring=configdefaults[mykey] - else: - return "" - if (len(mystring)==0): - return "" - if mystring[0]=="'": - #single-quoted, no expansion - return mystring[1:-1] - newstring="" - pos=0 - while (pos<len(mystring)): - if mystring[pos]=='\\': - if (pos+1)>=len(mystring): - #we're at the end of the string - return "" #error - a=mystring[pos+1] - pos=pos+2 - if a=='a': - newstring=newstring+chr(007) - elif a=='b': - newstring=newstring+chr(010) - elif a=='e': - newstring=newstring+chr(033) - elif a=='f': - newstring=newstring+chr(012) - elif a=='r': - newstring=newstring+chr(015) - elif a=='t': - newstring=newstring+chr(011) - elif a=='v': - newstring=newstring+chr(013) - elif a=="'": - newstring=newstring+"'" - else: - newstring=newstring+mystring[pos-1:pos] - elif mystring[pos]=="$": - #variable expansion - if (pos+1)>=len(mystring): - #we're at the end of the string, error - return "" - if mystring[pos+1]=="{": - newpos=pos+1 - while newpos<len(mystring) and mystring[newpos]!="}": - newpos=newpos+1 - if newpos>=len(mystring): - return "" # ending } not found - varname=mystring[pos+2:newpos] - if len(varname)==0: - return "" #zero-length variable, error - newstring=newstring+getsetting(varname,recdepth+1) - pos=newpos+1 - else: - newpos=pos+1 - while newpos<len(mystring) and (mystring[newpos] not in string.whitespace): - newpos=newpos+1 - if newpos>=len(mystring): - varname=mystring[pos+1:] - else: - varname=mystring[pos+1:newpos] - pos=newpos - if len(varname)==0: - return "" #zero-length variable, error - newstring=newstring+getsetting(varname,recdepth+1) - #recurse - else: - newstring=newstring+mystring[pos] - pos=pos+1 - return newstring -def getsetting(mykey,recdepth=0): - """perform bash-like basic variable expansion, recognizing ${foo} and $bar""" - if recdepth>10: - return "" - #avoid infinite recursion - global configdefaults, cdcached - global configsettings, cscached - if os.environ.has_key(mykey): - mystring=os.environ[mykey] - elif configsettings.has_key(mykey): - mystring=configsettings[mykey] - elif configdefaults.has_key(mykey): - mystring=configdefaults[mykey] - else: - return "" - if (len(mystring)==0): - return "" - if mystring[0]=="'": - #single-quoted, no expansion - return mystring[1:-1] - newstring="" - pos=0 - while (pos<len(mystring)): - if mystring[pos]=='\\': - if (pos+1)>=len(mystring): - #we're at the end of the string - return "" #error - a=mystring[pos+1] - pos=pos+2 - if a=='a': - newstring=newstring+chr(007) - elif a=='b': - newstring=newstring+chr(010) - elif a=='e': - newstring=newstring+chr(033) - elif a=='f': - newstring=newstring+chr(012) - elif a=='r': - newstring=newstring+chr(015) - elif a=='t': - newstring=newstring+chr(011) - elif a=='v': - newstring=newstring+chr(013) - elif a=="'": - newstring=newstring+"'" - else: - newstring=newstring+mystring[pos-1:pos] - elif mystring[pos]=="$": - #variable expansion - if (pos+1)>=len(mystring): - #we're at the end of the string, error - return "" - if mystring[pos+1]=="{": - newpos=pos+1 - while newpos<len(mystring) and mystring[newpos]!="}": - newpos=newpos+1 - if newpos>=len(mystring): - return "" # ending } not found - varname=mystring[pos+2:newpos] - if len(varname)==0: - return "" #zero-length variable, error - newstring=newstring+getsetting(varname,recdepth+1) - pos=newpos+1 - else: - newpos=pos+1 - while newpos<len(mystring) and (mystring[newpos] not in string.whitespace): - newpos=newpos+1 - if newpos>=len(mystring): - varname=mystring[pos+1:] - else: - varname=mystring[pos+1:newpos] - pos=newpos - if len(varname)==0: - return "" #zero-length variable, error - newstring=newstring+getsetting(varname,recdepth+1) - #recurse - else: - newstring=newstring+mystring[pos] - pos=pos+1 - return newstring - -def getconfig(mycfg): - myconfigfile=open(mycfg,"r") - myconfiglines=myconfigfile.readlines() - myconfigfile.close() - myconfigdict={} - for x in myconfiglines: - #strip whitespace - x=string.strip(x) - #skip comment or blank line - if (len(x)==0): - continue - if (x[0]=="#"): - continue - myparts=string.split(x,"=") - if myparts<2: - continue - #invalid line, no equals sign - mykey=string.strip(myparts[0]) - myvalue=string.strip(string.join(myparts[1:],"=")) - if myvalue[0]=='"': - if myvalue[-1]=='"': - myvalue=myvalue[1:-1] - else: - continue - #no closing double-quote! - elif myvalue[0]=="'": - if myvalue[-1]=="'": - pass - else: - continue - #no closing single-quote! - if len(myvalue)>0: - myconfigdict[mykey]=myvalue - return myconfigdict - -def relparse(myver): - number=0 - p1=0 - p2=0 - mynewver=string.split(myver,"_") - if len(mynewver)==2: - #alpha,beta or pre - number=string.atof(mynewver[0]) - if "beta" == mynewver[1][:4]: - p1=-3 - try: - p2=string.atof(mynewver[1][4:]) - except: - p2=0 - elif "alpha" == mynewver[1][:5]: - p1=-4 - try: - p2=string.atof(mynewver[1][5:]) - except: - p2=0 - elif "pre" ==mynewver[1][:3]: - p1=-2 - try: - p2=string.atof(mynewver[1][3:]) - except: - p2=0 - elif "rc" ==mynewver[1][:2]: - p1=-1 - try: - p2=string.atof(mynewver[1][2:]) - except: - p2=0 - - elif "p" ==mynewver[1][:1]: - try: - p1=string.atoi(mynewver[1][1:]) - except: - p1=0 - else: - #normal number or number with letter at end - divider=len(myver)-1 - if myver[divider:] not in "1234567890": - #letter at end - p1=ord(myver[divider:]) - number=string.atof(myver[0:divider]) - else: - number=string.atof(myver) - return [number,p1,p2] - - -def revverify(myrev): - if len(myrev)==0: - return 0 - if myrev[0]=="r": - try: - string.atoi(myrev[1:]) - return 1 - except: - pass - return 0 - -#returns 1 if valid version string, else 0 -# valid string in format: <v1>.<v2>...<vx>[a-z,_{alpha,beta,pre}[vy]] -# ververify doesn't do package rev. - -def ververify(myval): - global ERRVER - ERRVER="" - myval=string.split(myval,'.') - for x in myval[1:]: - x="."+x - for x in myval[:-1]: - try: - foo=string.atof(x) - except: - ERRVER=x+" is not a valid version component." - return 0 - try: - string.atof(myval[-1]) - return 1 - except: - pass - if myval[-1][-1] in "abcdefghijklmnopqrstuvwxyz": - try: - string.atof(myval[-1][:-1]) - # if we got here, it's something like .02a - return 1 - except: - pass - splits=string.split(myval[-1],"_") - if len(splits)!=2: - #not a valid _alpha, _beta, _pre or _p, so fail - ERRVER="Too many or too few \"_\" characters." - return 0 - try: - string.atof(splits[0]) - except: - #something like .asldfkj_alpha1 which is invalid :) - ERRVER=splits[0]+" is not a valid number." - return 0 - valid=["alpha","beta","p","rc","pre"] - for x in valid: - if splits[1][0:len(x)]==x: - firpart=x - secpart=splits[1][len(x):] - ok=1 - if not ok: - ERRVER='Did not find an "alpha", "beta", "pre" or "p" after trailing "_"' - return 0 - if len(secpart)==0: - if firpart=="p": - #patchlevel requires an int - ERRVER='"p" (patchlevel) requires a trailing integer (i.e. "p3")' - return 0 - else: - #alpha, beta and pre don't require an int - return 1 - try: - string.atoi(secpart) - return 1 - #the int after the "alpha", "beta" or "pre" was ok - except: - ERRVER=secpart+" is not a valid integer." - return 0 - #invalid number! - -def isjustname(mypkg): - myparts=string.split(mypkg,'-') - for x in myparts: - if ververify(x): - return 0 - return 1 - -def isspecific(mypkg): - mysplit=string.split(mypkg,"/") - if len(mysplit)==2: - if not isjustname(mysplit[1]): - return 1 - return 0 - -# This function can be used as a package verification function, i.e. -# "pkgsplit("foo-1.2-1") will return None if foo-1.2-1 isn't a valid -# package (with version) name. If it is a valid name, pkgsplit will -# return a list containing: [ pkgname, pkgversion(norev), pkgrev ]. -# For foo-1.2-1, this list would be [ "foo", "1.2", "1" ]. For -# Mesa-3.0, this list would be [ "Mesa", "3.0", "0" ]. - -def pkgsplit(mypkg): - global ERRPKG - ERRPKG="" - myparts=string.split(mypkg,'-') - if len(myparts)<2: - ERRPKG="Not enough \"-\" characters." - return None - if revverify(myparts[-1]): - if ververify(myparts[-2]): - if len(myparts)==2: - ERRPKG="Found rev and version, but no package name." - return None - else: - for x in myparts[:-2]: - if ververify(x): - ERRPKG=x+" shouldn't look like a version part." - return None - #names can't have versiony looking parts - return [string.join(myparts[:-2],"-"),myparts[-2],myparts[-1]] - else: - ERRPKG="Found revision but "+myparts[-2]+" does not appear to be a valid version." - return None - - elif ververify(myparts[-1]): - if len(myparts)==1: - ERRPKG="Found version, but no package name." - return None - else: - for x in myparts[:-1]: - if ververify(x): - ERRPKG=x+" shouldn't look like a version part." - return None - return [string.join(myparts[:-1],"-"),myparts[-1],"r0"] - else: - ERRPKG=myparts[-1]+" doesn't appear to be a version or rev string." - return None - -def catpkgsplit(mycatpkg): - """returns [cat, pkgname, version, rev ]""" - mysplit=string.split(mycatpkg,"/") - if len(mysplit)!=2: - return None - mysplit2=pkgsplit(mysplit[1]) - if mysplit2==None: - return None - return [mysplit[0],mysplit2[0],mysplit2[1],mysplit2[2]] - -# vercmp: -# This takes two version strings and returns an integer to tell you whether -# the versions are the same, val1>val2 or val2>val1. - -def vercmp(val1,val2): - val1=string.split(val1,'-') - if len(val1)==2: - val1[0]=val1[0]+"."+val1[1] - val1=string.split(val1[0],'.') - #add back decimal point so that .03 does not become "3" ! - for x in val1[1:]: - x="."+x - val2=string.split(val2,'-') - if len(val2)==2: - val2[0]=val2[0]+"."+val2[1] - val2=string.split(val2[0],'.') - for x in val2[1:]: - x="."+x - if len(val2)<len(val1): - for x in range(0,len(val1)-len(val2)): - val2.append("0") - elif len(val1)<len(val2): - for x in range(0,len(val2)-len(val1)): - val1.append("0") - #The above code will extend version numbers out so they - #have the same number of digits. - myval1=[] - for x in range(0,len(val1)): - cmp1=relparse(val1[x]) - cmp2=relparse(val2[x]) - for y in range(0,3): - myret=cmp1[y]-cmp2[y] - if myret != 0: - return myret - return 0 - - -def pkgcmp(pkg1,pkg2): - """if returnval is less than zero, then pkg2 is newer than pkg2, zero if equal and positive if older.""" - mycmp=vercmp(pkg1[1],pkg2[1]) - if mycmp>0: - return 1 - if mycmp<0: - return -1 - r1=string.atoi(pkg1[2][1:]) - r2=string.atoi(pkg2[2][1:]) - if r1>r2: - return 1 - if r2>r1: - return -1 - return 0 - -def getgeneral(mycatpkg): - """Takes a specific catpkg and returns the general version. getgeneral("foo/bar-1.0") returns "foo/bar""" - mysplit=catpkgsplit(mycatpkg) - if not mysplit: - return None - else: - return string.join([mysplit[0],mysplit[1]],"/") - -def dep_parenreduce(mysplit,mypos=0): - "Accepts a list of strings, and converts '(' and ')' surrounded items to sub-lists" - while (mypos<len(mysplit)): - if (mysplit[mypos]=="("): - firstpos=mypos - mypos=mypos+1 - while (mypos<len(mysplit)): - if mysplit[mypos]==")": - mysplit[firstpos:mypos+1]=[mysplit[firstpos+1:mypos]] - mypos=firstpos - break - elif mysplit[mypos]=="(": - #recurse - mysplit=dep_parenreduce(mysplit,mypos) - mypos=mypos+1 - mypos=mypos+1 - return mysplit - -def dep_opconvert(mysplit,myuse): - "Does dependency operator conversion, such as moving '||' inside a sub-list, etc." - mypos=0 - while mypos<len(mysplit): - if type(mysplit[mypos])==types.ListType: - mysplit[mypos]=dep_opconvert(mysplit[mypos],myuse) - elif mysplit[mypos]==")": - #mismatched paren, error - return None - elif mysplit[mypos]=="||": - if (mypos+1)<len(mysplit): - if type(mysplit[mypos+1])!=types.ListType: - # || must be followed by paren'd list - return None - else: - mynew=dep_opconvert(mysplit[mypos+1],myuse) - mysplit[mypos+1]=mynew - mysplit[mypos+1][0:0]=["||"] - del mysplit[mypos] - else: - #don't end a depstring with || :) - return None - elif mysplit[mypos][-1]=="?": - #uses clause, i.e "gnome? ( foo bar )" - if (mysplit[mypos][:-1]) in myuse: - #if the package is installed, just delete the conditional - del mysplit[mypos] - else: - #the package isn't installed, delete conditional and next item - del mysplit[mypos] - del mysplit[mypos] - #we don't want to move to the next item, so we perform a quick hack - mypos=mypos-1 - mypos=mypos+1 - return mysplit - -def dep_wordreduce(mydeplist): - """Calls dep_depreduce() on all the items in the deplist""" - mypos=0 - deplist=mydeplist[:] - while mypos<len(deplist): - if type(deplist[mypos])==types.ListType: - #recurse - deplist[mypos]=dep_wordreduce(deplist[mypos]) - else: - if deplist[mypos]=="||": - pass - else: - mydep=dep_depreduce(deplist[mypos]) - if mydep!=None: - deplist[mypos]=mydep - else: - #encountered invalid string - return None - mypos=mypos+1 - return deplist - -def dep_eval(deplist): - if len(deplist)==0: - return 1 - if deplist[0]=="||": - #or list; we just need one "1" - for x in deplist[1:]: - if type(x)==types.ListType: - if dep_eval(x)==1: - return 1 - elif x==1: - return 1 - return 0 - else: - for x in deplist: - if type(x)==types.ListType: - if dep_eval(x)==0: - return 0 - elif x==0: - return 0 - return 1 - -def dep_catpkgstring(mypkgdep): - if mypkgdep[0]=="!": - if not pkgsplit(mypkgdep[1:]): - return "(invalid dependency)" - else: - return "unmerge "+mypkgdep[1:] - elif mypkgdep[0]=="=": - if not pkgsplit(mypkgdep[1:]): - return "(invalid dependency)" - else: - return "merge "+mypkgdep[1:] - elif mypkgdep[0:2]==">=": - if not pkgsplit(mypkgdep[2:]): - return "(invalid dependency)" - else: - return "merge "+mypkgdep[2:]+" or newer" - elif mypkgdep[0:2]=="<=": - if not pkgsplit(mypkgdep[2:]): - return "(invalid dependency)" - else: - return "merge "+mypkgdep[2:]+" or older" - elif mypkgdep[0]=="<": - mysplit=catpkgsplit(mypkgdep[1:]) - if mysplit==None: - return "(invalid dependency)" - else: - myret="merge "+string.join([mysplit[0],mysplit[1]],"/")+" older than version" - if mysplit[3]=="r0": - return myret+" "+mysplit[2] - else: - return myret+" "+mysplit[2]+"-"+mysplit[3] - elif mypkgdep[0]==">": - mysplit=catpkgsplit(mypkgdep[1:]) - if mysplit==None: - return "(invalid dependency)" - else: - myret="merge "+string.join([mysplit[0],mysplit[1]],"/")+" newer than version" - if mysplit[3]=="r0": - return myret+" "+mysplit[2] - else: - return myret+" "+mysplit[2]+"-"+mysplit[3] - elif not isspecific(mypkgdep): - mysplit=string.split(mypkgdep,"/") - if len(mysplit)!=2: - return "(invalid dependency)" - else: - return "merge any version of "+mypkgdep - else: - return "(invalid dependency)" - -def dep_print(deplist,mylevel=0): - "Prints out a deplist in a human-understandable format" - if (deplist==None) or (len(deplist)==0): - return - if deplist[0]=="||": - for x in deplist[1:]: - if type(x)==types.ListType: - dep_print(x,mylevel+1) - else: - print " "*(mylevel)+"|| "+dep_catpkgstring(x) - else: - for x in deplist: - if type(x)==types.ListType: - dep_print(x,mylevel+1) - else: - print " "*(mylevel)+"&& "+dep_catpkgstring(x) - - - -""" -This is an early (semi-working) attempt at recursive ebuilding. Commented out as -we're getting ready for production use. - -def dep_print_resolve(deplist): - "Prints out list of things to do" - if (deplist==None) or (len(deplist)==0): - return - if deplist[0]=="||": - for x in deplist[1:]: - if type(x)==types.ListType: - dep_print(x) - else: - print "|| "+dep_catpkgstring(x)+' ('+porttree.dep_bestmatch(x)+')' - return - else: - for x in deplist: - if type(x)==types.ListType: - dep_print_resolve(x) - else: - mymatch=porttree.dep_bestmatch(x) - if mymatch=="": - print "!! "+dep_catpkgstring(x) - return - else: - print "Best match is",mymatch - mysplit=catpkgsplit(mymatch) - myebuild=getsetting("PORTDIR")+"/"+mysplit[0]+"/"+mysplit[1]+"/"+string.split(mymatch,"/")[1]+".ebuild" - print "ebuild file is",myebuild - result=doebuild(myebuild,"merge") - if result: - #error - print "STOPPING deep merge!" - sys.exit(1) - myebuild=getsetting("PORTDIR")+"/"+getsetting("CATEGORY")+"/"+getsetting("PN")+"/"+getsetting("PF")+".ebuild" - result=doebuild(myebuild,"merge") - return result -""" - -def dep_zapdeps(unreduced,reduced): - """Takes an unreduced and reduced deplist and removes satisfied dependencies. - Returned deplist contains steps that must be taken to satisfy dependencies.""" - if unreduced[0]=="||": - if dep_eval(reduced): - #deps satisfied, return None - return None - else: - return unreduced - else: - if dep_eval(reduced): - #deps satisfied, return None - return None - else: - returnme=[] - x=0 - while x<len(reduced): - if type(reduced[x])==types.ListType: - myresult=dep_zapdeps(unreduced[x],reduced[x]) - if myresult: - returnme.append(myresult) - else: - if reduced[x]==0: - returnme.append(unreduced[x]) - x=x+1 - return returnme - -def dep_listcleanup(deplist): - "remove unnecessary clutter from deplists. Remove multiple list levels, empty lists" - newlist=[] - if (len(deplist)==1): - #remove multiple-depth lists - if (type(deplist[0])==types.ListType): - for x in deplist[0]: - if type(x)==types.ListType: - if len(x)!=0: - newlist.append(dep_listcleanup(x)) - else: - newlist.append(x) - else: - #unembed single nodes - newlist.append(deplist[0]) - else: - for x in deplist: - if type(x)==types.ListType: - if len(x)==1: - newlist.append(x[0]) - elif len(x)!=0: - newlist.append(dep_listcleanup(x)) - else: - newlist.append(x) - return newlist - -def merge_check(mycatpkg): - if roottree.exists_specific(mycatpkg): - return 1 - return 0 - -def dep_frontend(mytype,depstring): - """shell frontend for dependency system""" - if depstring=="": - print ">>> No",mytype,"dependencies." - return 0 - if mytype=="build": - myparse=localtree.depcheck(depstring) - elif mytype=="runtime": - myparse=roottree.depcheck(depstring) - else: - print "!!! Error: dependency type",mytype,"not recognized. Exiting." - sys.exit(1) - if myparse[0]==0: - #error - print '!!! '+mytype+' dependency error:',myparse[1] - return 1 - elif myparse[1]==None: - print '>>> '+mytype+' dependencies OK ;)' - return 0 - else: - print '!!! Some '+mytype+' dependencies must be satisfied:' - print - print myparse[1] - dep_print(myparse[1]) - print -# This is the semi-working auto-ebuild stuff, disabled for now -# dep_print_resolve(myparse[1]) - return 1 - -def port_porttree(): - """ - This function builds a dictionary of available ebuilds in the portage tree. - Dictionary format is: - mydict["cat/pkg"]=[ - ["cat/fullpkgname",["cat","pkg","ver","rev"] - ["cat/fullpkgname",["cat","pkg","ver2","rev2"] - ] - """ - portagedict={} - mydir=getsetting("PORTDIR") - if not os.path.isdir(mydir): - return - origdir=os.getcwd() - os.chdir(mydir) - for x in categories: - if not os.path.isdir(os.getcwd()+"/"+x): - continue - for y in os.listdir(os.getcwd()+"/"+x): - if not os.path.isdir(os.getcwd()+"/"+x+"/"+y): - continue - if y=="CVS": - continue - for mypkg in os.listdir(os.getcwd()+"/"+x+"/"+y): - if mypkg[-7:] != ".ebuild": - continue - mypkg=mypkg[:-7] - mykey=x+"/"+y - fullpkg=x+"/"+mypkg - if not portagedict.has_key(mykey): - portagedict[mykey]=[] - portagedict[mykey].append([fullpkg,catpkgsplit(fullpkg)]) - os.chdir(origdir) - return portagedict - -class packagetree: - def __init__(self): - self.tree={} - self.populated=0 - def populate(self): - "populates the tree with values" - populated=1 - pass - def exists_specific(self,catpkg): - if not self.populated: - self.populate() - "this function tells you whether or not a specific package is installed" - cpsplit=catpkgsplit(catpkg) - if cpsplit==None: - return None - if not self.tree.has_key(cpsplit[0]+"/"+cpsplit[1]): - return 0 - for x in self.tree[cpsplit[0]+"/"+cpsplit[1]]: - if x[0]==catpkg: - return 1 - return 0 - def exists_node(self,nodename): - if not self.populated: - self.populate() - if self.tree.has_key(nodename): - return 1 - return 0 - def getnodes(self,nodename): - if not self.populated: - self.populate() - if self.tree.has_key(nodename): - return self.tree[nodename] - return [] - def depcheck(self,depstring): - """evaluates a dependency string and returns a 2-node result list - [1, None] = ok, no dependencies - [1, ["x11-base/foobar","sys-apps/oni"] = dependencies must be satisfied - [0, * ] = parse error - """ - if not self.populated: - self.populate() - myusesplit=string.split(getsetting("USE")) - mysplit=string.split(depstring) - #convert parenthesis to sublists - mysplit=dep_parenreduce(mysplit) - #mysplit can't be None here, so we don't need to check - mysplit=dep_opconvert(mysplit,myusesplit) - #if mysplit==None, then we have a parse error (paren mismatch or misplaced ||) - #up until here, we haven't needed to look at the database tree - - if mysplit==None: - return [0,"Parse Error (parenthesis mismatch or || abuse?)"] - elif mysplit==[]: - #dependencies were reduced to nothing - return [1,None] - mysplit2=mysplit[:] - mysplit2=self.dep_wordreduce(mysplit2) - if mysplit2==None: - return [0,"Invalid token"] - myeval=dep_eval(mysplit2) - if myeval: - return [1,None] - else: - return [1,dep_listcleanup(dep_zapdeps(mysplit,mysplit2))] - def dep_wordreduce(self,mydeplist): - """Calls dep_depreduce() on all the items in the deplist""" - mypos=0 - deplist=mydeplist[:] - while mypos<len(deplist): - if type(deplist[mypos])==types.ListType: - #recurse - deplist[mypos]=self.dep_wordreduce(deplist[mypos]) - else: - if deplist[mypos]=="||": - pass - else: - mydep=self.dep_depreduce(deplist[mypos]) - if mydep!=None: - deplist[mypos]=mydep - else: - #encountered invalid string - return None - mypos=mypos+1 - return deplist - def dep_depreduce(self,mypkgdep): - if mypkgdep[0]=="!": - # !cat/pkg-v - if self.exists_specific(mypkgdep[1:]): - return 0 - else: - return 1 - elif mypkgdep[0]=="=": - # =cat/pkg-v - return self.exists_specific(mypkgdep[1:]) - elif (mypkgdep[0]=="<") or (mypkgdep[0]==">"): - # >=cat/pkg-v or <=,>,< - if mypkgdep[1]=="=": - cmpstr=mypkgdep[0:2] - cpv=mypkgdep[2:] - else: - cmpstr=mypkgdep[0] - cpv=mypkgdep[1:] - if not isspecific(cpv): - return None - if self.exists_node(getgeneral(cpv)): - mycatpkg=catpkgsplit(cpv) - mykey=mycatpkg[0]+"/"+mycatpkg[1] - if not self.exists_node(mykey): - return 0 - for x in self.getnodes(mykey): - if eval("pkgcmp(x[1][1:],mycatpkg[1:])"+cmpstr+"0"): - return 1 - return 0 - if not isspecific(mypkgdep): - # cat/pkg - if self.exists_node(mypkgdep): - return 1 - else: - return 0 - else: - return None - def dep_bestmatch(self,mypkgdep): - """ - returns best match for mypkgdep in the tree. Accepts - a single depstring, such as ">foo/bar-1.0" and finds - the most recent version of foo/bar that satisfies the - dependency and returns it, i.e: "foo/bar-1.3". Works - for >,<,>=,<=,=,and general deps. Don't call with a ! - dep, since there is no good match for a ! dep. - """ - if (mypkgdep[0]=="="): - if self.exists_specific(mypkgdep[1:]): - return mypkgdep[1:] - else: - return "" - elif (mypkgdep[0]==">") or (mypkgdep[0]=="<"): - if mypkgdep[1]=="=": - cmpstr=mypkgdep[0:2] - cpv=mypkgdep[2:] - else: - cmpstr=mypkgdep[0] - cpv=mypkgdep[1:] - if not isspecific(cpv): - return "" - mycatpkg=catpkgsplit(cpv) - mykey=mycatpkg[0]+"/"+mycatpkg[1] - if not self.exists_node(mykey): - return "" - mynodes=[] - for x in self.getnodes(mykey): - if eval("pkgcmp(x[1][1:],mycatpkg[1:])"+cmpstr+"0"): - mynodes.append(x) - #now we have a list of all nodes that qualify - if len(mynodes)==0: - return "" - bestmatch=mynodes[0] - for x in mynodes[1:]: - if pkgcmp(x[1][1:],bestmatch[1][1:])>0: - bestmatch=x - return bestmatch[0] - elif not isspecific(mypkgdep): - if not self.exists_node(mypkgdep): - return "" - mynodes=self.getnodes(mypkgdep)[:] - if len(mynodes)==0: - return "" - bestmatch=mynodes[0] - for x in mynodes[1:]: - if pkgcmp(x[1][1:],bestmatch[1][1:])>0: - bestmatch=x - return bestmatch[0] - def dep_match(self,mypkgdep): - """ - returns a list of all matches for mypkgdep in the tree. Accepts - a single depstring, such as ">foo/bar-1.0" and finds - all the versions of foo/bar that satisfy the - dependency and returns them, i.e: ["foo/bar-1.3"]. Works - for >,<,>=,<=,=,and general deps. Don't call with a ! - dep, since there is no good match for a ! dep. - """ - if (mypkgdep[0]=="="): - if self.exists_specific(mypkgdep[1:]): - return [mypkgdep[1:]] - else: - return [] - elif (mypkgdep[0]==">") or (mypkgdep[0]=="<"): - if mypkgdep[1]=="=": - cmpstr=mypkgdep[0:2] - cpv=mypkgdep[2:] - else: - cmpstr=mypkgdep[0] - cpv=mypkgdep[1:] - if not isspecific(cpv): - return [] - mycatpkg=catpkgsplit(cpv) - mykey=mycatpkg[0]+"/"+mycatpkg[1] - if not self.exists_node(mykey): - return [] - mynodes=[] - for x in self.getnodes(mykey): - if eval("pkgcmp(x[1][1:],mycatpkg[1:])"+cmpstr+"0"): - mynodes.append(x) - #now we have a list of all nodes that qualify - #since we want all nodes that match, return this list - return mynodes - elif not isspecific(mypkgdep): - if not self.exists_node(mypkgdep): - return [] - return self.getnodes(mypkgdep)[:] - -class vartree(packagetree): - "this tree will scan a var/db/pkg database located at root (passed to init)" - def __init__(self,root): - self.root=root - packagetree.__init__(self) - def populate(self): - "populates the local tree (/var/db/pkg)" - if not os.path.isdir(self.root+"var"): - os.mkdir(self.root+"var",0755) - if not os.path.isdir(self.root+"var/db"): - os.mkdir(self.root+"var/db",0755) - if not os.path.isdir(self.root+"var/db/pkg"): - os.mkdir(self.root+"var/db/pkg",0755) - dbdir=self.root+"var/db/pkg" - origdir=os.getcwd() - os.chdir(dbdir) - for x in os.listdir(os.getcwd()): - if not os.path.isdir(os.getcwd()+"/"+x): - continue - for y in os.listdir(os.getcwd()+"/"+x): - if x=="virtual": - #virtual packages don't require versions, if none is found, add a "1.0" to the end - if isjustname(y): - fullpkg=x+"/"+y+"-1.0" - else: - fullpkg=x+"/"+y - else: - fullpkg=x+"/"+y - mysplit=catpkgsplit(fullpkg) - mykey=x+"/"+mysplit[1] - if not self.tree.has_key(mykey): - self.tree[mykey]=[] - self.tree[mykey].append([fullpkg,mysplit]) - os.chdir(origdir) - self.populated=1 - -class portagetree(packagetree): - "this tree will scan a portage directory located at root (passed to init)" - def __init__(self,root): - self.root=root - packagetree.__init__(self) - def populate(self): - "populates the port tree" - origdir=os.getcwd() - os.chdir(self.root) - for x in categories: - if not os.path.isdir(os.getcwd()+"/"+x): - continue - for y in os.listdir(os.getcwd()+"/"+x): - if not os.path.isdir(os.getcwd()+"/"+x+"/"+y): - continue - if y=="CVS": - continue - for mypkg in os.listdir(os.getcwd()+"/"+x+"/"+y): - if mypkg[-7:] != ".ebuild": - continue - mypkg=mypkg[:-7] - mykey=x+"/"+y - fullpkg=x+"/"+mypkg - if not self.tree.has_key(mykey): - self.tree[mykey]=[] - self.tree[mykey].append([fullpkg,catpkgsplit(fullpkg)]) - os.chdir(origdir) - self.populated=1 - def getdeps(self,pf): - "returns list of dependencies, if any" - if not self.populated: - self.populate() - if self.exists_specific(pf): - mysplit=catpkgsplit(pf) - mydepfile=self.root+"/"+mysplit[0]+"/"+mysplit[1]+"/files/depend-"+string.split(pf,"/")[1] - if os.path.exists(mydepfile): - myd=open(mydepfile,"r") - mydeps=myd.readlines() - myd.close() - returnme="" - for x in mydeps: - returnme=returnme+" "+x[:-1] - return returnme - return "" - -class currenttree(packagetree): - "this tree will scan a current package file located at root (passed to init)" - def __init__(self,root): - self.root=root - packagetree.__init__(self) - def populate(self): - "populates the current tree" - mycurrent=open(self.root,"r") - mylines=mycurrent.readlines() - for x in mylines: - if x[:2]!="./": - continue - myline=string.split(string.strip(x)[2:-7],"/") - if len(myline)!=3: - continue - fullpkg=string.join([myline[0],myline[2]],"/") - mysplit=catpkgsplit(fullpkg) - mykey=mysplit[0]+"/"+mysplit[1] - if not self.tree.has_key(mykey): - self.tree[mykey]=[] - self.tree[mykey].append([fullpkg,mysplit]) - mycurrent.close() - self.populated=1 - -class binarytree(packagetree): - "this tree scans for a list of all packages available in PKGDIR" - def __init__(self): - self.root=getsetting("PKGDIR") - packagetree.__init__(self) - def populate(self): - "popules the binarytree" - if (not os.path.isdir(self.root)): - return 0 - for mycat in categories: - try: - mypkgs=os.listdir(self.root+"/"+mycat) - except: - continue - for mypkg in mypkgs: - if mypkg[-5:]!=".tbz2": - continue - fullpkg=mycat+"/"+mypkg[:-5] - mysplit=catpkgsplit(fullpkg) - mykey=mycat+"/"+mysplit[1] - if not self.tree.has_key(mykey): - self.tree[mykey]=[] - self.tree[mykey].append([fullpkg,mysplit]) - self.populated=1 - def getname(self,pkgname): - "returns file location for this particular package" - return self.root+"/"+pkgname+".tbz2" - - -def depgrab(myfilename,depmark): - """ - Will grab the dependency string from an ebuild file, using - depmark as a marker (normally DEPEND or RDEPEND) - """ - depstring="" - myfile=open(myfilename,"r") - mylines=myfile.readlines() - myfile.close() - pos=0 - while (pos<len(mylines)): - if mylines[pos][0:len(depmark)+1]==depmark+"=": - depstart=string.split(mylines[pos][len(depmark):],'"') - if len(depstart)==3: - depstring=depstart[1] - return string.join(string.split(depstring)," ") - elif len(depstart)==2: - depstring=depstart[1]+" " - pos=pos+1 - while 1: - mysplit=string.split(mylines[pos],'"') - depstring=depstring+mysplit[0]+" " - if len(mysplit)>1: - return string.join(string.split(depstring)," ") - pos=pos+1 - elif len(depstart)==1: - depstring=depstring+mylines[pos][len(depmark)+1:] - break - else: - break - else: - pos=pos+1 - return string.join(string.split(depstring)," ") - -def cleanup_pkgmerge(mypkg): - print ">>> Cleaning up temporary storage..." - shutil.rmtree(getsetting("PKG_TMPDIR")+"/"+mypkg,1) - -def pkgmerge(mytbz2): - """will merge a .tbz2 file, returning a list of runtime dependencies that must be - satisfied, or None if there was a merge error. This code assumes the package - exists.""" - if mytbz2[-5:]!=".tbz2": - print "!!! Not a .tbz2 file" - return None - tmploc=getsetting("PKG_TMPDIR") - if not os.path.exists(tmploc): - os.mkdir(tmploc) - mypkg=os.path.basename(mytbz2)[:-5] - pkgloc=tmploc+"/"+mypkg - if os.path.exists(pkgloc): - shutil.rmtree(pkgloc,1) - os.mkdir(pkgloc) - os.chdir(pkgloc) - print ">>> extracting",mypkg - notok=os.system("cat "+mytbz2+"| bzip2 -d | tar xf -") - if notok: - print "!!! Error extracting",mytbz2 - cleanup_pkgmerge(mypkg) - return None - try: - mycat=os.listdir("var/db/pkg")[0] - except: - print "!!! Package database info not found, aborting..." - cleanup_pkgmerge(mypkg) - return None - mycatpkg=mycat+"/"+mypkg - if roottree.exists_specific(mycatpkg): - print "!!! Error:",mycatpkg,"is already installed. Unmerge first." - cleanup_pkgmerge(mypkg) - return None - - rundepfile="var/db/pkg/"+mycatpkg+"/RDEPEND" - rdep="" - if os.path.exists(rundepfile): - a=open(rundepfile,"r") - myrunlines=a.readlines() - rdep="" - for x in myrunlines: - rdep=rdep+" "+x[:-1] - del myrunlines - doebuild("var/db/pkg/"+mycatpkg+"/"+mypkg+".ebuild","preinst") - merge(mycat,mypkg,os.getcwd()) - doebuild(root+"var/db/pkg/"+mycatpkg+"/"+mypkg+".ebuild","postinst") - cleanup_pkgmerge(mypkg) - print ">>> Done." - if rdep=="": - return "" - else: - return rdep[1:] - -def init(): -# global installcache - global root, ERRPKG, ERRVER, configdefaults, configsettings, currtree, roottree, localtree, porttree - configdefaults=getconfig("/etc/make.defaults") - configsettings=getconfig("/etc/make.conf") - root=getsetting("ROOT") - if len(root)==0: - root="/" - elif root[-1]!="/": - root=root+"/" - if root != "/": - if not os.path.exists(root[:-1]): - print "!!! Error: ROOT",root,"does not exist. Please correct this." - print "!!! Exiting." - print - sys.exit(1) - elif not os.path.isdir(root[:-1]): - print "!!! Error: ROOT",root[:-1],"is not a directory. Please correct this." - print "!!! Exiting." - print - sys.exit(1) - #packages installed locally (for build dependencies) - localtree=vartree("/") - if root=="/": - #root is local, and build dep database is the runtime dep database - roottree=localtree - else: - #root is non-local, initialize non-local database as roottree - roottree=vartree(root) - porttree=portagetree(getsetting("PORTDIR")) - currtree=currenttree(getsetting("CURRENTFILE")) - #package database is now initialized and ready, cap'n! - ERRPKG="" - ERRVER="" -# installcache=None -init() diff --git a/sys-apps/portage/files/pytemplate b/sys-apps/portage/files/pytemplate deleted file mode 100755 index 3c471a38a545..000000000000 --- a/sys-apps/portage/files/pytemplate +++ /dev/null @@ -1,69 +0,0 @@ -#! /usr/bin/spython -# Copyright 1999-2000 Gentoo Technologies, Inc. -# Distributed under the terms of the GNU General Public License, v2 or later -# Author Daniel Robbins <drobbins@gentoo.org> -# $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/files/pytemplate,v 1.3 2001/01/12 16:27:35 drobbins Exp $ - -import sys,string -from types import * - -#global settings -gset={} - -def setkey(mykey,myvalue): - global gset - mykey=string.split(mykey,".") - keyptr=gset - for x in mykey[:-1]: - if not keyptr.has_key(x): - keyptr[x]={} - keyptr=keyptr[x] - keyptr[mykey[-1]]=myvalue - -def getkey(mykey): - global gset - mykey=string.split(mykey,".") - keyptr=gset - for x in mykey[:-1]: - if type(keyptr) != DictionaryType: - return - if not keyptr.has_key(x): - return - keyptr=keyptr[x] - if keyptr.has_key(mykey[-1]): - return keyptr[mykey[-1]] - return - -def runfile(myarg): - mylocals={} - try: - a=open(myarg,'r') - except IOError: - sys.stderr.write("Error opening "+myarg+". Exiting.\n") - return - mylines=a.readlines() - a.close() - pos=0 - while pos<len(mylines): - if mylines[pos][0:8]=="<!--code": - mycode="" - pos=pos+1 - while (pos<len(mylines)) and (mylines[pos][0:3]!="-->"): - mycode=mycode+mylines[pos] - pos=pos+1 - exec(mycode,globals(),mylocals) - else: - sys.stdout.write(mylines[pos]) - pos=pos+1 - -if len(sys.argv)>1: - for x in sys.argv[1:]: - runfile(x) - sys.exit(0) -else: - sys.stderr.write("pytemplate 1.0: Embedded Python Templater\n") - sys.stderr.write("Copyright 1999-2000, Gentoo Technologies, Inc.\n") - sys.stderr.write("Distributed under the GPL, v2 or later\n\n") - sys.stderr.write("Usage: "+sys.argv[0]+" file0 [file1]...\n") - sys.exit(1) - diff --git a/sys-apps/portage/files/pytemplate.test b/sys-apps/portage/files/pytemplate.test deleted file mode 100644 index d5e6f2746368..000000000000 --- a/sys-apps/portage/files/pytemplate.test +++ /dev/null @@ -1,58 +0,0 @@ -this is a test -<!--code -x=1 -while x<10: - print "this is really a test!" - x=x+1 -foo="sure I do!" ---> - -Do you like the test? - -<!--code - -print foo - ---> - -<!--code -print "setting key foo.bar to 23" -setkey("foo.bar",23) -print "getting value for key foo.bar:",getkey("foo.bar") ---> - -I will soon add support to automatically save keys to a global file. -In addition, I will add support for macro expansion, so that if something -like this appears in the text file: [net.resolv.domain] - -it will automatically be replaced with: 129.24.8.4 - -If the net.resolv.domain key is set to 129.24.8.4. - -The embedded python functionality combined with the simple [macro] expansion -features will make it easy to customize config files -- really easy! -Administrators will be able to "template-enable" their own config files -within minutes. And, they have all the power of python. Look at this example -code: - -#this is to simulate the fact that this setting is in global config -setkey("net.resolv.nameserver",["129.24.8.1","129.24.8.4"]) - -#this is sample code from /etc/resolv.conf.tmpl -for x in getkey("net.resolv.nameserver"): - print "nameserver",x - -Now, let's see it actually run: - -<!--code -setkey("net.resolv.nameserver",["129.24.8.1","129.24.8.4"]) -for x in getkey("net.resolv.nameserver"): - print "nameserver",x ---> - -Beautiful, no? The administrator can embed python in any of his or her -config files! Also, consider that the administrator doesn't need to study -complex XSL to understand how the global settings are inserted into the -config file. :) Complex actions are possible... even "pulling in" settings -from a network server! setkey and getkey can be configured to store -registry information on a remote machine or in a database. diff --git a/sys-apps/portage/files/queryhost.sh b/sys-apps/portage/files/queryhost.sh deleted file mode 100644 index 61213f379f07..000000000000 --- a/sys-apps/portage/files/queryhost.sh +++ /dev/null @@ -1,27 +0,0 @@ - -#!/bin/sh - -hping() { - host=`echo $1 | sed -e 's:.*\://::' -e 's:/.*::'` - result=`ping -c3 -q ${host} 2>/dev/null` - if [ -n "$result" ] - then - if [ -z "`echo $result | sed 's:.*0 packets received.*:N:'`" ] - then - result=`echo $result | sed -e "s:.*= [0-9|\.]*/::" -e "s:/[0-9|\.]* ms::" | awk '{ printf ("%04i\n",(atof $1)) }'` - echo $result $1 - else - echo 9999 $1 - fi - fi -} -pingall() { - - for i in $1 - do - hping $i - done -} -pingall "$1" | sort | sed -e "s:[0-9]* ::" -#pingall "$1" - diff --git a/sys-apps/portage/files/tbz2tool.c b/sys-apps/portage/files/tbz2tool.c deleted file mode 100644 index 8222f529639e..000000000000 --- a/sys-apps/portage/files/tbz2tool.c +++ /dev/null @@ -1,228 +0,0 @@ -#include <stdio.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> -#include <errno.h> -#include <string.h> - -/*buffered reading/writing size*/ -#define BUFLEN 262144 -char *myname="tbz2tool"; -struct stat *mystat=NULL; -void *mybuf; -FILE *datafile, *dbfile, *outfile, *infile; -unsigned char endbuf[8]; -long seekto,insize; - -int exists(const char *myfile) { - int result; - result=stat(myfile,mystat); - if (result==-1) - return 0; - return 1; -} - -void writefile(FILE *src, FILE *dest) { - int count=1; - while (count) { - count=fread(mybuf, 1, BUFLEN, src); - fwrite(mybuf, 1, count, dest); - } -} - -void writefileto(FILE *src, FILE *dest, int endpos) { - int pos=ftell(src); - int thiscount; - while (pos < endpos) { - //thiscount=how much to read - thiscount=endpos-pos; - if (thiscount>BUFLEN) - thiscount=BUFLEN; - thiscount=fread(mybuf, 1, thiscount , src); - //thiscount=how much we actually did read - if (thiscount==0) - //eof -- shouldn't happen - break; - //update internal position counter - pos+=thiscount; - fwrite(mybuf, 1, thiscount, dest); - } -} - -int main(int argc, char **argv) { - if ((argc==2) && (!(strcmp(argv[1],"--help")))) - goto usage; - if (argc!=5) { - printf("%s: four arguments expected\n",myname); - goto error; - } - if (!(mystat=(struct stat *) malloc(sizeof(struct stat)))) - goto memalloc; - - if (!(mybuf=(void *) malloc(BUFLEN))) { - free(mystat); - goto memalloc; - } - - //JOIN MODE - if (!(strcmp(argv[1],"join"))) { - - //check if datafile exists - if (!(exists(argv[2]))) { - printf("%s: %s doesn't exist\n",myname,argv[2]); - free(mystat); - goto error; - } - - //check if dbfile exists - if (!(exists(argv[3]))) { - printf("%s: %s doesn't exist\n",myname,argv[3]); - free(mystat); - goto error; - } - //create end buffer for later use - printf("insize: %i\n",mystat->st_size); - endbuf[0]=((mystat->st_size) & 0xff000000) >> 24; - endbuf[1]=((mystat->st_size) & 0x00ff0000) >> 16; - endbuf[2]=((mystat->st_size) & 0x0000ff00) >> 8; - endbuf[3]=(mystat->st_size) & 0x000000ff; - endbuf[4]='S'; - endbuf[5]='T'; - endbuf[6]='O'; - endbuf[7]='P'; - - //if outfile exists, unlink first (safer) - if (exists(argv[4])) - unlink(argv[4]); - - //open datafile for reading - if ((datafile=fopen(argv[2],"r"))==NULL) { - free(mybuf); - free(mystat); - printf("%s: Error opening %s\n",myname,argv[2]); - goto error; - } - - //open dbfile for reading - if ((dbfile=fopen(argv[3],"r"))==NULL) { - fclose(datafile); - free(mybuf); - free(mystat); - printf("%s: Error opening %s\n",myname,argv[3]); - goto error; - } - - //open outfile for writing - if ((outfile=fopen(argv[4],"a"))==NULL) { - fclose(dbfile); - fclose(datafile); - free(mybuf); - free(mystat); - printf("%s: Error opening %s\n",myname,argv[4]); - goto error; - } - - writefile(datafile,outfile); - writefile(dbfile,outfile); - fwrite(endbuf,1,8,outfile); - fclose(outfile); - fclose(dbfile); - fclose(datafile); - free(mybuf); - free(mystat); - exit(0); - - //SPLIT MODE - } else if (!(strcmp(argv[1],"split"))) { - - //check if infile exists - if (!(exists(argv[2]))) { - printf("%s: %s doesn't exist\n",myname,argv[2]); - free(mystat); - goto error; - } - - //store infile size for later use - - insize=mystat->st_size; - - //if datafile exists, unlink first (safer) - if (exists(argv[3])) - unlink(argv[3]); - - //if dbfile exists, unlink first (safer) - if (exists(argv[4])) - unlink(argv[4]); - - //open infile for reading - if ((infile=fopen(argv[2],"r"))==NULL) { - free(mybuf); - free(mystat); - printf("%s: Error opening %s\n",myname,argv[2]); - goto error; - } - - //read in end buffer - fseek(infile,-8,SEEK_END); - fread(endbuf,1,8,infile); - //quick end buffer read and verification - if ( (endbuf[4]!='S') || (endbuf[5]!='T') || (endbuf[6]!='O') || (endbuf[7]!='P') ) { - fclose(infile); - free(mybuf); - free(mystat); - printf("%s: %s appears to be corrupt (end buffer invalid)\n",myname,argv[2]); - goto error; - } - - printf(" %i %i %i %i\n",endbuf[0],endbuf[1],endbuf[2],endbuf[3]); - seekto=0; - seekto=seekto+endbuf[0]*256*256*256; - seekto=seekto+endbuf[1]*256*256; - seekto=seekto+endbuf[2]*256; - seekto=seekto+endbuf[3]; - - //open datafile for writing - if ((datafile=fopen(argv[3],"a"))==NULL) { - fclose(infile); - free(mybuf); - free(mystat); - printf("%s: Error opening %s\n",myname,argv[3]); - goto error; - } - - //open dbfile for writing - if ((dbfile=fopen(argv[4],"a"))==NULL) { - fclose(datafile); - fclose(infile); - free(mybuf); - free(mystat); - printf("%s: Error opening %s\n",myname,argv[4]); - goto error; - } - - rewind(infile); - printf("insize: %i seekto: %li\n",insize,seekto); - writefileto(infile,datafile,insize-(seekto+8)); - fseek(infile,-(seekto+8),SEEK_END); - writefileto(infile,dbfile,insize-8); - fclose(infile); - fclose(dbfile); - fclose(datafile); - free(mybuf); - free(mystat); - exit(0); - - } else { - free(mybuf); - free(mystat); - goto usage; - } - - usage: - printf("Usage: %s join DATAFILE DBFILE OUTFILE (datafile + dbfile -> outfile)\n %s split INFILE DATAFILE DBFILE (infile -> datafile + dbfile)\n",myname,myname); -error: - exit(1); -memalloc: - printf("%s: memory allocation error\n",myname); - exit(2); -} diff --git a/sys-apps/portage/files/unmerge b/sys-apps/portage/files/unmerge deleted file mode 100644 index 102de1d2f43c..000000000000 --- a/sys-apps/portage/files/unmerge +++ /dev/null @@ -1,128 +0,0 @@ -#!/usr/bin/env python -#This should be called like so: # unmerge mycategory/mypackage - -import sys -import os -norm=os.path.normpath -import string -from commands import * -category=os.environ["CATEGORY"] - -def pkgscript(x): - myresult=getstatusoutput("/usr/bin/ebuild "+myebuildfile+" "+x) - if myresult[0] or myresult[1]: - print - if myresult[0]: - print "Error code from",pkgname,x,"script --",myresult[0] - if myresult[1]: - print "Output from",pkgname,x,"script:" - print - print myresult[1] - -def md5(x): - myresult=getstatusoutput("/usr/bin/md5sum "+x) - return string.split(myresult[1]," ")[0] - -def getmtime(x): - return `os.lstat(x)[-2]` - -try: - myroot=os.environ["ROOT"] -except KeyError: - myroot="/" - -for pkgname in sys.argv[1:]: - if os.path.isdir(os.path.normpath(myroot+"var/db/pkg/"+category+"/"+pkgname)): - if myroot=="/": - print "Unmerging",pkgname+"..." - else: - print "Unmerging",pkgname,"from",myroot+"..." - print - else: - print pkgname,"not installed" - continue - try: contents=open(os.path.normpath(myroot+"var/db/pkg/"+category+"/"+pkgname+"/CONTENTS")) - except: - print "Error -- could not open CONTENTS file for", pkgname+". Aborting." - sys.exit(1) - pkgfiles={} - for line in contents.readlines(): - mydat=string.split(line) - # we do this so we can remove from non-root filesystems - # (use the ROOT var to allow maintenance on other partitions) - mydat[1]=os.path.normpath(myroot+mydat[1][1:]) - if mydat[0]=="obj": - #format: type, mtime, md5sum - pkgfiles[mydat[1]]=[mydat[0], mydat[3], mydat[2]] - elif mydat[0]=="dir": - #format: type - pkgfiles[mydat[1]]=[mydat[0] ] - elif mydat[0]=="sym": - #format: type, mtime, dest - pkgfiles[mydat[1]]=[mydat[0], mydat[4], mydat[3]] - else: - print "Error -- CONTENTS file for", pkgname, "is corrupt." - print ">>> "+line - sys.exit(1) - # we don't want to automatically remove the ebuild file listed - # in the CONTENTS file. We'll do after everything else has - # completed successfully. - myebuildfile=os.path.normpath(myroot+"var/db/pkg/"+category+"/"+pkgname+"/"+pkgname+".ebuild") - if pkgfiles.has_key(myebuildfile): - del pkgfiles[myebuildfile] - - mykeys=pkgfiles.keys() - mykeys.sort() - mykeys.reverse() - - #prerm script - pkgscript("prerm") - - for obj in mykeys: - obj=norm(obj) - if not os.path.exists(obj): - print "--- !found", pkgfiles[obj][0], obj - continue - if (pkgfiles[obj][0]!="dir") and (getmtime(obj) != pkgfiles[obj][1]): - print "--- !mtime", pkgfiles[obj][0], obj - continue - if pkgfiles[obj][0]=="dir": - if not os.path.isdir(obj): - print "--- !dir ","dir", obj - continue - if os.listdir(obj): - print "--- !empty","dir", obj - continue - os.rmdir(obj) - print "<<< ","dir",obj - elif pkgfiles[obj][0]=="sym": - if not os.path.islink(obj): - print "--- !sym ","sym", obj - continue - mydest=os.readlink(obj) - if mydest != pkgfiles[obj][2]: - print "--- !destn","sym", obj - continue - os.unlink(obj) - print "<<< ","sym",obj - elif pkgfiles[obj][0]=="obj": - if not os.path.isfile(obj): - print "--- !obj ","obj", obj - continue - mymd5=md5(obj) - if mymd5 != pkgfiles[obj][2]: - print "--- !md5 ","obj", obj - continue - os.unlink(obj) - print "<<< ","obj",obj - #postrm script - pkgscript("postrm") - #recursive cleanup - for thing in os.listdir(myroot+"var/db/pkg/"+category+"/"+pkgname): - os.unlink(myroot+"var/db/pkg/"+category+"/"+pkgname+"/"+thing) - os.rmdir(myroot+"var/db/pkg/"+category+"/"+pkgname) - print - if myroot=="/": - print pkgname,"unmerged." - else: - print pkgname,"unmerged from",myroot+"." diff --git a/sys-apps/portage/files/webtools/clogtohtml b/sys-apps/portage/files/webtools/clogtohtml deleted file mode 100755 index 9e456070bcbc..000000000000 --- a/sys-apps/portage/files/webtools/clogtohtml +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env python -"""Parse ChangeLog, no validation.""" - -import string -import portage -import sys -import os - -portdir=portage.getsetting("PORTDIR") -if not os.path.exists(portdir+"/ChangeLog"): - print "!!! Error: Can't find ChangeLog. Exiting." - print - sys.exit(1) -entry=0 -a=open(portdir+"/ChangeLog") -mylines=a.readlines() -pos=0 -print '<p class="itemdesc">' -while (pos<len(mylines)) and (entry<10): - curline=mylines[pos][:-1] - if len(curline)==0: - pos=pos+1 - continue - splitline=string.split(curline) - if splitline[0]=="date": - print '<table width="100%" border=0 cellspacing=0 cellpadding=0><tr><td align="center" class="infobox"><b>'+string.join(splitline[1:]," ")+"</b></td></tr></table>" - pos=pos+1 - continue - elif splitline[0]=="new": - pkgsplit=string.split(splitline[1],"/") - print "<b>New package",splitline[1]+"</b><br>" - elif splitline[0]=="upd": - pkgsplit=string.split(splitline[1],"/") - print "<b>Updated package",splitline[1],"to",splitline[3]+"</b><br>" - elif splitline[0]=="rel": - print "<h2>New Release! Gentoo Linux",splitline[1]+"</h2><br>" - desc="" - elif splitline[0]=="del": - print "<b>Removed package",splitline[1]+"</b><br>" - desc="" - pos=pos+2 - desc="" - while mylines[pos][:-1]!="": - desc=desc+" "+string.strip(mylines[pos][:-1]) - pos=pos+1 - if desc: - print '<p class="itemdesc">'+desc+'</p>' - print "<br>" - pos=pos+1 - entry=entry+1 -print '</p>' diff --git a/sys-apps/portage/files/webtools/pytext b/sys-apps/portage/files/webtools/pytext deleted file mode 100755 index f0bd4336d880..000000000000 --- a/sys-apps/portage/files/webtools/pytext +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env python - -# pytext 2.1 -# Copyright 1999-2000 Daniel Robbins -# Distributed under the GPL - -import sys - -def runfile(myarg): - "interprets a text file with embedded elements" - mylocals={} - try: - a=open(myarg,'r') - except IOError: - sys.stderr.write("!!! Error opening "+myarg+"!\n") - return - mylines=a.readlines() - a.close() - pos=0 - while pos<len(mylines): - if mylines[pos][0:8]=="<!--code": - mycode="" - pos=pos+1 - while (pos<len(mylines)) and (mylines[pos][0:3]!="-->"): - mycode=mycode+mylines[pos] - pos=pos+1 - exec(mycode,globals(),mylocals) - else: - sys.stdout.write(mylines[pos]) - pos=pos+1 - -if len(sys.argv)>1: - for x in sys.argv[1:]: - runfile(x) - sys.exit(0) -else: - sys.stderr.write("pytext 2.1 -- Copyright 1999-2000 Daniel Robbins. Distributed under the\nGNU Public License\n\nUsage: "+sys.argv[0]+" file0 [file1]...\n") - sys.exit(1) diff --git a/sys-apps/portage/files/xbuild/shell-test.py b/sys-apps/portage/files/xbuild/shell-test.py deleted file mode 100644 index cc88e5bd990f..000000000000 --- a/sys-apps/portage/files/xbuild/shell-test.py +++ /dev/null @@ -1,12 +0,0 @@ -import shlex -import string -f = open('test.parse') -lex = shlex.shlex(f) -lex.wordchars=string.digits+string.letters+"~!@#$%*_\:;?,./-+{}" -#"+-=><" -lex.quotes="" -token = ' ' -while token != '': - token = lex.get_token() - print token - diff --git a/sys-apps/portage/files/xbuild/test.parse b/sys-apps/portage/files/xbuild/test.parse deleted file mode 100755 index f3816eb5fba6..000000000000 --- a/sys-apps/portage/files/xbuild/test.parse +++ /dev/null @@ -1,19 +0,0 @@ -cd /usr/local/bin -a = `ls -l foo/bar` -b="asd;lfkjsdf;" -c="asdlfkj"foobar$foo$bar${foobar} -d=`ls -l foobar$oo$gar${foobar}`$foo -for x in a -do - echo a -done -if [ x == 1 ] -then - asdlfk - lasdk - asldkf - lsdk -done -if (x >=1) { - print foo bar -} diff --git a/sys-apps/portage/files/xbuild/xbuild-ideas.py b/sys-apps/portage/files/xbuild/xbuild-ideas.py deleted file mode 100644 index 8e02bdc884dd..000000000000 --- a/sys-apps/portage/files/xbuild/xbuild-ideas.py +++ /dev/null @@ -1,62 +0,0 @@ -class main(package): - name="sys-libs/glibc-2.1-r1" - sources="site1,site2/foo.tar.gz site3/bar.tar.gz" - sites={ "site1":"ftp://ftp.ibiblio.org/pub/linux/utils", - "site2":"http://www.gentoo.org/patches", - "site3":"http://foo.bar.com/oni" } - depend="sys-apps/foo >=sys-apps/bar-1.2" - rdepend=depend - -or... - -parent: - virtual/package -name: - sys-libs/glibc-2.1-r1 -sources: - site1,site2/foo.tar.gz - site3/bar.tar.gz -sites: - site1 ftp://ftp.ibiblio.org/pub/linux/utils - site2 http://www.gentoo.org/patches - site3 http://foo.bar.com/oni -depend: - sys-apps/foo - >=sys-apps/bar-1.2 -rdepend: - ${depend} -provides: - virtual/foo-bar-bar-jinks -install: - cd ${S}/foo - convert to: - bashobj.command("cd ${S}/foo") >> bashobj.cd(["/tmp/portage/etc/foo"]) ? - #features special variable expansion and evaluates special functions as - #python code - #OR - #advanced shell-like syntax - #python with ` `,${S},cd,etc support? maybe. - #create a bash object that has its own env settings... then send commands - #to this bash object for evaluation. - #will the shell specify strings like "this" or this (bash-style?) - -class bashobj: - cwd="/" - env={} - def command(self,string): - def cd(self,string): - def test(self,string): - [ x -gt 1 ] etc - def dobin(self,string): - def dodoc(self,string): - #what's nice is that these commands can have persistent metainformation - #that's not stored as environment variables. Which means more complex - #metainformation. - - #also, this bash shell program can exist in the same process as xbuild. - #just make the rest of the xbuild code (except xbuild arg parsing) independent - #of the os.cwd setting and you're all set. This object can control cwd. - - #toughest parts are for,while,test,if, recognizing things like && and || - #these are also parts of the shell interpreter that could be improved. - #good array support could be added. diff --git a/sys-apps/portage/files/xpak.py b/sys-apps/portage/files/xpak.py deleted file mode 100755 index d036aafeee8c..000000000000 --- a/sys-apps/portage/files/xpak.py +++ /dev/null @@ -1,154 +0,0 @@ -import sys -import os - -def addtolist(mylist,curdir): - for x in os.listdir("."): - if os.path.isdir(x): - os.chdir(x) - addtolist(mylist,curdir+x+"/") - os.chdir("..") - else: - mylist.append(curdir+x) - -def encodeint(myint): - part1=chr((myint >> 24 ) & 0x000000ff) - part2=chr((myint >> 16 ) & 0x000000ff) - part3=chr((myint >> 8 ) & 0x000000ff) - part4=chr(myint & 0x000000ff) - return part1+part2+part3+part4 - -def decodeint(mystring): - myint=0 - myint=myint+ord(mystring[3]) - myint=myint+(ord(mystring[2]) << 8) - myint=myint+(ord(mystring[1]) << 16) - myint=myint+(ord(mystring[0]) << 24) - return myint - -def xpak(rootdir,outfile): - origdir=os.getcwd() - os.chdir(rootdir) - mylist=[] - - addtolist(mylist,"") - mylist.sort() - - #Our list index has been created - - indexglob="" - indexpos=0 - dataglob="" - datapos=0 - for x in mylist: - a=open(x,"r") - newglob=a.read() - a.close() - mydatasize=len(newglob) - indexglob=indexglob+encodeint(len(x))+x+encodeint(datapos)+encodeint(mydatasize) - indexpos=indexpos+4+len(x) - dataglob=dataglob+newglob - datapos=datapos+mydatasize - os.chdir(origdir) - outf=open(outfile,"w") - outf.write("XPAKPACK"+encodeint(len(indexglob))+encodeint(len(dataglob))) - outf.write(indexglob) - outf.write(dataglob) - outf.write("XPAKSTOP") - outf.close() - -def xsplit(infile): - myfile=open(infile,"r") - mydat=myfile.read() - myfile.close() - if mydat[0:8]!="XPAKPACK": - return - if mydat[-8:]!="XPAKSTOP": - return - indexsize=decodeint(mydat[8:12]) - datasize=decodeint(mydat[12:16]) - print indexsize,datasize,datasize+indexsize+24 - myfile=open(infile+".index","w") - myfile.write(mydat[16:indexsize+16]) - myfile.close() - myfile=open(infile+".dat","w") - myfile.write(mydat[indexsize+16:-8]) - myfile.close() - -def getindex(infile): - myfile=open(infile,"r") - myheader=myfile.read(16) - if myheader[0:8]!="XPAKPACK": - myfile.close() - return - indexsize=decodeint(myheader[8:12]) - myindex=myfile.read(indexsize) - myfile.close() - return myindex - -def getboth(infile): - myfile=open(infile,"r") - myheader=myfile.read(16) - if myheader[0:8]!="XPAKPACK": - myfile.close() - return - indexsize=decodeint(myheader[8:12]) - datasize=decodeint(myheader[12:16]) - myindex=myfile.read(indexsize) - mydata=myfile.read(datasize) - myfile.close() - return [myindex,mydata] - -def listindex(myindex): - myindexlen=len(myindex) - startpos=0 - while ((startpos+8)<myindexlen): - mytestlen=decodeint(myindex[startpos:startpos+4]) - print myindex[startpos+4:startpos+4+mytestlen] - startpos=startpos+mytestlen+12 - -def searchindex(myindex,myitem): - mylen=len(myitem) - myindexlen=len(myindex) - startpos=0 - while ((startpos+8)<myindexlen): - mytestlen=decodeint(myindex[startpos:startpos+4]) - if mytestlen==mylen: - if myitem==myindex[startpos+4:startpos+4+mytestlen]: - #found - print "found!" - datapos=decodeint(myindex[startpos+4+mytestlen:startpos+8+mytestlen]); - datalen=decodeint(myindex[startpos+8+mytestlen:startpos+12+mytestlen]); - return [datapos,datalen] - startpos=startpos+mytestlen+12 - - -def getitem(myid,myitem): - myindex=myid[0] - mydata=myid[1] - myloc=searchindex(myindex,myitem) - if not myloc: - return None - return mydata[myloc[0]:myloc[0]+myloc[1]] - -def xpand(myid,mydest): - myindex=myid[0] - mydata=myid[1] - origdir=os.getcwd() - os.chdir(mydest) - myindexlen=len(myindex) - startpos=0 - while ((startpos+8)<myindexlen): - namelen=decodeint(myindex[startpos:startpos+4]) - datapos=decodeint(myindex[startpos+4+namelen:startpos+8+namelen]); - datalen=decodeint(myindex[startpos+8+namelen:startpos+12+namelen]); - myname=myindex[startpos+4:startpos+4+namelen] - dirname=os.path.dirname(myname) - if dirname: - if not os.path.exists(dirname): - os.makedirs(dirname) - mydat=open(myname,"w") - mydat.write(mydata[datapos:datapos+datalen]) - mydat.close() - startpos=startpos+namelen+12 - os.chdir(origdir) - |