Buildiso with AUR packages: Using buildpkg

Revision as of 07:28, 23 September 2017 by imported>Fhdk (→‎Create directories: updated to reflect dropped support for 32-bit arch)


This tutorial is about creating your own online repository. This repository can be used to download (with the help of yaourt) and build (with the help of buildpkg) packages. Later, you can install those packages to your customized Manjaro ISO using buildiso.


Before you start with this tutorial make sure you have completed the prerequisite steps in Build Manjaro ISOs with buildiso.

The same XFCE ISO profile will be used as example on this Wiki page.


Create directories

The first thing you should probably do is create a directory for your online repository. The online repository is called online-repo throughout this tutorial and it is located in your home-folder. You however are free to name it and place it to your liking. This'll help keep things organized. Your repository consist of only this folder:

 mkdir -p ~/online-repo

This online repository is created in your home folder, but you can create it anywhere you want.

Download package files from AUR using yaourt

Now, go to your online build directory:

cd ~/online-build

Next do

yaourt -G <package name>

in order to download package files from the AUR to your build directory. You will see a new directory with the package name. In it are various files, including a PKGBUILD file.

Example:

You want to add the package pcmanfm-qt-git to your ISO. Therefore, you need to download it to your online repository first. You download and unpack it using

yaourt -G pcmanfm-qt-git

You see a new PKGBUILD file in your online build directory:

~/online-build/pcmanfm-qt-git/PKGBUILD


Building with buildpkg

Up to this point, you have only downloaded and unpacked files from the AUR. Next, you need to build those files into proper packages:

cd ~/online-build
buildpkg -p <package name>


If you want to build 32-Bit packages on a 64-Bit system, you can do this by specifying the architecture:

buildpkg -a i686 -p <package name> 


For more examples how to use buildpkg, look here.

Example:

As instructed above, try to build pcmanfm-qt-git:

buildpkg -p pcmanfm-qt-git

The build gets aborted with the following error message:

==> Installing missing dependencies...
error: target not found: liblxqt-git
==> ERROR: 'pacman' failed to install missing dependencies.

This means liblxqt-git is a dependency of pcmanfm-qt-git. You need to download and build liblxqt-git before you can build pcmanfm-qt-git successfully. Therefore, do the same (with one slight difference) as you did with pcmanfm-qt-git:

yaourt -G liblxqt-git
buildpkg -n -p liblxqt-git

Please note the additional -n argument. This argument installs liblxqt-git in your build environment (pcmanfm-qt-git needs liblxqt-git installed in order to utilize it).

Again, you receive an error:

==> Installing missing dependencies...
error: target not found: libqtxdg-git
==> ERROR: 'pacman' failed to install missing dependencies.

So, liblxqt-git has another dependency: libqtxdg-git Repeat the whole process with libqtxdg-git:

yaourt -G libqtxdg-git
buildpkg -n -p libqtxdg-git

Finally, a package gets built (and installed in your build environment) successfully!

Now, build the other packages (in reverse order):

buildpkg -n -p liblxqt-git
buildpkg -p pcmanfm-qt-git


Copy package files to online repository

In the last chapter you have built packages. These packages were created in this directory on your system:

/var/cache/manjaro-tools/

On a 64-Bit system using the unstable branch the exact path is

/var/cache/manjaro-tools/pkg/unstable/x86_64

You should see compressed package files. The file name should end with .pkg.tar.xz.


Move all package files to your online repository:

~/online-repo/x86_64

Example:

Your online repository should now look like this:

liblxqt-git-0.8.0.23.g079768e-1-x86_64.pkg.tar.xz  
libqtxdg-git-1.0.0.7.g0503cf7-1-x86_64.pkg.tar.xz  
pcmanfm-qt-git-0.8.0.4.g99987af-1-x86_64.pkg.tar.xz


Build a .db file

Use the command repo-add to build a database file. Run the following commands in a terminal:

cd ~/online-repo/x86_64
repo-add online-repo.db.tar.gz *.pkg.tar.*

Every time you add packages to your online repositories, these commands need to be executed again! Otherwise, buildiso will complain later about missing packages in your online repository.

Example:

After running those commands, your online repository looks like this:

online-repo.db.tar
online-repo.db
liblxqt-git-0.8.0.23.g079768e-1-x86_64.pkg.tar.xz  
libqtxdg-git-1.0.0.7.g0503cf7-1-x86_64.pkg.tar.xz  
pcmanfm-qt-git-0.8.0.4.g99987af-1-x86_64.pkg.tar.xz


Upload online-repo to Host Server

Now you need to upload online-repo to your Host Server. Upload everything from online-repo to your Host Server. Your web address as to match the name of the directory folder you created.

Example:

This is what your web address should look like after upload online-repo to your Host Server.

64-Bit Repository

http://www.myserver.com/repository/online-repo/x86/

32-Bit Repository

http://www.myserver.com/repository/online-repo/i686


Add online-repo to your iso-profile

Create a file

${profile_dir}/user-repos.conf

Add these lines

[online-repo]
SigLevel = Never
Server = http://www.myserver.com/repository/online-repo/$repo/$arch

Example:

[online-repo]
SigLevel = Never
Server = http://www.myserver.com/repository/online-repo/$repo/$arch

Custom online repositories will get removed automatically from this file before it gets copied over to the installed system, whereas custom non-online repositories will be kept. This means AUR packages are best installed from a custom online repository (as demonstrated by [online-repo] in this tutorial). Packages neither available in the Manjaro repositories nor in the AUR are best installed from a custom non-online repository (see [infinality-bundle] as example).

Add package names to ISO profile

Using the example mentioned in here, you can now add the AUR package names to your Packages-Xfce file.

Attention: You need to add all dependency names before the package name (only for dependencies from the AUR).

Example:

You can now add pcmanfm-qt-git to your package list for your ISO profile. This means your /usr/share/manjaro-tools/iso-profiles/official/xfce/Packages-Xfce file should look exactly like this:

## XFCE Main Packages
ffmpegthumbnailer
gconf # fix qt-theme
gnome-keyring # fix wlan segfault
gufw # firewall
accountsservice
lightdm-gtk-greeter
lightdm-gtk-greeter-settings
light-locker
manjaro-settings-manager
menulibre

...

## AUR packages
libqtxdg-git
liblxqt-git 
pcmanfm-qt-git

The order of package installations to your ISO is from top to bottom. Please note the exact order of the last 3 packages. pcmanfm-qt-git depends on liblxqt-git, which depends on libqtxdg-git (see chapter 4.1). Therefore, liblxqt-git needs to be the first package, which gets installed!


Cleaning build environment

For removing your build environment from your hard drive, execute:

sudo rm -r /var/lib/manjaro-tools/buildpkg


More

Now, you can continue to adjust your manjaro-tools.conf or build your ISO.


Please remember to install yaourt, octopi, or pamac on your ISO, too. Only these Programs can update packages from the AUR.