Looks reasonable.

        -Tim Abbott

On Sun, 12 Apr 2009, Roger Leigh wrote:

> On Sat, Apr 11, 2009 at 04:58:41PM -0400, Tim Abbott wrote:
> […]
> 
> Many thanks for the patch.  I applied it verbatim, but followed
> it with the following small change.  This moves the source/append
> version conflict check from the options parser Sbuild::Options to
> Sbuild::Conf so it works if you are driving sbuild without using
> the options parser.
> 
> diff --git a/lib/Sbuild/Conf.pm b/lib/Sbuild/Conf.pm
> index 943b278..a20293a 100644
> --- a/lib/Sbuild/Conf.pm
> +++ b/lib/Sbuild/Conf.pm
> @@ -70,6 +70,18 @@ sub init_allowed_keys {
>           if !-d $directory;
>      };
>  
> +    my $validate_append_version = sub {
> +     my $self = shift;
> +     my $entry = shift;
> +
> +     if (defined($self->get('APPEND_TO_VERSION')) &&
> +         $self->get('APPEND_TO_VERSION') &&
> +         $self->get('BUILD_SOURCE') != 0) {
> +         # See <http://bugs.debian.org/475777> for details
> +         die "The --append-to-version option is incompatible with a source 
> upload\n";
> +     }
> +    };
> +
>      my $HOME = $self->get('HOME');
>  
>      my %sbuild_keys = (
> @@ -408,7 +420,8 @@ sub init_allowed_keys {
>           DEFAULT => []
>       },
>       'BUILD_SOURCE'                          => {
> -         DEFAULT => 0
> +         DEFAULT => 0,
> +         CHECK => $validate_append_version,
>       },
>       'ARCHIVE'                               => {
>           DEFAULT => undef
> @@ -420,7 +433,8 @@ sub init_allowed_keys {
>           DEFAULT => undef
>       },
>       'APPEND_TO_VERSION'                     => {
> -         DEFAULT => undef
> +         DEFAULT => undef,
> +         CHECK => $validate_append_version,
>       },
>       'GCC_SNAPSHOT'                          => {
>           DEFAULT => 0
> diff --git a/lib/Sbuild/Options.pm b/lib/Sbuild/Options.pm
> index 8ee63db..02f8ca8 100644
> --- a/lib/Sbuild/Options.pm
> +++ b/lib/Sbuild/Options.pm
> @@ -184,11 +184,6 @@ sub parse_options {
>                      },
>       );
>  
> -    if (defined($self->get_conf('APPEND_TO_VERSION')) &&
> -     $self->get_conf('BUILD_SOURCE') != 0) {
> -     # See <http://bugs.debian.org/475777> for details
> -     die "The --append-to-version option is incompatible with a source 
> upload\n";
> -    }
>      return $ret;
>  }
> 
>  
> Regards,
> Roger
> 
> -- 
>   .''`.  Roger Leigh
>  : :' :  Debian GNU/Linux             http://people.debian.org/~rleigh/
>  `. `'   Printing on GNU/Linux?       http://gutenprint.sourceforge.net/
>    `-    GPG Public Key: 0x25BFB848   Please GPG sign your mail.
> 

Reply via email to