summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2020-06-17 13:45:55 (EDT)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2020-06-17 14:01:22 (EDT)
commitcf09c0ea05db8158d2cd781d0315730fc58162cf (patch)
tree6160762f539e2150ef46a54daaeb9ef9f94772a7
parenta1ae81b8656839e97a21577f5cac6cc5089e032c (diff)
ob-gencontrol: Generate a "Section" field
And add it to SPF 2.x.
-rw-r--r--NEWS4
-rw-r--r--lib/package/2.sh2
-rw-r--r--src/ob-gencontrol.sh10
-rw-r--r--tests/data/pkg/bar.pkg/control1
-rw-r--r--tests/data/pkg/foo.pkg/control1
-rwxr-xr-xtests/exe/ob-gencontrol.sh2
6 files changed, 18 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index 6b4a27b..fac76c3 100644
--- a/NEWS
+++ b/NEWS
@@ -11,11 +11,15 @@ Utilities:
ordering bug.
* ob-gencontrol now generates a "Format" field to indicate the source
package format version.
+ * ob-gencontrol now generates a "Section" field when defined for a
+ binary package.
libopkbuild:
* ob_get_source_parameter() now supports a "Format" field to get the
source package formate version.
+ * An optional "Section" control field has been added to source package
+ format 2.x.
* The modification time in manual pages is now parsed and formatted
correctly.
diff --git a/lib/package/2.sh b/lib/package/2.sh
index ce96e5f..1ed7466 100644
--- a/lib/package/2.sh
+++ b/lib/package/2.sh
@@ -20,7 +20,7 @@
_OB_SOURCE_FIELDS_REQUIRED_2='Maintainer'
_OB_SOURCE_FIELDS_OPTIONAL_2='Build-Depends Homepage'
_OB_BINARY_FIELDS_REQUIRED_2='Architecture Platform Description'
-_OB_BINARY_FIELDS_OPTIONAL_2='Essential Depends Recommends Suggests '\
+_OB_BINARY_FIELDS_OPTIONAL_2='Section Essential Depends Recommends Suggests '\
'Pre-Depends Conflicts Provides Replaces'
_ob_source_substvars_set_2=false
diff --git a/src/ob-gencontrol.sh b/src/ob-gencontrol.sh
index 471e079..b6d649e 100644
--- a/src/ob-gencontrol.sh
+++ b/src/ob-gencontrol.sh
@@ -119,8 +119,8 @@ gen_control_bin()
local plat="${4}"
local desc="${5}"
shift 5
- local name=
local value=
+ local name=
local homepage=
mkdir -p -- "${binary}.control"
@@ -131,6 +131,14 @@ gen_control_bin()
Version: ${version}
Architecture: ${arch}
Platform: ${plat}
+ EOF
+ value="$(ob_get_binary_parameter "${binary}" 'Section')"
+ if [ -n "${value}" ]; then
+ cat >>"${binary}.control/control" <<-EOF
+ Section: ${value}
+ EOF
+ fi
+ cat >>"${binary}.control/control" <<-EOF
Maintainer: $(ob_get_source_parameter 'Maintainer' | \
tr '\n' ' ')
EOF
diff --git a/tests/data/pkg/bar.pkg/control b/tests/data/pkg/bar.pkg/control
index b0c05fa..78bf79c 100644
--- a/tests/data/pkg/bar.pkg/control
+++ b/tests/data/pkg/bar.pkg/control
@@ -1,5 +1,6 @@
Architecture: all
Platform: all
+Section: utils
Description: Bit-bang All Registers
${Common-Description}
.
diff --git a/tests/data/pkg/foo.pkg/control b/tests/data/pkg/foo.pkg/control
index b383ff9..e768224 100644
--- a/tests/data/pkg/foo.pkg/control
+++ b/tests/data/pkg/foo.pkg/control
@@ -1,5 +1,6 @@
Architecture: any-linux-any
Platform: all
+Section: libdev
Depends: ${Generated-Depends}
Description: Frobnicator of Objects
${Common-Description}
diff --git a/tests/exe/ob-gencontrol.sh b/tests/exe/ob-gencontrol.sh
index 6f29d9b..3f3d05f 100755
--- a/tests/exe/ob-gencontrol.sh
+++ b/tests/exe/ob-gencontrol.sh
@@ -52,6 +52,7 @@ for run in 'first' 'second'; do
Version: 1.0-1
Architecture: i686-linux-glibc
Platform: all
+ Section: libdev
Maintainer: "J. Random Hacker" <jrandom@example.com>
Depends: bar
Installed-Size: 1
@@ -71,6 +72,7 @@ for run in 'first' 'second'; do
Version: 1.0-1
Architecture: all
Platform: all
+ Section: utils
Maintainer: "J. Random Hacker" <jrandom@example.com>
Installed-Size: 0
Description: Bit-bang All Registers