Table of Content

This is a four-parts article. There are few sections here.

Part One
  • Preface: Test Bed, Must Read
  • Getting Started With Docker
  • Package Management: ALPM Frontend, ASP and AUR Helper, Get Help
  • Updating System: OS Release, The Riddle, Refresh Update, List Upgradable, Download Upgrade, Upgrade, Common Form
  • Package IRSIF: Install, Removal, Query Search, Show Info, Change Log, List Files, Verify, Package as File
  • What's Next
Part Two
  • Dependency: Using pacman, Test, Using pactree
  • Repository: Configuration, Mirror
  • Group: Blackarch Example, List Group
  • Lock Package: IgnorePkg, HoldPkg
  • System Wide: List Packages, Search Files
  • History: The Log File
  • Clean Up: Cache, Autoremove
  • Case: When chroot fail
  • What's Next
Part Three
  • Automatic Build: User Privilege, PKGBUILD, makepkg, Example, Dependency, Download, Install, Namcap
  • ABS: Deprecation, ASP, SVN
  • What's Next
Part Four
  • Introducing AUR: Package Query, cower, Foreign Package
  • AUR Helper: yaourt, pacaur, packer, aura
  • Screenshot: Query AUR
  • Conclusion

Automatic Build

makepkg is some kind of automatic build process, utilizing information from PKGBUKD. Don’t be scared, this process is easy, and won’t hurt you.

No need to do configure, make, and make install separately. Since they are already in PKGBUKD.

It is a good idea to compile as a non-root user. Consider prepare a user if not exist yet.

User Privilege

Build require regular user, non root one. Consider make one first.

$ useradd -m -g users -G wheel -s /bin/bash epsi

$ groups epsi
epsi : users sudo

$ passwd epsi
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

$ su epsi

$ whoami
epsi

Docker AUR: Add User and Privilege

You should also setup sudoers, otherwise this message.

$ sudo nano
epsi is not in the sudoers file. This incident will be reported.
$ nano /etc/sudoers
epsi ALL=(ALL:ALL) ALL
$ su epsi
$ cd ~

PKGBUILD

ALPM handle source code only in one text file named PKGBUILD. Indeed a smart design, only one text file.

Consider check this package query package from AUR.

  • https://aur.archlinux.org/packages/package-query/

You can read PKGBUILD here.

  • https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=package-query

Consider download the PKGBUILD snapshot.

  • https://aur.archlinux.org/cgit/aur.git/snapshot/package-query.tar.gz
$ wget https://aur.archlinux.org/cgit/aur.git/snapshot/package-query.tar.gz
--2017-09-15 21:23:58-- https://aur.archlinux.org/cgit/aur.git/snapshot/package-query.tar.gz
Loaded CA certificate '/etc/ssl/certs/ca-certificates.crt'
...

Docker AUR: Package Query: Download

$ tar -xzvf package-query.tar.gz 
package-query/
package-query/.SRCINFO
package-query/PKGBUILD
$ cat package-query/PKGBUILD 
# Contributor: tuxce <tuxce.net@gmail.com>
# Contributor: Skunnyk <skunnyk@archlinux.fr>
pkgname=package-query
pkgver=1.9
pkgrel=2
pkgdesc="Query ALPM and AUR"
arch=('i686' 'x86_64' 'mips64el' 'armv6h' 'armv7h' 'arm' 'aarch64')
url="https://github.com/archlinuxfr/package-query/"
license=('GPL')
depends=('pacman>=5.0' 'yajl>=2.0')

Docker AUR: Package Query: PKGBUILD

As you can see, it needs yajl Yet Another JSON Library, therefore we should install yajl first. This time using sudo.

$ sudo pacman -S yajl
resolving dependencies...
looking for conflicting packages...

Packages (1) yajl-2.1.0-1

Total Download Size: 0.03 MiB
Total Installed Size: 0.16 MiB

:: Proceed with installation? [Y/n]

makepkg

There is this makepkg at the heart of automatic build. This will compile package, and create the .tar.xz ALPM package. In order to do this we need to change our working directory first. This is a long verbose output.

Although we can have AUR Frontend as described later, sometimes we need to go to lower level, use this sweet good makepkg.

$ cd package-query

$ makepkg
==> Making package: package-query 1.9-2 (Fri Sep 15 21:44:23 UTC 2017)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
-> Downloading package-query-1.9.tar.gz...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 357k 100 357k 0 0 178k 0 0:00:02 0:00:02 --:--:-- 136k
==> Validating source files with sha256sums...
package-query-1.9.tar.gz ... Passed
==> Extracting sources...
-> Extracting package-query-1.9.tar.gz with bsdtar
==> Starting build()...
checking for a BSD-compatible install... /usr/bin/install -c
...
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating src/Makefile
...
make all-recursive
make[1]: Entering directory '/home/epsi/package-query/src/package-query-1.9'
...
make[1]: Leaving directory '/home/epsi/package-query/src/package-query-1.9'
==> Tidying install...
-> Removing libtool files...
-> Purging unwanted files...
-> Removing static library files...
-> Stripping unneeded symbols from binaries and libraries...
-> Compressing man and info pages...
==> Checking for packaging issue...
==> Creating package "package-query"...
-> Generating .PKGINFO file...
-> Generating .BUILDINFO file...
-> Generating .MTREE file...
-> Compressing package...
==> Leaving fakeroot environment.
==> Finished making: package-query 1.9-2 (Fri Sep 15 21:44:42 UTC 2017)

Docker AUR: Package Query: makepkg

If build goes well, the package should be ready to served.

$ ls -l
total 400
-rw-r--r-- 1 epsi users 754 Jul 20 02:06 PKGBUILD
-rw-r--r-- 1 epsi users 27336 Sep 15 21:40 package-query-1.9-2-x86_64.pkg.tar.xz
-rw-r--r-- 1 epsi users 366513 Sep 15 21:39 package-query-1.9.tar.gz
drwxr-xr-x 3 epsi users 4096 Sep 15 21:40 pkg
drwxr-xr-x 3 epsi users 4096 Sep 15 21:39 src

And install using --upgrade

$ sudo pacman -U package-query-1.9-2-x86_64.pkg.tar.xz 

Equal to:

$ sudo pacman --upgrade package-query-1.9-2-x86_64.pkg.tar.xz 
[sudo] password for epsi:
loading packages...
resolving dependencies...
looking for conflicting packages...

Packages (1) package-query-1.9-2

Total Installed Size: 0.08 MiB

:: Proceed with installation? [Y/n]

Docker AUR: Package Query: Install

Example

Consider this asp-git package form AUR.

$ wget https://aur.archlinux.org/cgit/aur.git/snapshot/asp-git.tar.gz
$ tar -xvf asp-git.tar.gz
$ cd asp-git

Dependency

$ makepkg
==> Making package: asp-git 1.3.g375b035-1 (Tue Sep 19 21:22:25 UTC 2017)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Missing dependencies:
-> asciidoc
==> ERROR: Could not resolve all dependencies.

==> ERROR: An unknown error has occurred. Exiting...

Docker makepkg: Dependency Error

We can solve this using syncdeps.

$ makepkg --syncdeps
==> Making package: asp-git 1.3.g375b035-1 (Tue Sep 19 21:31:03 UTC 2017)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Installing missing dependencies...
[sudo] password for epsi:
resolving dependencies...
looking for conflicting packages...

Packages (1) asciidoc-8.6.9-3

Total Installed Size: 2.23 MiB

:: Proceed with installation? [Y/n]

Docker makepkg: Sync Dependency

Download

You can download package using --nobuild. This is useful if you want to alter the configuration, or even the source code.

$ makepkg -o
==> Making package: asp-git 1.3.g375b035-1 (Tue Sep 19 17:02:41 UTC 2017)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
-> Cloning asp git repo...
Cloning into bare repository '/home/epsi/asp-git/asp'...
remote: Counting objects: 347, done.
remote: Total 347 (delta 0), reused 0 (delta 0), pack-reused 347
Receiving objects: 100% (347/347), 65.53 KiB | 175.00 KiB/s, done.
Resolving deltas: 100% (204/204), done.
==> Validating source files with md5sums...
asp ... Skipped
==> Extracting sources...
-> Creating working copy of asp git repo...
Cloning into 'asp'...
done.
==> Starting pkgver()...
==> Updated version: asp-git 2-1
==> Sources are ready.

Docker makepkg: nobuild

Now you can continue, without cloning.

$ makepkg
==> Making package: asp-git 2-1 (Tue Sep 19 17:07:18 UTC 2017)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
-> Updating asp git repo...
Fetching origin
==> Validating source files with md5sums...
asp ... Skipped
==> Extracting sources...
-> Creating working copy of asp git repo...
Switched to a new branch 'makepkg'
==> Starting pkgver()...
==> Starting build()...
...

Docker makepkg: asp-git

Install

You can also use --install to automatically install.

$ makepkg -i

Equal to:

$ makepkg --install
==> Making package: asp-git 2-1 (Tue Sep 19 17:12:18 UTC 2017)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
-> Updating asp git repo...
Fetching origin
==> Validating source files with md5sums...
asp ... Skipped
==> Extracting sources...
-> Creating working copy of asp git repo...
Reset branch 'makepkg'
==> Starting pkgver()...
==> WARNING: A package has already been built, installing existing package...
==> Installing package asp-git with pacman -U...
[sudo] password for epsi:
...

Docker makepkg: install

Namcap

Check for possible issue, similar to lintian. The namcap name is the reverse pacman character.

$ namcap asp-git-2-1-any.pkg.tar.xz 
asp-git E: Missing custom license directory (usr/share/licenses/asp-git)
asp-git W: Referenced library 'bash' is an uninstalled dependency
asp-git W: Dependency included and not needed ('awk')
asp-git W: Dependency included and not needed ('bash')
asp-git W: Dependency included and not needed ('jq')
asp-git W: Dependency included and not needed ('git')

Docker Arch: namcap


ABS

AUR is not the only ALPM’s strength, You can also build official package. Sometimes we need to build instead of binary to add build configuration to enable feature that was disabled, or disable feature we do not want, or any change in the build for an official package.

ABS stand for The Arch Build System.

Deprecation

ASP is an alternative for ABS that has been deprecated.

ASP

Using asp is as simple as below:

$ asp export ncdu
==> Initializing ASPROOT in /home/epsi/.cache/asp
remote: Counting objects: 100, done.
remote: Compressing objects: 100% (80/80), done.
remote: Total 100 (delta 9), reused 78 (delta 5)
Receiving objects: 100% (100/100), 14.46 KiB | 7.23 MiB/s, done.
Resolving deltas: 100% (9/9), done.
From https://git.archlinux.org/svntogit/community
* branch packages/ncdu -> FETCH_HEAD
* [new branch] packages/ncdu -> community/packages/ncdu
==> exporting ncdu:trunk

Now we can continue with makepkg.

$ cd ncdu

$ makepkg -i --skippgpcheck

Docker ASP: export ncdu

Using SVN

This is a lower level method than ASP for curious reader. But first you have to install SVN.

$ sudo pacman -S svn

I was a little bit confused, about this SVN thing. But then I got helpful answer from community. Dean Wallace has pointed me to the right direction. And suggest to stick with asp

$ svn checkout --depth=empty svn://svn.archlinux.org/packages
Checked out revision 305653.

$ svn checkout --depth=empty svn://svn.archlinux.org/community
Checked out revision 257755.

$ svn update ncdu
Updating 'ncdu':
A ncdu
A ncdu/trunk
A ncdu/trunk/PKGBUILD
A ncdu/repos
A ncdu/repos/community-i686
A ncdu/repos/community-i686/PKGBUILD
A ncdu/repos/community-x86_64
A ncdu/repos/community-x86_64/PKGBUILD
Updated to revision 257755.

Docker SVN: update ncdu

Now you can continue with newly downloaded PKGBUILD.


What’s Next

There are still, some AUR topic to go. Consider finish reading [ Part Four ].

Thank you for reading