You are not logged in.

#1 2016-02-25 12:14:26

ethoms
Member
Registered: 2013-10-08
Posts: 11

PKGBUILD review for netdrive-connector

Dear Archers, I'm the developer of a new (at least publicly) app called netdrive-connector.

It's a PyQt GUI app with accompanying shell commands to make easy setting up of SFTP (sshfs) and WebDAV (davfs2) connections (via FUSE and fstab).

The project can be found here on github: https://github.com/ethoms/netdrive-connector and here on PyPi: https://pypi.python.org/pypi/netdrive-connector

I have used the OBS to create packages for most of the major distributions and I am the SlackBuilds.org maintainer. I would like to get it into the AUR too.

Here is my PKGBUILD that seems to work for me. Could somebody please test it so I can submit it.

# Maintainer: Euan Thoms <euan@potensol.com>
pkgname=netdrive-connector
pkgver=1.3.2
pkgrel=1
pkgdesc="Utility to setup mountable SFTP and WebDAV connections on Linux/UNIX systems."
arch=('i686' 'x86_64')
url="https://github.com/ethoms/netdrive-connector"
license=('BSD-2-clause')
depends=('python2'
         'python2-pyqt4'
         'openssh'
         'openssh-askpass'
         'sshfs'
         'davfs2'
         'expect')
makedepends=('python2-setuptools')
options=(!emptydirs)
source=("https://pypi.python.org/packages/source/n/$pkgname/$pkgname-$pkgver.tar.gz")
md5sums=('08f02dc3cb07212d1a0c04dae8cb20aa')
package() {
  cd "$srcdir/$pkgname-$pkgver"
  python2 setup.py install --root="$pkgdir/" --optimize=1
}

Offline

#2 2016-02-25 12:41:16

michis
Member
Registered: 2015-12-12
Posts: 77

Re: PKGBUILD review for netdrive-connector

Building a package works here, not tested your program. ;)

A few notes:
- arch=('i686' 'x86_64') should be arch=('any') since there is nothing compiled for a specific architecture.
- license=('BSD-2-clause') should be license='(custom:BSD-2-clause') and the LICENSE file installed to /usr/share/licenses/$pkgname/LICENSE
- python2 dependency is already satisfied by python2-pyqt4
- I think using sha1sums or sha256sums is preferred to using md5sums.

I don't know if you already know namcap. You can use it to check the PKGBUILD and package for errors.

Last edited by michis (2016-02-25 12:51:45)

Offline

#3 2016-02-25 17:09:28

ethoms
Member
Registered: 2013-10-08
Posts: 11

Re: PKGBUILD review for netdrive-connector

Thanks michis.

I did initially use arch=('any') on the OBS but I suspected it to be a problem and changed it. I prefer having a noarch package myself, so this is good news.

License: are you sure it has to be custom:...? The BSD-2-clause is probably the most common license after GPL.
How do I get it to install the LICENSE file there? Currently python2-setuptools does all the installing of files.

I got md5sum from the Arch wiki packaging for python guidelines. I will change it to sha256sum.

Thanks again.

Offline

#4 2016-02-25 17:28:01

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

Re: PKGBUILD review for netdrive-connector

The checksum you use doesn't really matter.

As for the license, it should be listed as simply 'BSD', and you do need to install the file to /usr/share/licenses/$pkgname. You would typically use the "install" command to do it. For more information about why, see https://wiki.archlinux.org/index.php/PKGBUILD#license

Offline

#5 2016-02-25 17:29:13

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: PKGBUILD review for netdrive-connector

ethoms wrote:

Thanks michis.

I did initially use arch=('any') on the OBS but I suspected it to be a problem and changed it. I prefer having a noarch package myself, so this is good news.

License: are you sure it has to be custom:...? The BSD-2-clause is probably the most common license after GPL.

See: https://wiki.archlinux.org/index.php/PKGBUILD#license
BSD has its own copyright line, so each package needs its own copy of the license.  You don't *have* to specify it as a custom license, but you do need to install a copy.

How do I get it to install the LICENSE file there? Currently python2-setuptools does all the installing of files.

Is there something very non-obvious about

install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"

???

I got md5sum from the Arch wiki packaging for python guidelines. I will change it to sha256sum.

Thanks again.

The ABS samples are very out of date.
There is no good reason to stick with outdated checksum methods.

...

Couple additional style nits:

1) Why is each depends on its own line?
2) Why specify "!noemptydirs" -- is it critical to the package? Usually that is left for the makepkg.conf defaults.
3) You should use a build function.

build() {
    cd "${srcdir}/${pkgname}-${pkgver}"
    python2 setup.py build
}

package() {
    cd "${srcdir}/${pkgname}-${pkgver}"
    python2 setup.py install --root="${pkgdir}" --optimize=1 --skip-build
}

Last edited by eschwartz (2016-02-25 17:32:28)


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#6 2016-02-25 17:31:30

michis
Member
Registered: 2015-12-12
Posts: 77

Re: PKGBUILD review for netdrive-connector

ethoms wrote:

License: are you sure it has to be custom:...? The BSD-2-clause is probably the most common license after GPL.

https://wiki.archlinux.org/index.php/Ar … s#Licenses
Just license=('BSD-2-clause') is ok, but then namcap prints an error.

netdrive-connector E: BSD-2-clause is not a common license (it's not in /usr/share/licenses/common/)
ethoms wrote:

How do I get it to install the LICENSE file there? Currently python2-setuptools does all the installing of files.

You can use the install command. For example

install -Dm644 "$srcdir/path/to/LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

Offline

#7 2016-02-25 17:33:31

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

Re: PKGBUILD review for netdrive-connector

Eschwartz wrote:

3) You should use a build function.

If it doesn't build anything, there's no reason for a build function.

Offline

#8 2016-02-25 17:40:23

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: PKGBUILD review for netdrive-connector

Scimmia wrote:
Eschwartz wrote:

3) You should use a build function.

If it doesn't build anything, there's no reason for a build function.

But setuptools does "build" something.

It collects the selected modules and optional data files in build/lib before finally copying build/lib to the install location.

This is a pretty standard technique in the python setuptools-based PKGBUILDs I have seen.


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#9 2016-02-25 17:45:16

michis
Member
Registered: 2015-12-12
Posts: 77

Re: PKGBUILD review for netdrive-connector

michis wrote:

Just license=('BSD-2-clause') is ok, but then namcap prints an error.

netdrive-connector E: BSD-2-clause is not a common license (it's not in /usr/share/licenses/common/)
Scimmia wrote:

As for the license, it should be listed as simply 'BSD'

Ah, didn't know that, sorry. With simply BSD there is no error.

edit:
Maybe you should also handle this one.

netdrive-connector E: Mime type handler found. Add "update-desktop-database -q" to the install file

Last edited by michis (2016-02-25 17:47:37)

Offline

#10 2016-02-25 17:48:44

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

Re: PKGBUILD review for netdrive-connector

Eschwartz wrote:
Scimmia wrote:
Eschwartz wrote:

3) You should use a build function.

If it doesn't build anything, there's no reason for a build function.

But setuptools does "build" something.

It collects the selected modules and optional data files in build/lib before finally copying build/lib to the install location.

This is a pretty standard technique in the python setuptools-based PKGBUILDs I have seen.

It's standard when setup.py actually builds something. When it's just copying things, it's not needed.

Offline

#11 2016-02-25 18:11:51

ethoms
Member
Registered: 2013-10-08
Posts: 11

Re: PKGBUILD review for netdrive-connector

OK, thanks people. I've got this so far:

# Maintainer: Euan Thoms <euan@potensol.com>
pkgname=netdrive-connector
pkgver=1.3.2
pkgrel=1
pkgdesc="Utility to setup mountable SFTP and WebDAV connections on Linux/UNIX systems."
arch=('any')
url="https://github.com/ethoms/netdrive-connector"
license=('custom:BSD-2-clause')
depends=('python2-pyqt4'
         'openssh'
         'openssh-askpass'
         'sshfs'
         'davfs2'
         'expect')
makedepends=('python2-setuptools')
source=("https://pypi.python.org/packages/source/n/$pkgname/$pkgname-$pkgver.tar.gz")
sha256sums=('8d0ae5d77d27cd8b7613fb2ef2410a26f49c8e5ab4d4c8fb32d7c63a14b8848b')
package() {
  cd "$srcdir/$pkgname-$pkgver"
  python2 setup.py install --root="$pkgdir/" --optimize=1
}
install -D -m644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
install=$pkgname.install

and in my netdrive-connector.install:

#!/bin/sh

post_install()
{
  if [ -x /usr/bin/update-desktop-database ]; then
    /usr/bin/update-desktop-database -q usr/share/applications >/dev/null 2>&1
  fi
}

Does this look OK? I am not at home where I have an Antergos installed in  VirtualBox, so I can't test it.

Offline

#12 2016-02-25 18:19:06

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: PKGBUILD review for netdrive-connector

If you need to install desktop files, add desktop-file-utils as a depends and skip the post_install check.

Also, just use:

post_install() {
  update-desktop-database -q
}

post_upgrade() {
  post_install
}

post_remove() {
  post_install
}


(This is the same install script used by many many packages, together/merged with update-mime-database or gtk-update-icon-cache.)

Last edited by eschwartz (2016-02-25 18:21:38)


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#13 2016-02-25 18:26:36

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

Re: PKGBUILD review for netdrive-connector

Installing the license should be done in the package function.
Again, that license entry is wrong. Please read the link we gave you.
Hopefully that install scriptlet won't be needed in the near future. Unfortunately it is for now, though.

Offline

#14 2016-02-25 19:15:28

ethoms
Member
Registered: 2013-10-08
Posts: 11

Re: PKGBUILD review for netdrive-connector

Thanks again, here's my latest PKGBUILD:

# Maintainer: Euan Thoms <euan@potensol.com>
pkgname=netdrive-connector
pkgver=1.3.2
pkgrel=1
pkgdesc="Utility to setup mountable SFTP and WebDAV connections on Linux/UNIX systems."
arch=('any')
url="https://github.com/ethoms/netdrive-connector"
license=('BSD')
depends=('python2-pyqt4'
         'openssh'
         'openssh-askpass'
         'sshfs'
         'davfs2'
         'expect')
makedepends=('python2-setuptools')
source=("https://pypi.python.org/packages/source/n/$pkgname/$pkgname-$pkgver.tar.gz")
sha256sums=('8d0ae5d77d27cd8b7613fb2ef2410a26f49c8e5ab4d4c8fb32d7c63a14b8848b')
package() {
  cd "$srcdir/$pkgname-$pkgver"
  python2 setup.py install --root="$pkgdir/" --optimize=1
  install -D -m644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
install=$pkgname.install

And I changed my $pkgname.install to match  Eshwartzs' suggestion.

Do I need a shebang in the .install script? The documentation doesn't suggest one either way, but my SlackBuilds usually have a shebang.

Offline

#15 2016-02-25 19:16:40

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: PKGBUILD review for netdrive-connector

No shebang -- pacman invokes bash to run the install scriptlet anyway.


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#16 2016-02-25 19:19:25

ethoms
Member
Registered: 2013-10-08
Posts: 11

Re: PKGBUILD review for netdrive-connector

OK, thanks. I'll test it when I get home. So assuming it still builds OK, is it ready to submit to AUR?

Offline

#17 2016-02-25 20:10:22

michis
Member
Registered: 2015-12-12
Posts: 77

Re: PKGBUILD review for netdrive-connector

Only things I see are 'cosmetics' wink

Eschwartz wrote:

Couple additional style nits:

1) Why is each depends on its own line?

It's irritating to see install=$pkgname.install as last line. Usually it's somewhere among the other variables above the functions.

Maybe an empty line to separate the function from the variables optically?

Last edited by michis (2016-02-25 20:11:38)

Offline

#18 2016-03-04 22:25:48

ethoms
Member
Registered: 2013-10-08
Posts: 11

Re: PKGBUILD review for netdrive-connector

Cheers guys, it's now in the AUR. If any of you would like to help make it less "unofficial" and "untested" it would be appreciated. I think netdrive-connector is a great way for many less experienced users to more easily discover the excellence of more open standards based remote filesystems like SFTP and WebDAV.

Thanks again for your great help, Archers are awesome!

Although I am a devout Slacker, I really like Arch. PKGBUILD's seem like the best packaging mechanism, even better than the already awesome SlackBuilds. I even like the way the AUR uses git for submission, it's shear class!

Offline

Board footer

Powered by FluxBB