You are not logged in.

#1 2020-01-19 12:29:13

pseudoroot
Member
Registered: 2019-11-19
Posts: 3

PKGBUILD review request

Hi all,

I am writing a PKGBUILD for a little wrapper program I wrote. I'd be grateful if someone could review this.
The file builds and installs fine on my system.

# Maintainer: pseudoroot <pseudoroot@protonmail.ch>
pkgname='yt-audio'
pkgver=0.1
pkgrel=1
pkgdesc="youtube-dl wrapper for downloading/managing youtube audio (with added features)."
arch=('any')
url="https://github.com/pseudoroot/yt-audio"
license=('MIT')
depends=('youtube-dl' 'ffmpeg')
makedepends=('python-setuptools')

source=("$url/releases/download/v$pkgver/$pkgname-$pkgver.tar.gz")
md5sums=('13a2535b49555c89a9bab71da5502334')

build() {
	cd "$pkgname-$pkgver"
	python setup.py build
}

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

	# Install MIT licence
	install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

Thank you smile


Another question -

I have a configuration file for this program. The program by default looks for config file in $XDG_CONFIG_HOME/yt-audio/ directory.
If $XDG_CONFIG_HOME is not set, then $HOME/.config/yt-audio is used.

From my findings, there is no direct way provided by pip to copy config files. So users will have to copy the config file manually (or is there a way that I am missing?)

Would it be fine (or rather ethical) to copy config file when installing program using PKGBUILD?
I played around with PKGBUILD a bit (implementing the same)(code below). It worked fine, but as mentioned here - Packages should not contain '/home' directory.
(I got a directory permission warning as well when installing the program).

So should I copy the config file during installation? And if its fine, how can I achieve the same?

Here is what I wrote in package() function of PKGBUILD to copy config file

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

	# Install MIT licence
	install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
        
        # Copy config file
	if [ -z $XDG_CONFIG_HOME ]
	then
		_DIR=$(echo $HOME | cut -c2-)
		mkdir -p $pkgdir/$_DIR/.config/yt-audio
		cp config.ini $pkgdir/$_DIR/.config/yt-audio
	else
		_DIR=$(echo $XDG_CONFIG_HOME | cut -c2-)
		mkdir -p $pkgdir/$_DIR/.config/yt-audio
		cp config.ini $pkgdir/$_DIR/.config/yt-audio
	fi
}

This worked fine and config file was copied to appropriate directory (I did, however, got a permission mis-match warning for /home/<user> directory).

Thanks

Offline

#2 2020-01-19 13:06:47

a821
Member
From: My Location
Registered: 2012-10-31
Posts: 159

Re: PKGBUILD review request

pseudoroot wrote:

Hi all,

I am writing a PKGBUILD for a little wrapper program I wrote. I'd be grateful if someone could review this.

It looks good to me and builds in a clean chroot.


Using the PKGBUILD to install config files in a user's home directory is a no-no if you plan to submit to the AUR. You may leave instructions for the users to copy the configuration to their homes in a `.install` file. Alternatively, since you're upstream, you could modify your program so it copies its config on the first run (or tell users to do so). 

For personal use you can do whatever you want with the PKGBUILD.

Offline

#3 2020-01-19 13:47:05

pseudoroot
Member
Registered: 2019-11-19
Posts: 3

Re: PKGBUILD review request

a821 wrote:

Using the PKGBUILD to install config files in a user's home directory is a no-no if you plan to submit to the AUR. You may leave instructions for the users to copy the configuration to their homes in a `.install` file. Alternatively, since you're upstream, you could modify your program so it copies its config on the first run (or tell users to do so).

Thanks. I'll look into adding .install file for config instructions.

Offline

Board footer

Powered by FluxBB