You are not logged in.

#1 2016-11-20 08:32:01

Xylemon
Member
Registered: 2016-11-20
Posts: 2

[SOLVED] My PKGBUILD fails because the pkg directory already exists?

Hello all, I'm still fairly new to the process of creating PKGBUILDs, so I apologize if I've done something blatantly wrong. Anyhow, I keep receiving a strange error that prevents my script from packing everything together. After extracting and cleaning up everything from the program's run file, I always hit this barrier:

==> Entering fakeroot environment...
mkdir: cannot create directory ‘<pathhere>/jack-editor/pkg/’: File exists
/usr/bin/fakeroot: line 181: 25486 User defined signal 1   FAKEROOTKEY=$FAKEROOTKEY LD_LIBRARY_PATH="$PATHS" LD_PRELOAD="$LIB" "$@"

Even after clearing the "src" and "pkg" folders and retrying, once the script enters a fakeroot environment it always complains that the "pkg" directory has already been created. I can build other packages just fine, so I am completely baffled as to why this happens. Here's the script:

# Maintainer: Xylemon <staff@bloodbathsoftworks.com>
# Bits taken from teamspeak3's PKGBUILD by Sven-Hendrik Haase <sh@lutzhaase.com>

pkgbase=J.A.C.K.
pkgver=1.1.1064
pkgrver=111064
pkgrel=1
pkgdesc="A map editor for Quake I - III, Half-Life, and derivatives. Inspired by editors like VHE and has no relation to the similarly named sound server."
arch=('i686' 'x86_64')
url="http://jack.hlfx.ru/"
license=('custom')
depends=('qt4')
optdepends=('nas: For audio playback via OSS emulation')
source=('Jack.desktop'
		'Jack.launcher'
		'Jack.png')
source_i686=("http://jack.hlfx.ru/pub/jack_${pkgrver}_linux_x86.run")
source_x86_64=("http://jack.hlfx.ru/pub/jack_${pkgrver}_linux_x64.run")
sha512sums=('0d541199775427ba49cb6a5a5ff12aa1ba1ee72f682b00703f63e3fb53508223a456c29a6c31fd26e110808ad4ced4048fa889bb2fb4d6bf8360354ed24cb7ad'
			'89208256942aafd61dc4c5a287922f0061906853b673cb34d9ae759c90361df018b27c372942ce89539983a1536371d72c1b4b9d4ed621cc20981ea2dc9b7811'
			'8e0764bbfa4effe2c4129d7abaf90cf4a335795085cc42d47fee964413615eaf7c7e0ae406f4bc9cdf7e18aa26988a070a7a1b2b8c0f3dd2e496e767984234ea')
sha512sums_i686=('092828fe147c451d3b50d87775f170661f5239a6b38d3ade16c2c04e79cf2abd34a5ead52990304820d8519c7535421510bd1e70f72058c3ab91360933a7fbb5')
sha512sums_x86_64=('2c56279aba3d34284fa867d807a59012051cd2c31e8bc3a84d14aff4953141b8a4503760095cda2549f3a258bc9b7a7d7bc87c2831b76598c664bc71cf0d6c9b')

[[ "$CARCH" == "i686" ]] && JARCH='x86'
[[ "$CARCH" == "x86_64" ]] && JARCH='x64'

prepare() {
  mkdir archive && cd archive
  sh ../jack_${pkgrver}_linux_${JARCH}.run --noexec --target .

  # Delete bundled Qt libs to use system-wide ones
  rm libQt*
  
  # Delete bundled icon and desktop file
  rm Jack.desktop
  rm Jack.xpm
  
  # Delete bundled install script
  rm install.sh

  # Fix permissions
  find -type d | xargs chmod 755
  find -type f | xargs chmod 644
  find -name *.so | xargs chmod 755
  chmod +x Jack*
}

package() {
  install -d ${pkgdir}/{usr/bin/,opt/jack-editor}

  cp -r archive/* ${pkgdir}/opt/jack-editor/

  # Install Desktop File
  install -D -m644 $srcdir/Jack.desktop ${pkgdir}/usr/share/applications/Jack.desktop

  # Install Icon File
  install -D -m644 $srcdir/Jack.png ${pkgdir}/usr/share/pixmaps/Jack.png

  # Install Client Launcher
  install -D -m755 $srcdir/jack.launcher ${pkgdir}/usr/bin/jack-editor
}

Any help or critiques are appreciated.

Last edited by Xylemon (2016-11-20 09:23:00)

Offline

#2 2016-11-20 09:09:07

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

Re: [SOLVED] My PKGBUILD fails because the pkg directory already exists?

The error comes from makepkg internals somewhere, probably when the "${pkgdir}" is recreated. Notice the error references mkdir which you never used.

The problem is that you have completely ignored basic PKGBUILD format, by having no pkgname anywhere.
pkgbase is meant for split packages, by the way.

...

Other critiques:
pkgname is not meant to contain uppercase letters or punctuation, which leaves a grand total of zero valid pkgname letters in there. makepkg doesn't actually choke and die on that, but I am pretty sure it still isn't a good idea. wink
You use $pkgdir and $srcdir a lot, but without quotes this will break hard when the current directory has spaces in the name. Oddly enough, you took care to quote the $CARCH variable which has well-defined content and doesn't need it.
Piping `find` to `xargs` instead of using the exec switch is silly, not to mention once again liable to break when dealing with unexpected filenames.

EDIT: huh, it appears several of my critiques actually should be directed at the teamspeak3 maintainer for [community] which is unexpected...

Last edited by eschwartz (2016-11-20 09:15:01)


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

Offline

#3 2016-11-20 09:22:34

Xylemon
Member
Registered: 2016-11-20
Posts: 2

Re: [SOLVED] My PKGBUILD fails because the pkg directory already exists?

Eschwartz wrote:

The error comes from makepkg internals somewhere, probably when the "${pkgdir}" is recreated. Notice the error references mkdir which you never used.

The problem is that you have completely ignored basic PKGBUILD format, by having no pkgname anywhere.
pkgbase is meant for split packages, by the way.

...

Other critiques:
pkgname is not meant to contain uppercase letters or punctuation, which leaves a grand total of zero valid pkgname letters in there. makepkg doesn't actually choke and die on that, but I am pretty sure it still isn't a good idea. wink
You use $pkgdir and $srcdir a lot, but without quotes this will break hard when the current directory has spaces in the name. Oddly enough, you took care to quote the $CARCH variable which has well-defined content and doesn't need it.
Piping `find` to `xargs` instead of using the exec switch is silly, not to mention once again liable to break when dealing with unexpected filenames.

EDIT: huh, it appears several of my critiques actually should be directed at the teamspeak3 maintainer for [community] which is unexpected...

Yep, that silly mistake was indeed the problem! I based this off another PKGBUILD I did and of course changed everything but "pkgbase" (go figure). Thanks for your help and critiques, I'll start improving the script now that it actually works.

Offline

Board footer

Powered by FluxBB