diff options
author | Peter Gavin <pete@gentoo.org> | 2001-08-07 22:59:56 +0000 |
---|---|---|
committer | Peter Gavin <pete@gentoo.org> | 2001-08-07 22:59:56 +0000 |
commit | e91a61846fbb67a381ce6b076fca0cb153113ad8 (patch) | |
tree | 998e8fa616440a55a138da797534c2f78a0f59a7 /scripts | |
parent | fixed header (diff) | |
download | historical-e91a61846fbb67a381ce6b076fca0cb153113ad8.tar.gz historical-e91a61846fbb67a381ce6b076fca0cb153113ad8.tar.bz2 historical-e91a61846fbb67a381ce6b076fca0cb153113ad8.zip |
*** empty log message ***
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/autobuildimg.sh | 31 | ||||
-rw-r--r-- | scripts/autodist.sh | 88 | ||||
-rw-r--r-- | scripts/sortpkglist.py | 35 |
3 files changed, 150 insertions, 4 deletions
diff --git a/scripts/autobuildimg.sh b/scripts/autobuildimg.sh new file mode 100644 index 000000000000..fcf46836b931 --- /dev/null +++ b/scripts/autobuildimg.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +export USE=build +export CFLAGS="-O2 -mcpu=i486 -march=i486 -O2 -pipe" +export CXXFLAGS="${CFLAGS}" +export CHOST="i486-pc-linux-gnu" +export ROOT=/tmp/autobuildimg +export STEPS="clean unpack compile install qmerge clean" + +TODAY=`date '+%Y%m%d'` + +[ -z "${PORTDIR}" ] && PORTDIR=/usr/portage +[ -z "${BUILDTARBALL}" ] && BUILDTARBALL="build-${TODAY}.tbz2" +[ -z "${BUILD_PACKAGES}" ] && BUILD_PACKAGES=`ls -1 ${PORTDIR}/files/build-*.packages | sort | tail -1` + +echo ">>> Cleaning up ${ROOT}..." +rm -rf "${ROOT}" +mkdir -p "${ROOT}" + +scripts/autocompile.sh "${BUILD_PACKAGES}" + +rm -rf "${ROOT}/tmp" +mkdir -p ${ROOT}/tmp +chown root.root ${ROOT}/tmp +chmod 1777 ${ROOT}/tmp + +echo ">>> Creating ${BUILDTARBALL}..." +cd ${ROOT} +tar -cj --numeric-owner -p -f "${PORTDIR}/distribution/${BUILDTARBALL}" . + +rm -rf ${ROOT} diff --git a/scripts/autodist.sh b/scripts/autodist.sh index 985b7ecb9997..006c20526527 100644 --- a/scripts/autodist.sh +++ b/scripts/autodist.sh @@ -1,6 +1,13 @@ #!/bin/bash +runlog () { + echo "Running ${1+${@}}..." 1>&3 + ${1+"${@}"} 1>&3 2>&1 + echo 1>&3 +} + TODAY=`date '+%Y%m%d'` +FIRSTDIR=`pwd` # ok, this script builds: # @@ -15,12 +22,21 @@ TODAY=`date '+%Y%m%d'` BUILDROOT="${AUTODISTDIR}/buildroot" ISOROOT="${AUTODISTDIR}/isoroot" INITRDROOT="${AUTODISTDIR}/initrdroot" +INITRDIMG="${AUTODISTDIR}/initrdimg" +USRIMG="${AUTODISTDIR}/usrimg" [ -z "${BUILDTARBALL}" ] && BUILDTARBALL="build-${TODAY}.tbz2" [ -z "${SYSTARBALL}" ] && SYSTARBALL="sys-${TODAY}.tbz2" # shouldn't allow CFLAGS to be overridden export CFLAGS="-O2 -mcpu=i486 -march=i486" +export CXXFLAGS="${CFLAGS}" +export CHOST="i486-pc-linux-gnu" [ -d "${DISTRODIR}" ] || mkdir -p "${DISTRODIR}" +[ -z "${CONTINUE}" ] && CONTINUE=no +if [ "${CONTINUE}" = "yes" ] +then + CHECK=yes +fi [ -z "${ISOINITRD_PACKAGES}" ] && ISOINITRD_PACKAGES=`ls -1 ${PORTDIR}/files/isoinitrd-*.packages | sort | tail -1` [ -z "${BUILD_PACKAGES}" ] && BUILD_PACKAGES=`ls -1 ${PORTDIR}/files/build-*.packages | sort | tail -1` @@ -29,6 +45,19 @@ export CFLAGS="-O2 -mcpu=i486 -march=i486" [ -z "${KERNEL_VERSION}" ] && KERNEL_VERSION="`echo ${KERNEL_SRC} | sed 's,.*-\([0-9]\.[0-9]\.[0-9]\+\(-ac[0-9]\+\)\?\)$,\1,'`" [ -z "${INITRD_USE}" ] && INITRD_USE="bootcd lvm ext3" +# size of the initrd in kbytes +[ -z "${INITRD_SIZE}" ] && INITRD_SIZE=24576 +[ -z "${INITRD_BSIZE}" ] && INITRD_BSIZE=4096 +[ -z "${LOOPDEV}" ] && LOOPDEV=/dev/loop/0 +# check to see if this loop device is in use +if losetup ${LOOPDEV} &> /dev/null +then + echo "${LOOPDEV} is in use. Please specify another loop device by" + echo "setting the environment variable LOOPDEV." + exit 1 +fi + +exec 3> ${AUTODISTDIR}/autodist.log export PORTDIR export DISTRODIR @@ -60,15 +89,18 @@ echo ">>> Using SYS_PACKAGES=${SYS_PACKAGES}" echo ">>> Using KERNEL_SRC=${KERNEL_SRC}" echo ">>> Using KERNEL_VERSION=${KERNEL_VERSION}" -echo ">>> Cleaning up ${AUTODISTDIR}..." -rm -rf ${AUTODISTDIR} +if [ "${CONTINUE}" != "yes" ] +then + echo ">>> Cleaning up ${AUTODISTDIR}..." + rm -rf ${AUTODISTDIR} +fi echo ">>> Creating ISO directory tree..." mkdir -pv ${ISOROOT}/{doc,gentoo{,/distfiles,/packages{,/All}},isolinux{,/kernels},stuff} echo ">>> Building initrd packages..." mkdir -p ${INITRDROOT} -ERRQUIT=yes CHECK=no USE="${INITRD_USE}" ROOT="${INITRDROOT}" STEPS="clean unpack compile install qmerge clean" ${PORTDIR}/scripts/autocompile.sh ${ISOINITRD_PACKAGES} +ERRQUIT=yes CHECK="${CHECK}" USE="${INITRD_USE}" ROOT="${INITRDROOT}" STEPS="clean unpack compile install qmerge clean" ${PORTDIR}/scripts/autocompile.sh ${ISOINITRD_PACKAGES} if [ ${?} != 0 ] then echo "Error building initrd packages, quitting" @@ -81,7 +113,55 @@ chown root.root ${INITRDROOT}/tmp chmod 1777 ${INITRDROOT}/tmp echo ">>> Setting up initrd..." -find ${INITRDROOT}/etc -name "*._cfg_*" exec rm -vf {} \; +find ${INITRDROOT}/etc -name "*._cfg_*" -exec rm -vf {} \; ROOT=${INITRDROOT} rc-update autogen boot force ROOT=${INITRDROOT} rc-update autogen normal force ROOT=${INITRDROOT} rc-update autogen halt force + +echo ">>> Creating initrd.img..." +# /usr goes in its own image +if [ "${CONTINUE}" != "yes" ] || [ ! -d ${AUTODISTDIR}/initrdusr ] +then + mv ${INITRDROOT}/usr ${AUTODISTDIR}/initrdusr + mkdir ${INITRDROOT}/usr +fi + +runlog dd if=/dev/zero of=${AUTODISTDIR}/initrd.img bs=${INITRD_SIZE} count=1024 +runlog losetup ${LOOPDEV} ${AUTODISTDIR}/initrd.img +runlog mke2fs ${LOOPDEV} +mkdir -p ${INITRDIMG} +runlog mount ${LOOPDEV} ${INITRDIMG} +cd ${INITRDROOT} +# cpio is best for this kinda thing +echo -n ">>> Copying files" +find . -print0 | cpio -p -0dm --quiet --dot ${INITRDIMG} +echo +umount ${INITRDIMG} +runlog losetup -d ${LOOPDEV} +echo ">>> Compressing initrd..." +gzip -9 ${AUTODISTDIR}/initrd.img +mv -f ${AUTODISTDIR}/initrd.img.gz ${AUTODISTDIR}/initrd.img + +echo ">>> Creating usr.img..." +usrsize=`du -sk ${AUTODISTDIR}/initrdusr | sed 's,\([0-9]\+\).*,\1,'` +# it doesn't hurt to pad it a bit :) +usrsize=`expr ${usrsize} + 256` +# lets make it an even multiple of INITRD_BSIZE bytes +bsizek=`expr ${INITRD_BSIZE} / 1024` +usrsize=`expr ${usrsize} / ${bsizek}` +usrsize=`expr ${usrsize} + 1` +runlog dd if=/dev/zero of=${AUTODISTDIR}/usr.img bs=${INITRD_BSIZE} count=${usrsize} +mkdir -p ${AUTODISTDIR}/initrdusrimg +runlog losetup ${LOOPDEV} ${AUTODISTDIR}/usr.img +runlog mke2fs ${LOOPDEV} +runlog mount ${LOOPDEV} ${AUTODISTDIR}/initrdusrimg +cd ${AUTODISTDIR}/initrdusr +# cpio is best for this kinda thing +echo -n ">>> Copying files" +find . -print0 | cpio -p -0dm --quiet --dot ${AUTODISTDIR}/initrdusrimg +echo +runlog umount ${AUTODISTDIR}/initrdusrimg +runlog losetup -d ${LOOPDEV} +echo ">>> Compressing usr.img..." +create_compressed_fs ${AUTODISTDIR}/usr.img 65536 > ${AUTODISTDIR}/usr.img.compressed 2>&3 +mv ${AUTODISTDIR}/usr.img.compressed ${AUTODISTDIR}/usr.img diff --git a/scripts/sortpkglist.py b/scripts/sortpkglist.py index c589046e7476..673b5de9de99 100644 --- a/scripts/sortpkglist.py +++ b/scripts/sortpkglist.py @@ -7,4 +7,39 @@ import portage import sys +import os + +class depgraph: + pass + +class depgraph_node: + def __init__(self, info): + self.__info = info + +class packagelisttree(portage.packagetree): + def __init__(self, listfile, virtual=None): + portage.packagetree.__init__(self, virtual) + self.listfile = listfile + +class ebuildinfo: + def __init__(self, ebuildfile): + if not os.path.exists(ebuildfile): + print "!!! %s is an invalid ebuild file name!" % (ebuildfile) + sys.exit(1) + if ebuildfile[0:2] == './': + ebuildfile = ebuildfile[2:] + self.filename = ebuildfile + self.category = os.path.basename(os.path.normpath(os.path.dirname(ebuildfile) + "/..")) + self.pf = os.path.basename(ebuildfile[:-7]) + pkgsplit = portage.pkgsplit(self.pf, 0) + if pkgsplit == None: + print "!!! %s is an invalid ebuild file name!" % (ebuildfile) + sys.exit(1) + self.pn = pkgsplit[0] + self.pv = pkgsplit[1] + self.p = "%s-%s" % (self.pn, self.pv) + if pkgsplit[2] == "0": + self.pvr = self.pv + else: + self.pvr = "%s-r%s" % (self.pv, pkgsplit[2]) |