You are not logged in.

#1 2020-05-16 17:22:54

sshumate
Member
Registered: 2017-06-06
Posts: 4

PKGBUILD review request: hid-sony-ds3usb-dkms

This is my first attempt to submit a PKGBUILD to the AUR so I wanted to post it for review just in case.  It's based off of a few other DKMS PKGBUILDs already in the AUR.  I notified upstream of the problem and gave them the patch.

# Maintainer: Scott Shumate <scott(at)shumatech(dot)com>

_pkgbase='hid-sony-ds3usb'
pkgname=${_pkgbase}-dkms
pkgver=5.6.12
pkgrel=1
pkgdesc="The hid_sony kernel module with a patch to fix buttons on Sony DualShock 3 USB adapters"
_srctag=v${pkgver}-arch1
url='https://www.spinics.net/lists/linux-input/msg67472.html'
license=('GPL2')
arch=('x86_64')
depends=('dkms')
optdepends=('linux-headers: Build the module against Arch kernel'
            'linux-lts-headers: Build the module against LTS Arch kernel')
source=("hid-sony.c::https://git.archlinux.org/linux.git/plain/drivers/hid/hid-sony.c?h=${_srctag}"
        "hid-ids.h::https://git.archlinux.org/linux.git/plain/drivers/hid/hid-ids.h?h=${_srctag}"
        "Makefile"
        "hid-sony-ds3usb.patch"
        "hid-sony-ds3usb-dkms.dkms"
        "hid-sony-blacklist.modprobe")
sha256sums=('509b6d7d4fc33fdaa4efd971de93965e6864f50dc6fb8aa89ae67a36f75fc845'
            '162932261317e712cc344f5947af96c0bdff33adacade895e2e694df87330121'
            '96cab0ae36a9d7a8ab01aa7d5a20890981f7f5836328b1d35eaf54ec6bb6b208'
            '089fbfb629f77cbe71bf424ce79e59dd3c851ca90404935d5983608f26eede12'
            '04a25acef8059630188ebbf398115c87bf27f97a8e37ce9a10d1d30387800610'
            'f4ab0b6941e353e861007a0bb6c468b4a7d027c56d530056fa686ad837616635')

prepare(){
    local workdir="${srcdir}/workdir"
    mkdir -p "${workdir}"
    cp "${srcdir}/hid-sony.c" "${workdir}"
    patch -d "${workdir}" -Np3 -i "${srcdir}/hid-sony-ds3usb.patch"
}

package() {
    local dest="${pkgdir}/usr/src/${_pkgbase}-${pkgver}"
    install -d "${dest}"
    install -m 644 -T "${srcdir}/workdir/hid-sony.c" "${dest}/${_pkgbase}.c"
    install -m 644 -T "${srcdir}/hid-ids.h" "${dest}/hid-ids.h"
    install -m 644 -T "${srcdir}/Makefile" "${dest}/Makefile"
    install -m 644 -T "${srcdir}/hid-sony-ds3usb-dkms.dkms" "${dest}/dkms.conf"

    sed -e "s/@_PKGBASE@/${_pkgbase}/" \
        -e "s/@PKGVER@/${pkgver}/" \
        -i "${pkgdir}/usr/src/${_pkgbase}-${pkgver}/dkms.conf"

    # Blacklist the original hid_sony module
    install -dm755 "${pkgdir}/etc/modprobe.d"
    install -Dm644 "${srcdir}/hid-sony-blacklist.modprobe" "${pkgdir}/etc/modprobe.d/hid-sony-blacklist.conf"
}

Offline

#2 2020-05-16 19:36:23

loqs
Member
Registered: 2014-03-06
Posts: 17,198

Re: PKGBUILD review request: hid-sony-ds3usb-dkms

This package would be short term until the patch or an alternative solution is merged upstream?

optdepends=('linux-headers: Build the module against Arch kernel'
            'linux-lts-headers: Build the module against LTS Arch kernel')

The dkms package already lists the headers for the four official kernsl as optdepends.

source=("hid-sony.c::https://git.archlinux.org/linux.git/plain/drivers/hid/hid-sony.c?h=${_srctag}"
        "hid-ids.h::https://git.archlinux.org/linux.git/plain/drivers/hid/hid-ids.h?h=${_srctag}"
        "Makefile"
        "hid-sony-ds3usb.patch"
        "hid-sony-ds3usb-dkms.dkms"
        "hid-sony-blacklist.modprobe")

As an alternative to referencing the arch web2git you could use a kernel tarball or git obviously with a much bigger download or host just the patched module on a code hosting service.
The locally referenced files are not included so I can not comment on them or build the package.

prepare(){
    local workdir="${srcdir}/workdir"
    mkdir -p "${workdir}"
    cp "${srcdir}/hid-sony.c" "${workdir}"
    patch -d "${workdir}" -Np3 -i "${srcdir}/hid-sony-ds3usb.patch"
}

$workdir is just used to patch hid-sony.c why not perform that in $srcdir and reduce the function to one line?

Could the modprobe blacklist be skipped if the module is installed in the updates directory?

Last edited by loqs (2020-05-16 20:46:52)

Offline

#3 2020-05-17 02:11:52

sshumate
Member
Registered: 2017-06-06
Posts: 4

Re: PKGBUILD review request: hid-sony-ds3usb-dkms

Thanks for the feedback.

This package would be short term until the patch or an alternative solution is merged upstream?

Yes, this is a short term patch (hopefully).

The dkms package already lists the headers for the four official kernsl as optdepends.

Noted.  I'll remove the redundant optdepends.

As an alternative to referencing the arch web2git you could use a kernel tarball or git obviously with a much bigger download or host just the patched module on a code hosting service.
The locally referenced files are not included so I can not comment on them or build the package.

I went with the web2git route to make it easy to update the kernel version without having to maintain a separate repo.  I was also concerned about a giant download if I pulled in the full kernel source.  Is there a downside to doing it this way?

$workdir is just used to patch hid-sony.c why not perform that in $srcdir and reduce the function to one line?

The main reason I did it that way is that when I patched the hid-sony.c in $srcdir, patch complains since it's a soft link back to the source.  When I tried to patch the source, then makepkg complained that the source checksum failed on subsequent runs.

Could the modprobe blacklist be skipped if the module is installed in the updates directory?

I can't figure out a way to do an update install with DKMS.  It seems DKMS is designed for installing new drivers and not patching existing ones.  In the course of looking at this, should the blacklist go in /usr/lib/modprobe.d instead of /etc/modprobe.d?

Offline

#4 2020-05-17 10:59:00

loqs
Member
Registered: 2014-03-06
Posts: 17,198

Re: PKGBUILD review request: hid-sony-ds3usb-dkms

sshumate wrote:

$workdir is just used to patch hid-sony.c why not perform that in $srcdir and reduce the function to one line?

The main reason I did it that way is that when I patched the hid-sony.c in $srcdir, patch complains since it's a soft link back to the source.  When I tried to patch the source, then makepkg complained that the source checksum failed on subsequent runs.

Thank you for the explanation.  As an alternative you could add hid-sony-ds3usb.patch to the PATCH array of hid-sony-ds3usb-dkms.dkms and have dkms apply the patch. (would need to be changed to -p1 format)
See https://git.archlinux.org/svntogit/comm … om-wl-dkms as an example.

sshumate wrote:

Could the modprobe blacklist be skipped if the module is installed in the updates directory?

I can't figure out a way to do an update install with DKMS.  It seems DKMS is designed for installing new drivers and not patching existing ones.  In the course of looking at this, should the blacklist go in /usr/lib/modprobe.d instead of /etc/modprobe.d?

Yes it should go in  /usr/lib/modprobe.d as the conf is supplied by the package not the user.

Offline

Board footer

Powered by FluxBB