From e5aa2a4ae3842ec7a07867b454682c2b9be59d25 Mon Sep 17 00:00:00 2001 From: dancer Date: Fri, 10 Jan 2003 06:34:18 +0000 Subject: +2003-01-10 Junichi Uekawa + + * pbuilder-user-mode-linux: use /var/cache/pbuilder/pbuilder-umlresult + as directory to mount hostfs for result. + (UML_DEBUGMODE): --uml-debugmode option to enable trace of + shell. + + * Makefile (install): create pbuilder-umlresult dir. + + * pbuilder-uml.conf.5: document UML_BUILDRESULT + + * pbuilder-uml.conf (UML_BUILDRESULT): add UML_BUILDRESULT= + + * pbuilder-user-mode-linux (EXTRAOPT): add support for exitcode. + Thanks mdz for the hint! + (UML_EXTRAOPT): try and implement BUILDRESULT + --- ChangeLog | 17 +++++++++++++++++ Makefile | 1 + debian/changelog | 10 ++++++++-- pbuilder-uml.conf | 1 + pbuilder-uml.conf.5 | 5 +++++ pbuilder-user-mode-linux | 38 +++++++++++++++++++++++++++++++++----- pbuilder-user-mode-linux.1 | 7 +++++-- 7 files changed, 70 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5d7e52c..f869d2d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2003-01-10 Junichi Uekawa + + * pbuilder-user-mode-linux: use /var/cache/pbuilder/pbuilder-umlresult + as directory to mount hostfs for result. + (UML_DEBUGMODE): --uml-debugmode option to enable trace of + shell. + + * Makefile (install): create pbuilder-umlresult dir. + + * pbuilder-uml.conf.5: document UML_BUILDRESULT + + * pbuilder-uml.conf (UML_BUILDRESULT): add UML_BUILDRESULT= + + * pbuilder-user-mode-linux (EXTRAOPT): add support for exitcode. + Thanks mdz for the hint! + (UML_EXTRAOPT): try and implement BUILDRESULT + 2003-01-09 Junichi Uekawa * pbuilder-user-mode-linux: use /var/cache/pbuilder/pbuilder-mnt diff --git a/Makefile b/Makefile index 61ffa2f..6a9d32e 100644 --- a/Makefile +++ b/Makefile @@ -17,6 +17,7 @@ install: $(INSTALL_DIRECTORY) $(DESTDIR)/usr/share/pbuilder $(INSTALL_DIRECTORY) $(DESTDIR)/usr/share/doc/pbuilder/examples $(INSTALL_DIRECTORY) $(DESTDIR)/var/cache/pbuilder/pbuilder-mnt + $(INSTALL_DIRECTORY) $(DESTDIR)/var/cache/pbuilder/pbuilder-umlresult $(INSTALL_EXECUTABLE) pbuilder-buildpackage $(DESTDIR)/usr/lib/pbuilder/ $(INSTALL_EXECUTABLE) pbuilder-buildpackage-funcs $(DESTDIR)/usr/lib/pbuilder/ $(INSTALL_EXECUTABLE) pbuilder-createbuildenv $(DESTDIR)/usr/lib/pbuilder/ diff --git a/debian/changelog b/debian/changelog index 1a6ffed..f5681a7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,14 @@ pbuilder (0.61) UNRELEASED; urgency=low * UML: set hostname inside UML. - - -- Junichi Uekawa Thu, 9 Jan 2003 17:42:24 +0900 + * UML: Add (almost) enough features to pbuilder-user-mode-linux + so that it can be ran from within pbuildd, and can be used as + an alternative to pbuilder + - set exitcode according to pbuilder exit code. + thanks to mdz for his hint. (closes: #175983) + - implement --buildresult with hostfs mounting. + + -- Junichi Uekawa Fri, 10 Jan 2003 13:59:15 +0900 pbuilder (0.60) unstable; urgency=low diff --git a/pbuilder-uml.conf b/pbuilder-uml.conf index 4103609..fce9858 100644 --- a/pbuilder-uml.conf +++ b/pbuilder-uml.conf @@ -11,6 +11,7 @@ UML_MOUNT_TMPFS="no" BUILDPLACE="${HOME}/tmp/" UML_MEM=128M UML_HOSTNAME=uml-host +UML_BUILDRESULT= diff --git a/pbuilder-uml.conf.5 b/pbuilder-uml.conf.5 index 4ce95df..85d3c29 100644 --- a/pbuilder-uml.conf.5 +++ b/pbuilder-uml.conf.5 @@ -57,6 +57,11 @@ Give more value to here. .BI "UML_HOSTNAME=" "uml-host" The hostname for the UML +.TP +.BI "UML_BUILDRESULT=" "/directory/of/build/result" +The directory where build result of pbuilder-user-mode-linux +is stored. + .SH AUTHOR Initial coding, and main maintenance is done by Junichi Uekawa . diff --git a/pbuilder-user-mode-linux b/pbuilder-user-mode-linux index e61cd62..61847f9 100755 --- a/pbuilder-user-mode-linux +++ b/pbuilder-user-mode-linux @@ -18,7 +18,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -set -e +set -e function cleanup_function () { rm -f ${INSIDE_PBUILDER} @@ -51,11 +51,13 @@ function operate_uml () { INSIDE_PBUILDER=$(tempfile) trap cleanup_function exit UML_CHROOT_MOUNTPOINT=/var/cache/pbuilder/pbuilder-mnt - + UML_CHROOT_BUILDRESULTMOUNTDIR=/var/cache/pbuilder/pbuilder-umlresult #The following script is ran inside UML as soon as it is started. cat < ${INSIDE_PBUILDER} #! /bin/bash +${UML_DEBUGMODE} + mount -t proc /proc /proc mount -t tmpfs /tmp /tmp mount -t ext2 /dev/ubd/1 ${UML_CHROOT_MOUNTPOINT} @@ -87,6 +89,7 @@ iface eth0 inet static IP cat < ${UML_CHROOT_MOUNTPOINT}/tmp/chrootshell #! /bin/bash +${UML_DEBUGMODE} # the shell executed inside chroot inside UML echo Starting network inside the chroot /etc/init.d/networking stop @@ -102,20 +105,39 @@ EXTRAOPT= if [ -n "${UML_DISTRIBUTION}" ]; then EXTRAOPT="--distribution ${UML_DISTRIBUTION}" fi -pbuilder "$1" ${UML_EXTRAOPT} \${EXTRAOPT} --buildresult "" --buildplace ${UML_CHROOT_MOUNTPOINT} --internal-build-uml ${BUILDING_DSC_FILE} +if [ -z "${UML_BUILDRESULT}" ]; then + BUILDRESULT= +else + echo " -> Mount build result dir outside UML [${UML_BUILDRESULT}] as [${UML_CHROOT_BUILDRESULTMOUNTDIR}]" + BUILDRESULT=${UML_CHROOT_BUILDRESULTMOUNTDIR} + mkdir -p ${UML_CHROOT_BUILDRESULTMOUNTDIR} + mount -t hostfs none "${UML_CHROOT_BUILDRESULTMOUNTDIR}" -o "${UML_BUILDRESULT}" +fi +pbuilder "$1" ${UML_EXTRAOPT} \${EXTRAOPT} --buildresult "\${BUILDRESULT}" --buildplace "${UML_CHROOT_MOUNTPOINT}" --internal-build-uml ${BUILDING_DSC_FILE} +echo \$? > /proc/exitcode echo "Umounting ${UML_CHROOT_MOUNTPOINT}" umount ${UML_CHROOT_MOUNTPOINT} +if [ -n "${UML_BUILDRESULT}" ]; then + umount "${UML_CHROOT_BUILDRESULTMOUNTDIR}" +fi EOF chmod a+x ${INSIDE_PBUILDER} echo Invoking: "linux mem=${UML_MEM} eth0=${MY_ETH0} con0=fd:0,fd:1 con=pty ubd0=/ ubd1=${PBUILDER_COW}${PBUILDER_UML_IMAGE} devfs=mount init=${INSIDE_PBUILDER}" - linux mem=${UML_MEM} eth0=${MY_ETH0} con0=fd:0,fd:1 con=pty ubd0=/ ubd1="${PBUILDER_COW}${PBUILDER_UML_IMAGE}" devfs=mount init=${INSIDE_PBUILDER} + if linux mem=${UML_MEM} eth0=${MY_ETH0} con0=fd:0,fd:1 con=pty ubd0=/ ubd1="${PBUILDER_COW}${PBUILDER_UML_IMAGE}" devfs=mount init=${INSIDE_PBUILDER} ; then + UML_EXITCODE=$? + echo " -> Successful exit from user-mode linux" + else + UML_EXITCODE=$? + echo " -> Exit code ${UML_EXITCODE}" + fi } PBUILDER_COW="" OPERATION="$1" UML_EXTRAOPT= +UML_DEBUGMODE= shift; while [ -n "$1" ] ; do @@ -160,6 +182,9 @@ while [ -n "$1" ] ; do UML_HOSTNAME="$2"; shift; shift; ;; + --uml-debugmode) + UML_DEBUGMODE="set -x"; + shift;; --distribution) UML_DISTRIBUTION="$2"; shift; shift; @@ -174,6 +199,7 @@ while [ -n "$1" ] ; do shift; shift;; --buildresult) # ignore buildresult + UML_BUILDRESULT=$(readlink -f "$2") shift;shift;; --logfile) exec > $(readlink -f "$2"); @@ -196,7 +222,7 @@ done BUILDING_DSC_FILE=$(readlink -f "$1") EXTRACLEANUP= - +UML_EXITCODE=1 case "${OPERATION}" in build) usecow @@ -219,3 +245,5 @@ case "${OPERATION}" in echo "Error: Unknown option [${OPERATION}] was specified " >&2 ;; esac + +exit ${UML_EXITCODE} diff --git a/pbuilder-user-mode-linux.1 b/pbuilder-user-mode-linux.1 index e660694..72ce908 100644 --- a/pbuilder-user-mode-linux.1 +++ b/pbuilder-user-mode-linux.1 @@ -116,9 +116,12 @@ Specify this option to make the output go to instead of standard output. .TP -.BI "--buildresult " "dummy" -A dummy option. +.BI "--buildresult " "/dir/to/build/result" +The directory where build result is placed to +.TP +.BI "--uml-debugmode" +Enable tracing of shell scripts used by pbuilder-user-mode-linux. .SH "NOTES" This software is in early stage of development. -- cgit v1.2.3