From 545e427106ba9ebfa66db1e3bba3cf13078a213c Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 31 May 2023 19:03:12 +0300 Subject: Increment version iteration number for selected non-external package regardless of manifest/subprojects checksum --- bpkg/pkg-unpack.cxx | 60 ++++------------------------------------------------- 1 file changed, 4 insertions(+), 56 deletions(-) (limited to 'bpkg/pkg-unpack.cxx') diff --git a/bpkg/pkg-unpack.cxx b/bpkg/pkg-unpack.cxx index 8f01a8a..90ed331 100644 --- a/bpkg/pkg-unpack.cxx +++ b/bpkg/pkg-unpack.cxx @@ -162,7 +162,10 @@ namespace bpkg optional mc; optional bc; - if (!simulate) + // Only calculate the manifest/subprojects and buildfiles checksums for + // external packages (see selected_package::external() for details). + // + if (!simulate && (rl.empty () || rl.directory_based ())) { mc = package_checksum (o, d, pi); @@ -334,7 +337,6 @@ namespace bpkg shared_ptr pkg_unpack (const common_options& co, database& db, - database& rdb, transaction& t, const package_name& name, bool simulate) @@ -371,8 +373,6 @@ namespace bpkg fail << "package directory " << d << " already exists"; auto_rmdir arm; - optional mc; - optional bc; if (!simulate) { @@ -402,62 +402,11 @@ namespace bpkg { fail << "unable to extract " << a << " to " << c << ": " << e; } - - mc = package_checksum (co, d, nullptr /* package_info */); - - // Calculate the buildfiles checksum if the package has any buildfile - // clauses in the dependencies. - // - // Note that we may not have the available package (e.g., fetched as an - // existing package archive rather than from an archive repository), in - // which case we need to parse the manifest to retrieve the - // dependencies. This is unfortunate, but is probably not a big deal - // performance-wise given that this is not too common and we are running - // an archive unpacking process anyway. - // - shared_ptr ap ( - rdb.find (available_package_id (n, v))); - - if (ap != nullptr) - { - // Note that the available package already has all the buildfiles - // loaded. - // - if (has_buildfile_clause (ap->dependencies)) - bc = package_buildfiles_checksum (ap->bootstrap_build, - ap->root_build, - ap->buildfiles); - } - else - { - // Note that we don't need to translate the package version here since - // the manifest comes from an archive and so has a proper version - // already. - // - package_manifest m ( - pkg_verify (co, - d, - true /* ignore_unknown */, - false /* ignore_toolchain */, - false /* load_buildfiles */, - function ())); - - if (has_buildfile_clause (m.dependencies)) - bc = package_buildfiles_checksum (m.bootstrap_build, - m.root_build, - m.buildfiles, - d, - m.buildfile_paths, - m.alt_naming); - } } p->src_root = d.leaf (); // For now assuming to be in configuration. p->purge_src = true; - p->manifest_checksum = move (mc); - p->buildfiles_checksum = move (bc); - p->state = package_state::unpacked; db.update (p); @@ -522,7 +471,6 @@ namespace bpkg p = v.empty () ? pkg_unpack (o, db /* pdb */, - db /* rdb */, t, n, false /* simulate */) -- cgit v1.1