aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libbrep/package.cxx5
-rw-r--r--libbrep/package.hxx12
-rw-r--r--libbrep/package.xml6
-rw-r--r--load/load.cxx1
-rw-r--r--mod/mod-package-details.cxx2
-rw-r--r--mod/mod-package-version-details.cxx2
-rw-r--r--mod/page.cxx17
-rw-r--r--mod/page.hxx16
-rw-r--r--tests/load/1/math/libexp-+2-1.2+1.tar.gzbin408 -> 426 bytes
-rw-r--r--tests/load/1/math/packages.manifest3
-rw-r--r--tests/load/driver.cxx3
11 files changed, 48 insertions, 19 deletions
diff --git a/libbrep/package.cxx b/libbrep/package.cxx
index a01ed14..763cec9 100644
--- a/libbrep/package.cxx
+++ b/libbrep/package.cxx
@@ -52,6 +52,7 @@ namespace brep
package::
package (package_name nm,
version_type vr,
+ optional<string> uv,
package_name pn,
priority_type pr,
string sm,
@@ -81,6 +82,7 @@ namespace brep
tenant (id.tenant),
name (id.name),
version (move (vr)),
+ upstream_version (move (uv)),
project (move (pn)),
priority (move (pr)),
summary (move (sm)),
@@ -144,6 +146,9 @@ namespace brep
string k (project.string () + " " + name.string () + " " +
version.string () + " " + version.string (true));
+ if (upstream_version)
+ k += " " + *upstream_version;
+
// Add tags to keywords.
//
for (const auto& t: tags)
diff --git a/libbrep/package.hxx b/libbrep/package.hxx
index 2e31ff4..f59c0d8 100644
--- a/libbrep/package.hxx
+++ b/libbrep/package.hxx
@@ -21,7 +21,7 @@
//
#define LIBBREP_PACKAGE_SCHEMA_VERSION_BASE 11
-#pragma db model version(LIBBREP_PACKAGE_SCHEMA_VERSION_BASE, 12, closed)
+#pragma db model version(LIBBREP_PACKAGE_SCHEMA_VERSION_BASE, 13, closed)
namespace brep
{
@@ -344,6 +344,7 @@ namespace brep
public:
using repository_type = brep::repository;
using version_type = brep::version;
+ using upstream_version_type = brep::upstream_version;
using priority_type = brep::priority;
using license_alternatives_type = brep::license_alternatives;
using url_type = brep::url;
@@ -357,6 +358,7 @@ namespace brep
//
package (package_name,
version_type,
+ optional<string> upstream_version,
package_name project,
priority_type,
string summary,
@@ -399,9 +401,11 @@ namespace brep
//
package_id id;
- const string& tenant; // Tracks id.tenant.
- const package_name& name; // Tracks id.name.
- upstream_version version;
+ const string& tenant; // Tracks id.tenant.
+ const package_name& name; // Tracks id.name.
+ upstream_version_type version;
+
+ optional<string> upstream_version;
// Matches the package name if the project name is not specified in
// the manifest.
diff --git a/libbrep/package.xml b/libbrep/package.xml
index fdb4f04..a1e7602 100644
--- a/libbrep/package.xml
+++ b/libbrep/package.xml
@@ -1,4 +1,10 @@
<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="pgsql" schema-name="package" version="1">
+ <changeset version="13">
+ <alter-table name="package">
+ <add-column name="upstream_version" type="TEXT" null="true"/>
+ </alter-table>
+ </changeset>
+
<changeset version="12">
<alter-table name="package">
<add-column name="description_type" type="TEXT" null="true"/>
diff --git a/load/load.cxx b/load/load.cxx
index c5fa3cd..9b414d5 100644
--- a/load/load.cxx
+++ b/load/load.cxx
@@ -502,6 +502,7 @@ load_packages (const shared_ptr<repository>& rp,
p = make_shared<package> (
move (pm.name),
move (pm.version),
+ move (pm.upstream_version),
move (project),
pm.priority ? move (*pm.priority) : priority (),
move (pm.summary),
diff --git a/mod/mod-package-details.cxx b/mod/mod-package-details.cxx
index 5074eca..7b75e62 100644
--- a/mod/mod-package-details.cxx
+++ b/mod/mod-package-details.cxx
@@ -254,7 +254,7 @@ handle (request& rq, response& rs)
s << TABLE(CLASS="proplist version")
<< TBODY
- << TR_VERSION (name, p->version, root, tenant)
+ << TR_VERSION (name, p->version, root, tenant, p->upstream_version)
// @@ Shouldn't we skip low priority row ? Don't think so, why?
//
diff --git a/mod/mod-package-version-details.cxx b/mod/mod-package-version-details.cxx
index 40cbad6..437bff4 100644
--- a/mod/mod-package-version-details.cxx
+++ b/mod/mod-package-version-details.cxx
@@ -210,7 +210,7 @@ handle (request& rq, response& rs)
// Repeat version here since it can be cut out in the header.
//
- << TR_VERSION (pkg->version)
+ << TR_VERSION (pkg->version, pkg->upstream_version)
<< TR_PRIORITY (pkg->priority)
<< TR_LICENSES (pkg->license_alternatives)
diff --git a/mod/page.cxx b/mod/page.cxx
index 228a137..0c4c257 100644
--- a/mod/page.cxx
+++ b/mod/page.cxx
@@ -153,8 +153,8 @@ namespace brep
if (!value_.empty ())
s << VALUE(value_);
- if (!placeholder_.empty ())
- s << PLACEHOLDER(placeholder_);
+ if (placeholder_ != nullptr)
+ s << PLACEHOLDER(*placeholder_);
if (autofocus_)
s << AUTOFOCUS("");
@@ -249,7 +249,9 @@ namespace brep
{
s << version_;
- if (stub_)
+ if (upstream_version_ != nullptr)
+ s << " (" << *upstream_version_ << ')';
+ else if (stub_)
s << " (stub)";
}
else
@@ -259,12 +261,13 @@ namespace brep
s << A(HREF=tenant_dir (*root_, *tenant_) /
dir_path (mime_url_encode (package_->string (), false)) /
path (version_))
- << version_;
+ << version_
+ << ~A;
- if (stub_)
+ if (upstream_version_ != nullptr)
+ s << " (" << *upstream_version_ << ')';
+ else if (stub_)
s << " (stub)";
-
- s << ~A;
}
s << ~SPAN
diff --git a/mod/page.hxx b/mod/page.hxx
index 7260031..28257c1 100644
--- a/mod/page.hxx
+++ b/mod/page.hxx
@@ -129,7 +129,11 @@ namespace brep
const string& v,
const string& p = string (),
bool a = false)
- : label_ (l), name_ (n), value_ (v), placeholder_ (p), autofocus_ (a)
+ : label_ (l),
+ name_ (n),
+ value_ (v),
+ placeholder_ (!p.empty () ? &p : nullptr),
+ autofocus_ (a)
{
}
@@ -140,7 +144,7 @@ namespace brep
const string& label_;
const string& name_;
const string& value_;
- const string& placeholder_;
+ const string* placeholder_;
bool autofocus_;
};
@@ -222,9 +226,11 @@ namespace brep
TR_VERSION (const package_name& p,
const version& v,
const dir_path& r,
- const string& t)
+ const string& t,
+ const optional<string>& u = nullopt)
: package_ (&p),
version_ (v.string ()),
+ upstream_version_ (u ? &*u : nullptr),
stub_ (v.compare (wildcard_version, true) == 0),
root_ (&r),
tenant_ (&t)
@@ -233,9 +239,10 @@ namespace brep
// Display the version as a regular text.
//
- TR_VERSION (const version& v)
+ TR_VERSION (const version& v, const optional<string>& u = nullopt)
: package_ (nullptr),
version_ (v.string ()),
+ upstream_version_ (u ? &*u : nullptr),
stub_ (v.compare (wildcard_version, true) == 0),
root_ (nullptr),
tenant_ (nullptr)
@@ -248,6 +255,7 @@ namespace brep
private:
const package_name* package_;
string version_;
+ const string* upstream_version_;
bool stub_;
const dir_path* root_;
const string* tenant_;
diff --git a/tests/load/1/math/libexp-+2-1.2+1.tar.gz b/tests/load/1/math/libexp-+2-1.2+1.tar.gz
index 20c8434..5beeb84 100644
--- a/tests/load/1/math/libexp-+2-1.2+1.tar.gz
+++ b/tests/load/1/math/libexp-+2-1.2+1.tar.gz
Binary files differ
diff --git a/tests/load/1/math/packages.manifest b/tests/load/1/math/packages.manifest
index 1bb1c57..49caea6 100644
--- a/tests/load/1/math/packages.manifest
+++ b/tests/load/1/math/packages.manifest
@@ -3,6 +3,7 @@ sha256sum: b85ba3a0ba45b98e1fbb2507f199bc4b218a4a413ec6ba4094e214a7507490a2
:
name: libexp
version: +2-1.2+1
+upstream-version: 1.2.abc.15-x
project: mathLab
summary: The exponent
license: MIT
@@ -19,7 +20,7 @@ build-include: windows**d/x86_64**
build-include: windows-vc_13**
build-exclude: **; Only supported on Windows.
location: libexp-+2-1.2+1.tar.gz
-sha256sum: 4f476dab0cd13d4c7a4676b50180e66a9a10a65f92a3d335b8227a9a8ca58e21
+sha256sum: 317c8c6f45d9dfdfdef3a823411920cecd51729c7c4f58f9a0b0bbd681c07bd6
:
name: libfoo
version: +0-X.Y
diff --git a/tests/load/driver.cxx b/tests/load/driver.cxx
index 27be0da..18c601e 100644
--- a/tests/load/driver.cxx
+++ b/tests/load/driver.cxx
@@ -792,6 +792,7 @@ test_pkg_repos (const cstrings& loader_args,
db.load<package> (
package_id (tenant, package_name ("libexp"), version ("+2-1.2+1"))));
+ assert (epv->upstream_version && *epv->upstream_version == "1.2.abc.15-x");
assert (epv->project == "mathLab");
assert (epv->summary == "The exponent");
assert (epv->tags == strings ({"mathlab", "c++", "exponent"}));
@@ -836,7 +837,7 @@ test_pkg_repos (const cstrings& loader_args,
assert (check_location (epv));
assert (epv->sha256sum && *epv->sha256sum ==
- "4f476dab0cd13d4c7a4676b50180e66a9a10a65f92a3d335b8227a9a8ca58e21");
+ "317c8c6f45d9dfdfdef3a823411920cecd51729c7c4f58f9a0b0bbd681c07bd6");
// Verify libpq package version.
//