aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bpkg/pkg-build.cli25
-rw-r--r--bpkg/pkg-build.cxx24
2 files changed, 41 insertions, 8 deletions
diff --git a/bpkg/pkg-build.cli b/bpkg/pkg-build.cli
index ba9bf47..f9cee12 100644
--- a/bpkg/pkg-build.cli
+++ b/bpkg/pkg-build.cli
@@ -360,6 +360,13 @@ namespace bpkg
is otherwise a noop (performs no new package builds, upgrades, etc)."
}
+ bool --no-move
+ {
+ "Don't move dependency packages between configurations. In this mode the
+ \cb{--config-*} options specify packages' current rather than new
+ locations."
+ }
+
uint16_t --noop-exit
{
"<code>",
@@ -368,6 +375,17 @@ namespace bpkg
(performs no new package builds, upgrades, etc)."
}
+ string --rebuild-checksum
+ {
+ "<sum>",
+
+ "Hash the names and versions of all the packages that would be built.
+ If the resulting checksum matches the specified, then exit without
+ building anything (potentially with a special error code specified
+ with the \cb{--noop-exit} option). Otherwise, proceed to build as
+ normal. In both cases, print the resulting checksum to \cb{stdout}."
+ }
+
uint16_t --no-private-config
{
"<code>",
@@ -389,13 +407,6 @@ namespace bpkg
See \l{bpkg-cfg-create(1)} for details on linked configurations."
}
- bool --no-move
- {
- "Don't move dependency packages between configurations. In this mode the
- \cb{--config-*} options specify packages' current rather than new
- locations."
- }
-
dir_paths --directory|-d
{
"<dir>",
diff --git a/bpkg/pkg-build.cxx b/bpkg/pkg-build.cxx
index 76625e1..6661109 100644
--- a/bpkg/pkg-build.cxx
+++ b/bpkg/pkg-build.cxx
@@ -9,6 +9,7 @@
#include <cstring> // strlen()
#include <iostream> // cout
+#include <libbutl/sha256.mxx>
#include <libbutl/standard-version.mxx>
#include <bpkg/package.hxx>
@@ -6432,9 +6433,13 @@ namespace bpkg
// --plan, then we print it as long as it is not empty.
//
string plan;
+ sha256 csum;
bool need_prompt (false);
- if (o.print_only () || !o.yes () || o.plan_specified ())
+ if (!o.yes () ||
+ o.print_only () ||
+ o.plan_specified () ||
+ o.rebuild_checksum_specified ())
{
bool first (true); // First entry in the plan.
@@ -6543,6 +6548,12 @@ namespace bpkg
string rb;
if (!p.user_selection ())
{
+ // Note: if we are ever tempted to truncate this, watch out for
+ // the --rebuild-checksum functionality which uses this. But then
+ // it's not clear this information is actually important: can a
+ // dependent-dependency structure change without any of the
+ // package versions changing? Doesn't feel like it should.
+ //
for (const config_package& cp: p.required_by)
rb += (rb.empty () ? " " : ", ") + cp.string ();
@@ -6579,9 +6590,20 @@ namespace bpkg
// Print indented for better visual separation.
//
plan += (plan.empty () ? " " : "\n ") + act;
+
+ if (o.rebuild_checksum_specified ())
+ csum.append (act);
}
}
+ if (o.rebuild_checksum_specified ())
+ {
+ cout << csum.string () << endl;
+
+ if (o.rebuild_checksum () == csum.string ())
+ return o.noop_exit_specified () ? o.noop_exit () : 0;
+ }
+
if (o.print_only ())
return 0;