summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2020-07-05 00:24:21 (EDT)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2020-07-05 00:24:51 (EDT)
commitaee0be0d0605d98c411c4c042be70d66503c6215 (patch)
tree8d8eb80415197d1b074990bc0287316463795795
parent9540cac3c18c89cb35774ec9c0f02df627d71b3e (diff)
ob_validate_section(): New function
-rw-r--r--NEWS3
-rw-r--r--lib/metadata.sh17
-rw-r--r--lib/metadata/proteanos.sh15
-rw-r--r--man/local.mk1
4 files changed, 35 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 42c9f77..162fafe 100644
--- a/NEWS
+++ b/NEWS
@@ -50,7 +50,8 @@ libopkbuild:
format 2.x.
* The modification time in manual pages is now parsed and formatted
correctly.
- * A new function ob_qualify_package_name() has been added.
+ * New functions ob_validate_section() and ob_qualify_package_name()
+ have been added.
opkbuild version 4.1.4
----------------------
diff --git a/lib/metadata.sh b/lib/metadata.sh
index 44fc427..dac8105 100644
--- a/lib/metadata.sh
+++ b/lib/metadata.sh
@@ -335,6 +335,23 @@ ob_get_system_path()
return 0
}
+## @brief Validate a section name
+## @details \fBob_validate_section\fP() validates a package archive section name
+## against the list in the metadata plugin selected at libopkbuild's
+## build time.
+## @operand section req The section name to validate.
+## @return Returns 0 if valid or 1 if invalid.
+## @pure yes This function has no side effects.
+ob_validate_section()
+{
+ local section="${1}"
+ shift 1 || _ob_abort
+
+ _ob_metadata_do 'validate_section' "${section}" || return ${?}
+
+ return 0
+}
+
## @brief Get a possibly architecture-qualified package name
## @details \fBob_qualify_package_name\fP() qualifies the name of a binary
## package with the host architecture if the package is in a section
diff --git a/lib/metadata/proteanos.sh b/lib/metadata/proteanos.sh
index 66f2ea8..a891e6e 100644
--- a/lib/metadata/proteanos.sh
+++ b/lib/metadata/proteanos.sh
@@ -165,6 +165,21 @@ _ob_get_system_path()
return 0
}
+_ob_validate_section()
+{
+ local section="${1}"
+ shift 1 || _ob_abort
+
+ case "${section}" in
+ boot | dbg | dev | doc | lib | libdev | locale | share | util)
+ return 0
+ ;;
+ *)
+ return 1
+ ;;
+ esac
+}
+
_ob_section_is_coinstallable()
{
local sect="${1}"
diff --git a/man/local.mk b/man/local.mk
index 958967e..28ee816 100644
--- a/man/local.mk
+++ b/man/local.mk
@@ -51,6 +51,7 @@ man3_MANS = \
%reldir%/ob_arch_is_concerned.3 \
%reldir%/ob_plat_is_concerned.3 \
%reldir%/ob_get_system_path.3 \
+ %reldir%/ob_validate_section.3 \
%reldir%/ob_qualify_package_name.3 \
%reldir%/ob_parse_control.3 \
%reldir%/ob_set_binary_substvar.3 \