Hi, On Sun, Aug 17, 2025 at 08:48:34AM +0200, Hannes von Haugwitz wrote: > Source: git-buildpackage > Version: 0.9.38 > Severity: important > Tags: patch > > Dear Maintainers, > > gbp buildpackage always removes `<package>-<upstream-version>` directory > from parent folder by default, if export dir is not set (in my case the repo > directory was coincidentally named like that and I lost some minutes of > work). > > This is a regression of the fix for #1091554 via 005676a[0]. > > As the `export dir` variable is always set to > `output_dir/<sourcepkg>-<major>` (with `output_dir` defaults to `..` if > `options.export_dir` is not set), the condition for the removal of the > build directory (`export_dir and options.purge`) is always true (unless > --git-no-purge is explicitly set). > > The attached patch reverts the condition change and should fix the > issue.
Thanks. Could you open an MR at https://salsa.debian.org/agx/git-buildpackage Please add a `Closes: #1111340` to the commit message. If you feel like it You can also add a test in `tests/component/deb/test_buildpackage.py` to ensure this part doesn't regress in the future. Cheers, -- Guido > > Best regards > > Hannes > > [0] > https://salsa.debian.org/agx/git-buildpackage/-/commit/005676a6d4925ea7215b2954ced966e614f0c749 > > -- System Information: > Debian Release: forky/sid > APT prefers unstable > APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (100, > 'experimental') > Architecture: amd64 (x86_64) > > Kernel: Linux 6.16-amd64 (SMP w/16 CPU threads; PREEMPT) > Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), > LANGUAGE=en_GB:en > Shell: /bin/sh linked to /usr/bin/dash > diff --git before/gbp/scripts/buildpackage.py > after/gbp/scripts/buildpackage.py > index b5fd1713..36ad8d02 100755 > --- before/gbp/scripts/buildpackage.py > +++ after/gbp/scripts/buildpackage.py > @@ -607,7 +607,7 @@ def main(argv): > drop_index(repo) > > if not options.tag_only: > - if export_dir and options.purge: > + if options.export_dir and options.purge: > RemoveTree(export_dir)() > > if source:

