use Digest::MD5;
use List::MoreUtils qw(pairwise);
use Text::Glob qw(match_glob);
+use Text::CSV;
use Fcntl qw(:DEFAULT :flock);
use Carp;
return $kl->{$k};
}
}
+ foreach my $csvf (</usr/share/distro-info/*.csv>) {
+ my $csv_distro =
+ $csvf =~ m{/(\w+)\.csv$} ? $1 : do {
+ printdebug "skipping $csvf\n";
+ next;
+ };
+ my $csv = Text::CSV->new({ binary => 1, auto_diag => 2 }) or die;
+ my $fh = new IO::File $csvf, "<:encoding(utf8)"
+ or die "open $csvf: $!";
+ while (my $cols = $csv->getline($fh)) {
+ next unless $cols->[2] eq $isuite;
+ return $csv_distro;
+ }
+ die "$csvf $!" if $fh->error;
+ close $fh;
+ }
return cfg("dgit.default.distro");
}
}
}
}
+sub maybe_warn_opt_confusion ($$$) {
+ my ($subcommand, $willrun, $optsref) = @_;
+ foreach (@$optsref) {
+ if (m/^(?: --dry-run $
+ | --damp-run $
+ | --clean= | -w[gcnd]
+ | --(?:include|ignore)-dirty$
+ | --quilt= | --gbp$ | --dpm$ | --baredebian
+ | --split-view=
+ | --build-products-dir=
+ )/x) {
+ print STDERR f_ <<END, $&, $subcommand or die $!;
+warning: dgit option %s must be passed before %s on dgit command line
+END
+ } elsif (m/^(?: -C
+ | --no-sign $
+ | -k
+ )/x) {
+ print STDERR f_ <<END, $&, $subcommand, $willrun or die $!;
+warning: option %s should probably be passed to dgit before %s sub-command on the dgit command line, so that it is seen by dgit and not simply passed to %s
+END
+ }
+ }
+}
+
sub changesopts_initial () {
my @opts =@changesopts[1..$#changesopts];
}
sub cmd_build {
build_prep_early();
+ maybe_warn_opt_confusion 'build', 'dpkg-buildpackage', \@ARGV;
$buildproductsdir eq '..' or print STDERR +(f_ <<END, $us, $us);
%s: warning: build-products-dir set, but not supported by dpkg-buildpackage
%s: warning: build-products-dir will be ignored; files will go to ..
sub cmd_gbp_build {
build_prep_early();
+ maybe_warn_opt_confusion 'gbp-build', 'gbp buildpackage', \@ARGV;
# gbp can make .origs out of thin air. In my tests it does this
# even for a 1.0 format package, with no origs present. So I
sub cmd_sbuild {
build_prep_early();
+ maybe_warn_opt_confusion 'sbuild', 'sbuild', \@ARGV;
binary_builder(\@sbuild, (__ <<END), qw(-d), $isuite, @ARGV, $dscfn);
perhaps you need to pass -A ? (sbuild's default is to build only
arch-specific binaries; dgit 1.4 used to override that.)
sub pbuilder ($) {
my ($pbuilder) = @_;
build_prep_early();
+ maybe_warn_opt_confusion 'pbuilder', 'pbuilder', \@ARGV;
# @ARGV is allowed to contain only things that should be passed to
# pbuilder under debbuildopts; just massage those
my $wantsrc = massage_dbp_args \@ARGV;