summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS7
-rw-r--r--lib/package.sh8
-rw-r--r--src/ob-gencontrol.sh1
-rwxr-xr-xtests/exe/ob-gencontrol.sh1
4 files changed, 16 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 765c135..6710d47 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,13 @@ Utilities:
* ob-buildopk now correctly checks for the BusyBox tar reverse
ordering bug.
+ * ob-gencontrol now generates a "Format" field to indicate the source
+ package formate version.
+
+libopkbuild:
+
+ * ob_get_source_parameter() now supports a "Format" field to get the
+ source package formate version.
opkbuild version 4.1.4
----------------------
diff --git a/lib/package.sh b/lib/package.sh
index 27ea8cb..8ed6645 100644
--- a/lib/package.sh
+++ b/lib/package.sh
@@ -18,6 +18,7 @@
# along with opkbuild. If not, see <http://www.gnu.org/licenses/>.
_ob_package_dir=
+_ob_package_format_full=
_ob_package_format=
_ob_binary_packages=
_ob_got_binary_packages=false
@@ -50,8 +51,9 @@ ob_init_package()
_ob_package_dir="$(cd -- "${dir}" && pwd)"
+ _ob_package_format_full="$(cat -- "${_ob_package_dir}/format")"
if [ -r "${_ob_package_dir}/format" ]; then
- case "$(cat -- "${_ob_package_dir}/format")" in
+ case "${_ob_package_format_full}" in
2.0)
_ob_package_format='2'
;;
@@ -184,6 +186,10 @@ ob_get_source_parameter()
EOF
)"
+ case "${name}" in 'FORMAT')
+ printf '%s' "${_ob_package_format_full}"
+ esac
+
# TODO: Return error on no such field?
eval "printf '%s' \"\${_OB_SRCFIELD_${name}-}\""
diff --git a/src/ob-gencontrol.sh b/src/ob-gencontrol.sh
index 172f50f..be42c32 100644
--- a/src/ob-gencontrol.sh
+++ b/src/ob-gencontrol.sh
@@ -98,6 +98,7 @@ gen_control_src()
cat >>"${binary}.control/control" <<-EOF
Installed-Size: $(calc_inst_size "src-${OPK_SOURCE}")
+ Format: $(ob_get_source_parameter 'Format')
Description: ${OPK_SOURCE} source package
EOF
diff --git a/tests/exe/ob-gencontrol.sh b/tests/exe/ob-gencontrol.sh
index a619856..6f29d9b 100755
--- a/tests/exe/ob-gencontrol.sh
+++ b/tests/exe/ob-gencontrol.sh
@@ -36,6 +36,7 @@ cmd_is 'source package control file' cat 'src-foo.control/control' <<-EOF
Maintainer: "J. Random Hacker" <jrandom@example.com>
Build-Depends: build-all-runes
Installed-Size: 0
+ Format: 2.0
Description: foo source package
EOF