diff mbox

[Karmic] SRU: Fix virtual package build on i386

Message ID 1256989129-3054-1-git-send-email-stefan.bader@canonical.com
State Accepted
Headers show

Commit Message

Stefan Bader Oct. 31, 2009, 11:38 a.m. UTC
SRU Justification:

Impact: Running the kernel build from within debuild (which is done by
the buildds) seems to imply the -e shell option being set. This in
turn causes the copy loop, which takes modules from one main flavour
to the subflavour, to exit on the first wildcard rule which fails to
find any files. This is the case as with the "drivers/xen/*" line.
Everything after that is not going into the package.

Fix: Prevent the find command in the script from being a failure point.
If no files are found, just continue.
[The patch also fixes a small issue on printing the copied modules to
stdout. Before only the main module was printed multiple times, if there
were depending modules. Now the real module name is printed]

Testcase: Run "debuild -B" for the i386 architecture. Without this
patch, there are quite a lot modules missing. (Tested in PPA)

-Stefan


From ddcb071a37a446cb6ae62e4c6324daf55629c140 Mon Sep 17 00:00:00 2001
From: Stefan Bader <stefan.bader@canonical.com>
Date: Fri, 30 Oct 2009 17:26:27 +0000
Subject: [PATCH] UBUNTU: SAUCE: Fix sub-flavour script to not stop on missing directories

BugLink: http://bugs.launchpad.net/bugs/453073

The way the builders run the sub-flavour script seems to include setting
an option to exit loops when an error occurs within that loop. This will
happen when a wildcard entry is not found. Fix this by catching the
error condition and while being on it also fix the name printed on
install.

Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
---
 debian.master/scripts/sub-flavour |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

Comments

Colin Ian King Oct. 31, 2009, 12:23 p.m. UTC | #1
On Sat, 2009-10-31 at 11:38 +0000, Stefan Bader wrote:
> SRU Justification:
> 
> Impact: Running the kernel build from within debuild (which is done by
> the buildds) seems to imply the -e shell option being set. This in
> turn causes the copy loop, which takes modules from one main flavour
> to the subflavour, to exit on the first wildcard rule which fails to
> find any files. This is the case as with the "drivers/xen/*" line.
> Everything after that is not going into the package.
> 
> Fix: Prevent the find command in the script from being a failure point.
> If no files are found, just continue.
> [The patch also fixes a small issue on printing the copied modules to
> stdout. Before only the main module was printed multiple times, if there
> were depending modules. Now the real module name is printed]
> 
> Testcase: Run "debuild -B" for the i386 architecture. Without this
> patch, there are quite a lot modules missing. (Tested in PPA)
> 
> -Stefan
> 
> 
> From ddcb071a37a446cb6ae62e4c6324daf55629c140 Mon Sep 17 00:00:00 2001
> From: Stefan Bader <stefan.bader@canonical.com>
> Date: Fri, 30 Oct 2009 17:26:27 +0000
> Subject: [PATCH] UBUNTU: SAUCE: Fix sub-flavour script to not stop on missing directories
> 
> BugLink: http://bugs.launchpad.net/bugs/453073
> 
> The way the builders run the sub-flavour script seems to include setting
> an option to exit loops when an error occurs within that loop. This will
> happen when a wildcard entry is not found. Fix this by catching the
> error condition and while being on it also fix the name printed on
> install.
> 
> Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
> ---
>  debian.master/scripts/sub-flavour |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/debian.master/scripts/sub-flavour b/debian.master/scripts/sub-flavour
> index a5b7484..c0093a6 100644
> --- a/debian.master/scripts/sub-flavour
> +++ b/debian.master/scripts/sub-flavour
> @@ -27,7 +27,7 @@ do
>  	#
>  	if echo "$line" | grep '\*' > /dev/null
>  	then
> -		if [ `eval find "$line" -name '*.ko'|wc -l` -lt 1 ]
> +		if [ `eval find "$line" -name '*.ko' 2>/dev/null|wc -l` -lt 1 ]
>  		then
>  			echo SUB_INST Warning - No files in $line
>  		fi
> @@ -46,7 +46,7 @@ cat ${DEBIAN}/sub-flavours/$TO.list | while read line; do
>  	cd debian/$from_pkg/lib/modules/$ABI_RELEASE-$FROM/kernel;
>  	if echo "$line" | grep '\*' > /dev/null
>  	then
> -		eval find "$line" -name '*.ko'
> +		eval find "$line" -name '*.ko' 2>/dev/null || true
>  	elif [ -f "$line" ]
>  	then
>  		echo "$line"
> @@ -60,7 +60,7 @@ done | while read mod; do
>  	while read m; do
>  		m="${fromdir}$m"
>  		test -f debian/$to_pkg/$m && continue
> -		echo "SUB_INST installing: $mod"
> +		echo "SUB_INST installing: $m"
>  		install -D -m644 debian/$from_pkg/$m \
>  			debian/$to_pkg/$m
>  	done
> -- 
> 1.6.3.3
> 
> 

OK, looks sane to me, and the fix to the module printing was a good
catch too.

Acked-by: Colin King <colin.king@canonical.com>
Andy Whitcroft Oct. 31, 2009, 12:35 p.m. UTC | #2
On Sat, Oct 31, 2009 at 11:38:49AM +0000, Stefan Bader wrote:
> SRU Justification:
> 
> Impact: Running the kernel build from within debuild (which is done by
> the buildds) seems to imply the -e shell option being set. This in
> turn causes the copy loop, which takes modules from one main flavour
> to the subflavour, to exit on the first wildcard rule which fails to
> find any files. This is the case as with the "drivers/xen/*" line.
> Everything after that is not going into the package.
> 
> Fix: Prevent the find command in the script from being a failure point.
> If no files are found, just continue.
> [The patch also fixes a small issue on printing the copied modules to
> stdout. Before only the main module was printed multiple times, if there
> were depending modules. Now the real module name is printed]
> 
> Testcase: Run "debuild -B" for the i386 architecture. Without this
> patch, there are quite a lot modules missing. (Tested in PPA)

It also cleans up some spurious error messages in the output (which is
good).  Looks good to me, and the PPA packages look a lot bigger.

Acked-by: Andy Whitcroft <apw@canonical.com>

> From ddcb071a37a446cb6ae62e4c6324daf55629c140 Mon Sep 17 00:00:00 2001
> From: Stefan Bader <stefan.bader@canonical.com>
> Date: Fri, 30 Oct 2009 17:26:27 +0000
> Subject: [PATCH] UBUNTU: SAUCE: Fix sub-flavour script to not stop on missing directories
> 
> BugLink: http://bugs.launchpad.net/bugs/453073
> 
> The way the builders run the sub-flavour script seems to include setting
> an option to exit loops when an error occurs within that loop. This will
> happen when a wildcard entry is not found. Fix this by catching the
> error condition and while being on it also fix the name printed on
> install.
> 
> Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
> ---
>  debian.master/scripts/sub-flavour |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/debian.master/scripts/sub-flavour b/debian.master/scripts/sub-flavour
> index a5b7484..c0093a6 100644
> --- a/debian.master/scripts/sub-flavour
> +++ b/debian.master/scripts/sub-flavour
> @@ -27,7 +27,7 @@ do
>  	#
>  	if echo "$line" | grep '\*' > /dev/null
>  	then
> -		if [ `eval find "$line" -name '*.ko'|wc -l` -lt 1 ]
> +		if [ `eval find "$line" -name '*.ko' 2>/dev/null|wc -l` -lt 1 ]
>  		then
>  			echo SUB_INST Warning - No files in $line
>  		fi
> @@ -46,7 +46,7 @@ cat ${DEBIAN}/sub-flavours/$TO.list | while read line; do
>  	cd debian/$from_pkg/lib/modules/$ABI_RELEASE-$FROM/kernel;
>  	if echo "$line" | grep '\*' > /dev/null
>  	then
> -		eval find "$line" -name '*.ko'
> +		eval find "$line" -name '*.ko' 2>/dev/null || true
>  	elif [ -f "$line" ]
>  	then
>  		echo "$line"
> @@ -60,7 +60,7 @@ done | while read mod; do
>  	while read m; do
>  		m="${fromdir}$m"
>  		test -f debian/$to_pkg/$m && continue
> -		echo "SUB_INST installing: $mod"
> +		echo "SUB_INST installing: $m"
>  		install -D -m644 debian/$from_pkg/$m \
>  			debian/$to_pkg/$m
>  	done

-apw
Stefan Bader Oct. 31, 2009, 12:45 p.m. UTC | #3
applied
Tim Gardner Oct. 31, 2009, 1:52 p.m. UTC | #4
Stefan Bader wrote:
> SRU Justification:
> 
> Impact: Running the kernel build from within debuild (which is done by
> the buildds) seems to imply the -e shell option being set. This in
> turn causes the copy loop, which takes modules from one main flavour
> to the subflavour, to exit on the first wildcard rule which fails to
> find any files. This is the case as with the "drivers/xen/*" line.
> Everything after that is not going into the package.
> 
> Fix: Prevent the find command in the script from being a failure point.
> If no files are found, just continue.
> [The patch also fixes a small issue on printing the copied modules to
> stdout. Before only the main module was printed multiple times, if there
> were depending modules. Now the real module name is printed]
> 
> Testcase: Run "debuild -B" for the i386 architecture. Without this
> patch, there are quite a lot modules missing. (Tested in PPA)
> 
> -Stefan
> 

The root cause for this change in behavior is bash which was revised
from 3.x to 4.x during the Karmic development cycle. Evidentally the 4.x
version strictly enforces '-e' semantics. I whacked on the sub-flavours
script when that happened, but I'm clearly not the best shell programmer
:) Good catches.

rtg
diff mbox

Patch

diff --git a/debian.master/scripts/sub-flavour b/debian.master/scripts/sub-flavour
index a5b7484..c0093a6 100644
--- a/debian.master/scripts/sub-flavour
+++ b/debian.master/scripts/sub-flavour
@@ -27,7 +27,7 @@  do
 	#
 	if echo "$line" | grep '\*' > /dev/null
 	then
-		if [ `eval find "$line" -name '*.ko'|wc -l` -lt 1 ]
+		if [ `eval find "$line" -name '*.ko' 2>/dev/null|wc -l` -lt 1 ]
 		then
 			echo SUB_INST Warning - No files in $line
 		fi
@@ -46,7 +46,7 @@  cat ${DEBIAN}/sub-flavours/$TO.list | while read line; do
 	cd debian/$from_pkg/lib/modules/$ABI_RELEASE-$FROM/kernel;
 	if echo "$line" | grep '\*' > /dev/null
 	then
-		eval find "$line" -name '*.ko'
+		eval find "$line" -name '*.ko' 2>/dev/null || true
 	elif [ -f "$line" ]
 	then
 		echo "$line"
@@ -60,7 +60,7 @@  done | while read mod; do
 	while read m; do
 		m="${fromdir}$m"
 		test -f debian/$to_pkg/$m && continue
-		echo "SUB_INST installing: $mod"
+		echo "SUB_INST installing: $m"
 		install -D -m644 debian/$from_pkg/$m \
 			debian/$to_pkg/$m
 	done