aboutsummaryrefslogtreecommitdiff
path: root/bpkg/manifest-utility.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'bpkg/manifest-utility.hxx')
-rw-r--r--bpkg/manifest-utility.hxx68
1 files changed, 51 insertions, 17 deletions
diff --git a/bpkg/manifest-utility.hxx b/bpkg/manifest-utility.hxx
index 8ef517e..a5ea962 100644
--- a/bpkg/manifest-utility.hxx
+++ b/bpkg/manifest-utility.hxx
@@ -7,6 +7,8 @@
#include <libbpkg/manifest.hxx>
#include <libbpkg/package-name.hxx>
+#include <libbutl/b.hxx> // b_info_flags
+
#include <bpkg/types.hxx>
#include <bpkg/utility.hxx>
@@ -17,17 +19,19 @@ namespace bpkg
extern const path signature_file; // signature.manifest
extern const path manifest_file; // manifest
+ using butl::b_info_flags;
+
// Obtain build2 projects info for package source or output directories.
//
vector<package_info>
- package_b_info (const common_options&, const dir_paths&, bool ext_mods);
+ package_b_info (const common_options&, const dir_paths&, b_info_flags);
// As above but return the info for a single package directory.
//
inline package_info
- package_b_info (const common_options& o, const dir_path& d, bool ext_mods)
+ package_b_info (const common_options& o, const dir_path& d, b_info_flags fl)
{
- vector<package_info> r (package_b_info (o, dir_paths ({d}), ext_mods));
+ vector<package_info> r (package_b_info (o, dir_paths ({d}), fl));
return move (r[0]);
}
@@ -62,16 +66,14 @@ namespace bpkg
version
parse_package_version (const char*,
bool allow_wildcard = false,
- bool fold_zero_revision = true);
+ version::flags fl = version::fold_zero_revision);
inline version
parse_package_version (const string& s,
bool allow_wildcard = false,
- bool fold_zero_revision = true)
+ version::flags fl = version::fold_zero_revision)
{
- return parse_package_version (s.c_str (),
- allow_wildcard,
- fold_zero_revision);
+ return parse_package_version (s.c_str (), allow_wildcard, fl);
}
// Extract the package constraint from either <name>[/<version>] or
@@ -80,10 +82,11 @@ namespace bpkg
// the package name is specified.
//
optional<version_constraint>
- parse_package_version_constraint (const char*,
- bool allow_wildcard = false,
- bool fold_zero_revision = true,
- bool version_only = false);
+ parse_package_version_constraint (
+ const char*,
+ bool allow_wildcard = false,
+ version::flags = version::fold_zero_revision,
+ bool version_only = false);
// If the passed location is a relative local path, then assume this is a
// relative path to the repository directory and complete it based on the
@@ -118,7 +121,7 @@ namespace bpkg
//
// Note that if a package directory is under the version control, then the
// resulting version may be populated with the snapshot information (see
- // libbutl/standard-version.mxx for more details). Thus, this function can
+ // libbutl/standard-version.hxx for more details). Thus, this function can
// be used for fixing up the package manifest versions.
//
class common_options;
@@ -132,14 +135,14 @@ namespace bpkg
using package_version_infos = vector<package_version_info>;
package_version_infos
- package_versions (const common_options&, const dir_paths&);
+ package_versions (const common_options&, const dir_paths&, b_info_flags);
// As above but return the version of a single package.
//
inline package_version_info
- package_version (const common_options& o, const dir_path& d)
+ package_version (const common_options& o, const dir_path& d, b_info_flags fl)
{
- package_version_infos r (package_versions (o, dir_paths ({d})));
+ package_version_infos r (package_versions (o, dir_paths ({d}), fl));
return move (r[0]);
}
@@ -148,12 +151,43 @@ namespace bpkg
//
// Pass the build2 project info for the package, if available, to speed up
// the call and NULL otherwise (in which case it will be queried by the
- // implementation).
+ // implementation). In the former case it is assumed that the package info
+ // has been retrieved with the b_info_flags::subprojects flag.
//
string
package_checksum (const common_options&,
const dir_path& src_dir,
const package_info*);
+
+ // Calculate the checksum of the buildfiles using the *-build manifest
+ // values and, if the package source directory is specified (not empty),
+ // build-file values. If the package source directory is specified, then
+ // also use the files it contains for unspecified values. If additionally
+ // the alt_naming flag is specified, then verify the package's buildfile
+ // naming scheme against its value and fail on mismatch.
+ //
+ string
+ package_buildfiles_checksum (const optional<string>& bootstrap_build,
+ const optional<string>& root_build,
+ const vector<buildfile>& buildfiles,
+ const dir_path& src_dir = {},
+ const vector<path>& buildfile_paths = {},
+ optional<bool> alt_naming = nullopt);
+
+ // Load the package's buildfiles for unspecified manifest values. Throw
+ // std::runtime_error for underlying errors (unable to find bootstrap.build,
+ // unable to read from file, etc). Optionally convert paths used in the
+ // potential error description to be relative to the package source
+ // directory.
+ //
+ // Note that before calling this function you need to expand the build-file
+ // manifest values into the respective *-build values, for example, by
+ // calling manifest::load_files().
+ //
+ void
+ load_package_buildfiles (package_manifest&,
+ const dir_path& src_dir,
+ bool err_path_relative = false);
}
#endif // BPKG_MANIFEST_UTILITY_HXX