aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--brep/package10
-rw-r--r--loader/loader.cxx20
-rw-r--r--tests/loader/driver.cxx79
-rw-r--r--tests/loader/external/1/basics/packages8
-rw-r--r--tests/loader/external/1/basics/repositories3
-rw-r--r--tests/loader/external/1/misc/repositories7
-rw-r--r--tests/loader/external/1/staging/packages8
-rw-r--r--tests/loader/external/1/staging/repositories3
-rw-r--r--tests/loader/external/1/testing/packages9
-rw-r--r--tests/loader/external/1/testing/repositories8
-rw-r--r--tests/loader/internal/1/stable/repositories6
11 files changed, 134 insertions, 27 deletions
diff --git a/brep/package b/brep/package
index 7713288..719a906 100644
--- a/brep/package
+++ b/brep/package
@@ -266,7 +266,6 @@ namespace brep
timestamp packages_timestamp;
// Initialized with timestamp_nonexistent by default.
- // For external repositories stays timestamp_nonexistent.
//
timestamp repositories_timestamp;
@@ -353,11 +352,10 @@ namespace brep
// Create external package object.
//
- // External repository packages can appear on the WEB interface only on
- // the package version details page in dependency list in the form of a
- // link to the corresponding WEB page. The only package information
- // required to compose such a link is the package name, version, and
- // repository location.
+ // External repository packages can appear on the WEB interface only in
+ // dependency list in the form of a link to the corresponding WEB page.
+ // The only package information required to compose such a link is the
+ // package name, version, and repository location.
//
package (std::string name, version_type, std::shared_ptr<repository_type>);
diff --git a/loader/loader.cxx b/loader/loader.cxx
index 633521f..ecc6032 100644
--- a/loader/loader.cxx
+++ b/loader/loader.cxx
@@ -372,9 +372,9 @@ load_packages (const shared_ptr<repository>& rp, database& db)
db.persist (rp); // Save the repository state.
}
-// Load the prerequsite repositories state from the 'repositories' file.
-// Update the repository persistent state to save repositories_timestamp
-// member. Should be called once per internal repository.
+// Load the prerequsite repositories and their complements state from the
+// 'repositories' file. Update the repository persistent state to save
+// repositories_timestamp member. Should be called once per internal repository.
//
static void
load_prerequisites (const shared_ptr<repository>& rp, database& db)
@@ -384,10 +384,6 @@ load_prerequisites (const shared_ptr<repository>& rp, database& db)
//
assert (rp->repositories_timestamp == timestamp_nonexistent);
- // Load prerequisites for internal repositories only.
- //
- assert (rp->internal);
-
// Only locally accessible repositories allowed until package manager API is
// ready.
//
@@ -399,6 +395,7 @@ load_prerequisites (const shared_ptr<repository>& rp, database& db)
ifstream ifs;
path p (rp->local_path / path ("repositories"));
rp->repositories_timestamp = manifest_stream (p, ifs);
+ db.update (rp);
manifest_parser mp (ifs, p.string ());
rpm = repository_manifests (mp);
@@ -406,7 +403,9 @@ load_prerequisites (const shared_ptr<repository>& rp, database& db)
for (auto& rm: rpm)
{
- if (rm.location.empty ())
+ if (rm.location.empty () ||
+ (!rp->internal &&
+ rm.effective_role () == repository_role::prerequisite))
continue; // Ignore entry for this repository.
repository_location rl;
@@ -472,11 +471,8 @@ load_prerequisites (const shared_ptr<repository>& rp, database& db)
}
load_packages (pr, db);
+ load_prerequisites (pr, db);
}
-
- // Updates repositories_timestamp member.
- //
- db.update (rp);
}
int
diff --git a/tests/loader/driver.cxx b/tests/loader/driver.cxx
index f1e1385..74c6966 100644
--- a/tests/loader/driver.cxx
+++ b/tests/loader/driver.cxx
@@ -89,12 +89,14 @@ main (int argc, char* argv[])
session s;
transaction t (db.begin ());
- assert (db.query<repository> ().size () == 3);
- assert (db.query<package> ().size () == 10);
+ assert (db.query<repository> ().size () == 5);
+ assert (db.query<package> ().size () == 12);
shared_ptr<repository> sr (db.load<repository> ("cppget.org/stable"));
shared_ptr<repository> mr (db.load<repository> ("cppget.org/math"));
shared_ptr<repository> cr (db.load<repository> ("cppget.org/misc"));
+ shared_ptr<repository> tr (db.load<repository> ("cppget.org/testing"));
+ shared_ptr<repository> gr (db.load<repository> ("cppget.org/staging"));
// Verify 'stable' repository.
//
@@ -443,7 +445,8 @@ main (int argc, char* argv[])
assert (cr->packages_timestamp ==
file_mtime (dir_path (cr->local_path) / path ("packages")));
- assert (cr->repositories_timestamp == timestamp_nonexistent);
+ assert (cr->repositories_timestamp ==
+ file_mtime (dir_path (cr->local_path) / path ("repositories")));
assert (!cr->internal);
shared_ptr<package> bpv (
@@ -525,6 +528,76 @@ main (int argc, char* argv[])
assert (fpv6->dependencies.empty ());
assert (fpv6->requirements.empty ());
+ // Verify 'testing' repository.
+ //
+ assert (tr->location.canonical_name () == "cppget.org/testing");
+ assert (tr->location.string () ==
+ "http://pkg.cppget.org/external/1/testing");
+ assert (tr->display_name.empty ());
+
+ dir_path trp (cp.directory () / dir_path ("external/1/testing"));
+ assert (tr->local_path == trp.normalize ());
+
+ assert (tr->packages_timestamp ==
+ file_mtime (dir_path (tr->local_path) / path ("packages")));
+ assert (tr->repositories_timestamp ==
+ file_mtime (dir_path (tr->local_path) / path ("repositories")));
+ assert (!tr->internal);
+
+ shared_ptr<package> mpv (
+ db.load<package> (package_id ("libmisc", version ("1.1"))));
+ assert (check_location (mpv));
+
+ shared_ptr<package> tpv (
+ db.load<package> (package_id ("libexpat", version ("5.1"))));
+ assert (check_location (tpv));
+
+ // Verify libmisc package version.
+ //
+ // libmisc-1.1
+ //
+ assert (mpv->summary.empty ());
+ assert (mpv->tags.empty ());
+ assert (!mpv->description);
+ assert (mpv->url.empty ());
+ assert (!mpv->package_url);
+ assert (mpv->email.empty ());
+ assert (!mpv->package_email);
+
+ assert (mpv->internal_repository == nullptr);
+ assert (mpv->external_repositories.size () == 1);
+ assert (mpv->external_repositories[0].load () == tr);
+
+ assert (mpv->priority == priority ());
+ assert (mpv->changes.empty ());
+
+ assert (mpv->license_alternatives.empty ());
+ assert (mpv->dependencies.empty ());
+ assert (mpv->requirements.empty ());
+
+ // Verify libexpat package version.
+ //
+ // libexpat-5.1
+ //
+ assert (tpv->summary.empty ());
+ assert (tpv->tags.empty ());
+ assert (!tpv->description);
+ assert (tpv->url.empty ());
+ assert (!tpv->package_url);
+ assert (tpv->email.empty ());
+ assert (!tpv->package_email);
+
+ assert (tpv->internal_repository == nullptr);
+ assert (tpv->external_repositories.size () == 1);
+ assert (tpv->external_repositories[0].load () == gr);
+
+ assert (tpv->priority == priority ());
+ assert (tpv->changes.empty ());
+
+ assert (tpv->license_alternatives.empty ());
+ assert (tpv->dependencies.empty ());
+ assert (tpv->requirements.empty ());
+
// Change package summary, update the object persistent state, rerun
// loader and ensure the model were not rebuilt.
//
diff --git a/tests/loader/external/1/basics/packages b/tests/loader/external/1/basics/packages
new file mode 100644
index 0000000..86c20c1
--- /dev/null
+++ b/tests/loader/external/1/basics/packages
@@ -0,0 +1,8 @@
+: 1
+name: libexpat
+version: 5.1
+summary: The Expat Library
+license: MIT
+url: http://www.example.com/expat/
+email: expat-users@example.com
+location: libexpat-5.1.tar.gz
diff --git a/tests/loader/external/1/basics/repositories b/tests/loader/external/1/basics/repositories
new file mode 100644
index 0000000..9a15f2b
--- /dev/null
+++ b/tests/loader/external/1/basics/repositories
@@ -0,0 +1,3 @@
+: 1
+# Local repository manifest (this repository).
+#
diff --git a/tests/loader/external/1/misc/repositories b/tests/loader/external/1/misc/repositories
index 5128606..93acdb3 100644
--- a/tests/loader/external/1/misc/repositories
+++ b/tests/loader/external/1/misc/repositories
@@ -1,11 +1,12 @@
: 1
# Foreign repository manifest.
#
-location: http://pkg.example.org/1/misc
+location: ../basics
:
-# Foreign repository manifest.
+# Adjacent repository manifest.
#
-location: http://pkg.example.org/1/math
+location: ../testing
+role: complement
:
# Local repository manifest (this repository).
#
diff --git a/tests/loader/external/1/staging/packages b/tests/loader/external/1/staging/packages
new file mode 100644
index 0000000..86c20c1
--- /dev/null
+++ b/tests/loader/external/1/staging/packages
@@ -0,0 +1,8 @@
+: 1
+name: libexpat
+version: 5.1
+summary: The Expat Library
+license: MIT
+url: http://www.example.com/expat/
+email: expat-users@example.com
+location: libexpat-5.1.tar.gz
diff --git a/tests/loader/external/1/staging/repositories b/tests/loader/external/1/staging/repositories
new file mode 100644
index 0000000..9a15f2b
--- /dev/null
+++ b/tests/loader/external/1/staging/repositories
@@ -0,0 +1,3 @@
+: 1
+# Local repository manifest (this repository).
+#
diff --git a/tests/loader/external/1/testing/packages b/tests/loader/external/1/testing/packages
new file mode 100644
index 0000000..ac5ab95
--- /dev/null
+++ b/tests/loader/external/1/testing/packages
@@ -0,0 +1,9 @@
+: 1
+name: libmisc
+version: 1.1
+summary: The Expat Library
+license: MIT
+url: http://www.example.com/misc/
+email: misc-users@example.com
+depends: libexpat >= 5.0
+location: libmisc-1.1.tar.gz
diff --git a/tests/loader/external/1/testing/repositories b/tests/loader/external/1/testing/repositories
new file mode 100644
index 0000000..5f7246c
--- /dev/null
+++ b/tests/loader/external/1/testing/repositories
@@ -0,0 +1,8 @@
+: 1
+# Adjacent repository manifest.
+#
+location: ../staging
+role: complement
+:
+# Local repository manifest (this repository).
+#
diff --git a/tests/loader/internal/1/stable/repositories b/tests/loader/internal/1/stable/repositories
index 4c12e72..38fdd72 100644
--- a/tests/loader/internal/1/stable/repositories
+++ b/tests/loader/internal/1/stable/repositories
@@ -1,11 +1,11 @@
: 1
# Foreign repository manifest.
#
-location: http://pkg.cppget.org/1/math
+location: ../../../external/1/misc
:
-# Foreign repository manifest.
+# Adjacent repository manifest.
#
-location: ../../../external/1/misc
+location: ../math
:
# Local repository manifest (this repository).
#