From cf09c0ea05db8158d2cd781d0315730fc58162cf Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Wed, 17 Jun 2020 13:45:55 -0400 Subject: ob-gencontrol: Generate a "Section" field And add it to SPF 2.x. --- 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" 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" Installed-Size: 0 Description: Bit-bang All Registers -- cgit v0.9.1