Building AUR packages using manjaro-tools

I reconfigured my vm to streamline my building of DeLinuxCo ISO and I have an issue that is just stumping me. Building AUR packages locally fails, but works when using yay!

I created a manjaro-tools directory in my home directory. /home/delinuxco/manjaro-tools
and added pkgbuild directory.
I copied the manjaro-tools config files to /home/delinuxco/.config/manjaro-tools/

Contents of ~/.config/manjaro-tools/manjaro-tools.conf pointing to /home/delinuxco/manjaro-tools/pkgbuild

######################################################
################ manjaro-tools.conf ##################
######################################################

# default target branch
# target_branch=stable

# default target arch: auto detect
# target_arch=$(uname -m)

# cache dir where buildpkg, buildtree cache packages/pkgbuild, builiso iso files
 cache_dir=/home/delinuxco/manjaro-tools/pkgbuild

# build dir where buildpkg or buildiso chroots are created
# chroots_dir=/home/packages/pkgbuild
  chroots_dir=/home/delinuxco/manjaro-tools/pkgbuild

# log dir where log files are created
 log_dir='/var/log/manjaro-tools'

The package I am trying to build is called delinuxco, I put the PKGBUILD file in /home/delinuxco/manjaro-tools/pkgbuild/delinuxco

When I try to build the package, I get the following error:

My PKGBUILD file...
# Maintainer: John Machado <john at delinuxco dot com>

pkgname=delinuxco
pkgver=1.1.0  
pkgrel=1
pkgdesc="DeLinuxCo Base "
arch=('x86_64')
url="https://www.delinuxco.com"
license=('GPL')
optdepends=('awesome-terminal-fonts' 'backintime' 'backintime-cli' 'clipit' 'chromium' 'encfs' 'ffmpeg' 'gscan2pdf' 'libreoffice-fresh' 'lsd' 'mint-x-icons' 'python-secretstorage' 'python-keyring' 'redshift' 'pulseaudio-equalizer-ladspa' 'timeshift' 'nemo-media-columns' 'nemo-mediainfo-tab' 'nitroshare' 'ice-ssb' 'xcursor-thedot' 'kdenlive-appimage' 'chromium-widevine' 'albert' 'libqalculate' 'qalculate-gtk' 'numactl' 'timeshift' 'terminus-font' 'cantarell-fonts' 'ttf-liberation' 'ttf-dejavu')
provides=('delinuxco=1.1.0')
conflicts=('delinuxco')

source=("https://repo.delinuxco.com/source/packages/${pkgname}-${pkgver}-${arch}.tar.xz")
md5sums=('0b0807e975e44e27c57af132b10a0ec9')
options=(!strip)
filename=${pkgname}-${pkgver}-${arch}

prepare() {
  chmod +x ${filename}.tar.xz
  tar -xf ${filename}.tar.xz
}

package() {
  mkdir -p ${pkgdir}/usr/share/delinuxco/etc
  mkdir -p ${pkgdir}/usr/share/delinuxco/usr
  mkdir -p ${pkgdir}/usr/share/icons/${pkgname}
  mkdir -p ${pkgdir}/usr/share/backgrounds/${pkgname}
  mkdir -p ${pkgdir}/usr/share/sounds/${pkgname}
  mkdir -p ${pkgdir}/usr/share/gnome-background-properties
    cp -Rf ${srcdir}/etc/* ${pkgdir}/usr/share/${pkgname}/etc/
    cp -Rf ${srcdir}/usr/* ${pkgdir}/usr/share/${pkgname}/usr
    cp -Rf ${srcdir}/usr/share/backgrounds/${pkgname}/* ${pkgdir}/usr/share/backgrounds/${pkgname}
    cp -Rf ${srcdir}/usr/share/icons/${pkgname}/* ${pkgdir}/usr/share/icons/${pkgname}
    cp -Rf ${srcdir}/usr/share/sounds/${pkgname}/* ${pkgdir}/usr/share/sounds/${pkgname}
    cp -f ${srcdir}/usr/share/gnome-background-properties/delinuxco.xml ${pkgdir}/usr/share/gnome-background-properties/delinuxco.xml
 }

You don’t need to do any of that. The PKGBUILD should be one folder up from your current directory.

Say your PKGBUILD is here: ~/pkgbuilds/delinuxco/. From ~/pkgbuilds/ you would run:

With manjaro-tools-pkg

buildpkg -p delinuxco -c

or with manjaro-chrootbuild (easier, no configuration necessary)

sudo chrootbuild -p delinuxco -c

@Yochanan, No go…

I completely removed manjaro-tools from the system, purged /var/lib as well as /var/cache and in the home directory of anything manjaro-tools. I then reinstalled manjaro-tools, updated the system and rebooted.

After reboot, copied the manjaro-tools from /etc to ~/.config/
Edited ~/.config/manjaro-tools/manjaro-tools.conf and changed the cache and chroots;

######################################################
################ manjaro-tools.conf ##################
######################################################

# default target branch
# target_branch=stable

# default target arch: auto detect
# target_arch=$(uname -m)

# cache dir where buildpkg, buildtree cache packages/pkgbuild, builiso iso files
# cache_dir=/var/cache/manjaro-tools
  cache_dir=/home/delinuxco/pkgbuild

# build dir where buildpkg or buildiso chroots are created
# chroots_dir=/var/lib/manjaro-tools
  chroots_dir=/home/delinuxco/pkgbuild

# log dir where log files are created
# log_dir='/var/log/manjaro-tools'

# custom build mirror server
# build_mirror=https://manjaro.moson.eu/
######################################################
################ manjaro-tools.conf ##################
######################################################

# default target branch
# target_branch=stable

# default target arch: auto detect
# target_arch=$(uname -m)

# cache dir where buildpkg, buildtree cache packages/pkgbuild, builiso iso files
# cache_dir=/var/cache/manjaro-tools
  cache_dir=/home/delinuxco/pkgbuild

# build dir where buildpkg or buildiso chroots are created
# chroots_dir=/var/lib/manjaro-tools
  chroots_dir=/home/delinuxco/pkgbuild

# log dir where log files are createdbuildpkg -p delinuxco -c
# log_dir='/var/log/manjaro-tools'

# custom build mirror server
# build_mirror=https://manjaro.moson.eu/

################ buildtree ###############

I then created the build directory in ~/pkgbuild
then copied the delinuxco directory into the pkgbuild so that the PKGBUILD file path is: ~/pkgbuild/delinuxco/PKGBUILD
Then from inside ~/pkgbuild directory I ran;

buildpkg -p delinuxco -c

Still getting this error…

I tried both buildpkg -p delinuxco -c and buildpkg -p delinuxco

Running command: sudo chrootbuild -p delinuxco -c command not found.

I just don’t understand, I built that package twice before…

Ah, I see now. Your setup is fine. I’m having trouble focusing with these cluster headaches. :face_with_head_bandage:

Please post logs using Preformatted text instead of screnshots.

The problem is in your package() function, the error is referring to this line:

cp -Rf ${srcdir}/etc/* ...

That path does not exist. the source tarball is automatically extracted to the SRCDEST: ${srcdir}/${pkgname}-${pkgver}-${arch}. Your prepare() function is completely unnecessary.

However, you could skip extracting it with:

noextract=("${pkgname}-${pkgver}-${arch}.tar.xz")

Then all you’d have to do in the package() function is:

package() {
  _filename="${pkgname}-${pkgver}-${arch}"
  
  bsdtar -xvf "${_filename}.tar.xz" -C "${pkgdir}"
  mv "${_filename}}"/* "$pkgdir"
  rm -rf "${_filename}"
}

Don’t use new variables if you can help it, but if you do add an underscore in front like I did above. That way they won’t conflict with any existing or future variables used.

Some PKGBUILD critique:

A package already provides and conflicts with itself, no need for either.

Tip: instead of mkdir -p, use install -D to create a leading directory. Permissions should also be set; i.e., install -Dm755 binary "${pkgdir}"/usr/bin/binary.

1 Like

Thank you, I got it to build, definitely the srcdir issue! I will study your suggestions and learn to streamline the PKGBUILD.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.