aboutsummaryrefslogtreecommitdiff
path: root/bpkg/package.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2023-05-31 19:03:12 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2023-06-01 13:03:45 +0300
commit545e427106ba9ebfa66db1e3bba3cf13078a213c (patch)
tree9c89ab9481262124c7b63552353bcee56e468548 /bpkg/package.cxx
parentecb8c74e002b66f61199e1cb6bc61fabf2f29a01 (diff)
Increment version iteration number for selected non-external package regardless of manifest/subprojects checksum
Diffstat (limited to 'bpkg/package.cxx')
-rw-r--r--bpkg/package.cxx71
1 files changed, 40 insertions, 31 deletions
diff --git a/bpkg/package.cxx b/bpkg/package.cxx
index fe04248..c98e7a4 100644
--- a/bpkg/package.cxx
+++ b/bpkg/package.cxx
@@ -389,45 +389,54 @@ namespace bpkg
false /* iteration */))
return nullopt;
- string mc (package_checksum (o, d, pi));
+ bool changed (!p->external ());
- // The selected package must not be "simulated" (see pkg-build for
- // details).
+ // If the selected package is not external, then increment the iteration
+ // number to make the external package preferable. Note that for such
+ // packages the manifest/subprojects and buildfiles checksums are absent.
//
- assert (p->manifest_checksum);
-
- bool changed (mc != *p->manifest_checksum);
-
- // If the manifest hasn't changed and the package has buildfile clauses in
- // the dependencies, then check if the buildfiles haven't changed either.
- //
- if (!changed && p->buildfiles_checksum)
+ if (!changed)
{
- // Always calculate the checksum over the buildfiles since the package
- // is external.
+ // The selected package must not be "simulated" (see pkg-build for
+ // details).
//
- changed = package_buildfiles_checksum (
- nullopt /* bootstrap_build */,
- nullopt /* root_build */,
- {} /* buildfiles */,
- d) != *p->buildfiles_checksum;
- }
+ assert (p->manifest_checksum);
- // If the manifest hasn't changed but the selected package points to an
- // external source directory, then we also check if the directory have
- // moved.
- //
- if (!changed && p->external ())
- {
- dir_path src_root (p->effective_src_root (db.config));
+ changed = (package_checksum (o, d, pi) != *p->manifest_checksum);
- // We need to complete and normalize the source directory as it may
- // generally be completed against the configuration directory (unlikely
- // but possible), that can be relative and/or not normalized.
+ // If the manifest hasn't changed and the package has buildfile clauses
+ // in the dependencies, then check if the buildfiles haven't changed
+ // either.
//
- normalize (src_root, "package source");
+ if (!changed && p->buildfiles_checksum)
+ {
+ // Always calculate the checksum over the buildfiles since the package
+ // is external.
+ //
+ changed = package_buildfiles_checksum (
+ nullopt /* bootstrap_build */,
+ nullopt /* root_build */,
+ {} /* buildfiles */,
+ d) != *p->buildfiles_checksum;
+ }
+
+ // If the manifest hasn't changed but the selected package points to an
+ // external source directory, then we also check if the directory have
+ // moved.
+ //
+ if (!changed)
+ {
+ dir_path src_root (p->effective_src_root (db.config));
- changed = src_root != normalize (d, "package source");
+ // We need to complete and normalize the source directory as it may
+ // generally be completed against the configuration directory
+ // (unlikely but possible), that can be relative and/or not
+ // normalized.
+ //
+ normalize (src_root, "package source");
+
+ changed = src_root != normalize (d, "package source");
+ }
}
return !changed