aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bpkg/pkg-build.cxx17
-rw-r--r--tests/pkg-system.testscript12
2 files changed, 24 insertions, 5 deletions
diff --git a/bpkg/pkg-build.cxx b/bpkg/pkg-build.cxx
index 80e14f0..27e509b 100644
--- a/bpkg/pkg-build.cxx
+++ b/bpkg/pkg-build.cxx
@@ -4260,13 +4260,20 @@ namespace bpkg
{
if (*p.action == build_package::drop)
{
- transaction t (db, !simulate /* start */);
- pkg_purge (c, t, sp, simulate); // Commits the transaction.
+ // Note that the selected system package has already gone being
+ // disfigured (see above).
+ //
+ if (sp != nullptr)
+ {
+ transaction t (db, !simulate /* start */);
+ pkg_purge (c, t, sp, simulate); // Commits the transaction.
- if (verbose && !o.no_result ())
- text << "purged " << *sp;
+ if (verbose && !o.no_result ())
+ text << "purged " << *sp;
+
+ sp = nullptr;
+ }
- sp = nullptr;
break;
}
diff --git a/tests/pkg-system.testscript b/tests/pkg-system.testscript
index e8ad676..678e838 100644
--- a/tests/pkg-system.testscript
+++ b/tests/pkg-system.testscript
@@ -908,4 +908,16 @@ rep_remove += -d cfg 2>!
$pkg_drop foo
}
+
+ : unhold
+ :
+ : Test that the system package get purged being unhold.
+ :
+ {
+ $clone_cfg;
+
+ $pkg_build 'sys:foo' 2>'configured sys:foo/*';
+
+ $pkg_build ?foo 2>'purged foo/*'
+ }
}