diff options
author | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2024-02-21 21:53:06 (EST) |
---|---|---|
committer | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2024-02-21 21:53:06 (EST) |
commit | 5e9bdfaebd234423df81992317e7c2a46bc315c6 (patch) | |
tree | be80db1a38c9912edd66dbc68cfb614010bbef7c | |
parent | 91863a2f944400f11e16d039f2e9270af34bb8a1 (diff) |
ob-gencontrol: Improve docs pkg dep versions
Also use "<<" ".~" instead of "<=" "-z".
-rw-r--r-- | locale/C/opkbuild.sh | 1 | ||||
-rw-r--r-- | src/ob-gencontrol.sh | 22 | ||||
-rwxr-xr-x | tests/exe/ob-gencontrol.sh | 11 |
3 files changed, 18 insertions, 16 deletions
diff --git a/locale/C/opkbuild.sh b/locale/C/opkbuild.sh index 75d915e..8dfc0cb 100644 --- a/locale/C/opkbuild.sh +++ b/locale/C/opkbuild.sh @@ -111,7 +111,6 @@ msg_opkbuild_cant_ln_doc_dir='Can'\''t make link to documentation directory' # src/ob-gencontrol.sh msg_opkbuild_gen_control='Generating control files for package "%s"...' -msg_opkbuild_bad_source_version='Invalid source package version identifier "%s"' # src/ob-buildopk msg_opkbuild_build_opk='Packing "%s"...' diff --git a/src/ob-gencontrol.sh b/src/ob-gencontrol.sh index a05ba64..f88508c 100644 --- a/src/ob-gencontrol.sh +++ b/src/ob-gencontrol.sh @@ -1,6 +1,6 @@ # Generate a control directory with a control file and scripts # -# Copyright (C) 2012, 2019 Patrick McDermott +# Copyright (C) 2012, 2019, 2023-2024 Patrick McDermott # # This file is part of opkbuild. # @@ -131,7 +131,7 @@ gen_control_bin() local binary_qual= local value= local doc_pkg= - local upstream_ver= + local doc_pkg_q= local doc_dep= local name= local homepage= @@ -163,19 +163,23 @@ gen_control_bin() ob_error "$(ob_get_msg 'cant_get_doc_pkg')" return 1 fi - doc_pkg="$(ob_qualify_package_name "${doc_pkg}" "${OPK_HOST_ARCH}")" - if ! ob_parse_version -u upstream_ver "${OPK_SOURCE_VERSION}"; then - ob_error "$(ob_get_msg 'bad_source_version')" - return 1 + doc_pkg_q="$(ob_qualify_package_name "${doc_pkg}" "${OPK_HOST_ARCH}")" + if [ x"$(ob_get_binary_parameter "${doc_pkg}" 'Architecture')" \ + = x'all' ]; then + doc_dep="${doc_pkg_q} (= ${OPK_SOURCE_VERSION})" + elif [ x"$(ob_get_binary_parameter "${binary}" 'Architecture')" \ + = x'all' ]; then + doc_dep="${doc_pkg_q} (>= ${OPK_SOURCE_VERSION}), $(: \ + )${doc_pkg_q} (<< ${OPK_SOURCE_VERSION}.~)" + else + doc_dep="${doc_pkg_q} (= ${OPK_BINARY_VERSION})" fi - doc_dep="${doc_pkg} (>= ${upstream_ver}), $(: \ - )${doc_pkg} (<= ${upstream_ver}-z)" for name in Essential Depends Recommends Suggests Pre-Depends \ Conflicts Provides Replaces; do value="$(ob_get_binary_parameter "${binary}" "${name}")" if [ x"${name}" = x'Depends' ] && - [ x"${binary_qual}" != x"${doc_pkg}" ]; then + [ x"${binary_qual}" != x"${doc_pkg_q}" ]; then value="${doc_dep}, ${value}" fi if [ -z "${value}" ]; then diff --git a/tests/exe/ob-gencontrol.sh b/tests/exe/ob-gencontrol.sh index 9c74a52..ae84875 100755 --- a/tests/exe/ob-gencontrol.sh +++ b/tests/exe/ob-gencontrol.sh @@ -75,8 +75,7 @@ for run in 'first' 'second'; do Platform: all Section: util Maintainer: "J. Random Hacker" <jrandom@example.com> - Depends: foo:i686-linux-glibc (>= 1.0), $(: \ - )foo:i686-linux-glibc (<= 1.0-z) + Depends: foo:i686-linux-glibc (= 1.0-1) Installed-Size: 0 Description: Bit-bang All Registers This is a frobnicator of objects. Conveniently, it also $(: \ @@ -92,8 +91,8 @@ for run in 'first' 'second'; do Architecture: all Platform: all Maintainer: "J. Random Hacker" <jrandom@example.com> - Depends: foo:i686-linux-glibc (>= 1.0), $(: \ - )foo:i686-linux-glibc (<= 1.0-z), bar + Depends: foo:i686-linux-glibc (>= 1.0-1), $(: \ + )foo:i686-linux-glibc (<< 1.0-1.~), bar Installed-Size: 0 Description: Add all the things This is a frobnicator of objects. Conveniently, it also $(: \ @@ -111,8 +110,8 @@ for run in 'first' 'second'; do Architecture: all Platform: all Maintainer: "J. Random Hacker" <jrandom@example.com> - Depends: foo:i686-linux-glibc (>= 1.0), $(: \ - )foo:i686-linux-glibc (<= 1.0-z), bar + Depends: foo:i686-linux-glibc (>= 1.0-1), $(: \ + )foo:i686-linux-glibc (<< 1.0-1.~), bar Installed-Size: 0 Description: Hyphenate all the things This is a frobnicator of objects. Conveniently, it also $(: \ |