chiark / gitweb /
parsechangelog takes optional args for dpkg-parsechangelog
[dgit.git] / dgit
diff --git a/dgit b/dgit
index 3f9dd97375a6cf00a1a22276fe8ee16f5dd24645..123c2d513ae2cc05f3f3dd82a90c06a3b64202bd 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -28,6 +28,8 @@ use File::Basename;
 use Dpkg::Version;
 use POSIX;
 
+our $our_version = 'UNRELEASED'; ###substituted###
+
 our $isuite = 'unstable';
 our $idistro;
 our $package;
@@ -36,6 +38,8 @@ our $sign = 1;
 our $dryrun = 0;
 our $changesfile;
 our $new_package = 0;
+our $ignoredirty = 0;
+our $noquilt = 0;
 our $existing_package = 'dpkg';
 our $cleanmode = 'dpkg-source';
 
@@ -83,7 +87,16 @@ sub debiantag ($) {
     return "debian/$v";
 }
 
-sub dscfn ($) { return "${package}_$_[0].dsc"; }
+sub stripepoch ($) {
+    my ($vsn) = @_;
+    $vsn =~ s/^\d+\://;
+    return $vsn;
+}
+
+sub dscfn ($) {
+    my ($vsn) = @_;
+    return "${package}_".(stripepoch $vsn).".dsc";
+}
 
 sub changesopts () { return @changesopts[1..$#changesopts]; }
 
@@ -196,6 +209,11 @@ sub runcmd_ordryrun {
     }
 }
 
+sub shell_cmd {
+    my ($first_shell, @cmd) = @_;
+    return qw(sh -ec), $first_shell.'; exec "$@"', 'x', @cmd;
+}
+
 our $helpmsg = <<END;
 main usages:
   dgit [dgit-opts] clone [dgit-opts] package [suite] [./dir|/dir]
@@ -219,7 +237,7 @@ sub badusage {
     exit 8;
 }
 
-sub helponly () {
+sub cmd_help () {
     print $helpmsg or die $!;
     exit 0;
 }
@@ -230,13 +248,14 @@ our %defcfg = ('dgit.default.distro' => 'debian',
               'dgit.default.ssh' => 'ssh',
               'dgit-distro.debian.git-host' => 'git.debian.org',
               'dgit-distro.debian.git-proto' => 'git+ssh://',
-              'dgit-distro.debian.git-path' => '/git/dgit-repos',
+              'dgit-distro.debian.git-path' => '/git/dgit-repos/repos',
               'dgit-distro.debian.git-check' => 'ssh-cmd',
               'dgit-distro.debian.git-create' => 'ssh-cmd',
               'dgit-distro.debian.sshdakls-host' => 'coccia.debian.org',
               'dgit-distro.debian.sshdakls-dir' =>
                   '/srv/ftp-master.debian.org/ftp/dists',
-              'dgit-distro.debian.mirror' => 'http://http.debian.net/debian/');
+              'dgit-distro.debian.upload-host' => 'ftp-master', # for dput
+              'dgit-distro.debian.mirror' => 'http://ftp.debian.org/debian/');
 
 sub cfg {
     foreach my $c (@_) {
@@ -321,7 +340,7 @@ sub getfield ($$) {
 sub parsechangelog {
     my $c = Dpkg::Control::Hash->new();
     my $p = new IO::Handle;
-    my @cmd = (qw(dpkg-parsechangelog));
+    my @cmd = (qw(dpkg-parsechangelog), @_);
     open $p, '-|', @cmd or die $!;
     $c->parse($p);
     $?=0; $!=0; close $p or failedcmd @cmd;
@@ -399,7 +418,7 @@ sub madison_parse ($) {
        }
        $5 eq 'source' or die "$rmad ?";
        my $prefix = substr($package, 0, $package =~ m/^l/ ? 4 : 1);
-       my $subpath = "/pool/$component/$prefix/$package/${package}_$vsn.dsc";
+       my $subpath = "/pool/$component/$prefix/$package/".dscfn($vsn);
        push @out, [$vsn,$subpath,$newsuite];
     }
     return sort { -version_compare_string($a->[0],$b->[0]); } @out;
@@ -415,6 +434,8 @@ sub canonicalise_suite_madison ($$) {
 }
 
 sub canonicalise_suite () {
+    return if defined $csuite;
+    fail "cannot operate on $isuite suite" if $isuite eq 'UNRELEASED';
     $csuite = archive_query('canonicalise_suite');
     if ($isuite ne $csuite) {
        # madison canonicalises for us
@@ -430,17 +451,15 @@ sub get_archive_dsc () {
        $dscurl = access_cfg('mirror').$subpath;
        $dscdata = url_get($dscurl);
        next unless defined $dscdata;
-       $dscurl = access_cfg('mirror').$subpath;
-       $dscdata = url_get($dscurl);
        my $dscfh = new IO::File \$dscdata, '<' or die $!;
        print DEBUG Dumper($dscdata) if $debug>1;
        $dsc = parsecontrolfh($dscfh,$dscurl, allow_pgp=>1);
        print DEBUG Dumper($dsc) if $debug>1;
        my $fmt = getfield $dsc, 'Format';
        fail "unsupported source format $fmt, sorry" unless $format_ok{$fmt};
-       return $dsc;
+       return;
     }
-    return undef;
+    $dsc = undef;
 }
 
 sub check_for_git () {
@@ -471,7 +490,7 @@ sub create_remote_git_repo () {
     }
 }
 
-our ($dsc_hash,$upload_hash);
+our ($dsc_hash,$lastpush_hash);
 
 our $ud = '.git/dgit/unpack';
 
@@ -499,16 +518,35 @@ sub mktree_in_ud_from_only_subdir () {
     return ($tree,$dir);
 }
 
-sub dsc_files () {
-    my $field = $dsc->{'Checksums-Sha256'} || $dsc->{Files};
-    defined $field or
-       fail "missing both Checksums-Sha256 and Files in ".
+sub dsc_files_info () {
+    foreach my $csumi (['Checksums-Sha256','Digest::SHA', 'new(256)'],
+                      ['Checksums-Sha1',  'Digest::SHA', 'new(1)'],
+                      ['Files',           'Digest::MD5', 'new()']) {
+       my ($fname, $module, $method) = @$csumi;
+       my $field = $dsc->{$fname};
+       next unless defined $field;
+       eval "use $module; 1;" or die $@;
+       my @out;
+       foreach (split /\n/, $field) {
+           next unless m/\S/;
+           m/^(\w+) (\d+) (\S+)$/ or
+               fail "could not parse .dsc $fname line \`$_'";
+           my $digester = eval "$module"."->$method;" or die $@;
+           push @out, {
+               Hash => $1,
+               Bytes => $2,
+               Filename => $3,
+               Digester => $digester,
+           };
+       }
+       return @out;
+    }
+    fail "missing any supported Checksums-* or Files field in ".
        $dsc->get_option('name');
-    map {
-       m/^\w+ \d+ (\S+)$/ or
-           fail "could not parse .dsc Files/Checksums line \`$_'";
-       $1;
-    } grep m/\S/, split /\n/, $field;
+}
+
+sub dsc_files () {
+    map { $_->{Filename} } dsc_files_info();
 }
 
 sub is_orig_file ($) {
@@ -563,8 +601,8 @@ END
     my $outputhash = make_commit qw(../commit.tmp);
     my $cversion = getfield $clogp, 'Version';
     print "synthesised git commit from .dsc $cversion\n";
-    if ($upload_hash) {
-       runcmd @git, qw(reset --hard), $upload_hash;
+    if ($lastpush_hash) {
+       runcmd @git, qw(reset --hard), $lastpush_hash;
        runcmd qw(sh -ec), 'dpkg-parsechangelog >>../changelogold.tmp';
        my $oldclogp = parsecontrol('../changelogold.tmp','previous changelog');
        my $oversion = getfield $oldclogp, 'Version';
@@ -575,7 +613,7 @@ END
            open C, ">../commit2.tmp" or die $!;
            print C <<END or die $!;
 tree $tree
-parent $upload_hash
+parent $lastpush_hash
 parent $outputhash
 author $authline
 committer $authline
@@ -590,9 +628,9 @@ Version actually in archive:    $cversion (older)
 Last allegedly pushed/uploaded: $oversion (newer or same)
 $later_warning_msg
 END
-            $outputhash = $upload_hash;
+            $outputhash = $lastpush_hash;
         } else {
-           $outputhash = $upload_hash;
+           $outputhash = $lastpush_hash;
        }
     }
     chdir '../../../..' or die $!;
@@ -605,10 +643,20 @@ END
 }
 
 sub ensure_we_have_orig () {
-    foreach my $f (dsc_files()) {
+    foreach my $fi (dsc_files_info()) {
+       my $f = $fi->{Filename};
        next unless is_orig_file($f);
-       if (stat "../$f") {
-           die "$f ?" unless -f _;
+       if (open F, "<", "../$f") {
+           $fi->{Digester}->reset();
+           $fi->{Digester}->addfile(*F);
+           F->error and die $!;
+           my $got = $fi->{Digester}->hexdigest();
+           $got eq $fi->{Hash} or
+               fail "existing file $f has hash $got but .dsc".
+                   " demands hash $fi->{Hash}".
+                   " (perhaps you should delete this file?)";
+           print "using existing $f\n";
+           next;
        } else {
            die "$f $!" unless $!==&ENOENT;
        }
@@ -617,8 +665,7 @@ sub ensure_we_have_orig () {
        $origurl .= "/$f";
        die "$f ?" unless $f =~ m/^${package}_/;
        die "$f ?" if $f =~ m#/#;
-       runcmd_ordryrun qw(sh -ec),'cd ..; exec "$@"','x',
-           @dget,'--',$origurl;
+       runcmd_ordryrun shell_cmd 'cd ..', @dget,'--',$origurl;
     }
 }
 
@@ -628,74 +675,96 @@ sub rev_parse ($) {
 
 sub is_fast_fwd ($$) {
     my ($ancestor,$child) = @_;
-    my $mb = cmdoutput @git, qw(merge-base), $ancestor, $child;
-    return rev_parse($mb) eq rev_parse($ancestor);
+    my @cmd = (@git, qw(merge-base), $ancestor, $child);
+    my $mb = cmdoutput_errok @cmd;
+    if (defined $mb) {
+       return rev_parse($mb) eq rev_parse($ancestor);
+    } else {
+       $?==256 or failedcmd @cmd;
+       return 0;
+    }
 }
 
 sub git_fetch_us () {
-    badusage "cannot dry run with fetch" if $dryrun;
-    runcmd @git, qw(fetch),access_giturl(),fetchspec();
+    runcmd_ordryrun @git, qw(fetch),access_giturl(),fetchspec();
 }
 
 sub fetch_from_archive () {
     # ensures that lrref() is what is actually in the archive,
     #  one way or another
-    get_archive_dsc() or return 0;
-    foreach my $field (@ourdscfield) {
-       $dsc_hash = $dsc->{$field};
-       last if defined $dsc_hash;
-    }
-    if (defined $dsc_hash) {
-       $dsc_hash =~ m/\w+/ or fail "invalid hash in .dsc \`$dsc_hash'";
-       $dsc_hash = $&;
-       print "last upload to archive specified git hash\n";
+    get_archive_dsc();
+
+    if ($dsc) {
+       foreach my $field (@ourdscfield) {
+           $dsc_hash = $dsc->{$field};
+           last if defined $dsc_hash;
+       }
+       if (defined $dsc_hash) {
+           $dsc_hash =~ m/\w+/ or fail "invalid hash in .dsc \`$dsc_hash'";
+           $dsc_hash = $&;
+           print "last upload to archive specified git hash\n";
+       } else {
+           print "last upload to archive has NO git hash\n";
+       }
     } else {
-       print "last upload to archive has NO git hash\n";
+       print "no version available from the archive\n";
     }
 
     my $lrref_fn = ".git/".lrref();
     if (open H, $lrref_fn) {
-       $upload_hash = <H>;
-       chomp $upload_hash;
-       die "$lrref_fn $upload_hash ?" unless $upload_hash =~ m/^\w+$/;
+       $lastpush_hash = <H>;
+       chomp $lastpush_hash;
+       die "$lrref_fn $lastpush_hash ?" unless $lastpush_hash =~ m/^\w+$/;
     } elsif ($! == &ENOENT) {
-       $upload_hash = '';
+       $lastpush_hash = '';
     } else {
        die "$lrref_fn $!";
     }
-    print DEBUG "previous reference hash=$upload_hash\n";
+    print DEBUG "previous reference hash=$lastpush_hash\n";
     my $hash;
     if (defined $dsc_hash) {
        fail "missing git history even though dsc has hash -".
            " could not find commit $dsc_hash".
            " (should be in ".access_giturl()."#".rrref().")"
-           unless $upload_hash;
+           unless $lastpush_hash;
        $hash = $dsc_hash;
        ensure_we_have_orig();
-       if ($dsc_hash eq $upload_hash) {
-       } elsif (is_fast_fwd($dsc_hash,$upload_hash)) {
+       if ($dsc_hash eq $lastpush_hash) {
+       } elsif (is_fast_fwd($dsc_hash,$lastpush_hash)) {
            print STDERR <<END or die $!;
 
 Git commit in archive is behind the last version allegedly pushed/uploaded.
 Commit referred to by archive:  $dsc_hash
-Last allegedly pushed/uploaded: $upload_hash
+Last allegedly pushed/uploaded: $lastpush_hash
 $later_warning_msg
 END
-           $hash = $upload_hash;
+           $hash = $lastpush_hash;
        } else {
            fail "archive's .dsc refers to ".$dsc_hash.
-               " but this is an ancestor of ".$upload_hash;
+               " but this is an ancestor of ".$lastpush_hash;
        }
-    } else {
+    } elsif ($dsc) {
        $hash = generate_commit_from_dsc();
+    } elsif ($lastpush_hash) {
+       # only in git, not in the archive yet
+       $hash = $lastpush_hash;
+       print STDERR <<END or die $!;
+
+Package not found in the archive, but has allegedly been
+pushed/uploaded using dgit.
+$later_warning_msg
+END
+    } else {
+       print DEBUG "nothing found!\n";
+       return 0;
     }
     print DEBUG "current hash=$hash\n";
-    if ($upload_hash) {
+    if ($lastpush_hash) {
        fail "not fast forward on last upload branch!".
            " (archive's version left in DGIT_ARCHIVE)"
-           unless is_fast_fwd($upload_hash, $hash);
+           unless is_fast_fwd($lastpush_hash, $hash);
     }
-    if ($upload_hash ne $hash) {
+    if ($lastpush_hash ne $hash) {
        my @upd_cmd = (@git, qw(update-ref -m), 'dgit fetch', lrref(), $hash);
        if (!$dryrun) {
            cmdoutput @upd_cmd;
@@ -721,7 +790,7 @@ sub clone ($) {
     if (check_for_git()) {
        print "fetching existing git history\n";
        git_fetch_us();
-       runcmd @git, qw(fetch origin);
+       runcmd_ordryrun @git, qw(fetch origin);
     } else {
        print "starting new git history\n";
     }
@@ -746,6 +815,7 @@ sub pull () {
 }
 
 sub check_not_dirty () {
+    return if $ignoredirty;
     my @cmd = (@git, qw(diff --quiet HEAD));
     printcmd(\*DEBUG,"+",@cmd) if $debug>0;
     $!=0; $?=0; system @cmd;
@@ -763,7 +833,7 @@ sub commit_quilty_patch () {
     my $bad=0;
     foreach my $l (split /\n/, $output) {
        next unless $l =~ m/\S/;
-       if ($l =~ m{^\?\? (.pc|debian/patches)}) {
+       if ($l =~ m{^(?:\?\?| M) (.pc|debian/patches)}) {
            $adds{$1}++;
        } else {
            print STDERR "git status: $l\n";
@@ -785,6 +855,10 @@ sub madformat ($) {
     my ($format) = @_;
     return 0 unless $format eq '3.0 (quilt)';
     print "Format \`$format', urgh\n";
+    if ($noquilt) {
+       print "Not doing any fixup of \`$format' due to --no-quilt-fixup";
+       return 0;
+    }
     return 1;
 }
 
@@ -835,12 +909,12 @@ sub dopush () {
     $dsc->{$ourdscfield[0]} = rev_parse('HEAD');
     $dsc->save("../$dscfn.tmp") or die $!;
     if (!$changesfile) {
-       my $multi = "../${package}_${cversion}_multi.changes";
+       my $multi = "../${package}_".(stripepoch $cversion)."_multi.changes";
        if (stat "$multi") {
            $changesfile = $multi;
        } else {
            $!==&ENOENT or die "$multi: $!";
-           my $pat = "${package}_${cversion}_*.changes";
+           my $pat = "${package}_".(stripepoch $cversion)."_*.changes";
            my @cs = glob "../$pat";
            fail "failed to find unique changes file".
                " (looked for $pat in .., or $multi);".
@@ -860,6 +934,7 @@ sub dopush () {
        create_remote_git_repo();
     }
     runcmd_ordryrun @git, qw(push),access_giturl(),"HEAD:".rrref();
+    runcmd_ordryrun @git, qw(update-ref -m), 'dgit push', lrref(), 'HEAD';
     if (!$dryrun) {
        rename "../$dscfn.tmp","../$dscfn" or die "$dscfn $!";
     } else {
@@ -870,7 +945,7 @@ sub dopush () {
            $keyid = access_cfg('keyid','RETURN-UNDEF');
        }
        my @tag_cmd = (@git, qw(tag -s -m),
-                      "Release $dversion for $csuite [dgit]");
+                      "$package release $dversion for $csuite [dgit]");
        push @tag_cmd, qw(-u),$keyid if defined $keyid;
        push @tag_cmd, $tag;
        runcmd_ordryrun @tag_cmd;
@@ -951,7 +1026,7 @@ sub cmd_pull {
 sub cmd_push {
     parseopts();
     badusage "-p is not allowed with dgit push" if defined $package;
-    runcmd @git, qw(diff --quiet HEAD);
+    check_not_dirty();
     my $clogp = parsechangelog();
     $package = getfield $clogp, 'Source';
     if (@ARGV==0) {
@@ -967,7 +1042,10 @@ sub cmd_push {
        git_fetch_us();
     }
     if (fetch_from_archive()) {
-       is_fast_fwd(lrref(), 'HEAD') or die;
+       is_fast_fwd(lrref(), 'HEAD') or
+           fail "dgit push: HEAD is not a descendant".
+               " of the archive's version.\n".
+               "$us: To overwrite it, use git-merge -s ours ".lrref().".";
     } else {
        $new_package or
            fail "package appears to be new in this suite;".
@@ -992,18 +1070,24 @@ sub build_maybe_quilt_fixup () {
     chomp;
     return unless madformat($_);
     # sigh
+    my $clogp = parsechangelog();
+    my $version = getfield $clogp, 'Version';
+    my $author = getfield $clogp, 'Maintainer';
     my $headref = rev_parse('HEAD');
     my $time = time;
+    my $ncommits = 3;
     my $patchname = "auto-$version-$headref-$time";
-    my $author = cmdoutput @git, qw(log -n1), '--pretty=format:%an <%ae>';
-    my $msg = cmdoutput @git, qw(log -n1), "--pretty=format:%s\n%b";
+    my $msg = cmdoutput @git, qw(log), "-n$ncommits";
+    mkpath '.git/dgit';
     my $descfn = ".git/dgit/quilt-description.tmp";
     open O, '>', $descfn or die "$descfn: $!";
     $msg =~ s/\n/\n /g;
     $msg =~ s/^\s+$/ ./mg;
     print O <<END or die $!;
-Description: $msg
- [generated from git commit $headref]
+Description: Automatically generated patch ($clogp->{Version})
+ Last (up to) $ncommits git changes, FYI:
+ .
+ $msg
 Author: $author
 
 ---
@@ -1017,7 +1101,7 @@ END
        runcmd_ordryrun @dpkgsource, qw(--commit .), $patchname;
     }
 
-    if (!open P, '>', ".pc/applied-patches") {
+    if (!open P, '>>', ".pc/applied-patches") {
        $!==&ENOENT or die $!;
     } else {
        close P;
@@ -1045,19 +1129,32 @@ sub quilt_fixup_editor () {
     exit 0;
 }
 
-sub cmd_build {
-    # we pass further options and args to git-buildpackage
-    badusage "-p is not allowed with dgit build" if defined $package;
-    badusage "dgit build implies --clean=dpkg-source" if defined $package;
+sub build_prep () {
+    badusage "-p is not allowed when building" if defined $package;
+    check_not_dirty();
     my $clogp = parsechangelog();
     $isuite = getfield $clogp, 'Distribution';
     $package = getfield $clogp, 'Source';
     $version = getfield $clogp, 'Version';
     build_maybe_quilt_fixup();
+}
+
+sub cmd_build {
+    badusage "dgit build implies --clean=dpkg-source"
+       if $cleanmode ne 'dpkg-source';
+    build_prep();
+    runcmd_ordryrun @dpkgbuildpackage, qw(-us -uc), changesopts(), @ARGV;
+    printdone "build successful\n";
+}
+
+sub cmd_git_build {
+    badusage "dgit git-build implies --clean=dpkg-source"
+       if $cleanmode ne 'dpkg-source';
+    build_prep();
     my @cmd =
        (qw(git-buildpackage -us -uc --git-no-sign-tags),
         "--git-builder=@dpkgbuildpackage");
-    unless (grep { m/^--git-debian-branch/ } @ARGV) {
+    unless (grep { m/^--git-debian-branch|^--git-ignore-branch/ } @ARGV) {
        canonicalise_suite();
        push @cmd, "--git-debian-branch=".lbranch();
     }
@@ -1067,15 +1164,9 @@ sub cmd_build {
 }
 
 sub build_source {
-    badusage "-p is not allowed with this action" if defined $package;
-    check_not_dirty();
-    my $clogp = parsechangelog();
-    $package = getfield $clogp, 'Source';
-    $isuite = getfield $clogp, 'Distribution';
-    $version = getfield $clogp, 'Version';
-    $sourcechanges = "${package}_${version}_source.changes";
+    build_prep();
+    $sourcechanges = "${package}_".(stripepoch $version)."_source.changes";
     $dscfn = dscfn($version);
-    build_maybe_quilt_fixup();
     if ($cleanmode eq 'dpkg-source') {
        runcmd_ordryrun (@dpkgbuildpackage, qw(-us -uc -S)), changesopts();
     } else {
@@ -1106,7 +1197,7 @@ sub cmd_build_source {
 sub cmd_sbuild {
     build_source();
     chdir ".." or die $!;
-    my $pat = "${package}_${version}_*.changes";
+    my $pat = "${package}_".(stripepoch $version)."_*.changes";
     if (!$dryrun) {
        stat $dscfn or fail "$dscfn (in parent directory): $!";
        stat $sourcechanges or fail "$sourcechanges (in parent directory): $!";
@@ -1117,7 +1208,7 @@ sub cmd_sbuild {
     }
     runcmd_ordryrun @sbuild, @ARGV, qw(-d), $isuite, $dscfn;
     runcmd_ordryrun @mergechanges, glob $pat;
-    my $multichanges = "${package}_${version}_multi.changes";
+    my $multichanges = "${package}_".(stripepoch $version)."_multi.changes";
     if (!$dryrun) {
        stat $multichanges or fail "$multichanges: $!";
     }
@@ -1131,6 +1222,11 @@ sub cmd_quilt_fixup {
     build_maybe_quilt_fixup();
 }
 
+sub cmd_version {
+    print "dgit version $our_version\n" or die $!;
+    exit 0;
+}
+
 sub parseopts () {
     my $om;
     while (@ARGV) {
@@ -1143,7 +1239,9 @@ sub parseopts () {
            } elsif (m/^--no-sign$/) {
                $sign=0;
            } elsif (m/^--help$/) {
-               helponly();
+               cmd_help();
+           } elsif (m/^--version$/) {
+               cmd_version();
            } elsif (m/^--new$/) {
                $new_package=1;
            } elsif (m/^--(\w+)=(.*)/s &&
@@ -1161,6 +1259,10 @@ sub parseopts () {
                $cleanmode = $1;
            } elsif (m/^--clean=(.*)$/s) {
                badusage "unknown cleaning mode \`$1'";
+           } elsif (m/^--ignore-dirty$/s) {
+               $ignoredirty = 1;
+           } elsif (m/^--no-quilt-fixup$/s) {
+               $noquilt = 1;
            } else {
                badusage "unknown long option \`$_'";
            }
@@ -1169,7 +1271,7 @@ sub parseopts () {
                if (s/^-n/-/) {
                    $dryrun=1;
                } elsif (s/^-h/-/) {
-                   helponly();
+                   cmd_help();
                } elsif (s/^-D/-/) {
                    open DEBUG, ">&STDERR" or die $!;
                    $debug++;
@@ -1204,6 +1306,8 @@ if ($ENV{$fakeeditorenv}) {
     quilt_fixup_editor();
 }
 
+delete $ENV{'DGET_UNPACK'};
+
 parseopts();
 print STDERR "DRY RUN ONLY\n" if $dryrun;
 if (!@ARGV) {