Patchwork [1/1] UBUNTU: record the compiler in the ABI and check for inconsistant builds

login
register
mail settings
Submitter Andy Whitcroft
Date Aug. 19, 2011, 11:26 a.m.
Message ID <1313753166-4622-2-git-send-email-apw@canonical.com>
Download mbox | patch
Permalink /patch/110585/
State New
Headers show

Comments

Andy Whitcroft - Aug. 19, 2011, 11:26 a.m.
When pulling the compiled kernels to extract the ABI information also
extract the compiler used for that build.  Record the result in the abi
directory so it is also recorded historically.

Signed-off-by: Andy Whitcroft <apw@canonical.com>
---
 debian/scripts/misc/getabis |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
Stefan Bader - Aug. 19, 2011, 12:44 p.m.
On 19.08.2011 13:26, Andy Whitcroft wrote:
> When pulling the compiled kernels to extract the ABI information also
> extract the compiler used for that build.  Record the result in the abi
> directory so it is also recorded historically.
> 
> Signed-off-by: Andy Whitcroft <apw@canonical.com>
> ---
>  debian/scripts/misc/getabis |   19 +++++++++++++++++++
>  1 files changed, 19 insertions(+), 0 deletions(-)
> 
> diff --git a/debian/scripts/misc/getabis b/debian/scripts/misc/getabis
> index 2a1fc55..0556f8e 100755
> --- a/debian/scripts/misc/getabis
> +++ b/debian/scripts/misc/getabis
> @@ -53,6 +53,20 @@ getall() {
>  			(cd tmp; find lib/modules/$verabi-$sub/kernel -name '*.ko') | \
>  				sed -e 's/.*\/\([^\/]*\)\.ko/\1/' | sort > \
>  				$abidir/$arch/$sub.modules
> +			(
> +				cd tmp;
> +				ko=`find lib/modules/$verabi-$sub/kernel -name '*.ko' | head -1`
> +				readelf -p .comment "$ko" | awk '
> +					($1 == "[") {
> +						printf("%s", $3);
> +						for (n=4; n<=NF; n++) {
> +							printf(" %s", $n);
> +						}
> +						print ""
> +					}' | sort -u >$abidir/$arch/$sub.compiler
> +				version=`cat $abidir/$arch/$sub.compiler`
> +				echo -n "$version..."
> +			)
>  			rm -rf tmp $filename
>  			echo "done."
>  		else
> @@ -73,4 +87,9 @@ echo $abi > $abidir/abiname
>  
>  . $DEBIAN/etc/getabis
>  
> +compilers=`cat $abidir/*/*.compiler | sort -u | wc -l`
> +if [ "$compilers" != 1 ]; then
> +	echo "WARNING: inconsistant compiler versions detected" 1>&2
> +fi
> +
>  rmdir $tmpdir

Guess it should work. The elf output seems to contain multiple lines (which I am
not sure could be different) but there only should be one compiler possible per
binary.

Not sure this is really simpler but you could do the awk like:

awk '/CC:/{sub(/^ *\[[^\]]*\] */, ""); print}'

Overall ok though... so

Ack

-Stefan
Leann Ogasawara - Aug. 19, 2011, 1:22 p.m.
Applied to Oneiric master-next.  I applied it to P master-next as well.

Thanks,
Leann

On Fri, 2011-08-19 at 12:26 +0100, Andy Whitcroft wrote:
> When pulling the compiled kernels to extract the ABI information also
> extract the compiler used for that build.  Record the result in the abi
> directory so it is also recorded historically.
> 
> Signed-off-by: Andy Whitcroft <apw@canonical.com>
> ---
>  debian/scripts/misc/getabis |   19 +++++++++++++++++++
>  1 files changed, 19 insertions(+), 0 deletions(-)
> 
> diff --git a/debian/scripts/misc/getabis b/debian/scripts/misc/getabis
> index 2a1fc55..0556f8e 100755
> --- a/debian/scripts/misc/getabis
> +++ b/debian/scripts/misc/getabis
> @@ -53,6 +53,20 @@ getall() {
>  			(cd tmp; find lib/modules/$verabi-$sub/kernel -name '*.ko') | \
>  				sed -e 's/.*\/\([^\/]*\)\.ko/\1/' | sort > \
>  				$abidir/$arch/$sub.modules
> +			(
> +				cd tmp;
> +				ko=`find lib/modules/$verabi-$sub/kernel -name '*.ko' | head -1`
> +				readelf -p .comment "$ko" | awk '
> +					($1 == "[") {
> +						printf("%s", $3);
> +						for (n=4; n<=NF; n++) {
> +							printf(" %s", $n);
> +						}
> +						print ""
> +					}' | sort -u >$abidir/$arch/$sub.compiler
> +				version=`cat $abidir/$arch/$sub.compiler`
> +				echo -n "$version..."
> +			)
>  			rm -rf tmp $filename
>  			echo "done."
>  		else
> @@ -73,4 +87,9 @@ echo $abi > $abidir/abiname
>  
>  . $DEBIAN/etc/getabis
>  
> +compilers=`cat $abidir/*/*.compiler | sort -u | wc -l`
> +if [ "$compilers" != 1 ]; then
> +	echo "WARNING: inconsistant compiler versions detected" 1>&2
> +fi
> +
>  rmdir $tmpdir
> -- 
> 1.7.4.1
> 
>

Patch

diff --git a/debian/scripts/misc/getabis b/debian/scripts/misc/getabis
index 2a1fc55..0556f8e 100755
--- a/debian/scripts/misc/getabis
+++ b/debian/scripts/misc/getabis
@@ -53,6 +53,20 @@  getall() {
 			(cd tmp; find lib/modules/$verabi-$sub/kernel -name '*.ko') | \
 				sed -e 's/.*\/\([^\/]*\)\.ko/\1/' | sort > \
 				$abidir/$arch/$sub.modules
+			(
+				cd tmp;
+				ko=`find lib/modules/$verabi-$sub/kernel -name '*.ko' | head -1`
+				readelf -p .comment "$ko" | awk '
+					($1 == "[") {
+						printf("%s", $3);
+						for (n=4; n<=NF; n++) {
+							printf(" %s", $n);
+						}
+						print ""
+					}' | sort -u >$abidir/$arch/$sub.compiler
+				version=`cat $abidir/$arch/$sub.compiler`
+				echo -n "$version..."
+			)
 			rm -rf tmp $filename
 			echo "done."
 		else
@@ -73,4 +87,9 @@  echo $abi > $abidir/abiname
 
 . $DEBIAN/etc/getabis
 
+compilers=`cat $abidir/*/*.compiler | sort -u | wc -l`
+if [ "$compilers" != 1 ]; then
+	echo "WARNING: inconsistant compiler versions detected" 1>&2
+fi
+
 rmdir $tmpdir