Skip to contentSkip to conversation

tools/mkrpm: improve version.release handling

PATCH Applied Olaf Hering 3 participants 4 messages Mar 24, 2015 – Mar 30, 2015

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 tools/mkrpm: improve version.release handling

An increasing version and/or release number helps to update existing packages without --force as in "rpm Uvh --force xen.rpm". Instead its possible to do "rpm -Fvh *.rpm" to update only already installed packages.

The usage of --force disables essentials checks such as file conflict detection. As a result the new xen.rpm may overwrite files owned by other packages.

With the current way of calculating version-release it is difficult to get an increasing release number into the spec file. The release is always zero unless "make make XEN_VENDORVERSION=date +.%s" is used, which has the bad side effect that xen.gz always gets a different filename every time.

Update mkrpm to recognize PKG_RELEASE=. Its value will be appended to the Release string. It can be filled with a time stamp, like:
make rpmball PKG_RELEASE="date +%Y%m%d%H%M%S"

Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Wei Liu <[email protected]>
Cc George Dunlap <[email protected]>
---
 INSTALL          | 4 +++-
 tools/misc/mkrpm | 4 +---
 2 files changed, 4 insertions(+), 4 deletions(-)
INSTALL +3 -1
index 1b67c36..8735bf5 100644
@@ -197,8 +197,10 @@ BOOT_DIR=
 EFI_DIR=
 
 The make target 'rpmball' will build a xen.rpm. This variable can be
-used to append a custom string to the name.
+used to append a custom string to the name. In addition a string can be
+appended to the rpm Release: tag.
 PKG_SUFFIX=
+PKG_RELEASE=
 
 The hypervisor will report a certain version string. This variable can
 be used to append a custom string to the version.
tools/misc/mkrpm +1 -3
index 9b8c6d9..f9363a1 100644
@@ -17,9 +17,7 @@ xenroot="$1"
 # version and release.  Default to "0" if there isn't a release.
 v=(${2/-/ })
 version=${v[0]}
-release=${v[1]}
-
-[[ -n "$release" ]] || release="0"
+release="${v[1]:-0}${PKG_RELEASE:+.$PKG_RELEASE}"
 
 cd $xenroot
Reviewed-by Tested-by on v2 1/1
#1 lore raw
Quoted 51 lines · Olaf Hering

An increasing version and/or release number helps to update existing packages without --force as in "rpm Uvh --force xen.rpm". Instead its possible to do "rpm -Fvh *.rpm" to update only already installed packages.

The usage of --force disables essentials checks such as file conflict detection. As a result the new xen.rpm may overwrite files owned by other packages.

With the current way of calculating version-release it is difficult to get an increasing release number into the spec file. The release is always zero unless "make make XEN_VENDORVERSION=date +.%s" is used, which has the bad side effect that xen.gz always gets a different filename every time.

Update mkrpm to recognize PKG_RELEASE=. Its value will be appended to the Release string. It can be filled with a time stamp, like:
make rpmball PKG_RELEASE="date +%Y%m%d%H%M%S"

Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Wei Liu <[email protected]>
Cc George Dunlap <[email protected]>
---
 INSTALL          | 4 +++-
 tools/misc/mkrpm | 4 +---
 2 files changed, 4 insertions(+), 4 deletions(-)
INSTALL +3 -1
index 1b67c36..8735bf5 100644
@@ -197,8 +197,10 @@ BOOT_DIR=
 EFI_DIR=
 
 The make target 'rpmball' will build a xen.rpm. This variable can be
-used to append a custom string to the name.
+used to append a custom string to the name. In addition a string can be
+appended to the rpm Release: tag.
 PKG_SUFFIX=
+PKG_RELEASE=
 
 The hypervisor will report a certain version string. This variable can
 be used to append a custom string to the version.
tools/misc/mkrpm +0 -0
index 9b8c6d9..f9363a1 100644

tools/misc/mkrpm xenroot="$1" · line 20

Quoted 7 lines
tools/misc/mkrpm +1 -3
@@ -17,9 +17,7 @@ xenroot="$1"
 # version and release.  Default to "0" if there isn't a release.
 v=(${2/-/ })
 version=${v[0]}
-release=${v[1]}
-
-[[ -n "$release" ]] || release="0"
+release="${v[1]:-0}${PKG_RELEASE:+.$PKG_RELEASE}"

Thanks Olaf. I kicked the tires a bit and it seems to work as described.

I think in my ideal world the result would look like this:

case ${v[1]} && PKG_RELEASE: "${v[1]}.${PKG_RELEASE}" case ${v[1]} && !PKG_RELEASE: "${v[1]}"
case !${v[1]} && PKG_RELEASE: "${PKG_RELEASE}" case !${v[1]} && !PKG_RELEASE: "0"

Right now the 3rd case looks like "0.${PKG_RELEASE}". But I think you've put up enough with my pickiness. :-)

I may come back and see if I can make a patch so it acts like above; but for now: