diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-09-18 06:21:35 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-09-18 06:21:35 +0200 |
commit | b18e54a088e84ed31f320d69b904af3f999adb2b (patch) | |
tree | b61cd10098ec1355e8765717b153c232043a44b7 | |
parent | faafff4814b4bfbbd043d13899c81115bd0f8604 (diff) |
Get rid of 'updated' state; clean in pkg-disfigure
-rw-r--r-- | bpkg/package | 5 | ||||
-rw-r--r-- | bpkg/package.cxx | 8 | ||||
-rw-r--r-- | bpkg/pkg-configure.cxx | 4 | ||||
-rw-r--r-- | bpkg/pkg-disfigure | 5 | ||||
-rw-r--r-- | bpkg/pkg-disfigure.cxx | 26 |
5 files changed, 28 insertions, 20 deletions
diff --git a/bpkg/package b/bpkg/package index f2c9b9a..aca883d 100644 --- a/bpkg/package +++ b/bpkg/package @@ -68,11 +68,10 @@ namespace bpkg // enum class state { + broken, fetched, unpacked, - configured, - updated, - broken + configured }; string diff --git a/bpkg/package.cxx b/bpkg/package.cxx index 7ffb99d..66769d1 100644 --- a/bpkg/package.cxx +++ b/bpkg/package.cxx @@ -15,11 +15,10 @@ namespace bpkg { switch (s) { + case state::broken: return "broken"; case state::fetched: return "fetched"; case state::unpacked: return "unpacked"; case state::configured: return "configured"; - case state::updated: return "updated"; - case state::broken: return "broken"; } return string (); // Should never reach. @@ -28,11 +27,10 @@ namespace bpkg state from_string (const string& s) { - if (s == "fetched") return state::fetched; + if (s == "broken") return state::broken; + else if (s == "fetched") return state::fetched; else if (s == "unpacked") return state::unpacked; else if (s == "configured") return state::configured; - else if (s == "updated") return state::updated; - else if (s == "broken") return state::broken; else throw invalid_argument (s); } } diff --git a/bpkg/pkg-configure.cxx b/bpkg/pkg-configure.cxx index c0dc05e..65355ba 100644 --- a/bpkg/pkg-configure.cxx +++ b/bpkg/pkg-configure.cxx @@ -101,10 +101,10 @@ namespace bpkg // the broken state. // - // Pretend we are configured. + // Indicate to pkg_disfigure() we are partially configured. // p->out_root = out_root.leaf (); - p->state = state::configured; + p->state = state::broken; pkg_disfigure (c, t, p); // Commits the transaction. throw; diff --git a/bpkg/pkg-disfigure b/bpkg/pkg-disfigure index 0e16a40..2df892b 100644 --- a/bpkg/pkg-disfigure +++ b/bpkg/pkg-disfigure @@ -15,7 +15,10 @@ namespace bpkg pkg_disfigure (const pkg_disfigure_options&, cli::scanner& args); // Disfigure the package, update its state, and commit the - // transaction. + // transaction. If the package state is broken, then this + // is taken to mean it hasn't been successfully configured + // and no clean prior to disfigure is necessary (or possible, + // for that matter). // void pkg_disfigure (const dir_path& configuration, diff --git a/bpkg/pkg-disfigure.cxx b/bpkg/pkg-disfigure.cxx index 48e54ba..fca5dd7 100644 --- a/bpkg/pkg-disfigure.cxx +++ b/bpkg/pkg-disfigure.cxx @@ -41,18 +41,26 @@ namespace bpkg // Form the buildspec. // - // Why do we need to specify src_root? While it shouldn't be - // necessary for a completely configured package, we might - // also be called to disfigure a partially configured one. - // string bspec; - if (src_root == out_root) - bspec = "disfigure(" + out_root.string () + "/)"; + if (p->state != state::broken) + { + bspec = "clean(" + out_root.string () + "/) " + "disfigure(" + out_root.string () + "/)"; + } else - bspec = "disfigure(" + - src_root.string () + "/@" + - out_root.string () + "/)"; + { + // Why do we need to specify src_root? While it's unnecessary + // for a completely configured package, here we disfigure a + // partially configured one. + // + if (src_root == out_root) + bspec = "disfigure(" + out_root.string () + "/)"; + else + bspec = "disfigure(" + + src_root.string () + "/@" + + out_root.string () + "/)"; + } level4 ([&]{trace << "buildspec: " << bspec;}); |