You are not logged in.

#1 2018-08-18 12:21:16

zapp-brannigan
Member
Registered: 2018-08-18
Posts: 6

My first PKGBUILD

Hey Guys,

i'm going to upload my first pkgbuilds. Would be nice if someone can review them first wink
I have two pkgbuilds for vdo and its kernel-modules (see https://github.com/dm-vdo/vdo and https://access.redhat.com/documentation … uick-start

vdo:

# Maintainer: zapp-brannigan (fuerst.reinje@web.de)

pkgname=vdo
pkgrel=1
pkgver=6.2.0.197
pkgdesc='Userspace tools for managing VDO volumes'
arch=('x86_64')
url="https://github.com/dm-vdo/vdo"
license=('GPL2')
depends=('kvdo' 'python' 'device-mapper')
source=("$pkgname-$pkgver.tar.gz::https://github.com/dm-vdo/vdo/archive/$pkgver.tar.gz")
sha256sums=('2ca31bfbf5aa960395a9b5b2e56745e6387b4934adfb8d2f06a525564d835a70')

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

package() {
  cd "$pkgname-$pkgver"
  make DESTDIR="$pkgdir" \
       unitdir=/usr/lib/systemd/system \
       presetdir=/usr/lib/systemd/system-preset \
       mandir=/usr/share/man \
       install
}

and the kernel-modules:

# Maintainer: zapp-brannigan (fuerst.reinje@web.de)

_pkgname=kvdo
pkgname=kvdo-dkms
pkgrel=1
pkgver=6.2.0.197
pkgdesc='A pair of kernel modules which provide pools of deduplicated and/or compressed block storage'
arch=('x86_64')
url="https://github.com/dm-vdo/kvdo"
license=('GPL2')
provides=('kvdo')
source=("$_pkgname-$pkgver.tar.gz::https://github.com/dm-vdo/kvdo/archive/$pkgver.tar.gz"
        "dkms.conf")
sha256sums=('a477561b695ab52450be3fe56799334377be75a07c47e4aac7dcb7f29b8303c5'
            '516f60bdb28f7a0cb6c8f1f84c656ee7c6aec8feb393538f227ed515372ac88a')

package() {
  mkdir -p "$pkgdir"/usr/src
  cp -r "$_pkgname-$pkgver" "$pkgdir"/usr/src/"$_pkgname-$pkgver"
  sed -e "s/@PKGVER@/${pkgver}/" dkms.conf > "$pkgdir"/usr/src/"$_pkgname-$pkgver"/dkms.conf
}

this is my dkms.conf:

PACKAGE_NAME="kvdodrv"
PACKAGE_VERSION=@PKGVER@
AUTOINSTALL=yes

BUILT_MODULE_NAME[0]="kvdo"
BUILT_MODULE_LOCATION[0]="vdo"
DEST_MODULE_LOCATION[0]="/kernel/misc"

BUILT_MODULE_NAME[1]="uds"
BUILT_MODULE_LOCATION[1]="uds"
DEST_MODULE_LOCATION[1]="/kernel/misc"

I'm not sure about the dependencies, there is nothing mentioned on the github pages. Both packages are compiling and working without errors on my system, so i simply don't know the dependencies.

Edit: updated pkgbuilds

Last edited by zapp-brannigan (2018-08-19 06:44:21)

Offline

#2 2018-08-18 12:35:56

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

Re: My first PKGBUILD

provides=('vdo')

All packages provide themselves

  cp -r lib usr/
  rm -rf lib

Could you not use mv instead?

Offline

#3 2018-08-18 13:09:56

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

Re: My first PKGBUILD

I was also wondering about the cp and rm - mv is an obvious improvement, but are those necessary at all?

I checked the makefile to see if it used PREFIX for this, which it should, but I couldn't even find any references to /lib/ at all.  What get's installed to /lib?

EDIT: ah, I didn't check under "examples" as I figured those were just ... well ... examples.

Last edited by Trilby (2018-08-18 15:29:19)


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

Offline

#4 2018-08-18 14:28:41

zapp-brannigan
Member
Registered: 2018-08-18
Posts: 6

Re: My first PKGBUILD

loqs wrote:

All packages provide themselves

Ok, i will remove that

logs wrote:

Could you not use mv instead?

A simple "mv" won't work because $pkgdir/usr/lib is not empty (there is already a python-module in it).

Trilby wrote:

What get's installed to /lib?

It's just a systemd-unit and a .preset file. Pacman refuses to install files to /lib, so i copied/moved them to /usr/lib

Offline

#5 2018-08-18 14:38:48

progandy
Member
Registered: 2012-05-17
Posts: 5,184

Re: My first PKGBUILD

You should be able to set unitdir and presetdir as variables to make to fix that.

$ grep -r lib/
examples/systemd/Makefile:unitdir ?= /lib/systemd/system
examples/systemd/Makefile:presetdir ?= /lib/systemd/system-preset
...

| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#6 2018-08-18 16:15:38

zapp-brannigan
Member
Registered: 2018-08-18
Posts: 6

Re: My first PKGBUILD

Thank you for the hint. I've added a patch file.

Offline

#7 2018-08-18 16:19:36

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

Re: My first PKGBUILD

There should be no need to patch the Makfile - it accepts variables:

make DESTDIR="$pkgdir" unitdir=/usr/lib/systemd/system presetdir=/usr/lib/systemd/system-preset install

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

Offline

#8 2018-08-18 16:36:32

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,466

Re: My first PKGBUILD

Is it even installable? It depends on kvdo, but nothing seems to provide that. Does it really need gcc at runtime?

The source file name is too generic, you need to rename it. If someone's using a combined SRCDEST, it could conflict with other packages.

Why cp then sed -i dkms.conf instead of just redirecting the output of sed?

What does namcap tell you about dependencies?

Offline

#9 2018-08-18 17:07:36

progandy
Member
Registered: 2012-05-17
Posts: 5,184

Re: My first PKGBUILD

Scimmia wrote:

Is it even installable? It depends on kvdo, but nothing seems to provide that.

kvdo-dkms is probably the required package, but it is missing provides=('kvdo')


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#10 2018-08-18 18:54:41

zapp-brannigan
Member
Registered: 2018-08-18
Posts: 6

Re: My first PKGBUILD

Scimmia wrote:

Does it really need gcc at runtime?
The source file name is too generic, you need to rename it.
Why cp then sed -i dkms.conf instead of just redirecting the output of sed?

progandy wrote:

kvdo-dkms is probably the required package, but it is missing provides=('kvdo')

Updated the pkgbuilds.

namcap complains about a few things which i don't know how to resolve:

vdo W: ELF file ('usr/bin/vdodmeventd') lacks FULL RELRO, check LDFLAGS.
vdo W: ELF file ('usr/bin/vdodumpconfig') lacks FULL RELRO, check LDFLAGS.
vdo W: ELF file ('usr/bin/vdoforcerebuild') lacks FULL RELRO, check LDFLAGS.
vdo W: ELF file ('usr/bin/vdoformat') lacks FULL RELRO, check LDFLAGS.
vdo W: ELF file ('usr/bin/vdoprepareupgrade') lacks FULL RELRO, check LDFLAGS.
vdo W: ELF file ('usr/bin/vdoreadonly') lacks FULL RELRO, check LDFLAGS.
vdo W: Unused shared library '/usr/lib/libz.so.1' by file ('usr/bin/vdodmeventd')
vdo W: Unused shared library '/usr/lib/libm.so.6' by file ('usr/bin/vdodmeventd')
vdo W: Unused shared library '/usr/lib/libuuid.so.1' by file ('usr/bin/vdodmeventd')
vdo W: Unused shared library '/usr/lib/libdl.so.2' by file ('usr/bin/vdodumpconfig')
vdo W: Unused shared library '/usr/lib/libm.so.6' by file ('usr/bin/vdodumpconfig')
vdo W: Unused shared library '/usr/lib/libdl.so.2' by file ('usr/bin/vdoforcerebuild')
vdo W: Unused shared library '/usr/lib/libm.so.6' by file ('usr/bin/vdoforcerebuild')
vdo W: Unused shared library '/usr/lib/libdl.so.2' by file ('usr/bin/vdoformat')
vdo W: Unused shared library '/usr/lib/libm.so.6' by file ('usr/bin/vdoformat')
vdo W: Unused shared library '/usr/lib/libdl.so.2' by file ('usr/bin/vdoprepareupgrade')
vdo W: Unused shared library '/usr/lib/libm.so.6' by file ('usr/bin/vdoprepareupgrade')
vdo W: Unused shared library '/usr/lib/libuuid.so.1' by file ('usr/bin/vdoprepareupgrade')
vdo W: Unused shared library '/usr/lib/libdl.so.2' by file ('usr/bin/vdoreadonly')
vdo W: Unused shared library '/usr/lib/libm.so.6' by file ('usr/bin/vdoreadonly')

The shared libs are not part of the vdo-package.

Offline

#11 2018-08-18 19:06:33

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,466

Re: My first PKGBUILD

What's with the prettyname/noextract stuff? I think you grossly misinterpreted what I was talking about. See https://wiki.archlinux.org/index.php/PKGBUILD#source

gcc in the makedepends is wrong as well, see https://wiki.archlinux.org/index.php/PK … akedepends

Offline

#12 2018-08-18 19:18:47

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

Re: My first PKGBUILD

kvdo has

makedepends=('dkms')

but dkms is only used once the package is installed.
Edit:
https://github.com/dm-vdo/vdo/blob/4248 … kefile#L68 would explain

vdo W: ELF file ('usr/bin/vdodmeventd') lacks FULL RELRO, check LDFLAGS.
vdo W: ELF file ('usr/bin/vdodumpconfig') lacks FULL RELRO, check LDFLAGS.
vdo W: ELF file ('usr/bin/vdoforcerebuild') lacks FULL RELRO, check LDFLAGS.
vdo W: ELF file ('usr/bin/vdoformat') lacks FULL RELRO, check LDFLAGS.
vdo W: ELF file ('usr/bin/vdoprepareupgrade') lacks FULL RELRO, check LDFLAGS.
vdo W: ELF file ('usr/bin/vdoreadonly') lacks FULL RELRO, check LDFLAGS.

Edit2:
https://github.com/dm-vdo/vdo/blob/4248 … kefile#L72 would explain

vdo W: Unused shared library '/usr/lib/libz.so.1' by file ('usr/bin/vdodmeventd')
vdo W: Unused shared library '/usr/lib/libm.so.6' by file ('usr/bin/vdodmeventd')
vdo W: Unused shared library '/usr/lib/libuuid.so.1' by file ('usr/bin/vdodmeventd')
vdo W: Unused shared library '/usr/lib/libdl.so.2' by file ('usr/bin/vdodumpconfig')
vdo W: Unused shared library '/usr/lib/libm.so.6' by file ('usr/bin/vdodumpconfig')
vdo W: Unused shared library '/usr/lib/libdl.so.2' by file ('usr/bin/vdoforcerebuild')
vdo W: Unused shared library '/usr/lib/libm.so.6' by file ('usr/bin/vdoforcerebuild')
vdo W: Unused shared library '/usr/lib/libdl.so.2' by file ('usr/bin/vdoformat')
vdo W: Unused shared library '/usr/lib/libm.so.6' by file ('usr/bin/vdoformat')
vdo W: Unused shared library '/usr/lib/libdl.so.2' by file ('usr/bin/vdoprepareupgrade')
vdo W: Unused shared library '/usr/lib/libm.so.6' by file ('usr/bin/vdoprepareupgrade')
vdo W: Unused shared library '/usr/lib/libuuid.so.1' by file ('usr/bin/vdoprepareupgrade')
vdo W: Unused shared library '/usr/lib/libdl.so.2' by file ('usr/bin/vdoreadonly')
vdo W: Unused shared library '/usr/lib/libm.so.6' by file ('usr/bin/vdoreadonly')

Last edited by loqs (2018-08-18 19:28:46)

Offline

#13 2018-08-19 06:49:27

zapp-brannigan
Member
Registered: 2018-08-18
Posts: 6

Re: My first PKGBUILD

Scimmia wrote:

I think you grossly misinterpreted what I was talking about.

Yes, i thought the name of the extracted src-archive is too short smile

Offline

#14 2018-08-19 14:47:57

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

Re: My first PKGBUILD

@loqs,

Wow, that Makefile is horrid. o_O

GLOBAL_LDFLAGS   = $(EXTRA_LDFLAGS)
EXTRA_LDFLAGS =
LDFLAGS = $(GLOBAL_LDFLAGS)

@zapp-brannigan,

I suggest you completely rewrite the Makefile from scratch, then submit your working Makefile upstream as a replacement. smile
There is absolutely nothing whatsoever of value in that Makefile to be preserved...


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

Offline

#15 2018-08-19 18:14:30

zapp-brannigan
Member
Registered: 2018-08-18
Posts: 6

Re: My first PKGBUILD

Eschwartz wrote:

I suggest you completely rewrite the Makefile from scratch

Well...i don't have the skills to do that wink

Offline

Board footer

Powered by FluxBB