diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2018-11-10 17:19:40 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2018-11-10 17:42:08 +0300 |
commit | 85eff0e9f81a3eeccc67e534f43be7e9f2e75521 (patch) | |
tree | 96242163a7f43611598c158e8f3da01ee183e938 | |
parent | b88ed73c1fa88976e99fa16f989920561f68f302 (diff) |
Fix pkg-build crash on system package drop
-rw-r--r-- | bpkg/pkg-build.cxx | 17 | ||||
-rw-r--r-- | tests/pkg-system.testscript | 12 |
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/*' + } } |