From 33153c6816c65c96a083c6f5b5e85418c444f929 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Sat, 29 Jul 2017 22:38:55 +0300 Subject: Add support for src-url and doc-url package manifest values --- libbrep/package.cxx | 4 ++++ libbrep/package.hxx | 4 ++++ libbrep/package.xml | 4 ++++ load/load.cxx | 2 ++ manifest | 1 + mod/mod-package-details.cxx | 11 +++++++++-- mod/mod-package-version-details.cxx | 6 ++++++ tests/load/1/math/libfoo-1.2.4+1.tar.gz | Bin 866 -> 933 bytes tests/load/1/math/packages | 10 ++++++---- tests/load/driver.cxx | 10 +++++++--- 10 files changed, 43 insertions(+), 9 deletions(-) diff --git a/libbrep/package.cxx b/libbrep/package.cxx index e14b15a..af63c82 100644 --- a/libbrep/package.cxx +++ b/libbrep/package.cxx @@ -56,6 +56,8 @@ namespace brep optional ds, string ch, url_type ur, + optional du, + optional su, optional pu, email_type em, optional pe, @@ -75,6 +77,8 @@ namespace brep description (move (ds)), changes (move (ch)), url (move (ur)), + doc_url (move (du)), + src_url (move (su)), package_url (move (pu)), email (move (em)), package_email (move (pe)), diff --git a/libbrep/package.hxx b/libbrep/package.hxx index d3e3e00..d59d633 100644 --- a/libbrep/package.hxx +++ b/libbrep/package.hxx @@ -307,6 +307,8 @@ namespace brep optional description, string changes, url_type, + optional doc_url, + optional src_url, optional package_url, email_type, optional package_email, @@ -341,6 +343,8 @@ namespace brep optional description; string changes; url_type url; + optional doc_url; + optional src_url; optional package_url; email_type email; optional package_email; diff --git a/libbrep/package.xml b/libbrep/package.xml index 0947d6f..1c85e49 100644 --- a/libbrep/package.xml +++ b/libbrep/package.xml @@ -84,6 +84,10 @@ + + + + diff --git a/load/load.cxx b/load/load.cxx index 860aeb0..759dc61 100644 --- a/load/load.cxx +++ b/load/load.cxx @@ -404,6 +404,8 @@ load_packages (const shared_ptr& rp, database& db) move (dsc), move (chn), move (pm.url), + move (pm.doc_url), + move (pm.src_url), move (pm.package_url), move (pm.email), move (pm.package_email), diff --git a/manifest b/manifest index 04b5631..41dbdeb 100644 --- a/manifest +++ b/manifest @@ -8,6 +8,7 @@ description-file: README changes-file: NEWS url: https://build2.org email: users@build2.org +src-url: https://git.build2.org/cgit/brep/tree/ build-email: builds@build2.org build-include: linux* build-include: freebsd* diff --git a/mod/mod-package-details.cxx b/mod/mod-package-details.cxx index a241c23..605022d 100644 --- a/mod/mod-package-details.cxx +++ b/mod/mod-package-details.cxx @@ -180,8 +180,15 @@ handle (request& rq, response& rs) << TBODY << TR_LICENSE (licenses) << TR_URL (pkg->url) - << TR_EMAIL (pkg->email) - << TR_TAGS (pkg->tags, root) + << TR_EMAIL (pkg->email); + + if (pkg->doc_url) + s << TR_URL (*pkg->doc_url, "doc-url"); + + if (pkg->src_url) + s << TR_URL (*pkg->src_url, "src-url"); + + s << TR_TAGS (pkg->tags, root) << ~TBODY << ~TABLE; } diff --git a/mod/mod-package-version-details.cxx b/mod/mod-package-version-details.cxx index edab232..1186470 100644 --- a/mod/mod-package-version-details.cxx +++ b/mod/mod-package-version-details.cxx @@ -195,6 +195,12 @@ handle (request& rq, response& rs) << TR_URL (pkg->url) << TR_EMAIL (em); + if (pkg->doc_url) + s << TR_URL (*pkg->doc_url, "doc-url"); + + if (pkg->src_url) + s << TR_URL (*pkg->src_url, "src-url"); + const auto& pu (pkg->package_url); if (pu && *pu != pkg->url) s << TR_URL (*pu, "package-url"); diff --git a/tests/load/1/math/libfoo-1.2.4+1.tar.gz b/tests/load/1/math/libfoo-1.2.4+1.tar.gz index 5210ced..20434bf 100644 Binary files a/tests/load/1/math/libfoo-1.2.4+1.tar.gz and b/tests/load/1/math/libfoo-1.2.4+1.tar.gz differ diff --git a/tests/load/1/math/packages b/tests/load/1/math/packages index a796d31..c49b7bd 100644 --- a/tests/load/1/math/packages +++ b/tests/load/1/math/packages @@ -12,8 +12,8 @@ email: users@exp.com build-email: builds@exp.com depends: libmisc depends: libpq >= 9.0.0 -build-include: linux* build-exclude: *; Only supported on Linux. +build-include: linux* location: libexp-1~1.2+1.tar.gz sha256sum: 0a7414d06ad26d49dad203deaf3841f3df97f1fe27c5bf190c1c20dfeb7f84e0 : @@ -51,8 +51,10 @@ changes: \ * test suite extended significantly \ url: http://www.example.com/foo/; Project home page. -package-url: http://www.example.com/foo/pack; Package details. email: foo-users@example.com; Public mailing list. Read FAQ before posting. +doc-url: http://www.example.org/projects/libfoo/man.xhtml; documentation page +src-url: https://git.example.org/cgit/libfoo/tree/; source tree url +package-url: http://www.example.com/foo/pack; Package details. package-email: pack@example.com; Current packager. depends: libmisc < 1.1 | libmisc > 2.3.0; Crashes with 1.1.0-2.3.0. depends: libexp >= 1.0 @@ -62,7 +64,7 @@ requires: c++11 requires: ? ; libc++ standard library if using Clang on Mac OS X. requires: ? vc++ >= 12.0; Only if using VC++ on Windows. location: libfoo-1.2.4+1.tar.gz -sha256sum: 6bf9de8c4647a32dee79ad5e787c10311495e3f6b5727bfd03b2d9dcd6a16eed +sha256sum: 2d912d510b42b1fa04028b0c6a31158ec14b225431b9c2ac0c953d46a7304225 : name: libpq version: 0 @@ -92,8 +94,8 @@ https://git.build2.org/cgit/packaging/postgresql/ \ url: https://www.postgresql.org/ -package-url: https://git.build2.org/cgit/packaging/postgresql/ email: pgsql-general@postgresql.org; Mailing list. +package-url: https://git.build2.org/cgit/packaging/postgresql/ package-email: packaging@build2.org; Mailing list. requires: build2 >= 0.4.0 location: libpq-0.tar.gz diff --git a/tests/load/driver.cxx b/tests/load/driver.cxx index 2c8f4b6..79a7989 100644 --- a/tests/load/driver.cxx +++ b/tests/load/driver.cxx @@ -511,6 +511,10 @@ main (int argc, char* argv[]) "MATLAB.\n\nUseful for conversion of research code into " "production environments."); assert (fpv5->url == "http://www.example.com/foo/"); + assert (fpv5->doc_url && *fpv5->doc_url == + "http://www.example.org/projects/libfoo/man.xhtml"); + assert (fpv5->src_url && + *fpv5->src_url == "https://git.example.org/cgit/libfoo/tree/"); assert (fpv5->package_url && *fpv5->package_url == "http://www.example.com/foo/pack"); assert (fpv5->email == "foo-users@example.com"); @@ -602,7 +606,7 @@ main (int argc, char* argv[]) assert (check_location (fpv5)); assert (fpv5->sha256sum && *fpv5->sha256sum == - "6bf9de8c4647a32dee79ad5e787c10311495e3f6b5727bfd03b2d9dcd6a16eed"); + "2d912d510b42b1fa04028b0c6a31158ec14b225431b9c2ac0c953d46a7304225"); // Verify libexp package version. // @@ -648,8 +652,8 @@ main (int argc, char* argv[]) assert ( epv->build_constraints == build_constraints ({ - build_constraint (false, "linux*", nullopt, ""), - build_constraint (true, "*", nullopt, "Only supported on Linux.")})); + build_constraint (true, "*", nullopt, "Only supported on Linux."), + build_constraint (false, "linux*", nullopt, "")})); assert (check_location (epv)); assert (epv->sha256sum && *epv->sha256sum == -- cgit v1.1