You are not logged in.

#1 2017-07-16 15:53:59

ferion
Member
Registered: 2017-07-16
Posts: 2

PKGBUILD review request agensgraph-git

Hi,

Please have a look at my  PKGBUILD and tell me if there's something amiss.

It's based off of existing postgresql packages available in AUR (specifically postgresql-git)
Changes:

  • path to libjvm.so to satisfy the Makefile for hadoop_fdw

  • default java environment set to jdk8 for the java compiler

We need to have the path to libjvm.so. One of the contribs that was causing issues was hadoop_fdw with build errors like:

fwrapv -fexcess-precision=standard -march=native -mtune=native -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 -fpic -shared -o hadoop_fdw.so hadoop_fdw.o deparse.o hive_funcs.o -L../../src/port -L../../src/common -Wl,-O1,--sort-common,--as-needed,-z,relro  -Wl,--as-needed -Wl,-rpath,'/usr/lib',--enable-new-dtags  -gre  -L
gcc: error: missing argument to ‘-L’
make[1]: *** [../../src/Makefile.shlib:310: hadoop_fdw.so] Error 1
make[1]: *** Waiting for unfinished jobs....
make -C pg_visibility all

hence the

 export JAVA_LIBRARY_PATH="/usr/lib/jvm/default-runtime/lib/amd64/server" 
# Maintainer: ferion <ferion@bit0.ro>

pkgname=('agensgraph-git')
pkgver=9.6.2
pkgrel=1
_majorver=9.6
pkgdesc="AgensGraph is a multi-model graph database based on PostgreSQL."
arch=('i686' 'x86_64')
url="http://bitnine.net/agensgraph/"
depends=('libxml2' 'readline>=6.0' 'zlib' 'openssl>=1.0.0')
backup=('etc/pam.d/postgresql' 'etc/logrotate.d/postgresql')
options=(!strip) # to facilitate debugging of testing builds
license=('Custom')
conflicts=('postgresql' 'postgresql-libs' 'postgresql-testing' 'postgresql-client' 'postgresql-git')
makedepends=('krb5' 'libxml2' 'python' 'perl' 'tcl>=8.6.0' 'openssl>=1.0.0' 'jdk' )
provides=("postgresql-libs=$pkgver" "postgresql=$pkgver" 'postgresql-git')
optdepends=('python2: for PL/Python support'
             'perl: for PL/Perl support'
             'tcl: for PL/Tcl support')
source=("git+https://github.com/bitnine-oss/agensgraph"
         postgresql-run-socket.patch
         postgresql.pam
         postgresql.logrotate
         postgresql.service
         postgresql.tmpfiles.conf
         postgresql-check-db-dir)
install=postgresql.install
sha256sums=('SKIP'
      '8538619cb8bea51078b605ad64fe22abd6050373c7ae3ad6595178da52f6a7d9'
      '57dfd072fd7ef0018c6b0a798367aac1abb5979060ff3f9df22d1048bb71c0d5'
      '6abb842764bbed74ea4a269d24f1e73d1c0b1d8ecd6e2e6fb5fb10590298605e'
      'c69b614731fdd3f4e127540814f5999f423363523c5209e252e19b1d4362ad68' 
      '7e086d70e0dcaa6ce45693b4e826ce92d770192b3aff5642319b1ef279d88dc4'
      '20a8716745ff3690275ff088ea394d397063d4c5e159ca26d0d91462146bc74b'
)
build() {
  cd "${srcdir}/agensgraph"

  export JAVA_LIBRARY_PATH="/usr/lib/jvm/default-runtime/lib/amd64/server"
  patch -Np1 < ../postgresql-run-socket.patch

  ./configure \
    --prefix=/usr \
    --mandir=/usr/share/man \
    --datadir=/usr/share/postgresql \
    --sysconfdir=/etc \
    --with-gssapi \
    --with-libxml \
    --with-perl \
    --with-openssl \
    --with-python PYTHON=/usr/bin/python2 \
    --with-tcl \
    --with-pam \
    --with-uuid=e2fs \
    --with-system-tzdata=/usr/share/zoneinfo \
    --enable-nls \
    --enable-thread-safety

  make
  make -C contrib
}

package() {
  cd "${srcdir}/agensgraph"

  # install license
  install -D -m644 COPYRIGHT "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"

  make DESTDIR="${pkgdir}" install
  make -C contrib DESTDIR="${pkgdir}" install

  install -D -m644 "${srcdir}/postgresql.tmpfiles.conf" \
    "${pkgdir}/usr/lib/tmpfiles.d/postgresql.conf"
  install -D -m644 "${srcdir}/postgresql.service" \
    "${pkgdir}/usr/lib/systemd/system/postgresql.service"
  install -D -m755 "${srcdir}/postgresql-check-db-dir" \
    "${pkgdir}/usr/bin/postgresql-check-db-dir"

  install -D -m644 "${srcdir}/postgresql.pam" \
    "${pkgdir}/etc/pam.d/postgresql"

  install -D -m644 "${srcdir}/postgresql.logrotate" \
    "${pkgdir}/etc/logrotate.d/postgresql"
}

Last edited by ferion (2017-07-16 15:54:18)

Offline

#2 2017-07-16 16:25:36

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: PKGBUILD review request agensgraph-git

You shouldn't have the application name in $pkgdesc, change it to 'A multi-model graph database based on PostgreSQL.'

I can't see any other obvious issues.


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#3 2017-07-17 04:34:02

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

Re: PKGBUILD review request agensgraph-git

Other obvious issues:

Having the version in more than one place. _majorver should be based on pkgver
Packages in depends have to be installed at build time, putting them in makedepends is redundant and wrong.
The version requirements on the deps are useless.
pkgname as an array for a non-split package
No pkgver function for a -git package **This one is major**
patching should be done in the prepare function

That's just a quick look.

Last edited by Scimmia (2017-07-18 00:35:44)

Offline

#4 2017-07-18 01:24:03

ferion
Member
Registered: 2017-07-16
Posts: 2

Re: PKGBUILD review request agensgraph-git

slithery wrote:

You shouldn't have the application name in $pkgdesc, change it to 'A multi-model graph database based on PostgreSQL.'

I can't see any other obvious issues.

- Fixed, thanks.

Scimmia wrote:

Other obvious issues:

1) Having the version in more than one place. _majorver should be based on pkgver
2) Packages in depends have to be installed at build time, putting them in makedepends is redundant and wrong.
3) The version requirements on the deps are useless.
4) pkgname as an array for a non-split package
5) No pkgver function for a -git package
6) patching should be done in the prepare function

That's just a quick look.

  1. If _majorver is set to 9.6.2 doesn't that include the .2 which is the latest revision ? Isn't _majorver suppose to indicate versions like 9.6/9.7 ... etc ?
    It's removed now anyway, as I think that it may not be needed.

  2. From what I read is that makedepends should be there just to build the package not necessarily hang out after the build is executed after the package is installed.`

  3. Fixed.*

  4. Used a pkgver() function to automatically add the version

  5. Moved to prepare()

*There's one problem though. This package does provide postgres 9.6.2 however agensgraph is version 1.1. I think that the provide array should mention a version like provides=("postgresql-libs=9.6.2" "postgresql=9.6.2")

Also another issue is in build(); make -C config reaches hadoop_fdw. The Makefile there calls javac which tries to install into
/usr/lib/postgresql which is owned by root or may not even be on the target system.

javac: directory not found: /usr/lib/postgresql
Usage: javac <options> <source files>
use -help for a list of possible options
make[1]: *** [Makefile:41: JAVAFILES] Error 2
make[1]: Leaving directory '/run/media/mig/Date/Date/AUR/build/agensgraph-git/src/agensgraph/contrib/hadoop_fdw'
make: *** [Makefile:98: all-hadoop_fdw-recurse] Error 2
make: Leaving directory '/run/media/mig/Date/Date/AUR/build/agensgraph-git/src/agensgraph/contrib'
==> ERROR: A failure occurred in build().
    Aborting...

---------------------------------
TRGTS = JAVAFILES

JAVA_SOURCES = \
        HadoopJDBCUtils.java \
	HadoopJDBCLoader.java \
 
PG_CPPFLAGS=-D'PKG_LIB_DIR=$(pkglibdir)'

JFLAGS = -d $(pkglibdir)

all:$(TRGTS)

JAVAFILES:
	javac $(JFLAGS) $(JAVA_SOURCES)
 
ifdef USE_PGXS
PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
subdir = contrib/hadoop_fdw
top_builddir = ../..
include $(top_builddir)/src/Makefile.global
include $(top_srcdir)/contrib/contrib-global.mk
SHLIB_LINK += -L$(JAVA_LIBRARY_PATH)
endif
-------------------

Quick patch.

--- agensgraph/contrib/hadoop_fdw/Makefile	2017-07-18 01:38:12.548453982 +0300
+++ agensgraph.new/contrib/hadoop_fdw/Makefile	2017-07-18 03:55:46.723320712 +0300
@@ -33,7 +33,7 @@
  
 PG_CPPFLAGS=-D'PKG_LIB_DIR=$(pkglibdir)'
 
-JFLAGS = -d $(pkglibdir)
+JFLAGS = -d ../../../
 
 all:$(TRGTS)
# Maintainer: ferion  <ferion@bit0.ro>

_pkgname='agensgraph'
pkgname="${_pkgname}-git"
pkgver=1.1.0.r41.gaf9b283
pkgrel=1
pkgdesc="A multi-model graph database based on PostgreSQL."
arch=('i686' 'x86_64')
url="http://bitnine.net/agensgraph/"
depends=('libxml2' 'readline' 'zlib' 'openssl' 'krb5' 'python2' 'perl')
backup=('etc/pam.d/postgresql' 'etc/logrotate.d/postgresql')
options=(!strip) # to facilitate debugging of testing builds
license=('Apache')
conflicts=('postgresql' 'postgresql-libs' 'postgresql-testing' 'postgresql-client' 'postgresql-git')
makedepends=('tcl' 'jdk' )
provides=("postgresql-libs=9.6.2" "postgresql=9.6.2")
optdepends=('python2: for PL/Python support'
             'perl: for PL/Perl support'
             'tcl: for PL/Tcl support')
source=("git+https://github.com/bitnine-oss/agensgraph"
         postgresql-run-socket.patch
         agensgraph.patch
         postgresql.pam
         postgresql.logrotate
         agensgraph.service
         postgresql.tmpfiles.conf
         postgresql-check-db-dir)
install=postgresql.install
sha256sums=('SKIP'
            '8538619cb8bea51078b605ad64fe22abd6050373c7ae3ad6595178da52f6a7d9'
            '0cfec996d06aa83d0ddd08d0ced3ebc9187d26fd05f90d54788a85bf6b7bd7b3'
            '57dfd072fd7ef0018c6b0a798367aac1abb5979060ff3f9df22d1048bb71c0d5'
            '6abb842764bbed74ea4a269d24f1e73d1c0b1d8ecd6e2e6fb5fb10590298605e'
            'daab6220ef01c729574384a3095f0659bf25617d6c195248a0cd28ede9b6c054'
            '7e086d70e0dcaa6ce45693b4e826ce92d770192b3aff5642319b1ef279d88dc4'
            '40da687da4fb1f6b35f406dd0f48922065d8c905d678e2a27da05806f874b780')
pkgver() {
  set -u
  cd "${srcdir}/${_pkgname}"
  git describe --long --tags | sed -e 's/^v//g' -e 's/\([^-]*-g\)/r\1/' -e 's/-/./g'
  set +u
}
prepare() {
  cd "${srcdir}/${_pkgname}"
  patch -Np1 < ../postgresql-run-socket.patch
  patch -Np1 < ../agensgraph.patch
  export JAVA_LIBRARY_PATH="/usr/lib/jvm/default-runtime/lib/amd64/server"
}
build() {
  cd "${srcdir}/${_pkgname}"

  ./configure \
    --prefix=/usr \
    --mandir=/usr/share/man \
    --datadir=/usr/share/postgresql \
    --sysconfdir=/etc \
    --with-gssapi \
    --with-libxml \
    --with-perl \
    --with-openssl \
    --with-python PYTHON=/usr/bin/python2 \
    --with-tcl \
    --with-pam \
    --with-uuid=e2fs \
    --with-system-tzdata=/usr/share/zoneinfo \
    --enable-nls \
    --enable-thread-safety

  make
  make -C contrib
}

package() {
  
  cd "${srcdir}/${_pkgname}"

  # install license
  install -D -m644 COPYRIGHT "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"

  make DESTDIR="${pkgdir}" install
  make -C contrib DESTDIR="${pkgdir}" install

  install -D -m755 "${srcdir}/HadoopJDBCLoader.class" \
    "${pkgdir}/usr/lib/postgresql/HadoopJDBCLoader.class"
  install -D -m755 "${srcdir}/HadoopJDBCUtils.class" \
    "${pkgdir}/usr/lib/postgresql/HadoopJDBCUtils.class"
  install -D -m644 "${srcdir}/postgresql.tmpfiles.conf" \
    "${pkgdir}/usr/lib/tmpfiles.d/postgresql.conf"
  install -D -m644 "${srcdir}/agensgraph.service" \
    "${pkgdir}/usr/lib/systemd/system/agensgraph.service"
  install -D -m755 "${srcdir}/postgresql-check-db-dir" \
    "${pkgdir}/usr/bin/postgresql-check-db-dir"
  install -D -m644 "${srcdir}/postgresql.pam" \
    "${pkgdir}/etc/pam.d/postgresql"
  install -D -m644 "${srcdir}/postgresql.logrotate" \
    "${pkgdir}/etc/logrotate.d/postgresql"
}

Last edited by ferion (2017-07-18 06:21:44)

Offline

Board footer

Powered by FluxBB