On Wed, Apr 18, 2012 at 01:19:55PM +0000, Gustavo Prado Alkmim wrote:
> Attached is a patch to add support to --stage1 option, which considers
> the Build-Depends-Stage1 field of control file instead of
> Build-Depends.

Thanks for your patch!

> diff -Nur xdeb-0.6.5.orig/xdeb.py xdeb-0.6.5/xdeb.py
> --- xdeb-0.6.5.orig/xdeb.py   2011-09-30 09:25:31.000000000 +0000
> +++ xdeb-0.6.5/xdeb.py        2012-04-18 12:22:04.366809385 +0000
> @@ -301,7 +301,12 @@
>          # that we can native-import them, but we don't want to go further
>          # down transitive build-dependencies.
>          if not options.only_explicit or not builddep_depth:
> -            builddeps = src_record.relations['build-depends']
> +            if options.stage1:
> +                builddeps = src_record.relations['build-depends-stage1']
> +                if builddeps == []:

Prefer 'if not builddeps:'.

> @@ -631,9 +642,20 @@
>      print "===== Building %s_%s =====" % (src, ver)
>      print
>  
> -    utils.spawn(['dpkg-checkbuilddeps'], cwd=srcdir)
> +    if options.stage1:
> +        utils.spawn(['dpkg-checkbuilddeps', '--stage=1'], cwd=srcdir)
> +    else:
> +        utils.spawn(['dpkg-checkbuilddeps'], cwd=srcdir)

Better to reduce repetition:

    checkbuilddeps = ['dpkg-checkbuilddeps']
    if options.stage1:
        checkbuilddeps.append('--stage=1')
    utils.spawn(checkbuilddeps, cwd=srcdir)

>      buildpackage = ['debuild', '--no-lintian', '-eUSER']
> +
> +    if 'DEB_BUILD_OPTIONS' in os.environ:
> +        build_options = '%s' % os.environ['DEB_BUILD_OPTIONS']
> +    else:
> +        build_options = '"'

The handling of DEB_BUILD_OPTIONS here isn't quite right.  No shell is
involved in executing debuild, so it's incorrect to use ""-style
quoting; the quotes will actually end up directly in the environment
variable if you do that.  I went for this approach instead:

    build_options = []
    if options.stage1:
        build_options.append('stage=1')

    ...

    if options.architecture != build_arch:
        ...
        build_options.append('nocheck')

    ...

    if build_options:
        if 'DEB_BUILD_OPTIONS' in os.environ:
            build_options_arg = '%s %s' % (
                os.environ['DEB_BUILD_OPTIONS'], ' '.join(build_options))
        else:
            build_options_arg = ' '.join(build_options)
        buildpackage.append('-eDEB_BUILD_OPTIONS=%s' % build_options_arg)

This is still a bit more repetitive than I'd like, but it should work
well enough.

Otherwise this looks good and I've applied it for my next upload.

-- 
Colin Watson                                       [[email protected]]



-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to