Skip to contentSkip to conversation

tools/mkrpm: improve version.release handling

PATCH In review Olaf Hering 4 participants 19 messages Oct 7, 2014 – Nov 7, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 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.

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.

Since the value of release has no meaning its fine to have an ever increasing number. This could be either the number of seconds (+%s), or some representation which could mean something to a human. The change uses a representation of date+time.

With this change my xen$PKG_SUFFIX.rpm gets as version-release 4.5_unstable-20141007161858, instead of 4.5-unstable$XEN_VENDORVERSION.

Note: to maintain the functionality that "rpm -F xen.rpm" works its also required that the alphanumerical chars increase. Unfortunately thats not the case for 4.5-rcN because "r" is smaller than "u"nstable. And going from 4.5-rcN to 4.5 (or 4.5.N-pre to 4.5.N) may break as well. But there is nothing we can do about this part.
Once 4.6 opens I suggest to set XEN_EXTRAVERSION to -devel because "d" is smaller than "r" in 4.6-rcN. But thats a different discussion.

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]>
---
 tools/misc/mkrpm | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
tools/misc/mkrpm +5 -7
index 9b8c6d9..b54de24 100644
@@ -13,13 +13,11 @@ fi
 
 xenroot="$1"
 
-# rpmbuild doesn't like dashes in the version; break it down into
-# version and release.  Default to "0" if there isn't a release.
-v=(${2/-/ })
-version=${v[0]}
-release=${v[1]}
-
-[[ -n "$release" ]] || release="0"
+# rpmbuild doesn't support dashes in the version;
+version=${2//-/_}
+# Use an ever increasing release number for this devel pkg.
+# This makes sure rpm -Fvh xen$PKG_SUFFIX.rpm can be updated wihtout --force.
+release="`date +%Y%m%d%H%M%S`"
 
 cd $xenroot
#1 lore raw
Quoted 1 line · Olaf Hering

always zero unless "make make XEN_VENDORVERSION=date +.%s" is used,

This should have been "make rpmball ...".

Olaf

#2 lore raw
In reply to Olaf Hering

Ping?

Quoted 60 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.

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.

Since the value of release has no meaning its fine to have an ever increasing number. This could be either the number of seconds (+%s), or some representation which could mean something to a human. The change uses a representation of date+time.

With this change my xen$PKG_SUFFIX.rpm gets as version-release 4.5_unstable-20141007161858, instead of 4.5-unstable$XEN_VENDORVERSION.

Note: to maintain the functionality that "rpm -F xen.rpm" works its also required that the alphanumerical chars increase. Unfortunately thats not the case for 4.5-rcN because "r" is smaller than "u"nstable. And going from 4.5-rcN to 4.5 (or 4.5.N-pre to 4.5.N) may break as well. But there is nothing we can do about this part.
Once 4.6 opens I suggest to set XEN_EXTRAVERSION to -devel because "d" is smaller than "r" in 4.6-rcN. But thats a different discussion.

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]>
---
 tools/misc/mkrpm | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
tools/misc/mkrpm +5 -7
index 9b8c6d9..b54de24 100644
@@ -13,13 +13,11 @@ fi
 
 xenroot="$1"
 
-# rpmbuild doesn't like dashes in the version; break it down into
-# version and release.  Default to "0" if there isn't a release.
-v=(${2/-/ })
-version=${v[0]}
-release=${v[1]}
-
-[[ -n "$release" ]] || release="0"
+# rpmbuild doesn't support dashes in the version;
+version=${2//-/_}
+# Use an ever increasing release number for this devel pkg.
+# This makes sure rpm -Fvh xen$PKG_SUFFIX.rpm can be updated wihtout --force.
+release="`date +%Y%m%d%H%M%S`"
 
 cd $xenroot
 
#3 lore raw
Quoted 1 line · Olaf Hering

Ping?

Sorry, I thought you had found an error and were going to resubmit. :-) I'll take a look at it today.

-George

#4 lore raw
In reply to Olaf Hering
Quoted 47 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.

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.

Since the value of release has no meaning its fine to have an ever increasing number. This could be either the number of seconds (+%s), or some representation which could mean something to a human. The change uses a representation of date+time.

With this change my xen$PKG_SUFFIX.rpm gets as version-release 4.5_unstable-20141007161858, instead of 4.5-unstable$XEN_VENDORVERSION.

Note: to maintain the functionality that "rpm -F xen.rpm" works its also required that the alphanumerical chars increase. Unfortunately thats not the case for 4.5-rcN because "r" is smaller than "u"nstable. And going from 4.5-rcN to 4.5 (or 4.5.N-pre to 4.5.N) may break as well. But there is nothing we can do about this part.
Once 4.6 opens I suggest to set XEN_EXTRAVERSION to -devel because "d" is smaller than "r" in 4.6-rcN. But thats a different discussion.

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]>
---
 tools/misc/mkrpm | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
tools/misc/mkrpm +0 -2
index 9b8c6d9..b54de24 100644
@@ -13,13 +13,11 @@ fi
 
 xenroot="$1"
 
-# rpmbuild doesn't like dashes in the version; break it down into
-# version and release.  Default to "0" if there isn't a release.

tools/misc/mkrpm fi · line 20

Quoted 10 lines
tools/misc/mkrpm +5 -5
-v=(${2/-/ })
-version=${v[0]}
-release=${v[1]}
-
-[[ -n "$release" ]] || release="0"
+# rpmbuild doesn't support dashes in the version;
+version=${2//-/_}
+# Use an ever increasing release number for this devel pkg.
+# This makes sure rpm -Fvh xen$PKG_SUFFIX.rpm can be updated wihtout --force.
+release="`date +%Y%m%d%H%M%S`"

Hrm, I can see how this might be useful, but I'm not really a fan of the uniquifier being based on the date the build was actually kicked off.

How difficult would it be to have this be something sensible like, "changesets since last tag"?

This information can be found, for instance, in "git describe"; for example:

$ git describe
4.5.0-rc1-44-g82587ce

(i.e., 44 commits pas 4.5.0-rc1)

$ git checkout 91086d0
$ git describe
4.5-unstable-1495-g91086d0

(i.e., 1495 commits past 4.5-unstable)

If git isn't present, then it's probably a source tarball, in which case "0" is probably a suitable value.

Thoughts?

-George

#5 lore raw
Quoted 46 lines · George Dunlap
Quoted 45 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.

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.

Since the value of release has no meaning its fine to have an ever increasing number. This could be either the number of seconds (+%s), or some representation which could mean something to a human. The change uses a representation of date+time.

With this change my xen$PKG_SUFFIX.rpm gets as version-release 4.5_unstable-20141007161858, instead of 4.5-unstable$XEN_VENDORVERSION.

Note: to maintain the functionality that "rpm -F xen.rpm" works its also required that the alphanumerical chars increase. Unfortunately thats not the case for 4.5-rcN because "r" is smaller than "u"nstable. And going from 4.5-rcN to 4.5 (or 4.5.N-pre to 4.5.N) may break as well. But there is nothing we can do about this part.
Once 4.6 opens I suggest to set XEN_EXTRAVERSION to -devel because "d" is smaller than "r" in 4.6-rcN. But thats a different discussion.

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]>
---
 tools/misc/mkrpm | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
tools/misc/mkrpm +0 -0
index 9b8c6d9..b54de24 100644
@@ -13,13 +13,11 @@ fi
 
 xenroot="$1"
 
Quoted 16 lines

tools/misc/mkrpm fi · line 20

Quoted 12 lines
tools/misc/mkrpm +5 -7
-# rpmbuild doesn't like dashes in the version; break it down into
-# version and release.  Default to "0" if there isn't a release.
-v=(${2/-/ })
-version=${v[0]}
-release=${v[1]}
-
-[[ -n "$release" ]] || release="0"
+# rpmbuild doesn't support dashes in the version;
+version=${2//-/_}
+# Use an ever increasing release number for this devel pkg.
+# This makes sure rpm -Fvh xen$PKG_SUFFIX.rpm can be updated wihtout --force.
+release="`date +%Y%m%d%H%M%S`"

Hrm, I can see how this might be useful, but I'm not really a fan of the uniquifier being based on the date the build was actually kicked off.

Given that these are also just supposed to be used by developers, requiring you to do "rpm -e xen" first doesn't seem like *that* much of a big deal. It's easy enough to put into a script.

-George

#6 lore raw
In reply to George Dunlap
Quoted 2 lines · George Dunlap

How difficult would it be to have this be something sensible like, "changesets since last tag"?

Very difficult, because one does changes without commit, runs 'make rpmball' and expects that rpm -Fvh *.rpm continues to work.

Olaf

#7 lore raw
Quoted 7 lines · Olaf Hering
Quoted 2 lines · George Dunlap

How difficult would it be to have this be something sensible like, "changesets since last tag"?

Very difficult, because one does changes without commit, runs 'make rpmball' and expects that rpm -Fvh *.rpm continues to work.

Isn't that what "rpm -Uvh" is for?

#11 lore raw
In reply to Olaf Hering
Quoted 6 lines · Olaf Hering
Quoted 2 lines · George Dunlap

How difficult would it be to have this be something sensible like, "changesets since last tag"?

Very difficult, because one does changes without commit, runs 'make rpmball' and expects that rpm -Fvh *.rpm continues to work.

Right. Personally, I think trying to make "rpm -Fvh" work for all the use cases a developer might want is more hassle than it's worth; as I said, I have scripts that just do "rpm -e" in such cases. I wouldn't oppose it, but I don't really support it either.

Ian / Ian / Wei, any thoughts?

-George

#8 lore raw
In reply to Ian Campbell
Quoted 10 lines · Ian Campbell
Quoted 7 lines · Olaf Hering
Quoted 2 lines · George Dunlap

How difficult would it be to have this be something sensible like, "changesets since last tag"?

Very difficult, because one does changes without commit, runs 'make rpmball' and expects that rpm -Fvh *.rpm continues to work.

Isn't that what "rpm -Uvh" is for?

No, thats for fresh install. -F installs whats already there.

Olaf

#12 lore raw
In reply to George Dunlap
Quoted 5 lines · George Dunlap
Quoted 4 lines · Olaf Hering
Quoted 2 lines · George Dunlap

How difficult would it be to have this be something sensible like, "changesets since last tag"?

Quoted 7 lines
Quoted 2 lines

Very difficult, because one does changes without commit, runs 'make rpmball' and expects that rpm -Fvh *.rpm continues to work.

Right. Personally, I think trying to make "rpm -Fvh" work for all the use cases a developer might want is more hassle than it's worth; as I said, I have scripts that just do "rpm -e" in such cases. I wouldn't oppose it, but I don't really support it either.

What exactly is the hassle here?! Its just some number for the sake of rpm.

Olaf

#9 lore raw
In reply to Olaf Hering
Quoted 8 lines · Olaf Hering
Quoted 6 lines · Ian Campbell
Quoted 5 lines · Olaf Hering
Quoted 2 lines · George Dunlap

How difficult would it be to have this be something sensible like, "changesets since last tag"?

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

Very difficult, because one does changes without commit, runs 'make rpmball' and expects that rpm -Fvh *.rpm continues to work.

Isn't that what "rpm -Uvh" is for?

No, thats for fresh install.

Isn't that -ivh?

Quoted 1 line

-F installs whats already there.

Does rpm --force -Fvh not work?

Ian.

#10 lore raw
Quoted 3 lines · Ian Campbell

On Mon, 2014-11-03 at 15:47 +0100, Olaf Hering wrote:

Isn't that -ivh?

-i installs multiple packages, if they have no overlapping files. -U replaces every installed version with the new one.

Quoted 2 lines
Quoted 1 line

-F installs whats already there.

Does rpm --force -Fvh not work?

-F behaves different. I think it would not take --force into account. At least --oldpackage does not work with -F.

Olaf

#13 lore raw
In reply to Olaf Hering
Quoted 10 lines · Olaf Hering
Quoted 8 lines · George Dunlap
Quoted 6 lines · Olaf Hering
Quoted 2 lines · George Dunlap

How difficult would it be to have this be something sensible like, "changesets since last tag"?

Very difficult, because one does changes without commit, runs 'make rpmball' and expects that rpm -Fvh *.rpm continues to work.

Quoted 7 lines
Quoted 4 lines

Right. Personally, I think trying to make "rpm -Fvh" work for all the use cases a developer might want is more hassle than it's worth; as I said, I have scripts that just do "rpm -e" in such cases. I wouldn't oppose it, but I don't really support it either.

What exactly is the hassle here?! Its just some number for the sake of rpm.

A number based on the time you happened to create the RPM, not based on something intrinsic about the content of the RPM; that just seems kind of hacky to me. It happens to work well for your common workflow, but you can certainly imagine other workflows or other situations where you'd have to more manually override things anyway (for instance, doing bisections, or comparing functionality in different releases). It seems like rather than having to remember when you can skip the manual override bits, and when you can't, it would be better to just use them all the time.

Anyway, like I said, I won't argue against it. I have no technical objections to the patch; it seems to do what it says on the tin. I'll leave it for the maintainers to decide what they think about the functionality.

-George

#14 lore raw
Quoted 9 lines · George Dunlap

A number based on the time you happened to create the RPM, not based on something intrinsic about the content of the RPM; that just seems kind of hacky to me. It happens to work well for your common workflow, but you can certainly imagine other workflows or other situations where you'd have to more manually override things anyway (for instance, doing bisections, or comparing functionality in different releases). It seems like rather than having to remember when you can skip the manual override bits, and when you can't, it would be better to just use them all the time.

George, the release number is and was never meant to describe the content of a package. It just means "its different". And it will even work for bisect because the package is always "newer", even if the content is different.

And after commit b8ebc6b9e07d3cc061fdded1a0530bd6b25d4634 ("tools/mkrpm:
allow custom rpm package name") and all the --prefix changes its easy to have independent packages for every branch.

Olaf

#15 lore raw
Quoted 12 lines · Olaf Hering
Quoted 9 lines · George Dunlap

A number based on the time you happened to create the RPM, not based on something intrinsic about the content of the RPM; that just seems kind of hacky to me. It happens to work well for your common workflow, but you can certainly imagine other workflows or other situations where you'd have to more manually override things anyway (for instance, doing bisections, or comparing functionality in different releases). It seems like rather than having to remember when you can skip the manual override bits, and when you can't, it would be better to just use them all the time.

Quoted 4 lines

George, the release number is and was never meant to describe the content of a package. It just means "its different". And it will even work for bisect because the package is always "newer", even if the content is different.

Not if you end up going to a previously built package for some reason.

I can see how this makes more sense if you do have an independent package installed for every branch; but most people are not going to do that.

Anyway, if I were a maintainer, I might decide to accept it, even though I didn't like it, on the grounds that it doesn't do much harm and somebody finds it useful.

Since I'm not a maintainer, I'm free to be opinionated. :-)

-George

#16 lore raw
Quoted 24 lines · George Dunlap
Quoted 12 lines · Olaf Hering
Quoted 9 lines · George Dunlap

A number based on the time you happened to create the RPM, not based on something intrinsic about the content of the RPM; that just seems kind of hacky to me. It happens to work well for your common workflow, but you can certainly imagine other workflows or other situations where you'd have to more manually override things anyway (for instance, doing bisections, or comparing functionality in different releases). It seems like rather than having to remember when you can skip the manual override bits, and when you can't, it would be better to just use them all the time.

Quoted 4 lines

George, the release number is and was never meant to describe the content of a package. It just means "its different". And it will even work for bisect because the package is always "newer", even if the content is different.

Not if you end up going to a previously built package for some reason.

I can see how this makes more sense if you do have an independent package installed for every branch; but most people are not going to do that.

Quoted 5 lines

Anyway, if I were a maintainer, I might decide to accept it, even though I didn't like it, on the grounds that it doesn't do much harm and somebody finds it useful.

Since I'm not a maintainer, I'm free to be opinionated. :-)

I don't think any of the formal maintainers of this code use RPM[0], and you are the original author of the tool... So I'm afraid I think you might have a more relevant opinion than you might like.

Ian.

[0] At least half happen to be Debian Maintainers...

#17 lore raw

So how should we proceed here?!

Olaf

Quoted 39 lines · Ian Campbell
Quoted 24 lines · George Dunlap
Quoted 12 lines · Olaf Hering
Quoted 9 lines · George Dunlap

A number based on the time you happened to create the RPM, not based on something intrinsic about the content of the RPM; that just seems kind of hacky to me. It happens to work well for your common workflow, but you can certainly imagine other workflows or other situations where you'd have to more manually override things anyway (for instance, doing bisections, or comparing functionality in different releases). It seems like rather than having to remember when you can skip the manual override bits, and when you can't, it would be better to just use them all the time.

Quoted 4 lines

George, the release number is and was never meant to describe the content of a package. It just means "its different". And it will even work for bisect because the package is always "newer", even if the content is different.

Not if you end up going to a previously built package for some reason.

I can see how this makes more sense if you do have an independent package installed for every branch; but most people are not going to do that.

Quoted 5 lines

Anyway, if I were a maintainer, I might decide to accept it, even though I didn't like it, on the grounds that it doesn't do much harm and somebody finds it useful.

Since I'm not a maintainer, I'm free to be opinionated. :-)

I don't think any of the formal maintainers of this code use RPM[0], and you are the original author of the tool... So I'm afraid I think you might have a more relevant opinion than you might like.

Ian.

[0] At least half happen to be Debian Maintainers...

#18 lore raw
Quoted 1 line · Olaf Hering

So how should we proceed here?!

George, any input on this since Ian just nominated you to be the maintainer-pro-temp?

Thanks.

Quoted 49 lines

Olaf

Quoted 31 lines · Ian Campbell
Quoted 24 lines · George Dunlap
Quoted 12 lines · Olaf Hering
Quoted 9 lines · George Dunlap

A number based on the time you happened to create the RPM, not based on something intrinsic about the content of the RPM; that just seems kind of hacky to me. It happens to work well for your common workflow, but you can certainly imagine other workflows or other situations where you'd have to more manually override things anyway (for instance, doing bisections, or comparing functionality in different releases). It seems like rather than having to remember when you can skip the manual override bits, and when you can't, it would be better to just use them all the time.

Quoted 4 lines

George, the release number is and was never meant to describe the content of a package. It just means "its different". And it will even work for bisect because the package is always "newer", even if the content is different.

Not if you end up going to a previously built package for some reason.

I can see how this makes more sense if you do have an independent package installed for every branch; but most people are not going to do that.

Quoted 5 lines

Anyway, if I were a maintainer, I might decide to accept it, even though I didn't like it, on the grounds that it doesn't do much harm and somebody finds it useful.

Since I'm not a maintainer, I'm free to be opinionated. :-)

Quoted 8 lines

I don't think any of the formal maintainers of this code use RPM[0], and you are the original author of the tool... So I'm afraid I think you might have a more relevant opinion than you might like.

Ian.

[0] At least half happen to be Debian Maintainers...

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel