You are not logged in.

#1 2017-06-02 17:51:34

dpriedel
Member
Registered: 2010-12-16
Posts: 19

PKGBUILD review request

Hi

This is my first attempt at an AUR package.  The package I am submitting converts a .deb file to a pacman package.  The package is needed to activate the touchpad on the new Alpha Litebook after installed Arch based distribution.

Thanks in advance for your help.

Dave Riedel


There are 2 files.

PKGBUILD

#!/bin/sh

# Maintainer: David P. Riedel <driedel@cox.net>
# Upstream URL: [url]https://github.com/Alpha-Universal/litebook-psmouse-enable[/url]

pkgname="litebook-psmouse-enable"
pkgver="1.0"
pkgrel="1"
pkgdesc="Converson of debian package to pacman package"
arch=('any')
url="https://github.com/Alpha-Universal/litebook-psmouse-enable"
license=('GPL3')
provides=('psmouse')
install="${pkgname}.install"
source=("https://github.com/Alpha-Universal/${pkgname}/raw/master/${pkgname}_${pkgver}-${pkgrel}_all.deb")
md5sums=('769811f21dfccf354fe6e9b7c02ef19f')


package() {

	# start by putting our data files in place

	bsdtar xf data.tar.xz

	mv usr "${pkgdir}"
	mv lib "${pkgdir}/usr"
	mv etc "${pkgdir}"
}

.install

#!/bin/sh

# these functions come from the corresponding scipts in the .deb file

pre_upgrade()
{

    /usr/bin/systemctl stop litebook-psmouse-enable.service >/dev/null
}

pre_remove()
{

    /usr/bin/systemctl stop litebook-psmouse-enable.service >/dev/null
}

post_install()
{
    /usr/bin/systemctl unmask litebook-psmouse-enable.service >/dev/null || true

    # is-enabled defaults to true, so new installations run enable.
    if /usr/bin/systemctl --quiet is-enabled litebook-psmouse-enable.service; then
        # Enables the unit on first installation, creates new
        # symlinks on upgrades if the unit file has changed.
        /usr/bin/systemctl enable litebook-psmouse-enable.service >/dev/null || true
    else
        # Update the statefile to add new symlinks (if any), which need to be
        # cleaned up on purge. Also remove old symlinks.
        /usr/bin/systemctl enable litebook-psmouse-enable.service >/dev/null || true
    fi

    /usr/bin/systemctl --system daemon-reload >/dev/null || true
    /usr/bin/systemctl start litebook-psmouse-enable.service >/dev/null || true
}

post_upgrade()
{

    # This will only remove masks created by d-s-h on package removal.
    /usr/bin/systemctl unmask litebook-psmouse-enable.service >/dev/null || true

    # is-enabled defaults to true, so new installations run enable.
    if /usr/bin/systemctl --quiet is-enabled litebook-psmouse-enable.service; then
        # Enables the unit on first installation, creates new
        # symlinks on upgrades if the unit file has changed.
        /usr/bin/systemctl enable litebook-psmouse-enable.service >/dev/null || true
    else
        # Update the statefile to add new symlinks (if any), which need to be
        # cleaned up on purge. Also remove old symlinks.
        /usr/bin/systemctl enable litebook-psmouse-enable.service >/dev/null || true
    fi

    /usr/bin/systemctl --system daemon-reload >/dev/null || true
    /usr/bin/systemctl start litebook-psmouse-enable.service >/dev/null || true

}

Last edited by dpriedel (2017-06-02 20:51:53)

Offline

#2 2017-06-02 18:09:13

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

Re: PKGBUILD review request

1) Do not derive the source files from the git master, you should use a specific commit.
2) it appears that the deb file merely rebundles the files that are otherwise included directly in that repo. It would be ideal if the owner of that repo would add a Makefile or something, either way please don't use the deb file smile and just copy the relevant files where they are needed.
3) Arch policy is to NOT do complicated fiddling with systemd units in install scripts, mostly because users don't generally want services autostarted for them. This is specifically against the Debian style guide, where Debian users are expected to want services autostarted for them.

4) It looks like the actual functionality of that entire package is to add a modprobe.d file directing the psmouse module to start with the "proto=imps" option, plus a script installed in a nonstandard location to automatically modprobe it by hand automatically via a service. Honestly, if I wanted to do such a thing, I would do it all directly in the service file rather than in a two-line shellscript which is then called by the service file... but modprobe is intelligent enough to handle this automatically and the only thing you need is the modprobe.d file.

Honestly, this looks like something better suited to a wiki page somewhere.


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

Offline

#3 2017-06-02 19:50:31

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,425

Re: PKGBUILD review request

Please wrap output like that in [ code ] tags

Offline

#4 2017-06-02 21:05:28

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

Re: PKGBUILD review request

I agree with the above - this should not be a package.  There is one very short line of a config file, that's all it is.  Then there are dozens of lines of other stuff wrapped around that, and now dozens of lines of PKGBUILD and .install file around *that*.  Just add the original one short line to your modeprobe.d folder.

But for future reference, this is not a pkgdesc:

pkgdesc="Converson of debian package to pacman package"

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

Offline

#5 2017-06-02 21:25:01

dpriedel
Member
Registered: 2010-12-16
Posts: 19

Re: PKGBUILD review request

The source repository has only the one master branch and there are no tags.  Since the .deb is named with a version/release number it seems that should work.  I have looked at several other packages in the AUR and it seems common practice to use an archive file of some type (tar.gz or .deb) as the source.  atom-editor-bin for example uses a .deb file and extracts the contents in its PKGBUILD.

As for doing the systemd setup in the package, the touchpad on the Litebook is totally non-functional without this package so enabling it as part of the install script provides immediate feedback that it worked.  As was pointed out, this is a philosophical difference between debian and Arch.  I would point out that there are a number of Arch derivatives, such as Manjaro, whose users also rely on the AUR which might lean a little more towards the debian way in this instance.

My goal with this package is to provide a simple yet complete solution to installing this necessary software.

Last edited by dpriedel (2017-06-02 21:27:10)

Offline

#6 2017-06-02 21:39:59

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

Re: PKGBUILD review request

dpriedel wrote:

The source repository has only the one master branch and there are no tags.  Since the .deb is named with a version/release number it seems that should work.  I have looked at several other packages in the AUR and it seems common practice to use an archive file of some type (tar.gz or .deb) as the source.  atom-editor-bin for example uses a .deb file and extracts the contents in its PKGBUILD.

I am not sure where you derived this conclusion from. atom-editor-bin is a *-bin package which is why it is one of the small minority of packages to use a .deb archive as the source. Most packages have many source files which is of course why they are distributed upstream as archives, typically .zip or .tar.gz and often fromm the GitHub Releases tab... alternatively, you can take any GitHub download link and replace "master" with the sha1 of a commit and download something that won't change when the repository owner pushes a new commit. Including the download link for the entire repository contents!

This is more about "don't use links that can change their contents" than "don't use debian packages as sources", though both are true.

As for doing the systemd setup in the package, the touchpad on the Litebook is totally non-functional without this package so enabling it as part of the install script provides immediate feedback that it worked.  As was pointed out, this is a philosophical difference between debian and Arch.  I would point out that there are a number of Arch derivatives, such as Manjaro, whose users also rely on the AUR which might lean a little more towards the debian way in this instance.

My goal with this package is to provide a simple yet complete solution to installing this necessary software.

That may be. But you are engaged in a tremendous amount of overkill, as a simple yet complete solution would be obtainable merely by installing the modprobe.d file. If you want to see immediately whether it worked, then you can `modprobe --remove psmouse && modprobe psmouse` after installing the modprobe.d configuration file, and modprobe will apply those changes already. You could theoretically put that in the install script, and it would achieve the same effect as that ugly systemd service...

... because there is no need for a service in order to do a one-time action to apply those changes in between the package installation and the next reboot.

Additionally, there is still the question "why must there be a package to install a per-hardware /etc configuration, shouldn't this simply go in the Wiki?"

EDIT: And regarding "I would point out that there are a number of Arch derivatives, such as Manjaro, whose users also rely on the AUR which might lean a little more towards the debian way in this instance."
I would point out that the AUR is run by the Arch Linux project, for the sake of Arch Linux users, and it is forbidden to upload packages to the AUR that are intended solely for by derivative distros. One could extrapolate from there that uploading packages which can be used by Arch users, but are designed for the philosophies of Manjaro, would draw the ire of the people in charge of managing the AUR.

Last edited by eschwartz (2017-06-02 21:45:59)


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

Offline

#7 2017-06-02 22:05:01

dpriedel
Member
Registered: 2010-12-16
Posts: 19

Re: PKGBUILD review request

That may be. But you are engaged in a tremendous amount of overkill, as a simple yet complete solution would be obtainable merely by installing the modprobe.d file. If you want to see immediately whether it worked, then you can `modprobe --remove psmouse && modprobe psmouse` after installing the modprobe.d configuration file, and modprobe will apply those changes already. You could theoretically put that in the install script, and it would achieve the same effect as that ugly systemd service...

Thank you for these suggestions.

I would point out that the AUR is run by the Arch Linux project, for the sake of Arch Linux users, and it is forbidden to upload packages to the AUR that are intended solely for by derivative distros. One could extrapolate from there that uploading packages which can be used by Arch users, but are designed for the philosophies of Manjaro, would draw the ire of the people in charge of managing the AUR.

fair point...

Thanks for your input.

Offline

Board footer

Powered by FluxBB