Package: pbuilder-uml
Version: 0.179
Severity: wishlist
Tags: patch

Hi,
while trying to switch from pbuilder to pbuilder-uml I lack support
option --debbuildopts in pbuilder-user-mode-linux. I tried to figure
out this a bit and to change some snipets of shell code around to
quote options properly. The attached code is only a first idea to get
support for $subject not tested in other modes of pbuilder operation.

I think, the main point is quoting values with printf -v var "%q".
Maybe it can be useful even it is far from its final form. :)

Best Regards
-- 
Zito

-- System Information:
Debian Release: 4.0
  APT prefers stable
  APT policy: (990, 'stable'), (500, 'unstable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-6-xen-686
Locale: LANG=C, LC_CTYPE=cs_CZ.ISO-8859-2 (charmap=ISO-8859-2)

Versions of packages pbuilder-uml depends on:
ii  pbuilder        0.179                    personal package builder for Debia
ii  rootstrap       0.3.24-4                 A tool for building complete Linux
ii  user-mode-linux 2.6.18-1um-2etch.18etch1 User-mode Linux (kernel)

pbuilder-uml recommends no packages.

-- no debconf information
diff --git a/pbuilder-uml-checkparams b/pbuilder-uml-checkparams
index 99d0920..a6ae5ec 100644
--- a/pbuilder-uml-checkparams
+++ b/pbuilder-uml-checkparams
@@ -117,6 +117,10 @@ while [ -n "$1" ] ; do
 		exit 1
 	    fi
 	    shift; shift;; 
+	--debbuildopts)
+	    DEBBUILDOPTS="$2";
+	    shift; shift;
+	    ;;
 	--logfile)
 	    exec > "$2";
 	    exec 2>&1
diff --git a/pbuilder-user-mode-linux b/pbuilder-user-mode-linux
index 485b1a8..f89c4e2 100755
--- a/pbuilder-user-mode-linux
+++ b/pbuilder-user-mode-linux
@@ -148,7 +148,11 @@ else
   mkdir -p ${UML_CHROOT_BUILDRESULTMOUNTDIR} || true
   mount -t hostfs none "${UML_CHROOT_BUILDRESULTMOUNTDIR}" -o "${UML_BUILDRESULT}"
 fi
-pbuilder "$1" ${UML_EXTRAOPT} [EMAIL PROTECTED] --buildresult "\${BUILDRESULT}" --buildplace "${UML_CHROOT_MOUNTPOINT}" --internal-build-uml ${UML_DEBUGMODE:+--debug} ${BUILDING_DSC_FILE}  ${UML_EXECUTE_EXTRAOPT} 
+DEBBUILDOPTS=$(printf %q "${DEBBUILDOPTS}")
+if [ -n "$DEBBUILDOPTS" ]; then
+  echo " -> DEBBUILDOPTS=$DEBBUILDOPTS"
+fi
+pbuilder "$1" ${UML_EXTRAOPT} [EMAIL PROTECTED] --buildresult "\${BUILDRESULT}" \${DEBBUILDOPTS:+--debbuildopts} \${DEBBUILDOPTS:+"\$DEBBUILDOPTS"} --buildplace "${UML_CHROOT_MOUNTPOINT}" --internal-build-uml ${UML_DEBUGMODE:+--debug} ${BUILDING_DSC_FILE}  ${UML_EXECUTE_EXTRAOPT} 
 echo \$? > /proc/exitcode
 
 if [ -n "\${kernel_modules}" ] ; then
@@ -211,7 +215,10 @@ case "${OPERATION}" in
 	    EXTRACLEANUP=cleancow
 	fi
 	shift;
-	UML_EXECUTE_EXTRAOPT="${UML_EXECUTE_EXTRAOPT} $@"
+	for arg
+	do
+	    printf -v UML_EXECUTE_EXTRAOPT "${UML_EXECUTE_EXTRAOPT} %q" "$arg"
+	done
 	operate_uml execute 
 	;;
     dumpconfig)
diff --git a/pdebuild-user-mode-linux b/pdebuild-user-mode-linux
index 3e441df..a7fcb59 100644
--- a/pdebuild-user-mode-linux
+++ b/pdebuild-user-mode-linux
@@ -37,17 +37,18 @@ ARCHITECTURE=$(dpkg-architecture -qDEB_HOST_ARCH)
 
 
 if [ "${USE_PDEBUILD_INTERNAL}" = 'yes' ]; then
-    if [ ! readlink -f .. ]; then
+    updir=$(readlink -f ..)
+    if [ ! -d "$updir" ]; then
 	echo "E: Cannot find .. dir from PWD=$(pwd)" >&2 
 	exit 1
     fi
-    pbuilder-user-mode-linux execute "$@" --bindmounts $(readlink -f ..) /usr/lib/pbuilder/pdebuild-internal ${PWD} --debbuildopts "${DEBBUILDOPTS}"
+    pbuilder-user-mode-linux execute "$@" --bindmounts "$updir" /usr/lib/pbuilder/pdebuild-internal ${PWD} --debbuildopts "${DEBBUILDOPTS}"
 else
     if ! dpkg-checkbuilddeps -B; then
 	echo "W: Unmet build-dependency in source" >&2 
     fi
     echo "dpkg-buildpackage -S -us -uc -r${BUILDSOURCEROOTCMD} $DEBBUILDOPTS" | /bin/bash
-    pbuilder-user-mode-linux build "$@" --buildresult "${UML_BUILDRESULT}" ../"${PKG_SOURCENAME}_${PKG_VERSION}".dsc
+    pbuilder-user-mode-linux build "$@" --buildresult "${UML_BUILDRESULT}" ${DEBBUILDOPTS:+--debbuildopts} ${DEBBUILDOPTS:+"$DEBBUILDOPTS"} ../"${PKG_SOURCENAME}_${PKG_VERSION}".dsc
 fi
 
 # do signing with optional key specifier

Reply via email to