From 388cbad887c0ecb179670847cb1e60d52d3b3c1d Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Tue, 26 Sep 2023 14:00:26 -0400 Subject: ob-gencontrol: Generate deps on doc-providing pkg --- diff --git a/NEWS b/NEWS index 445f946..5eb3440 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,13 @@ opkbuild version 4.2.2+dev Released: ????-??-?? +Utilities: + + * ob-gencontrol now automatically lists the binary package that + provides source package documentation as a dependency (with version + restrictions) of all other binary packages built from the same + source package. + libopkbuild: * ProteanOS source package versions may now contain epochs. This diff --git a/TODO b/TODO index 85eb4ba..835229c 100644 --- a/TODO +++ b/TODO @@ -4,8 +4,6 @@ Future Tasks Functional Changes ------------------ - * ob-gencontrol: Automatically generate dependencies on documentation- - providing package. * Make binary package `Description` fields architecture- and platform- independent (so a packages index Web site can show one description for a binary package for all its architectures and platforms). diff --git a/locale/C/opkbuild.sh b/locale/C/opkbuild.sh index 8dfc0cb..75d915e 100644 --- a/locale/C/opkbuild.sh +++ b/locale/C/opkbuild.sh @@ -111,6 +111,7 @@ 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 5a103a0..a05ba64 100644 --- a/src/ob-gencontrol.sh +++ b/src/ob-gencontrol.sh @@ -128,16 +128,21 @@ gen_control_bin() local plat="${4}" local desc="${5}" shift 5 + local binary_qual= local value= + local doc_pkg= + local upstream_ver= + local doc_dep= local name= local homepage= mkdir -p -- "${binary}.control" exec 3>"${binary}.control/control" + binary_qual="$(ob_qualify_package_name "${binary}" "${OPK_HOST_ARCH}")" + cat >&3 <<-EOF - Package: $(ob_qualify_package_name "${binary}" \ - "${OPK_HOST_ARCH}") + Package: ${binary_qual} Source: ${OPK_SOURCE} Version: ${version} Architecture: ${arch} @@ -154,9 +159,25 @@ gen_control_bin() tr '\n' ' ') EOF + if ! doc_pkg="$(ob_get_doc_package)"; then + 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 + 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 + value="${doc_dep}, ${value}" + fi if [ -z "${value}" ]; then continue fi diff --git a/tests/exe/ob-gencontrol.sh b/tests/exe/ob-gencontrol.sh index ecae536..87152f0 100755 --- a/tests/exe/ob-gencontrol.sh +++ b/tests/exe/ob-gencontrol.sh @@ -75,6 +75,8 @@ for run in 'first' 'second'; do Platform: all Section: util Maintainer: "J. Random Hacker" + Depends: foo:i686-linux-glibc (>= 1.0), $(: \ + )foo:i686-linux-glibc (<= 1.0-z) Installed-Size: 0 Description: Bit-bang All Registers This is a frobnicator of objects. Conveniently, it also $(: \ @@ -90,7 +92,8 @@ for run in 'first' 'second'; do Architecture: all Platform: all Maintainer: "J. Random Hacker" - Depends: bar + Depends: foo:i686-linux-glibc (>= 1.0), $(: \ + )foo:i686-linux-glibc (<= 1.0-z), bar Installed-Size: 0 Description: Add all the things This is a frobnicator of objects. Conveniently, it also $(: \ @@ -108,7 +111,8 @@ for run in 'first' 'second'; do Architecture: all Platform: all Maintainer: "J. Random Hacker" - Depends: bar + Depends: foo:i686-linux-glibc (>= 1.0), $(: \ + )foo:i686-linux-glibc (<= 1.0-z), bar Installed-Size: 0 Description: Hyphenate all the things This is a frobnicator of objects. Conveniently, it also $(: \ -- cgit v0.9.1