You are not logged in.

#1 2019-09-07 14:21:29

rhysperry111
Member
From: Yorkshire, UK
Registered: 2019-01-28
Posts: 51
Website

Install not working properly

Hi, I am trying to make a PKGBUILD for https://github.com/usefathom/fathom and have got to the very last step (packaging). The problem is that when 'pacman -U' is run on the produced .tar.gz it says

error: failed to commit transaction (conflicting files)
fathom-git: /bin exists in filesystem (owned by filesystem)

Here is the PKGBUILD: https://pastebin.com/cpB4JrSX
Any help is appreciated smile

Offline

#2 2019-09-07 14:54:55

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

Re: Install not working properly

pkgname="fathom-git"
pkgrel=1
pkgver="i.dont.know.what.to.put.here"
pkgdesc="Fathom - simple website analytics (Community Edition)"
url="https://github.com/usefathom/fathom"
license=("MIT")
arch=("any")
provides=("fathom")
conflicts=("fathom")
 
makedepends=("git" "go-pie" "npm")
 
source=("git+https://github.com/usefathom/fathom.git")
md5sums=("SKIP")
_gitname="fathom"
 
prepare(){
  mkdir -p gopath/src/github.com/usefathom
  ln -rTsf "$_gitname" gopath/src/github.com/usefathom/fathom
  export GOPATH="$srcdir"/gopath
}
 
build(){
  export GOPATH="$srcdir"/gopath
  cd "$srcdir"/"$_gitname"
  make build
}
 
package(){
  cd "$srcdir"/"$_gitname"
  install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/"$pkgname"/LICENSE
  install -Dm755 fathom "$pkgdir"/bin/fathom
}

Cause is

  install -Dm755 fathom "$pkgdir"/bin/fathom

Which conflicts with /bin provide by filesystem

stat /bin
  File: /bin -> usr/bin

Instead of installing in /bin install to /usr/bin
Edit:

pkgver="i.dont.know.what.to.put.here"

VCS_package_guidelines#The_pkgver()_function

pkgdesc="Fathom - simple website analytics (Community Edition)"

PKGBUILD#pkgdesc

arch=("any")

go generated a elf binary so the arch is the hosts architecture not any.  The binary depends on glibc.
The following creates the binary with RELRO and changes linking from static to dynamic.  There is probably a better way to achieve it.

  sed -i 's/LDFLAGS += -extldflags "-static"/LDFLAGS := -extldflags "$(LDFLAGS)"/' Makefile
  sed -i 's/go build -o $@ $(MAIN_PKG)/go build -trimpath -ldflags '\''-w $(LDFLAGS)'\'' -o $@ $(MAIN_PKG)/' Makefile

Last edited by loqs (2019-09-07 18:10:25)

Offline

Board footer

Powered by FluxBB