summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2023-09-26 14:00:26 (EDT)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2023-09-26 19:51:11 (EDT)
commit388cbad887c0ecb179670847cb1e60d52d3b3c1d (patch)
tree5d7aed26347763eead4e0319bbda854aee0a84f0
parentf5f35e8b716040c41f8844e5c988d52f4b93b311 (diff)
ob-gencontrol: Generate deps on doc-providing pkg
-rw-r--r--NEWS7
-rw-r--r--TODO2
-rw-r--r--locale/C/opkbuild.sh1
-rw-r--r--src/ob-gencontrol.sh25
-rwxr-xr-xtests/exe/ob-gencontrol.sh8
5 files changed, 37 insertions, 6 deletions
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" <jrandom@example.com>
+ 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" <jrandom@example.com>
- 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" <jrandom@example.com>
- 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 $(: \