aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2023-05-31 11:26:32 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2023-05-31 11:26:32 +0300
commit7c37a8d9a6c6b68426fe8f69e12f5f7b1505c0f6 (patch)
treeb7534682158bac2577d6eeb1926cd23c5e3edf0a
parent60698e1786782a834dcc293968c15ecd8821f548 (diff)
Advise user to use *-type package manifest value when extension for *-file is not recognized
-rw-r--r--libbpkg/manifest.cxx11
-rw-r--r--tests/manifest/testscript17
2 files changed, 25 insertions, 3 deletions
diff --git a/libbpkg/manifest.cxx b/libbpkg/manifest.cxx
index 152a513..aeb9b0e 100644
--- a/libbpkg/manifest.cxx
+++ b/libbpkg/manifest.cxx
@@ -4282,7 +4282,16 @@ namespace bpkg
bad_value (string ("invalid ") + what + " type: " + e.what ());
}
else
- bad_value (string ("invalid ") + what + " file: " + e.what ());
+ {
+ // Note that this can only happen due to inability to guess the
+ // type from the file extension. Let's help the user here a bit.
+ //
+ assert (r.file);
+
+ bad_value (string ("invalid ") + what + " file: " + e.what () +
+ " (use " + string (n, 0, n.size () - 5) +
+ "-type manifest value to specify explicitly)");
+ }
}
return r;
diff --git a/tests/manifest/testscript b/tests/manifest/testscript
index 4ad8f0e..7d808e3 100644
--- a/tests/manifest/testscript
+++ b/tests/manifest/testscript
@@ -488,7 +488,7 @@
license: LGPLv2
description-file: README.rtf
EOI
- stdin:6:19: error: invalid project description file: unknown text type
+ stdin:6:19: error: invalid project description file: unknown text type (use description-type manifest value to specify explicitly)
EOE
: ignore-unknown
@@ -739,7 +739,7 @@
license: LGPLv2
package-description-file: README.rtf
EOI
- stdin:6:27: error: invalid package description file: unknown text type
+ stdin:6:27: error: invalid package description file: unknown text type (use package-description-type manifest value to specify explicitly)
EOE
: ignore-unknown
@@ -935,6 +935,19 @@
%)
EOE
+ : unknown-text-type
+ :
+ $* <<EOI 2>>EOE != 0
+ : 1
+ name: libfoo
+ version: 2.0.0
+ summary: Modern C++ parser
+ license: LGPLv2
+ changes-file: CHANGES.0
+ EOI
+ stdin:6:15: error: invalid changes file: unknown text type (use changes-type manifest value to specify explicitly)
+ EOE
+
: different-type
:
$* <<EOI 2>>EOE != 0