[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [PATCH] jenkins.debian.net: Fix architecture check



On Wed, Mar 12, 2014 at 10:28:31AM +0100, Holger Levsen wrote:
> Hi Wouter,
> 
> seems your patch is broken:
> 
> from #debian-qa:
> 
> < KGB-1> | 08:39:35> d-i_build_flash-kernel: Build failed in Jenkins. See <http://jenkins.debian.net/job/d-i_build_flash-kernel/48/changes>
> < ijc> | Not sure about that jenkins failure, looks like infra rather than the pkg: dpkg-genchanges: error: cannot read files list file: No such file or directory
> < h01ger> | hm. 47 "worked", but only because it thought it could not be build on amd64
> < h01ger> | ijc: is that package to be build on amd64?
> < ijc> ah, no, its an arm thing. That would explain it!
> < h01ger> | wouter recently added a patch to fix the architecture check
> < ijc> a patch to the infra, not flash-kernel, right?
> < h01ger> | ijc: yes
> < h01ger> | 81051c4fc1 in git.debian.org/git/users/holger/jenkins.debian.net.git
> 
> Looking at it, I assume this
> 	 "if ! dpkg-architecture -i$ARCH ; then" 
> needs to be corrected to 
> 	"if ! dpkg-architecture -i$MYARCH ; then"

No, certainly not. That will always be true.

dpkg-architecture -i<spec>

will check if <spec> is an architecture wildcard that matches the
current architecture. For instance, if I run

dpkg-architecture -ilinux-any

on a machine running Linux on any architecture, it will return true.

The problem is that I forgot that control files of source packages which
provide more than one binary package will contain more than one
"Architecture:" line.

I could fix that, but there's actually an easier way, if you have
debhelper installed. Drop all the grepping; then:

if [ $(dh_listpackages | wc -l) -eq 0 ]; then
	<...error out...>
fi

dh_listpackages will list the packages that debhelper "will act upon" on this
architecture. If the architecture wildcard for a package doesn't match our
architecture, then the package isn't listed.

> but I need to wake up more first before applying this...
> 
> $ git show 81051c4fc12865b61759801ab2aa5ad00fe9b432
> commit 81051c4fc12865b61759801ab2aa5ad00fe9b432
> Author: Wouter Verhelst <w@uter.be>
> Date:   Tue Feb 25 08:28:04 2014 +0100
> 
>     Fix architecture check
>     
>     d-i_build.sh checks the architecture by parsing a hardcoded list of
>     architecture wildcards. It misses the wildcards of the form <os>-any and
>     any-<cpu>, however, which have been supported since a fair while now.
>     
>     This has caused jenkins to (incorrectly) skip the builds for partman-nbd
>     up until partman-nbd 0.22 (which reverted back to Architecture: all).
>     
>     Rather than trying to expand the hardcoded list, instead use
>     dpkg-architecture's -i option, which checks if the current architecture
>     matches the wildcard architecture specified as an argument to -i. This
>     option has been available since dpkg 1.13.13, i.e., pre-oldstable.
> 
> diff --git a/bin/d-i_build.sh b/bin/d-i_build.sh
> index 3a5f602..f5dc063 100755
> --- a/bin/d-i_build.sh
> +++ b/bin/d-i_build.sh
> @@ -36,12 +36,14 @@ pdebuild_package() {
>                 echo "Warning: A source package without debian/control, so no build will be tried."
>                 return
>         fi
> -       ARCH=$(dpkg --print-architecture)
> -       EGREP_PATTERN="( all| any| $ARCH)"
> -       if [ ! $(grep "Architecture:" debian/control | egrep "$EGREP_PATTERN" | wc -l ) -gt 0 ] ; then
> -               echo "This package is not to be supposed to be build on $ARCH:"
> -               grep "Architecture:" debian/control
> -               return
> +       ARCH=$(grep 'Architecture:' debian/control | cut -d' ' -f 2)
> +       MYARCH=$(dpkg --print-architecture)
> +       if [ $ARCH != "all" ] ; then
> +               if ! dpkg-architecture -i$ARCH ; then
> +                       echo "This package is not to be supposed to be build on $MYARCH:"
> +                       grep "Architecture:" debian/control
> +                       return
> +               fi
>         fi
>         #
>         # prepare build
> 
> 
> 
> cheers,
> 	Holger



-- 
This end should point toward the ground if you want to go to space.

If it starts pointing toward space you are having a bad problem and you
will not go to space today.

  -- http://xkcd.com/1133/


Reply to: