aboutsummaryrefslogtreecommitdiffstats
path: root/templates/base
diff options
context:
space:
mode:
authorRonan Le Martret <ronan.lemartret@iot.bzh>2018-09-18 08:13:39 +0000
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>2018-09-28 13:24:00 +0000
commit431cec1bfff374ddca12772c30ce8c8907c8a02a (patch)
treeeb03569c86135c02a2f12a6798a470915302cbc6 /templates/base
parentdd2ec33339bdbd4999108531a20d74af02753793 (diff)
Add an AGL revision to the RPM package
* To update a rpm file (with dnf) we need to have a valid rpm revision. Let 2 packages pkg_1 and pkg_2 (built in yocto). If pkg_2 is newer than pkg_1, and one wants to be able to update it with dnf, it must respect some rpm naming rules. if ${pkg_2_name} > ${pkg_1_name} -> pkg_2 is newer than pkg_1 elif ${pkg_2_name} = ${pkg_1_name} and ${pkg_2_revision} > ${pkg_1_revision} -> pkg_2 is newer than pkg_1 else -> pkg_2 is equal or older than pkg_1 Currently, the Yocto build process (used by AGL, so whithout special service) doesn't change revisions for a build. So packages are not updatable from a repository with dnf. * This patch adds an option -r|--rpm-revision <schema> to aglsetup.sh so that RPMs produced by bitbake will have correct revisions suitable for binary publishing. <schema> can be: 'prservice[:<address>]' : Use a PR service daemon. if <address> is not specified, the default value 'localhost:0' is used (shortcut for a PR service started by bitbake) 'timestamp' : Use a generated time stamp (UTC). 'value:<revision>' : Use <revision> explicitly. 'none' : Do nothing. p16: change --rpm-revision options parsing, use UTC timestamps, refactor code p19: remove smart parsing of host:port for prservice option - back to dumb option Bug-AGL: SPEC-920 Change-Id: I1f4c9fd093fa350d19450a12ac1847885740596d Signed-off-by: Ronan Le Martret <ronan.lemartret@iot.bzh> Signed-off-by: Johann CAHIER <johann.cahier@iot.bzh> Signed-off-by: Ronan Le Martret <ronan.lemartret@iot.bzh> Signed-off-by: Stephane Desneux <stephane.desneux@iot.bzh>
Diffstat (limited to 'templates/base')
-rw-r--r--templates/base/01_setup_pkg_revision.sh68
1 files changed, 68 insertions, 0 deletions
diff --git a/templates/base/01_setup_pkg_revision.sh b/templates/base/01_setup_pkg_revision.sh
new file mode 100644
index 000000000..af82c0988
--- /dev/null
+++ b/templates/base/01_setup_pkg_revision.sh
@@ -0,0 +1,68 @@
+# use a function to be neutral with other fragments
+function 01_setup_pkg_revision() {
+ # BASH_SOURCE can't be used as this fragment is concatenated in a larger script
+ local THIS=meta-agl/templates/base/01_setup_pkg_revision.sh
+
+ # RPMREVISION and LOCALCONF must be set previously in the setup script
+ [[ -z "$RPMREVISION" || -z "$LOCALCONF" ]] && return 0
+
+ echo "INFO: using RPM revision schema $RPMREVISION"
+
+ cat <<EOF >> $LOCALCONF
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+# fragment {
+# generated by $THIS "$RPMREVISION"
+#
+
+EOF
+
+ case "$RPMREVISION" in
+ prservice*)
+ [[ $RPMREVISION =~ ^prservice(:([^ \t\n]+))?$ ]] && {
+ echo "PRSERV_HOST ?= \"${BASH_REMATCH[2]:-localhost:0}\"" >> $LOCALCONF
+ } || {
+ echo "ERROR ($THIS): invalid address specified for PR Service"
+ return 1
+ }
+ ;;
+ timestamp)
+ AGL_PR=$(date --utc '+%Y%m%d.%H%M%S')
+ cat <<'EOF' >> $LOCALCONF
+# to re-generate AGL_PR the same way as aglsetup does, run:
+# echo "AGL_PR ?= \"$(date --utc '+%Y%m%d.%H%M%S')\""
+EOF
+ echo "AGL_PR ?= \"${AGL_PR}\"" >> $LOCALCONF;
+ cat <<'EOF' >> $LOCALCONF
+PKGR_append = ".${AGL_PR}"
+PKGV = "${@ '${PV}'.replace('AUTOINC','${AGL_PR}')}"
+BB_HASHBASE_WHITELIST_append = " PKGR PKGV"
+EOF
+ ;;
+ value:*)
+ echo "AGL_PR ?= \"${RPMREVISION#value:}\"" >> $LOCALCONF;
+ cat <<'EOF' >> $LOCALCONF
+PKGR_append = ".${AGL_PR}"
+PKGV = "${@ '${PV}'.replace('AUTOINC','${AGL_PR}')}"
+BB_HASHBASE_WHITELIST_append = " PKGR PKGV"
+EOF
+ ;;
+ none)
+ # do nothing
+ ;;
+ *)
+ echo "ERROR ($THIS): unknown package revision method '$REVISION'"
+ return 1
+ ;;
+ esac
+
+ cat <<'EOF' >> $LOCALCONF
+
+#
+# }
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+EOF
+
+}
+
+01_setup_pkg_revision