You are not logged in.

#1 2015-12-02 20:52:19

karlch
Member
Registered: 2015-06-14
Posts: 105

[SOLVED] Help with PKGBUILD for own software "vimiv"

I recently released the first considered the first considered stable version of my project mentioned here:
https://bbs.archlinux.org/viewtopic.php?id=205763

I am hoping to add it to the AUR but I have no experience with PKGBUILDs at all. This is what I have come up with so far:

# Maintainer: Christian Karl <christian.karl@protonmail.com>

pkgname='vimiv-git'
pkgver=0.1
pkgrel=1
pkgdesc='An image viewer with vim-like keybindings'
arch=('any')
url='https://github.com/karlch/vimiv'
license=('MIT')
depends=('python3' 'python-gobject' 'gtk3' 'python-pillow')
makedepends=('git')
optdepends=('imagemagick')
provides=('vimiv-git')
conflicts=('vimiv-git')
source=('$pkgname::git+${url}.git')
md5sums=('SKIP')

package() {
    cd '$srcdir/$pkgname'

    install -D -m755 vimiv $pkgdir/usr/bin/vimiv
    install -D -m644 vimivrc.py $pkgdir/etc/vimiv/vimivrc.py
    install -D -m644 vimiv.desktop $pkgdir/usr/share/applications/vimiv.desktop
    install -D -m644 LICENSE $pkgdir/usr/share/licenses/vimiv/LICENSE
    install -D -m644 vimiv.1 $pkgdir/usr/share/man/man1/vimiv.1
}

It works on my machine. Is there anything I should change, improve, do? smile

Last edited by karlch (2015-12-02 22:54:33)

Offline

#2 2015-12-02 20:58:22

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,842
Website

Re: [SOLVED] Help with PKGBUILD for own software "vimiv"

Looks pretty good to me, but why does it provide and conflict with itself?


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#3 2015-12-02 21:02:23

karlch
Member
Registered: 2015-06-14
Posts: 105

Re: [SOLVED] Help with PKGBUILD for own software "vimiv"

I copied that from this PKGBUILD:
https://aur.archlinux.org/cgit/aur.git/ … h=sxiv-git
and simply took for granted that this was a convention of some sort. I shall remove the conflicts part, thank you.

Offline

#4 2015-12-02 21:02:45

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,520
Website

Re: [SOLVED] Help with PKGBUILD for own software "vimiv"

If it's a git package you should use the pkgver function rather than a static pkgver.

You can make a PKGBUILD based on a specific git version/tag, but then this would not pull from head as this does, and it would have a checksum.

Other than that it looks great to me (except for the already mentioned provide/conflict entries, which are harmless, but just odd).


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#5 2015-12-02 21:07:28

karlch
Member
Registered: 2015-06-14
Posts: 105

Re: [SOLVED] Help with PKGBUILD for own software "vimiv"

Thanks for your feedback.

I will need some further reading for the git part, as soon as I come up with a new version I will post it here again.

Offline

#6 2015-12-02 21:36:19

karlch
Member
Registered: 2015-06-14
Posts: 105

Re: [SOLVED] Help with PKGBUILD for own software "vimiv"

So here is what I have come up with, I do not quite understand what you mean with a checksum, but this seems to work with a pkgver function:

# Maintainer: Christian Karl <christian.karl@protonmail.com>

pkgname='vimiv-git'
pkgrel=1
pkgver=305af42
pkgdesc="An image viewer with vim-like keybindings"
arch=('any')
url="https://github.com/karlch/vimiv"
license=('MIT')
depends=('python3' 'python-gobject' 'gtk3' 'python-pillow')
makedepends=('git')
optdepends=('imagemagick: for the optimization of images')
provides=('vimiv-git')
source=("$pkgname::git+${url}.git")
md5sums=('SKIP')

pkgver() {
    cd "$pkgname" 
    git describe --long --always | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

package() {
    cd "$srcdir/$pkgname"

    install -D -m755 vimiv $pkgdir/usr/bin/vimiv
    install -D -m644 vimivrc.py $pkgdir/etc/vimiv/vimivrc.py
    install -D -m644 vimiv.desktop $pkgdir/usr/share/applications/vimiv.desktop
    install -D -m644 LICENSE $pkgdir/usr/share/licenses/vimiv/LICENSE
    install -D -m644 vimiv.1 $pkgdir/usr/share/man/man1/vimiv.1
}

EDIT: stupide me did not remove the provides/conflicts issue

Last edited by karlch (2015-12-02 21:42:31)

Offline

#7 2015-12-02 21:55:42

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,520
Website

Re: [SOLVED] Help with PKGBUILD for own software "vimiv"

karlch wrote:

I do not quite understand what you mean with a checksum

Don't worry about it - it doesn't apply if you pull from get (this is the sha256sum or md5sum), these are just SKIP for git packages.  But if you were pulling a specific (and static) version/tag from git, then you'd want to include the checksum.

The above version looks great to me.  I haven't tested it, but it's pretty clean, I don't see anything that could go wrong.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#8 2015-12-02 22:26:50

karlch
Member
Registered: 2015-06-14
Posts: 105

Re: [SOLVED] Help with PKGBUILD for own software "vimiv"

Thanks again, one last question, do I edit the version in .SRCINFO manually or is this also automated somehow?

Offline

#9 2015-12-02 22:35:34

respiranto
Member
Registered: 2015-05-15
Posts: 479
Website

Re: [SOLVED] Help with PKGBUILD for own software "vimiv"

There is the command mksrcinfo which is provided by pkgbuild-introspection.

Offline

#10 2015-12-02 22:39:58

karlch
Member
Registered: 2015-06-14
Posts: 105

Re: [SOLVED] Help with PKGBUILD for own software "vimiv"

Yep, I used that to create the file smile

I will try to clarify my question.

If I understand everything correctly the package now receives a version depending on the git commit. The version of the package is automatically adapted when makepkg is run. But the version is also displayed on the AUR website. So would I have to readd the package to the AUR website everytime I do a git commit to the software or is the version there also updated automatically somehow? Or is it okay to have an outdated git version in the website description?

Offline

#11 2015-12-02 22:47:14

respiranto
Member
Registered: 2015-05-15
Posts: 479
Website

Re: [SOLVED] Help with PKGBUILD for own software "vimiv"

The website's shown data relies on the data provided in the .SRCINFO, i.e. it will stay the same.
To my knowledge it is common to have rather outdated numbers displayed there, however I personally avoid this by regularly checking for updates using cron.

Offline

#12 2015-12-02 22:52:51

karlch
Member
Registered: 2015-06-14
Posts: 105

Re: [SOLVED] Help with PKGBUILD for own software "vimiv"

Alright, I will try to keep it up to date. Thank you.

And thanks to all your help vimiv is now available in the AUR:
https://aur.archlinux.org/packages/vimiv-git/

Offline

#13 2015-12-03 00:49:22

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,541

Re: [SOLVED] Help with PKGBUILD for own software "vimiv"

The pkgver function is bad. That only works if the repo has tags, this one doesn't.

You still have the pkgname in "provides".

You should quote any paths that use $pkgdir or $srcdir.

The first command in one function is cd "$pkgname", the other is cd "$srcdir/$pkgname". They do the same thing, but should be consistent.

Last edited by Scimmia (2015-12-03 00:53:11)

Offline

#14 2015-12-03 03:18:02

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,520
Website

Re: [SOLVED] Help with PKGBUILD for own software "vimiv"

karlch wrote:

But the version is also displayed on the AUR website. So would I have to readd the package to the AUR website everytime I do a git commit to the software or is the version there also updated automatically somehow? Or is it okay to have an outdated git version in the website description?

You would not want to update the AUR website package everytime you commit something to git.  You could periodically if you wanted, there'd be no real harm other than the small bit of bandwidth used.  But this is just generally not done.

It is okay - and infact expected - to have an outdated git version in the website description.  This is one of the main reasons such packages need a postfix like "-git" in this case (others are "-cvs" or "-bzr" ...)  These indicate that the package builds a development version and users can rebuild at anytime for the newest development version regardless of what the AUR website lists for a version number.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#15 2015-12-03 09:03:35

karlch
Member
Registered: 2015-06-14
Posts: 105

Re: [SOLVED] Help with PKGBUILD for own software "vimiv"

Scimmia wrote:

The pkgver function is bad. That only works if the repo has tags, this one doesn't.

You still have the pkgname in "provides".

You should quote any paths that use $pkgdir or $srcdir.

The first command in one function is cd "$pkgname", the other is cd "$srcdir/$pkgname". They do the same thing, but should be consistent.

Thanks for your suggestions, here is my next version:

pkgname='vimiv-git'
pkgrel=1
pkgver=r35.305af42
pkgdesc="An image viewer with vim-like keybindings"
arch=('any')
url="https://github.com/karlch/vimiv"
license=('MIT')
depends=('python3' 'python-gobject' 'gtk3' 'python-pillow')
makedepends=('git')
optdepends=('imagemagick: for the optimization of images')
source=("$pkgname::git+${url}.git")
md5sums=('SKIP')

pkgver() {
    cd "$srcdir/$pkgname" 
    printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

package() {
    cd "$srcdir/$pkgname"

    install -D -m755 vimiv "$pkgdir/usr/bin/vimiv"
    install -D -m644 vimivrc.py "$pkgdir/etc/vimiv/vimivrc.py"
    install -D -m644 vimiv.desktop "$pkgdir/usr/share/applications/vimiv.desktop"
    install -D -m644 LICENSE "$pkgdir/usr/share/licenses/vimiv/LICENSE"
    install -D -m644 vimiv.1 "$pkgdir/usr/share/man/man1/vimiv.1"
}
Trilby wrote:

You would not want to update the AUR website package everytime you commit something to git.

Makes perfect sense to me and makes life a lot easier.

Offline

Board footer

Powered by FluxBB