Project packaging


The local builder allows the projects to be packaged locally. Here is an example of a simple use of this tool in the case of project packaging.

After following the “getting started for a developer” chapter, you will have at least one project with one application. The application chosen for the example is helloworld-binding.

In case you did not follow those instructions, the only command you need, is to create a project and a helloworld-binding application. ONLY execute this command if you did not before

rp-cli projects add --name "my awesome project" --description "My first project in redpesk CI" --mandatory-distro redpesk-lts-batz-2.0-update --mandatory-arch x86_64 --optional-arch aarch64

Please be sure to have rp-cli installed, configured and connected to a local builder. Refer to local builder installation

$ rp-cli applications list

ID                                     Name                 Slug                 Project
a3968638-58ae-41bd-9d9f-2e605fdceb87   Helloworld binding   helloworld-binding   my-awesome-project-1

This command shows your application Helloworld binding in the project described before.

Steps to follow

Initialize the project

In this step, rp-cli retrieves the corresponding application in redpesk UI.

rp-cli local package init helloworld-binding --project my-awesome-project-1

Apply your modifications

As it is precised in the message after initialization:

The spec file 'helloworld-binding.spec' has been copied to '~/my_rp_builder_dir/gitpkgs/helloworld-binding'
Please modify '~/my_rp_builder_dir/gitpkgs/helloworld-binding/helloworld-binding.spec' while working on packaging, only this specfile is used when running 'rp-cli local package run'

You can work on the spec file in your host here: ~/my_rp_builder_dir/gitpkgs/helloworld-binding/helloworld-binding.spec

Run to do the packaging

Once spec file modifications done, rp-cli is ready to build the package locally. Just choose between native and cross packaging by select the target in the command line as below:

Cross packaging

# If the target flag is not present, the default target is aarch64
rp-cli local package build helloworld-binding --target aarch64 --project my-awesome-project-1

Native packaging

rp-cli local package build helloworld-binding --target x86_64 --project my-awesome-project-1

Upload the new specfile

If the package was correctly built in the previous step, it is possible to upload the spec file in the UI using the following command:

rp-cli applications upload helloworld-binding ~/my_rp_builder_dir/gitpkgs/helloworld-binding/helloworld-binding.spec

Tips and tricks

If you want to make some changes for local use, as in this case, you can do it like this:

rp-cli local package build helloworld-binding --target aarch64 --project my-awesome-project-1 --shell

When you are in the mock, you can see that all directories are empty the first time.

<mock-chroot> sh-4.4# ls -R









That’s why it is necessary to firstly run the packaging with the -N option to keep the generated content of the mock inside it.

rp-cli local package build helloworld-binding --target aarch64 --project my-awesome-project-1 -N

Once the build is finished, you can replay the command with the --shell flag in order to enter the mock and interact with it.

rp-cli local package build helloworld-binding --target aarch64 --project my-awesome-project-1 -N --shell

You can then start building manually inside the mock

cd build/BUILD/helloworld-binding-1.0.1/
mkdir build && cd build
cmake ..

If everything is correct, you will have something like:

<mock-chroot> sh-4.4# cmake ..
-- The C compiler identification is GNU 8.4.1
-- The CXX compiler identification is GNU 8.4.1


-- Generating done
-- Build files have been written to: /builddir/build/BUILD/helloworld-binding-1.0.1/build

This is useful when you made some changes locally that you want to test quickly:

<mock-chroot> sh-4.4# make -j
Scanning dependencies of target htdocs
Scanning dependencies of target helloworld-skeleton
Scanning dependencies of target helloworld-subscribe-event
Scanning dependencies of target helloworld-config
Scanning dependencies of target test-files
Scanning dependencies of target prepare_package
Scanning dependencies of target prepare_package_test
Scanning dependencies of target autobuild
Scanning dependencies of target fixture-files
[  3%] Generating package
[  7%] Generating htdocs


[100%] Built target helloworld-binding_build_done

The method above is using the --target aarch64 option. This means that the package is built for an aarch64 architecture. However the same process can be followed for an x86_64 target, the only thing to change is the value of the --target flag: --target x86_64.

It is also possible to install a specific package inside the mock from rp-cli command line. Indeed, this is impossible from inside since the mock has no internet connection. To do that, use the --install flag like in the example below.

# Install jq package in the mock
rp-cli local package build helloworld-binding --target aarch64 --project my-awesome-project-1 -N --install jq