You are not logged in.

#1 2020-05-12 19:23:11

inversechi
Member
From: Berlin
Registered: 2018-03-29
Posts: 11

PKGBUILD review request: arm-bin

I'm wanting to create a package for a CLI tool that is installed as "arm".

Questions

- Should it be called arm-bin or arm-cli-bin? I was tempted by arm-bin since it best describes what it provides but it feels too short? Opinions?
- How to provide keywords? Is there a field for keywords in the PKGBUILD? I couldn't see anything


Any other feedback would be appreciated

# Maintainer: Malachi Soord <me@malachisoord.com>

pkgname=arm-bin
pkgver=1.0.0
pkgrel=1
pkgdesc="Armory CLI or better know as arm cli is a tool that let you render dinghyfiles offline."
provides('arm')
arch=('x86_64')
url="https://github.com/armory-io/arm"
license=('Apache')
source=("https://github.com/armory-io/arm/releases/download/$pkgver/arm-$pkgver-linux-amd64.zip")
sha512sums=('d92e3ce5a5ad603b69d5defe3e823408ef177ce920c0b899f17e70b1634cddfb1b10200932f5f54efacb291c5558f43abf466be1489dcf2de58314d313e800ee')

package() {
    install -Dm0755 ${srcdir}/arm-$pkgver-linux-amd64 "$pkgdir/usr/local/bin/arm"
}

Offline

#2 2020-05-12 19:55:41

loqs
Member
Registered: 2014-03-06
Posts: 10,586

Re: PKGBUILD review request: arm-bin

provides('arm')

Invalid syntax.  Also have you considered using conflicts as well as provides?

install -Dm0755 ${srcdir}/arm-$pkgver-linux-amd64 "$pkgdir/usr/local/bin/arm"

/usr/local should not be used by packages.  Unquoted use of $srcdir will break if $srcdir contains a space.  In this case $srcdir can be dropped as package() will start with the working directory $srcdir.
The binary depends on glibc for libpthread.so.0.
Are you going to do an none -bin version of the PKGBUILD as well?

Last edited by loqs (2020-05-12 19:56:27)

Offline

#3 2020-05-12 20:11:44

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

Re: PKGBUILD review request: arm-bin

Why would it conflict with or provide a non-existent package?  Unless your intent with this is to create a virtual package with that name ... but why? If you don't expect to create other implementations of it, do not create the virtual package.

In other words, don't conflict or provide just for the fun of it.  Neither one are applicable here.

Is this difficult to build?  It appeared to build successfully on my rather modest hardware in a couple seconds.  Why do you want to package the precompiled binary?


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

Online

#4 2020-05-12 20:12:59

inversechi
Member
From: Berlin
Registered: 2018-03-29
Posts: 11

Re: PKGBUILD review request: arm-bin

Thanks for the feedback


loqs wrote:
provides('arm')

Invalid syntax.  Also have you considered using conflicts as well as provides?

I will drop this.

loqs wrote:
install -Dm0755 ${srcdir}/arm-$pkgver-linux-amd64 "$pkgdir/usr/local/bin/arm"

/usr/local should not be used by packages.  Unquoted use of $srcdir will break if $srcdir contains a space.  In this case $srcdir can be dropped as package() will start with the working directory $srcdir.

Where should I install this binary then Their readme states

> You can add the tool to your path by doing ln -sf $PWD/arm /usr/local/bin/arm


loqs wrote:

The binary depends on glibc for libpthread.so.0.

Noted - I'l add it

loqs wrote:

Are you going to do an none -bin version of the PKGBUILD as well?

I wasn't going to right away but someone might want to build it from src - I guess that would be called arm-git though.

Offline

#5 2020-05-12 20:15:01

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

Re: PKGBUILD review request: arm-bin

You install binaries to /usr/bin/

inversechi wrote:

I wasn't going to right away but someone might want to build it from src - I guess that would be called arm-git though.

No, it would only be called arm-git if it built from the git HEAD rather than a tagged release.  But again, why not build from source?  That's preferrable - if not expected - if there isn't a good reason to distribute the precompiled binary which I see absolutely no reason for here.


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

Online

#6 2020-05-12 20:24:36

loqs
Member
Registered: 2014-03-06
Posts: 10,586

Re: PKGBUILD review request: arm-bin

Trilby did you use the Makefile or build.sh or call go build directly?
Edit:

# Maintainer: Malachi Soord <me@malachisoord.com>

pkgname=arm
pkgver=1.0.0
pkgrel=1
pkgdesc="Armory CLI is a tool that let you render dinghyfiles offline."
arch=('x86_64')
url="https://github.com/armory-io/arm"
license=('Apache')
source=("$pkgname-$pkgver.tar.gz::https://github.com/armory-io/$pkgname/archive/$pkgver.tar.gz")
sha512sums=('d4c5994b0b5d5f6b71878dfcb41da5179899000837265f7cd4f30a95009f178545e98d948899354fce03ce4fc23d995ef12c979e427500c1c236d286b685aa3d')
makedepends=('go-pie')
depends=('glibc')

build() {
    cd $pkgname-$pkgver
    go build \
        -trimpath \
        -ldflags "-X github.com/armory-io/arm/cmd.enableVersionCheck=offbydefault -X github.com/armory-io/arm/cmd.currentVersion=$PKGVER -extldflags ${LDFLAGS}" \
        -o $pkgname .
}

package() {
    cd $pkgname-$pkgver
    install -Dm0755 $pkgname "$pkgdir/usr/bin/$pkgname"
}

Last edited by loqs (2020-05-12 20:44:45)

Offline

#7 2020-05-12 21:09:39

eschwartz
Trusted User/Bug Wrangler
Registered: 2014-08-08
Posts: 3,309

Re: PKGBUILD review request: arm-bin

loqs wrote:

The binary depends on glibc for libpthread.so.0.

It depends on glibc for libc.so.6, practically *everything* depends on "have a libc, somehow", and even static binaries depend on having an operating system in which case you, uh, most likely still have glibc installed because we're bac to practically everything depends on a libc.


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

Offline

#8 2020-05-12 21:25:02

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

Re: PKGBUILD review request: arm-bin

loqs wrote:

Trilby did you use the Makefile or build.sh or call go build directly?

I used the makefile and called "make linux".  The lint target failed, due to missing golint which I don't see provided by a package in the repos - but that shouldn't matter.  It produced the binary.  That said, the build target is just a single call to go anyways, so there's no harm in doing that directly.


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

Online

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

inversechi
Member
From: Berlin
Registered: 2018-03-29
Posts: 11

Re: PKGBUILD review request: arm-bin

Trilby wrote:
loqs wrote:

Trilby did you use the Makefile or build.sh or call go build directly?

I used the makefile and called "make linux".  The lint target failed, due to missing golint which I don't see provided by a package in the repos - but that shouldn't matter.  It produced the binary.  That said, the build target is just a single call to go anyways, so there's no harm in doing that directly.

Thanks for the feedback. Building using this make file requires pulling docker and go-pie as build dependencies. Which I guess is alright.

One thing I'm suck with is I get this warning

==> WARNING: Package contains reference to $srcdir
usr/bin/arm

Which fround my understanding the binary is some how referencing the srcdir. Any ideas?

# Maintainer: Malachi Soord <me@malachisoord.com>

pkgname=arm
pkgver=1.0.0
pkgrel=1
pkgdesc="Armory CLI or better know as arm cli is a tool that let you render dinghyfiles offline."
arch=('x86_64')
url="https://github.com/armory-io/arm"
license=('Apache')
depends=('glibc')
makedepends=('go-pie' 'docker')
source=("https://github.com/armory-io/arm/archive/$pkgver.zip")
sha512sums=('f611dc0561d9eb586843e791d219f25ec8c80f5651e14ce1367a1f757d9e46fa0ce31cbf8e0e314e0747ae04e2dfeaaca186f64a5dc23529ba9e0b4124ef4c02')

build() {
    cd $pkgname-$pkgver
    make linux
}

package() {
    cd $pkgname-$pkgver
    install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
    install -Dm755 build/arm-0.0.1-linux-amd64 "$pkgdir/usr/bin/$pkgname"
}

Last edited by inversechi (2020-05-13 19:56:06)

Offline

#10 2020-05-13 19:56:02

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

Re: PKGBUILD review request: arm-bin

go-pie and docker are not required.  Those are only used in the Makefile for setting variables that are not relevant for the build.  I had previously used the Makefile before really looking at it just to confirm it works - but in this case only one line of the Makefile is actually relevant.  I thought you were going with calling go directly (as in post #6) which is probably the best idea here.

As for the warning, it is technically harmless, but if you want to get rid of it you could use the -trimpath flag for 'go build':

build() {
    cd $pkgname-$pkgver
    go build -o $pkgname -trimpath main.go
}

package() {
    cd $pkgname-$pkgver
    install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
    install -Dm755 $pkgname "$pkgdir/usr/bin/$pkgname"
}

Last edited by Trilby (2020-05-13 20:02:20)


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

Online

#11 2020-05-14 14:16:57

eschwartz
Trusted User/Bug Wrangler
Registered: 2014-08-08
Posts: 3,309

Re: PKGBUILD review request: arm-bin

trimpath, among other things, is discussed here: https://wiki.archlinux.org/index.php/Us … guidelines

This will, likely soon, become the next version of the official go packaging guidelines. The go-pie package is proposed to be removed in favor of -buildmode=pie.


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

Offline

#12 2020-05-14 18:49:57

inversechi
Member
From: Berlin
Registered: 2018-03-29
Posts: 11

Re: PKGBUILD review request: arm-bin

Thanks everyone for all your help!

Offline

Board footer

Powered by FluxBB