Manjaro Difference between revisions of "Buildiso with AUR packages: Using buildpkg"

Difference between revisions of "Buildiso with AUR packages: Using buildpkg"

From Manjaro
imported>Excalibur1234
imported>ABOhiccups
(Updating Tutorial)
Line 2: Line 2:




This tutorial is about creating your own local 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''.
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''.




Line 8: Line 8:


The same XFCE ISO profile will be used as example on this Wiki page.
The same XFCE ISO profile will be used as example on this Wiki page.
{{note| As of today, using a local repository is no longer supported. Instead, upload the packages, data base files, etc. to an online repository. This ensures that everybody can build the same Manjaro ISO as you the same way you do.}}




==Create directories==
==Create directories==


The first thing you should probably do is create a directory for your local repository. The local repository is called <code>local-repo</code> throughout this entire tutorial. This'll help keep things organized. Your repository will include two subdirectories for the different architectures:
The first thing you should probably do is create a directory for your online repository. The online repository is called <code>online-repo</code> throughout this entire tutorial. This'll help keep things organized. Your repository will include two subdirectories for the different architectures:


   mkdir -p ~/local-repo/i686 ~/local-repo/x86_64
   mkdir -p ~/online-repo/i686 ~/online-repo/x86_64


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




Next, you need to create a build directory. During the course of this tutorial you will need it as a temporary directory for files from the AUR:
Next, you need to create a build directory. During the course of this tutorial you will need it as a temporary directory for files from the AUR:


   mkdir -p ~/local-build/
   mkdir -p ~/online-build/


This temporary build directory is created in your home folder, but you can create it anywhere you want.
This temporary build directory is created in your home folder, but you can create it anywhere you want.
Line 30: Line 28:
==Download package files from AUR using yaourt==
==Download package files from AUR using yaourt==


Now, go to your local build directory:
Now, go to your online build directory:


  cd ~/local-build
  cd ~/online-build


Next do
Next do
Line 41: Line 39:


===Example:===
===Example:===
You want to add the package <code>pcmanfm-qt-git</code> to your ISO. Therefore, you need to download it to your local repository first. You download and unpack it using
You want to add the package <code>pcmanfm-qt-git</code> 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
  yaourt -G pcmanfm-qt-git


You see a new <code>PKGBUILD</code> file in your local build directory:
You see a new <code>PKGBUILD</code> file in your online build directory:


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




Line 54: Line 52:
Up to this point, you have only downloaded and unpacked files from the AUR. Next, you need to build those files into proper packages:
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 ~/local-build
  cd ~/online-build


  buildpkg -p <package name>
  buildpkg -p <package name>




If you want to build 32bit packages on a 64bit system, you can do this by specifying the architecture:
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>  
  buildpkg -a i686 -p <package name>  
Line 105: Line 103:




==Copy package files to local repository==
==Copy package files to online repository==


In the last chapter you have built packages. These packages were created in this directory on your system:
In the last chapter you have built packages. These packages were created in this directory on your system:
Line 111: Line 109:
  /var/cache/manjaro-tools/
  /var/cache/manjaro-tools/


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


  /var/cache/manjaro-tools/pkg/unstable/x86_64
  /var/cache/manjaro-tools/pkg/unstable/x86_64
Line 118: Line 116:




Move all package files to your local repository:
Move all package files to your online repository:


  ~/local-repo/x86_64
  ~/online-repo/x86_64


===Example:===
===Example:===
Your local repository should now look like this:
Your online repository should now look like this:


  liblxqt-git-0.8.0.23.g079768e-1-x86_64.pkg.tar.xz   
  liblxqt-git-0.8.0.23.g079768e-1-x86_64.pkg.tar.xz   
Line 134: Line 132:
Use the command <code>repo-add</code> to build a database file. Run the following commands in a terminal:
Use the command <code>repo-add</code> to build a database file. Run the following commands in a terminal:


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


Every time you add packages to your local repositories, these commands need to be executed again! Otherwise, ''buildiso'' will complain later about missing packages in your local repository.
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:===
===Example:===
After running those commands, your local repository looks like this:
After running those commands, your online repository looks like this:


  local-repo.db.tar
  online-repo.db.tar
  local-repo.db
  online-repo.db
  liblxqt-git-0.8.0.23.g079768e-1-x86_64.pkg.tar.xz   
  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   
  libqtxdg-git-1.0.0.7.g0503cf7-1-x86_64.pkg.tar.xz   
Line 149: Line 147:




==Add local-repo to pacman-XXXXX.conf file==
==Upload online-repo to Host Server==


Attention: The pacman configuration file is different for 32bit and 64bit systems: On 64bit systems the <code>[multilib]</code> repository is included.
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.
Copy and paste the template <code>pacman-default.conf</code> (for 32bit) and / or <code>pacman-multilib.conf</code> from <code>/usr/share/manjaro-tools/</code> to <code>manjaro-tools-iso-profiles/xfce/</code>


At the bottom of your new <code>pacman-XXXXX.conf</code> files, add:
===Example:===
This is what your web address should look like after upload online-repo to your Host Server.


  [local-repo]
64-Bit Repository
SigLevel = Never
  http://www.myserver.com/repository/online-repo/x86/
  Server = file:///home/'''<username>'''/$repo/$arch
 
32-Bit Repository
  http://www.myserver.com/repository/online-repo/i686
 
 
==Add online-repo to pacman-XXXXX.conf file==


Replace <code><username></code> with your username.
Attention: The pacman configuration file is different for 32-Bit and 64-Bit systems: On 64-Bit systems the <code>[multilib]</code> repository is included. On 32-Bit systems the <code>[default]</code> repository is included.


===Example:===
Open <code>/usr/share/manjaro-tools/pacman-XXXXX.conf</code> with a Text Editor.
Your customized XFCE ISO profile should now look like this (for building 64bit ISOs):


xfce-overlay
At the bottom of <code>pacman-XXXXX.conf</code> files, add:
isolinux -> ../shared/isolinux/
mkinitcpio.conf -> ../shared/mkinitcpio.conf
overlay -> ../shared/overlay/
overlay-livecd -> ../shared/overlay-livecd/
Packages -> ../shared/Packages-Systemd
Packages-Livecd -> ../shared/Packages-Livecd-Systemd
Packages-Xfce
Packages-Xorg -> ../shared/Packages-Xorg
'''pacman-multilib.conf'''
profile.conf


You can have both <code>pacman-multilib.conf</code> and <code>pacman-default.conf</code> files in your profile directory. The <code>pacman-default.conf</code> file will get used by ''buildiso'' to build 32bit ISOs and <code>pacman-multilib.conf</code> will get used for 64bit ISOs.
[online-repo]
SigLevel = Never
Server = http://www.myserver.com/repository/online-repo/$repo/$arch


===Example:===
Your new <code>pacman-multilib.conf</code> file looks like this:
Your new <code>pacman-multilib.conf</code> file looks like this:


Line 221: Line 216:
  #VerbosePkgLists
  #VerbosePkgLists
   
   
  # By default, pacman accepts packages signed by keys that its local keyring
  # By default, pacman accepts packages signed by keys that its online keyring
  # trusts (see pacman-key and its man page), as well as unsigned packages.
  # trusts (see pacman-key and its man page), as well as unsigned packages.
  SigLevel    = Required DatabaseOptional
  SigLevel    = Required DatabaseOptional
Line 227: Line 222:
  #RemoteFileSigLevel = Required
  #RemoteFileSigLevel = Required
   
   
  # NOTE: You must run `pacman-key --init` before first using pacman; the local
  # NOTE: You must run `pacman-key --init` before first using pacman; the online
  # keyring can then be populated with the keys of all official Manjaro Linux
  # keyring can then be populated with the keys of all official Manjaro Linux
  # packagers with `pacman-key --populate archlinux manjaro`.
  # packagers with `pacman-key --populate archlinux manjaro`.
Line 235: Line 230:
  #  - can be defined here or included from another file
  #  - can be defined here or included from another file
  #  - pacman will search repositories in the order defined here
  #  - pacman will search repositories in the order defined here
  #  - local/custom mirrors can be added here or in separate files
  #  - online/custom mirrors can be added here or in separate files
  #  - repositories listed first will take precedence when packages
  #  - repositories listed first will take precedence when packages
  #    have identical names, regardless of version number
  #    have identical names, regardless of version number
Line 279: Line 274:
  #Server = file:///home/custompkgs
  #Server = file:///home/custompkgs
   
   
  [local-repo]
  [online-repo]
  SigLevel = Never
  SigLevel = Never
  Server = file:///home/excalibur/$repo/$arch
  Server = http://www.myserver.com/repository/online-repo/$repo/$arch


As you can see, there is also another custom repository in this <code>pacman-multilib.conf</code> file: <code>[infinality-bundle]</code>. But it is commented out. This illustrates nicely the way to add a custom non-local repository.
As you can see, there is also another custom repository in this <code>pacman-multilib.conf</code> file: <code>[infinality-bundle]</code>. But it is commented out. This illustrates nicely the way to add a custom non-online repository.


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




Line 295: Line 290:


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


  ## XFCE Main Packages
  ## XFCE Main Packages

Revision as of 19:14, 2 June 2016


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 entire tutorial. This'll help keep things organized. Your repository will include two subdirectories for the different architectures:

 mkdir -p ~/online-repo/i686 ~/online-repo/x86_64

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


Next, you need to create a build directory. During the course of this tutorial you will need it as a temporary directory for files from the AUR:

 mkdir -p ~/online-build/

This temporary build directory 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 pacman-XXXXX.conf file

Attention: The pacman configuration file is different for 32-Bit and 64-Bit systems: On 64-Bit systems the [multilib] repository is included. On 32-Bit systems the [default] repository is included.

Open /usr/share/manjaro-tools/pacman-XXXXX.conf with a Text Editor.

At the bottom of pacman-XXXXX.conf files, add:

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

Example:

Your new pacman-multilib.conf file looks like this:

#
# /etc/pacman.conf
#
# See the pacman.conf(5) manpage for option and repository directives

#
# GENERAL OPTIONS
#
[options]
# The following paths are commented out with their default values listed.
# If you wish to use different paths, uncomment and update the paths.
#RootDir     = /
#DBPath      = /var/lib/pacman/
#CacheDir    = /var/cache/pacman/pkg/
#LogFile     = /var/log/pacman.log
#GPGDir      = /etc/pacman.d/gnupg/
HoldPkg     = pacman glibc
# If upgrades are available for these packages they will be asked for first
SyncFirst    = manjaro-system
#XferCommand = /usr/bin/curl -C - -f %u > %o
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
#CleanMethod = KeepInstalled
#UseDelta    = 0.7
Architecture = auto

# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
#IgnorePkg   =
#IgnoreGroup =

#NoUpgrade   =
#NoExtract   =

# Misc options
#UseSyslog
#Color
#TotalDownload
# We cannot check disk space from within a chroot environment
#CheckSpace
#VerbosePkgLists

# By default, pacman accepts packages signed by keys that its online keyring
# trusts (see pacman-key and its man page), as well as unsigned packages.
SigLevel    = Required DatabaseOptional
LocalFileSigLevel = Optional
#RemoteFileSigLevel = Required

# NOTE: You must run `pacman-key --init` before first using pacman; the online
# keyring can then be populated with the keys of all official Manjaro Linux
# packagers with `pacman-key --populate archlinux manjaro`.

#
# REPOSITORIES
#   - can be defined here or included from another file
#   - pacman will search repositories in the order defined here
#   - online/custom mirrors can be added here or in separate files
#   - repositories listed first will take precedence when packages
#     have identical names, regardless of version number
#   - URLs will have $repo replaced by the name of the current repo
#   - URLs will have $arch replaced by the name of the architecture
# 
# Repository entries are of the format:
#       [repo-name]
#       Server = ServerName
#       Include = IncludePath
#
# The header [repo-name] is crucial - it must be present and
# uncommented to enable the repo.
#

# The testing repositories are disabled by default. To enable, uncomment the
# repo name header and Include lines. You can add preferred servers immediately
# after the header, and they will be used before the default mirrors.

[core]
Include = /etc/pacman.d/mirrorlist

[extra]
Include = /etc/pacman.d/mirrorlist

[community]
Include = /etc/pacman.d/mirrorlist

# If you want to run 32 bit applications on your x86_64 system,
# enable the multilib repositories as required here.

[multilib]
Include = /etc/pacman.d/mirrorlist

#[infinality-bundle]
#SigLevel = Never
#Server = http://bohoomil.com/repo/$arch

# An example of a custom package repository.  See the pacman manpage for
# tips on creating your own repositories.
#[custom]
#SigLevel = Optional TrustAll
#Server = file:///home/custompkgs

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

As you can see, there is also another custom repository in this pacman-multilib.conf file: [infinality-bundle]. But it is commented out. This illustrates nicely the way to add a custom non-online repository.

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.

Cookies help us deliver our services. By using our services, you agree to our use of cookies.