X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=blobdiff_plain;f=dgit;h=37d38618572b90ce5514941021ff00355059dc48;hp=1d0fe8573d0b76ba0f7c8366bcb39325b64fcced;hb=70b522e712e52444e8c7b924502380d6413040fa;hpb=d98b7653e23426cdfe91f6892c2a2f1c21481cd0 diff --git a/dgit b/dgit index 1d0fe857..37d38618 100755 --- a/dgit +++ b/dgit @@ -101,7 +101,11 @@ our %forceopts = map { $_=>0 } our %format_ok = map { $_=>1 } ("1.0","3.0 (native)","3.0 (quilt)"); our $suite_re = '[-+.0-9a-z]+'; -our $cleanmode_re = qr{(?:dpkg-source(?:-d)?|git|git-ff|check|none)}; +our $cleanmode_re = qr{(?: dpkg-source (?: -d )? (?: ,no-check | ,all-check )? + | git | git-ff + | check (?: ,ignores )? + | none + )}x; our $git_authline_re = '^([^<>]+) \<(\S+)\> (\d+ [-+]\d+)$'; our $splitbraincache = 'dgit-intern/quilt-cache'; @@ -128,8 +132,8 @@ our (@mergechanges) = qw(mergechanges -f); our (@gbp_build) = (''); our (@gbp_pq) = ('gbp pq'); our (@changesopts) = (''); -our (@pbuilder) = ("sudo -E pbuilder"); -our (@cowbuilder) = ("sudo -E cowbuilder"); +our (@pbuilder) = ("sudo -E pbuilder","--no-source-only-changes"); +our (@cowbuilder) = ("sudo -E cowbuilder","--no-source-only-changes"); our %opts_opt_map = ('dget' => \@dget, # accept for compatibility 'curl' => \@curl, @@ -2193,6 +2197,12 @@ sub check_for_vendor_patches () { __ "(nominal) distro being accessed"); } +sub check_bpd_exists () { + stat $buildproductsdir + or fail f_ "build-products-dir %s is not accessible: %s\n", + $buildproductsdir, $!; +} + sub generate_commits_from_dsc () { # See big comment in fetch_from_archive, below. # See also README.dsc-import. @@ -3058,6 +3068,7 @@ END } sub fetch_from_archive () { + check_bpd_exists(); ensure_setup_existing_tree(); # Ensures that lrref() is what is actually in the archive, one way @@ -3754,10 +3765,13 @@ sub clone ($) { } printdebug "clone main body\n"; - canonicalise_suite(); - my $hasgit = check_for_git(); mkdir $dstdir or fail f_ "create \`%s': %s", $dstdir, $!; changedir $dstdir; + check_bpd_exists(); + + canonicalise_suite(); + my $hasgit = check_for_git(); + runcmd @git, qw(init -q); record_maindir(); setup_new_tree(); @@ -6199,18 +6213,48 @@ sub maybe_unapply_patches_again () { #----- other building ----- +sub clean_tree_check_git ($$) { + my ($honour_ignores, $message) = @_; + my @cmd = (@git, qw(clean -dn)); + push @cmd, qw(-x) unless $honour_ignores; + my $leftovers = cmdoutput @cmd; + if (length $leftovers) { + print STDERR $leftovers, "\n" or confess $!; + fail $message; + } +} + +sub clean_tree_check_git_wd ($) { + my ($message) = @_; + return if $cleanmode =~ m{no-check}; + return if $patches_applied_dirtily; # yuk + clean_tree_check_git +($cleanmode !~ m{all-check}), + (f_ <