From c28758a9327efc0f3bfc2f3c14d12b533750d94b Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Mon, 8 Jul 2019 21:27:53 +0300 Subject: Add support for marking internal repository as non-buildable --- load/load.cxx | 55 ++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 38 insertions(+), 17 deletions(-) (limited to 'load') diff --git a/load/load.cxx b/load/load.cxx index 9c1c31f..57acb3a 100644 --- a/load/load.cxx +++ b/load/load.cxx @@ -60,6 +60,7 @@ struct internal_repository string display_name; repository_location cache_location; optional fingerprint; + bool buildable = true; path packages_path () const {return cache_location.path () / packages;} @@ -74,7 +75,7 @@ using internal_repositories = vector; // // loadtab consists of lines in the following format: // -// cache: [fingerprint:] +// cache: [fingerprint:] [buildable:(yes|no)] // // Note that if the remote repository location is a pkg repository, then the // repository cache should be its local copy. Otherwise, the cache directory @@ -162,7 +163,7 @@ load_repositories (path p) r.display_name = move (tl[i++].value); // Parse options, that have : form. Currently defined - // options are cache (mandatory for now) and fingerprint. + // options are cache (mandatory for now), fingerprint, and buildable. // for (; i < n; ++i) { @@ -238,6 +239,15 @@ load_repositories (path p) } } } + else if (strncmp (nv.c_str (), "buildable:", vp = 10) == 0) + { + string v (nv, vp); + + r.buildable = (v == "yes"); + + if (!r.buildable && v != "no") + bad_line ("invalid buildable option value"); + } else bad_line ("invalid option '" + nv + "'"); } @@ -286,6 +296,7 @@ changed (const string& tenant, r.location.string () != pr->location.string () || r.display_name != pr->display_name || r.cache_location.path () != pr->cache_location.path () || + r.buildable != pr->buildable || file_mtime (r.packages_path ()) != pr->packages_timestamp || file_mtime (r.repositories_path ()) != pr->repositories_timestamp || !pr->internal) @@ -544,23 +555,32 @@ load_packages (const shared_ptr& rp, // assert (!rp->internal || p->internal ()); - // Note that the sha256sum manifest value can only be present if the - // package comes from the pkg repository. - // - if (rp->internal && pm.sha256sum) + if (rp->internal) { - // Save the package sha256sum if it is not present yet, match - // otherwise. + // Note that the sha256sum manifest value can only be present if the + // package comes from the pkg repository. + // + if (pm.sha256sum) + { + // Save the package sha256sum if it is not present yet, match + // otherwise. + // + if (!p->sha256sum) + p->sha256sum = move (pm.sha256sum); + else if (*pm.sha256sum != *p->sha256sum) + cerr << "warning: sha256sum mismatch for package " << p->name + << " " << p->version << endl + << " info: " << p->internal_repository.load ()->location + << " has " << *p->sha256sum << endl + << " info: " << rp->location << " has " << *pm.sha256sum + << endl; + } + + // A non-stub package is buildable if belongs to at least one + // buildable repository (see libbrep/package.hxx for details). // - if (!p->sha256sum) - p->sha256sum = move (pm.sha256sum); - else if (*pm.sha256sum != *p->sha256sum) - cerr << "warning: sha256sum mismatch for package " << p->name - << " " << p->version << endl - << " info: " << p->internal_repository.load ()->location - << " has " << *p->sha256sum << endl - << " info: " << rp->location << " has " << *pm.sha256sum - << endl; + if (!p->stub () && !p->buildable) + p->buildable = rp->buildable; } p->other_repositories.push_back (rp); @@ -1267,6 +1287,7 @@ try move (ir.display_name), move (ir.cache_location), move (cert), + ir.buildable, priority++)); load_packages (r, db, ops.ignore_unknown (), overrides); -- cgit v1.1