From b26f393c2257c3dfe7937696cd4f307e4075f20c Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 30 Apr 2019 20:25:19 +0300 Subject: Add support for description-type package manifest value --- bpkg/fetch-git.cxx | 3 ++- bpkg/pkg-verify.cxx | 3 ++- bpkg/pkg-verify.hxx | 9 +++++---- bpkg/rep-create.cxx | 2 +- doc/manual.cli | 26 ++++++++++++++++++++++++-- tests/common/satisfy/libfoo-1.0.0.tar.gz | Bin 348 -> 369 bytes tests/pkg-verify.testscript | 1 + 7 files changed, 35 insertions(+), 9 deletions(-) diff --git a/bpkg/fetch-git.cxx b/bpkg/fetch-git.cxx index 7650bf9..63ee09d 100644 --- a/bpkg/fetch-git.cxx +++ b/bpkg/fetch-git.cxx @@ -383,7 +383,8 @@ namespace bpkg return url.string (); #ifndef _WIN32 - // Enforce the 'file://' notation for local URLs (see libpkg/manifest.hxx). + // Enforce the 'file://' notation for local URLs (see + // libbpkg/manifest.hxx). // repository_url u (url.scheme, repository_url::authority_type (), diff --git a/bpkg/pkg-verify.cxx b/bpkg/pkg-verify.cxx index 00a5db0..4dea4fa 100644 --- a/bpkg/pkg-verify.cxx +++ b/bpkg/pkg-verify.cxx @@ -87,7 +87,8 @@ namespace bpkg } return s; - }); + }, + iu); } return m; diff --git a/bpkg/pkg-verify.hxx b/bpkg/pkg-verify.hxx index f3a7c01..7f36e72 100644 --- a/bpkg/pkg-verify.hxx +++ b/bpkg/pkg-verify.hxx @@ -19,10 +19,11 @@ namespace bpkg // Verify archive is a valid package and return its manifest. If requested, // expand the file-referencing manifest values (description, changes, etc), - // setting them to the contents of files they refer to as well as complete - // the dependency constraints. Throw failed if invalid or if something goes - // wrong. If diag is false, then don't issue diagnostics about the reason - // why the package is invalid. + // setting them to the contents of files they refer to, set the potentially + // absent description-type value to the effective description type (see + // libbpkg/manifest.hxx), and complete the dependency constraints. Throw + // failed if invalid or if something goes wrong. If diag is false, then + // don't issue diagnostics about the reason why the package is invalid. // package_manifest pkg_verify (const common_options&, diff --git a/bpkg/rep-create.cxx b/bpkg/rep-create.cxx index 5f8ecf9..9667016 100644 --- a/bpkg/rep-create.cxx +++ b/bpkg/rep-create.cxx @@ -90,7 +90,7 @@ namespace bpkg if (d == root) { if (p == repositories_file || - p == packages_file || + p == packages_file || p == signature_file) continue; } diff --git a/doc/manual.cli b/doc/manual.cli index cbd17d7..a5b9eb0 100644 --- a/doc/manual.cli +++ b/doc/manual.cli @@ -529,6 +529,7 @@ license: [; ] [tags]: [description]: [description-file]: [; ] +[description-type]: [changes]: [changes-file]: [; ] @@ -696,14 +697,35 @@ As a result, we will start simple and only allow single-word tags.| \ [description]: [description-file]: [; ] +[description-type]: \ The detailed description of the package. It can be provided either inline as a text fragment or by referring to a file within a package (e.g., \c{README}), but not both. -In the web interface (\c{brep}) the description is displayed as pre-formatted -plain text. \N{We could use the comment to \"hint\" at the file format.} +In the web interface (\c{brep}) the description is displayed according to its +type. Currently, pre-formatted plain text, \l{https://github.github.com/gfm +GitHub-Flavored Markdown}, and \l{https://spec.commonmark.org/current +CommonMark} are supported with the following \c{description-type} values, +respectively: + +\ +text/plain +text/markdown;variant=GFM +text/markdown;variant=CommonMark +\ + +If just \c{text/markdown} is specified, then the GitHub-Flavored Markdown +(which is a superset of CommonMark) is assumed. + +If the description type is not explicitly specified and the description is +specified as \c{description-file}, then an attempt to derive the type from the +file extension is made. Specifically, the \cb{.md} and \cb{.markdown} +extensions are mapped to \c{text/markdown}, the \cb{.txt} and no extension are +mapped to \c{text/plain}, and all other extensions are treated as an unknown +type, similar to unknown \c{description-type} values. And if the description +is not specified as a file, \c{text/plain} is assumed. \h2#manifest-package-changes|\c{changes}| diff --git a/tests/common/satisfy/libfoo-1.0.0.tar.gz b/tests/common/satisfy/libfoo-1.0.0.tar.gz index 28a6a90..41da9a0 100644 Binary files a/tests/common/satisfy/libfoo-1.0.0.tar.gz and b/tests/common/satisfy/libfoo-1.0.0.tar.gz differ diff --git a/tests/pkg-verify.testscript b/tests/pkg-verify.testscript index 13983d2..86637f9 100644 --- a/tests/pkg-verify.testscript +++ b/tests/pkg-verify.testscript @@ -82,6 +82,7 @@ $* --deep --ignore-unknown --manifest $src/foo-2.tar.gz >>EOO This package contains the foo utility. \ + description-type: text/plain changes: \ Version 2 -- cgit v1.1