aboutsummaryrefslogtreecommitdiff
path: root/bpkg/pkg-disfigure.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2016-08-19 17:37:29 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2016-08-29 18:20:03 +0300
commit53c2aa8e382dd50d09b385285bc3fa0b645ace0a (patch)
tree6d23d091bc57c0aa8d8a529e63ec2f2f22322a3a /bpkg/pkg-disfigure.cxx
parenta4b29effed15b0a3e9309a4633a3ada37f3081e6 (diff)
Support system packages
Diffstat (limited to 'bpkg/pkg-disfigure.cxx')
-rw-r--r--bpkg/pkg-disfigure.cxx22
1 files changed, 19 insertions, 3 deletions
diff --git a/bpkg/pkg-disfigure.cxx b/bpkg/pkg-disfigure.cxx
index de9b681..37a2989 100644
--- a/bpkg/pkg-disfigure.cxx
+++ b/bpkg/pkg-disfigure.cxx
@@ -25,6 +25,8 @@ namespace bpkg
tracer trace ("pkg_disfigure");
+ l4 ([&]{trace << *p;});
+
database& db (t.database ());
tracer_guard tg (db, trace);
@@ -51,6 +53,17 @@ namespace bpkg
}
}
+ if (p->substate == package_substate::system)
+ {
+ db.erase (p);
+ t.commit ();
+
+ p->state = package_state::transient;
+ p->substate = package_substate::none;
+
+ return;
+ }
+
// Since we are no longer configured, clear the prerequisites list.
//
p->prerequisites.clear ();
@@ -154,12 +167,15 @@ namespace bpkg
fail << "package " << n << " is " << p->state <<
info << "expected it to be configured";
- l4 ([&]{trace << p->name << " " << p->version;});
-
pkg_disfigure (c, o, t, p); // Commits the transaction.
+ assert (p->state == package_state::unpacked ||
+ p->state == package_state::transient);
+
if (verb)
- text << "disfigured " << p->name << " " << p->version;
+ text << (p->state == package_state::transient
+ ? "purged "
+ : "disfigured ") << *p;
return 0;
}