You are not logged in.
For the program, is it possible to just append the git version number to the actual version number?
For example, the current version number of my program is 0.9.2. The git commit number f2b19c0752. I would like the version number to be something like 0.9.2.f2b19c0752 in the PKGBUILD.
Also, why is PKGBUILD pkgver come out as pkgver=6620271 when the last commit was 36d9ff82ec?
Thanks in advance
Last edited by pivotraze (2013-05-22 03:23:53)
Offline
As long as your project has tagged version numbers:
pkgver() {
cd "$_gitname"
echo $(git describe --tags).$(git rev-parse --short master)
}
Scott
Offline
For some reason, I get this:
==> Updated version: wifiz 0.9.2-2-g833fd3f.-1
==> ERROR: pkgver is not allowed to contain colons, hyphens or whitespace.
The PKGBUILD:
# Maintainer: Cody Dostal <dostalcody@gmail.com>
pkgname=wifiz
_gitname=WiFiz
pkgver=0.9.1.2-8-g833fd3f.31403fc
pkgrel=1
pkgdesc="NetCTL GUI Frontend, written in wxPython. Stable Version."
arch=('any')
url="https://github.com/codywd/WiFiz"
license=('MIT')
depends=('python2' 'wxpython' 'wireless_tools' 'netctl'
'wpa_supplicant')
makedepends=('git')
conflicts=('wifiz-nightly')
provides=('wifiz')
source=('git://github.com/codywd/WiFiz.git#branch=develop')
# Because the sources are not static, skip Git checksum:
md5sums=('SKIP')
pkgver() {
cd "$_gitname"
echo $(git describe --tags).$(git rev-parse --short master)
}
package() {
cd $srcdir/$_gitname
pwd
python2 setup.py install --root="$pkgdir/" --optimize=1
}
What causes the hyphens?
Last edited by pivotraze (2013-05-22 03:47:24)
Offline
Hyphens is not allowed in pkgver, so "0.9.1.2-8-g833fd3f.31403fc" could not be used.
You can just find where the hyphens come from, and add
sed 's|-|.|g'
to use dots instead of hyphens
Offline
Here is the actual code I had to use:
pkgver() {
cd "$_gitname"
echo $(git describe --tags).$(git rev-parse --short develop) |
sed 's|-|.|g'
}
Thank you!
However, is there any way to remove the extraneous .s?
Like, here is the package name: wifiz-0.9.2.3.g2d3e0a8.-1-any.pkg.tar.xz
I would like it to be something like: "wifiz-0.9.2.g2d3e0a8-1-any.pkg.tar.xz" preferably, but "wifiz-0.9.2.3.g2d3e0a8-1-any.pkg.tar.xz" would be fine.
Last edited by pivotraze (2013-05-22 03:59:04)
Offline
first off, git describe already includes the short hash of the commit, get rid of git rev-parse. echo $(git describe --long | sed 's/-/./g') is really all you need.
second, you don't really want what you say you want. "wifiz-0.9.2.g2d3e0a8-1-any.pkg.tar.xz" will not give you a linear versioning. The next commit could give you "wifiz-0.9.2.g19ab453-1-any.pkg.tar.xz", which would then be interpreted as a downgrade because the version number is less than the previous one. Having the count of commits in there is important to advance the version on each update.
Offline
first off, git describe already includes the short hash of the commit, get rid of git rev-parse. echo $(git describe --long | sed 's/-/./g') is really all you need.
second, you don't really want what you say you want. "wifiz-0.9.2.g2d3e0a8-1-any.pkg.tar.xz" will not give you a linear versioning. The next commit could give you "wifiz-0.9.2.g19ab453-1-any.pkg.tar.xz", which would then be interpreted as a downgrade because the version number is less than the previous one. Having the count of commits in there is important to advance the version on each update.
Ahh, thanks for that...now I understand the rationale behind the wiki entry! So obvious in hindsight....
Scott
Offline
That seems to work better. It produces wifiz-0.9.2.8.gc38cae9-1-any.pkg.tar.xz which is more akin to what i wanted Thanks.
This is the final code for PKGBUILD:
# Maintainer: Cody Dostal <dostalcody@gmail.com>
pkgname=wifiz
_gitname=WiFiz
pkgver=0.9.2.8.gc38cae9
pkgrel=2
pkgdesc="NetCTL GUI Frontend, written in wxPython. Stable Version."
arch=('any')
url="https://github.com/codywd/WiFiz"
license=('MIT')
depends=('python2' 'wxpython' 'wireless_tools' 'netctl'
'wpa_supplicant')
makedepends=('git')
optdepends=('gedit: Manually editing profiles.')
conflicts=('wifiz-nightly')
provides=('wifiz')
source=('git://github.com/codywd/WiFiz.git#branch=develop')
# Because the sources are not static, skip Git checksum:
md5sums=('SKIP')
pkgver() {
cd "$_gitname"
echo $(git describe --long | sed 's/-/./g')
}
package() {
cd $srcdir/$_gitname
pwd
python2 setup.py install --root="$pkgdir/" --optimize=1
}
Offline
Hyphens is not allowed in pkgver, so "0.9.1.2-8-g833fd3f.31403fc" could not be used.
You can just find where the hyphens come from, and addsed 's|-|.|g'
to use dots instead of hyphens
bad idea
1.2.1 is greater tha 1.2.0 right?
but whit this a 2.0-299 become 2.0.299 and a 2.0.1-299 become 2.0.1.299
who is bigger, 2.0.299 or 2.0.1.299? vercmp say the first
I actually use
sed 's|-|.git|g'
and for now work as expeted making 2.0.git299 lower than 2.0.1.git299
and not sure what is the oppinion of dev about .r vs .git por git versions like that because for me adding .git mean git and .r is release like any common upstream release
Last edited by Jristz (2013-05-23 05:15:25)
Well, I suppose that this is somekind of signature, no?
Offline
I'm not sure I get all this, but doesn't `git rev-list --count HEAD` provide the propper sequential commit number?
In my git PKGBUILDS I use the following:
pkgver() {
cd "${_gitname}";
echo "2.$(git rev-list --count HEAD).$(git describe --always )"
}
Where the initial "2." can be any version prefix. In this case, this is a development version of the second major version and it provides sequential minor version numbers followed by non-sequential minor-minor version numbers, but this is fine as every change increments the minor version:
2.223.<hash>
2.224.<hash>
2.225.<hash>
...
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline
I'm not sure I get all this, but doesn't `git rev-list --count HEAD` provide the propper sequential commit number?
In my git PKGBUILDS I use the following:
pkgver() { cd "${_gitname}"; echo "2.$(git rev-list --count HEAD).$(git describe --always )" }
Where the initial "2." can be any version prefix. In this case, this is a development version of the second major version and it provides sequential minor version numbers followed by non-sequential minor-minor version numbers, but this is fine as every change increments the minor version:
2.223.<hash>
2.224.<hash>
2.225.<hash>
...
Yes it does, but "git describe" already includes a count, so "git rev-list --count" isn't needed here.
Offline
proudzhu wrote:Hyphens is not allowed in pkgver, so "0.9.1.2-8-g833fd3f.31403fc" could not be used.
You can just find where the hyphens come from, and addsed 's|-|.|g'
to use dots instead of hyphens
bad idea
1.2.1 is greater tha 1.2.0 right?
but whit this a 2.0-299 become 2.0.299 and a 2.0.1-299 become 2.0.1.299
who is bigger, 2.0.299 or 2.0.1.299? vercmp say the firstI actually use
sed 's|-|.git|g'
and for now work as expeted making 2.0.git299 lower than 2.0.1.git299
and not sure what is the oppinion of dev about .r vs .git por git versions like that because for me adding .git mean git and .r is release like any common upstream release
Also a bad idea (or at least not really ideal), you'd actually end up with end up with 2.0.1.git299.gitg833fd3f. KaiSforza, who's been doing a lot of work on pacman, proposes this: https://wiki.archlinux.org/index.php/Ta … .28.29.27s. It adds "r" after the first occurrence of "-" only. Personally, I would use awk if there was a chance you'd run into this situation. git describe --long | awk -F - '{print $1 ".r" $2 "." $3}'
Offline
git describe only seems to work with tags - I've never used tags, so git describe returns nothing unless I add the 'always' flag, then there is just a non-sequential hash.
Last edited by Trilby (2013-05-23 11:46:46)
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline
Right. This thread is about a repo that uses tags, though, so again, git rev-list isn't relevant here.
Offline
Sorry, I didn't mean to go OT, I thought this was more of a general discussion about pkgver functions for git PKGBUILDS.
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline