Sat Oct 27 13:21:35 2018 UTC

Scenario D

Introduction

You do not want to compile everything; you are satisfied with binaries available.

Your new packages use dependencies from existing binaries.

This scenario is probably the longest to implement, but once everything is in place, personal packages can be added very quickly.

The /etc/cards.conf file

A folder containing my personal packages is added. Neither this nor the collection folders should be updated by the cards sync command, so we do not specify a URL (updating libraries that you have built packages against could break those packages).

Only the base collection must remain active, this allows the rsync command to be downloaded and installed if not already installed.

The folder containing the build logs is defined

I do not need to specify the locales, they will always installed.

Directory folders define the basic system, in case a return to a base is required

The typical contents of your /etc/cards.conf file for the Scenario D:

dir /srv/www/x86_64/rolling/personnal
dir /srv/www/x86_64/rolling/gui
dir /srv/www/x86_64/rolling/cli
dir /srv/www/x86_64/rolling/base
dir /var/lib/pkg/depot/base|http://downloads.nutyx.org
dir /var/lib/pkg/depot/base-extra|http://downloads.nutyx.org
logdir /var/log/pkgbuild
base /srv/www/x86_64/rolling/base
base /srv/www/x86_64/rolling/tokeep

Installing development tools

For this scenario, we will synchronize all binaries available on the NuTyX mirror and will stick to these versions.

Let's start by installing all the development tools: C compiler, C and C++ library, etc.

get cards.devel

Lines pointing to the URL of the NuTyX mirror can now be removed, so that cards sync is deactivated.

The new /etc/cards.conf file:

dir /srv/www/x86_64/rolling/personnal
dir /srv/www/x86_64/rolling/gui
dir /srv/www/x86_64/rolling/cli
dir /srv/www/x86_64/rolling/base
logdir /var/log/pkgbuild
base /srv/www/x86_64/rolling/base
base /srv/www/x86_64/rolling/tokeep

Synchronising binaries with rsync

This is to fetch packages available as binaries from the base,cli and gui collections. It can last from several minutes to several hours depending on your connection.

Fortunately, this operation only takes so much time the first time you do it. Laughing Laughing Laughing.

Your next update using rsync will be a lot faster, as only necessary files will be updated according to your system.

Note the destination folder, I decided to move the binaries to the root of the http server Tongue out.

Your next step is to create the following folders:

sudo mkdir -p /srv/www/x86_64/rolling/{personal,tokeep}

We can now synchronize all the binaries:

for i in base cli gui; do sudo rsync -avz --delete-after rsync://downloads.nutyx.org/nutyx/x86_64/rolling/$i/ \
/srv/www/x86_64/rolling/$i/;done

Go and make a nice big cup of hot medium roasted Java or two, order your favorite Chinese/pizza take-away, or a tasty burger with some french fries, or whatever suits your palate. Or read a Linux Journal.. Laughing. This will take quite some time... .

The /etc/pkgmk.conf file

For this scenario, it is essential to check all the variables necessary for the proper functioning of the pkgmk and cards commands.

My processor is a dual core.

My source files are stored in a common folder; I do not want them to be deleted.

So as not to overpopulate my disk or lose work when running the command: rsync --delete-after rsync: //downloads.nutyx.org/nutyx/x86_64/rolling/ /srv/www/x86_64/rolling/ I prefer to use a temporary working folder:

PKGMK_SOURCE_DIR="/srv/www/sources"
PKGMK_KEEP_SOURCES="yes"
PKGMK_WORK_DIR="/tmp/work"

In this scenario, I want to install my dependencies without compiling them locally. I need the .PKGREPO file to be generated in the ports folder. I want to use the cards install or get command to be able to reinstall my available binaries. The pkgmk must generate the .PKGREPO file of my personal collection.

PKGMK_IGNORE_REPO="no"
PKGMK_IGNORE_COLLECTION="no"

Due to existing binary dependencies and the fact that these binary packages are split into parts, it is best to do the same for your personal packages. The locales produced will number 12 in total, including the local default:

PKGMK_GROUPS=(devel man doc service)
PKGMK_LOCALES=(ar fr de it es nl ja pt da nn sv fi)

We want all binary packages to have the same compression format as the official binaries; this is not obligatory but we want to maintain uniformity between all compressed binaries. I do not want to remove my created binaries after installation.

PKGMK_COMPRESSION_PACKAGE="yes"
PKGMK_COMPRESSION_MODE="xz"
PKGMK_CLEAN="no"

Here's what your /etc/pkgmk.conf file may look like for Scenario D:

export CFLAGS="-O2 -pipe"
export CXXFLAGS="${CFLAGS}"
case ${PKGMK_ARCH} in
    "x86_64"|"")
       export MAKEFLAGS="-j2"
       ;;
    "i686")
       export CFLAGS="${CFLAGS} -m32"
       export CXXFLAGS="${CXXFLAGS} -m32"
       export LDFLAGS="${LDFLAGS} -m32"
       ;;
    *)
       echo "Unknown architecture selected! Exiting."
       exit 1
       ;;
esac
PKGMK_SOURCE_DIR="/srv/www/sources"
PKGMK_KEEP_SOURCES="yes"
PKGMK_WORK_DIR="/tmp/work"
PKGMK_IGNORE_REPO="no"
PKGMK_IGNORE_COLLECTION="no"
PKGMK_GROUPS=(devel man doc service)
PKGMK_LOCALES=(fr de it es nl pt da nn sv fi)
PKGMK_COMPRESSION_PACKAGE="yes"
PKGMK_COMPRESSION_MODE="xz"
PKGMK_CLEAN="no"

Conclusion

For this scenario, the commands to remember are:

cards level
cards base -r
cards create
for i in base cli gui; do rsync -avz --delete-after rsync://downloads.nutyx.org/nutyx/x86_64/rolling/$i/ \
/srv/www/x86_64/rolling/$i/;done