Project packaging

Introduction

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 choosen for the example is helloworld-binding.

Please be sure to have rp-cli installed, configurated 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.

First step: 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

Second step: 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

Third step: 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:

Native packaging

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

Cross packaging

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

Fourth step: upload the new spec file

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 --file-path ~/my_rp_builder_dir/gitpkgs/helloworld-binding/helloworld-binding.spec