You are not logged in.
Hi,
Thanks for taking the time to check this out
i3configger is a tool I just built and I want to provide it as a package as well.
I looked at a few existing packages, waded through the many docs and came up with this for the current version:
I added the resulting package to the latest release on github: https://github.com/obestwalter/i3config … pkg.tar.xz
# $Id$
# Maintainer: Oliver Bestwalter <oliver@bestwalter.de>
pkgname=python-i3configger
pkgver=0.7.1
pkgrel=1
pkgdesc='i3 config manipulation tool'
arch=('any')
url='http://oliver.bestwalter.de/i3configger/'
makedepends=('python' 'python-setuptools')
license=('MIT')
source=("https://pypi.io/packages/source/i/i3configger/i3configger-${pkgver}.tar.gz")
sha256sums=('d06819771438d48966ad7c138dc3332b4edeffd432956d8ae4f71873629183bf')
package() {
# python-docutils is a actually python-daemon dependency (bug already filed)
depends=('python' 'python-psutil' 'python-daemon' 'python-docutils')
cd "$srcdir"/i3configger-$pkgver
python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1
install -D -m644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
This works in a fresh archlinux vagrant box (Used Vagrantfile is also in repo).
I first encountered the following problem:
If dependencies are outside the package function I get:
==> Making package: python-i3configger 0.7.1-1 (Sat Jun 10 21:06:43 UTC 2017)
==> Checking runtime dependencies...
==> Missing dependencies:
-> python-psutil
-> python-daemon
-> python-docutils
==> Checking buildtime dependencies...
==> ERROR: Could not resolve all dependencies.
==> ERROR: An unknown error has occurred. Exiting...
Moving depends inside the package() function creates a working package. I did not see anything regarding this in the docs, so I am unsure if this is the right way of doing it, but python-pip package does it the same way: https://git.archlinux.org/svntogit/pack … on-pip#n29
I am also not sure if I should really add the license to /usr/share/licenses/ - as I did not really comprehend the docs around licensing (my brain sort of switches into panic mode, when it is confronted with any kind of legaleese ...) so this is also basically just copied how python-pip does it.
The last question would be if it is o.k. to keep a Vagrantfile in the PKBUILD repo to have the testing harness right where it belongs as I read somewhere in the docs, that the repo should only contain the absolute necessities.
Cheers,
Oliver
Last edited by obestwalter (2017-06-13 20:05:06)
Offline
The package sounds like it installs a tool, not a module (by which I mean it may be a python module, but the main point of the package is for the tool in /usr/bin) so it should be named "i3configger" not "python-$modulename".
As an MIT license, you do indeed need to install the license into /usr/share/licenses/ so good job there.
As for the depends, if you run `makepkg -s` then depends will be installed by makepkg and it won't error. You need to do that anyway as you may not have python-setuptools pre-installed...
Moving the depends into package() is one way to hack around that, and you *could* use it to kludge in support for runtime depends that aren't needed for building. But you should probably just use `makepkg -s`
Managing AUR repos The Right Way -- aurpublish (now a standalone tool)
Offline
Thank you, that was very helpful.
The package sounds like it installs a tool, not a module (by which I mean it may be a python module, but the main point of the package is for the tool in /usr/bin) so it should be named "i3configger" not "python-$modulename".
Ahh, now I get it, I was a bit blindsided by the examples I looked at, as they are a bit special. Although they provide executables they are specific to the python ecosystem (I looked at python-pip and python-tox). So although they are not modules they have the prefix anyway I guess. But you are right: for i3configger it does not matter how it is implemented. If I rewrote it in golang tomorrow the user would not notice, so the prefix makes no sense here.
As an MIT license, you do indeed need to install the license into /usr/share/licenses/ so good job there.
Good - leaving it as it is then.
As for the depends, if you run `makepkg -s` then depends will be installed by makepkg and it won't error. You need to do that anyway as you may not have python-setuptools pre-installed...
Moving the depends into package() is one way to hack around that, and you *could* use it to kludge in support for runtime depends that aren't needed for building. But you should probably just use `makepkg -s`
Ahh, o.k. - I actually looked at the output of makepkg --help myself now and learned a few new tricks, thanks for the explanation and for not right away swinging the RTFM hammer at me
So this is the current PKGBUILD now:
# $Id$
# Maintainer: Oliver Bestwalter <oliver@bestwalter.de>
pkgname=i3configger
pkgver=0.7.1
pkgrel=2
pkgdesc='i3 config manipulation tool'
arch=('any')
url='http://oliver.bestwalter.de/i3configger/'
makedepends=('python' 'python-setuptools')
# python-docutils is a actually python-daemon dependency (bug already filed)
depends=('python' 'python-setuptools' 'python-psutil' 'python-daemon' 'python-docutils')
license=('MIT')
source=("https://pypi.io/packages/source/i/i3configger/i3configger-${pkgver}.tar.gz")
sha256sums=('d06819771438d48966ad7c138dc3332b4edeffd432956d8ae4f71873629183bf')
package() {
cd "$srcdir"/i3configger-$pkgver
python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1
install -D -m644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
Is this fit for being added to AUR then?
Cheers,
Oliver
Last edited by obestwalter (2017-06-11 15:51:27)
Offline
P.S. I tried to clarify the naming conventions in the WIKI: https://wiki.archlinux.org/index.php?ti … did=477610
Offline
The "# $Id$" at the top looks like an svn(1) keyword you copy-pasted from some repository package you don't actually need that.
Your edit looks good -- I did touch it up to fix a formatting issue.
Note on the Wiki page that it mentions when you need setuptools as a runtime dependency you should list it *only* in depends, since depends are included in makedepends by makepkg*. As you saw, given that you had to run `makepkg -s`. (Technically this has no practical difference, it just looks cleaner when the PKGBUILD doesn't have a makedepends line it doesn't actually need.)
"alternatively, if the PKGBUILD only installs the Python package for a single version of Python, setuptools should be moved from makedepends to depends"
* -- depends are for the built package, so pacman knows what packages rely on what other packages. makedepends are for makepkg, to know what packages need to be installed when building the package, something that usually includes depends which is why makepkg includes depends when calculating the makedepends.
Last edited by eschwartz (2017-06-11 19:37:16)
Managing AUR repos The Right Way -- aurpublish (now a standalone tool)
Offline
thanks for helping me on these first steps and even tidying up after me - very appreciated. I had not noticed that there was a formatting problem on the Wiki.
The "# $Id$" at the top looks like an svn(1) keyword you copy-pasted from some repository package you don't actually need that.
I was asssuming this will be used for some AUR magic I don't know of yet, as I saw it in all the PKGBUILDS I looked at. Good ol' cargo cult programming Wil get rid of that then.
"alternatively, if the PKGBUILD only installs the Python package for a single version of Python, setuptools should be moved from makedepends to depends"
o.k. I actually missed that, thanks.
Final version then (he said hopefully )
# Maintainer: Oliver Bestwalter <oliver@bestwalter.de>
pkgname=i3configger
pkgver=0.7.5
pkgrel=1
pkgdesc='i3 config manipulation tool'
arch=('any')
url='http://oliver.bestwalter.de/i3configger/'
# python-docutils is a actually python-daemon dependency (bug already filed)
depends=('python' 'python-setuptools' 'python-psutil' 'python-daemon' 'python-docutils')
license=('MIT')
source=("https://pypi.io/packages/source/i/i3configger/i3configger-${pkgver}.tar.gz")
sha256sums=('1c1cd542f1a604ca1340cde47274ffff4de9fb1e16f1ac9ee55a060c2f228a3f')
package() {
cd "$srcdir"/i3configger-$pkgver
python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1
install -D -m644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
Cheers,
Oliver
Offline
Looks good to me. As for AUR magic, the AUR only parses the .SRCINFO, and validates several things including matching the non-remote files in the source=() array against the list of files contained in the repo. (See my sig for handling .SRCINFO generation right).
The $Id$ keyword is used as I said by svn(1) which is the version control system currently used by the Arch Linux repository tooling, and svn does some magic to cause the actual checked-out files to contain the name of the committer instead of the keyword. Strange stuff.
Managing AUR repos The Right Way -- aurpublish (now a standalone tool)
Offline
Great
I had a look at your repo already and will use that to get my package into AUR.
Thanks!
Offline