You are not logged in.

#1 2022-07-24 06:24:04

frankencode
Member
From: Munich
Registered: 2022-07-24
Posts: 12

PKGBUILD review request: owlux

This is my second Arch package. Owlux is a small app to control the yeelights in your home. It is built on top of corecomponents. Hopefully I got the dependencies right...

Here's the PKGBUILD:

# Maintainer: Frank Mertens <frank at cyblogic dot de>

pkgbase=owlux
pkgname=(
    'owlux'
    'owlux_tools'
)
pkgver=1.0.0
pkgrel=1
pkgdesc="Yeelight smart LED control app"
url="https://github.com/frankencode/Owlux"
arch=('x86_64')
license=('GPL3')
source=(
    "https://github.com/frankencode/Owlux/archive/refs/tags/v${pkgver}.zip"
)
md5sums=(
    'ff42b9a808f1992769a2d9447685c3a7'
)
sha1sums=(
    'd56ef8ea3d9433df001aecbdd60872d62c98045b'
)

makedepends=(
    'corecomponents_tools'
)

build() {
    rm -rf Owlux
    ln -s Owlux-$pkgver Owlux
    rm -rf build
    mkdir -p build
    cd build
    ccbuild -prefix=/usr -release -test ../Owlux
}

package_owlux() {
    pkgdesc="$pkgdesc: protocol library"
    depends=(
        'corecomponents_core'
        'corecomponents_crypto'
        'corecomponents_glob'
        'corecomponents_meta'
        'corecomponents_network'
    )
    cd build
    ccbuild -prefix=/usr -root=$pkgdir -install -release -test ../Owlux/src
}

package_owlux_tools() {
    pkgdesc="$pkgdesc: gui app and tools"
    depends=('owlux' 'corecomponents_ux')
    cd build
    ccbuild -prefix=/usr -root=$pkgdir -install -release -test ../Owlux/tools
}

Any tips are welcome! THX in advance.

Offline

#2 2022-07-24 08:52:07

willemw
Member
Registered: 2013-02-19
Posts: 116

Re: PKGBUILD review request: owlux

The source zip filename should include $basename to make it unique (SRCDEST can be the same for all packages).

Offline

#3 2022-07-24 08:54:33

Scimmia
Fellow
Registered: 2012-09-01
Posts: 12,199

Re: PKGBUILD review request: owlux

None of those deps/makedeps exist.

Edit: ok, missed your other thread. Sorry

Both things mentioned in the other thread apply here as well. All of the deleting/symlinking/etc should be done away with and you need to quote paths you don't control.

Do corecomponents_crypto and the other not need to be installed at build time? That's how it's written.

Last edited by Scimmia (2022-07-24 09:01:24)

Offline

#4 2022-07-24 10:01:02

willemw
Member
Registered: 2013-02-19
Posts: 116

Re: PKGBUILD review request: owlux

The source zip filename should include $pkgname. $basename is also not unique enough.

Offline

#5 2022-07-24 14:51:24

frankencode
Member
From: Munich
Registered: 2022-07-24
Posts: 12

Re: PKGBUILD review request: owlux

@Scimmia: Yes, you have eagle eyes! I was missing a few things in makedeps. I also quoted the $pkgdir, etc.

@willemw: Why does it matter what name the source zip file has? The name is just what github generates for me from a version tag. I'm a bit lazy here...
(Hopefully that file is not used anywhere else;-)

Cleaned up PKGBUID:

# Maintainer: Frank Mertens <frank at cyblogic dot de>

pkgbase=owlux
pkgname=(
    'owlux'
    'owlux_tools'
)
pkgver=1.0.0
pkgrel=1
pkgdesc="Yeelight smart LED control app"
url="https://github.com/frankencode/Owlux"
arch=('x86_64')
license=('GPL3')
source=(
    "https://github.com/frankencode/Owlux/archive/refs/tags/v${pkgver}.zip"
)
md5sums=(
    'ff42b9a808f1992769a2d9447685c3a7'
)
sha1sums=(
    'd56ef8ea3d9433df001aecbdd60872d62c98045b'
)

makedepends=(
    'corecomponents_tools'
    'corecomponents_core'
    'corecomponents_crypto'
    'corecomponents_glob'
    'corecomponents_meta'
    'corecomponents_network'
    'corecomponents_ux'
)

build() {
    rm -rf Owlux
    ln -s Owlux-$pkgver Owlux
    mkdir -p build
    cd build
    ccbuild -prefix=/usr -release -test ../Owlux
}

package_owlux() {
    pkgdesc="$pkgdesc: protocol library"
    depends=(
        'corecomponents_core'
        'corecomponents_crypto'
        'corecomponents_glob'
        'corecomponents_meta'
        'corecomponents_network'
    )
    cd build
    ccbuild -prefix=/usr -root="$pkgdir" -install -release -test ../Owlux/src
}

package_owlux_tools() {
    pkgdesc="$pkgdesc: gui app and tools"
    depends=('owlux' 'corecomponents_ux')
    cd build
    ccbuild -prefix=/usr -root="$pkgdir" -install -release -test ../Owlux/tools
}

Offline

#6 2022-07-25 06:58:53

willemw
Member
Registered: 2013-02-19
Posts: 116

Re: PKGBUILD review request: owlux

James wrote:

Why does it matter what name the source zip file has? The name is just what github generates for me from a version tag.

That name is now v1.0.0.zip. That can conflict with other packages. See 'Warning' in https://wiki.archlinux.org/title/PKGBUILD#source.

Offline

#7 2022-07-25 16:50:07

frankencode
Member
From: Munich
Registered: 2022-07-24
Posts: 12

Re: PKGBUILD review request: owlux

@willemw: Thanks for pointing out how to handle zips originating from version tags correctly! (And yes, I should have RTFM!-)

Offline

#8 2022-07-25 17:15:40

willemw
Member
Registered: 2013-02-19
Posts: 116

Re: PKGBUILD review request: owlux

@frankencode: to be fair, I did not refer to the Wiki in my original comment about 'source='. But after that, I felt there was really no option left not to mention it.  smile

Offline

#9 2022-07-29 12:28:19

willemw
Member
Registered: 2013-02-19
Posts: 116

Re: PKGBUILD review request: owlux

In the owlux packages in the AUR:

Since 'Owlux' in build() is a symlink. '-r' can be removed from the 'rm' line:

rm -f Owlux

In package(), the file mode can be set:

install -Dm644 Owlux/tools/owlux/owlux.desktop -t "$pkgdir/usr/share/applications/"

Offline

#10 2022-07-29 15:41:02

frankencode
Member
From: Munich
Registered: 2022-07-24
Posts: 12

Re: PKGBUILD review request: owlux

@willemw: Thanks again. Force of habit! I remember when I once deleted half of my employer's root partition by confusing BSD tools as GNU tools and accidentally slipping in the "rm -r"...
Fixed that in both AUR packages: corecomponents and owlux. Though only owlux gets a package number increment, because of the file mode change (I think I'm slowly getting a hang of this makepkg;-).

Offline

#11 2022-07-30 07:17:13

willemw
Member
Registered: 2013-02-19
Posts: 116

Re: PKGBUILD review request: owlux

Come to think of it, these lines in build() can be made even shorter (and more optimized and just as safe. We might be approaching Rust territory here).

From

rm -f Owlux
ln -s Owlux-$pkgver Owlux

to

ln -sf Owlux-$pkgver Owlux

Also with other build systems, I see "prefix=/usr" only used once, either in package() or in build().

Last edited by willemw (2022-07-30 13:58:02)

Offline

#12 2022-07-30 11:24:07

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 13,069

Re: PKGBUILD review request: owlux

Also with other compilers, I see "prefix=/usr" only used once, usually in package() and not in build().

many buildsystems cache that value so it's only necessary to set it once, during setup phase ( ./configure , cmake , meson to name a few) .
If there's a build() function that phase should be in that function to ensure all package_*() use the same setup.

That caching can contain leftovers from earlier build attempts and very often mess up things.
(personally I wish such caching was disabled by default.)

Last edited by Lone_Wolf (2022-07-30 11:24:52)


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#13 2022-07-30 12:22:36

frankencode
Member
From: Munich
Registered: 2022-07-24
Posts: 12

Re: PKGBUILD review request: owlux

@Lone_Wolf, willemw: Yes, the way the prefix is passed might look odd. Actually it is redundant, too. The reason is that it will create a '-DCCBUILD_BUILD_PREFIX' in the compile jobs providing the modules at run time a hint where to look for its resources (e.g. /usr/share/my_app vs. /usr/local/share/my_app). If it doesn't find its stuff there it will simply ask the operating system about its current installation path and that will also work, but will be slightly more expensive. Besides that ccbuild does not cache any configuration information and is always performing an automatic reconfiguration each time it is invoked. Furthermore during installation "-prefix" will default to "/usr" if an installation root "-root=<smth>" is passed. So passing the "-prefix" a second time is only done for readability. I'm definitely missing a manual about how ccbuild works, but the golden rule was always to first implement expected behavior before writing manual pages.

Offline

#14 2022-07-30 13:21:49

frankencode
Member
From: Munich
Registered: 2022-07-24
Posts: 12

Re: PKGBUILD review request: owlux

I've also added a "check()" method to the "owlux" packages. See latest version: https://aur.archlinux.org/packages/owlux_tools .  (I feel about odd running developer unit tests everywhere, but why not?!-)

Last edited by frankencode (2022-07-30 13:39:40)

Offline

Board footer

Powered by FluxBB