diff options
author | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2020-06-13 11:27:33 (EDT) |
---|---|---|
committer | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2020-06-13 11:27:33 (EDT) |
commit | 445e3d6e43c55ddeb19322918e016c63f91c1958 (patch) | |
tree | ecc6c57a8854ec9a43c47fd413d7f7a70c3f20bc | |
parent | bc7912ee552446471dadc49893b1a821f1acb1c4 (diff) |
ob-gencontrol: Generate a "Format" field
And add the needed support to ob_get_source_parameter().
-rw-r--r-- | NEWS | 7 | ||||
-rw-r--r-- | lib/package.sh | 8 | ||||
-rw-r--r-- | src/ob-gencontrol.sh | 1 | ||||
-rwxr-xr-x | tests/exe/ob-gencontrol.sh | 1 |
4 files changed, 16 insertions, 1 deletions
@@ -9,6 +9,13 @@ Utilities: * ob-buildopk now correctly checks for the BusyBox tar reverse ordering bug. + * ob-gencontrol now generates a "Format" field to indicate the source + package formate version. + +libopkbuild: + + * ob_get_source_parameter() now supports a "Format" field to get the + source package formate version. opkbuild version 4.1.4 ---------------------- diff --git a/lib/package.sh b/lib/package.sh index 27ea8cb..8ed6645 100644 --- a/lib/package.sh +++ b/lib/package.sh @@ -18,6 +18,7 @@ # along with opkbuild. If not, see <http://www.gnu.org/licenses/>. _ob_package_dir= +_ob_package_format_full= _ob_package_format= _ob_binary_packages= _ob_got_binary_packages=false @@ -50,8 +51,9 @@ ob_init_package() _ob_package_dir="$(cd -- "${dir}" && pwd)" + _ob_package_format_full="$(cat -- "${_ob_package_dir}/format")" if [ -r "${_ob_package_dir}/format" ]; then - case "$(cat -- "${_ob_package_dir}/format")" in + case "${_ob_package_format_full}" in 2.0) _ob_package_format='2' ;; @@ -184,6 +186,10 @@ ob_get_source_parameter() EOF )" + case "${name}" in 'FORMAT') + printf '%s' "${_ob_package_format_full}" + esac + # TODO: Return error on no such field? eval "printf '%s' \"\${_OB_SRCFIELD_${name}-}\"" diff --git a/src/ob-gencontrol.sh b/src/ob-gencontrol.sh index 172f50f..be42c32 100644 --- a/src/ob-gencontrol.sh +++ b/src/ob-gencontrol.sh @@ -98,6 +98,7 @@ gen_control_src() cat >>"${binary}.control/control" <<-EOF Installed-Size: $(calc_inst_size "src-${OPK_SOURCE}") + Format: $(ob_get_source_parameter 'Format') Description: ${OPK_SOURCE} source package EOF diff --git a/tests/exe/ob-gencontrol.sh b/tests/exe/ob-gencontrol.sh index a619856..6f29d9b 100755 --- a/tests/exe/ob-gencontrol.sh +++ b/tests/exe/ob-gencontrol.sh @@ -36,6 +36,7 @@ cmd_is 'source package control file' cat 'src-foo.control/control' <<-EOF Maintainer: "J. Random Hacker" <jrandom@example.com> Build-Depends: build-all-runes Installed-Size: 0 + Format: 2.0 Description: foo source package EOF |