Packaging simple Linux packages¶
Before starting, we assume several conditions:
you have a graphical interface on your Linux system;
you have installed the vscode package from the Tranquil IT repository;
your user is named linuxuser and is a member of the sudoers group;
create a base template from you linux computer¶
start up a Command Line utility;
as linuxuser, create a WAPT package template;
wapt-get make-template <template_name>
Warning
Do not launch this command as root or with sudo.
When you create a template, there will be several files in the folder
.vscode
inside your package folder:settings.json;
launch.json;
Example with VLC:
wapt-get make-template "tis-vlc" Using config file: /opt/wapt/wapt-get.ini Template created. You can build the WAPT package by launching /opt/wapt//wapt-get.py build-package /home/linuxuser/waptdev/tis-vlc-wapt You can build and upload the WAPT package by launching /opt/wapt//wapt-get.py build-upload /home/linuxuser/waptdev/tis-vlc-wapt
Hint
All packages are stored in linuxuser’s home.
VSCode loads up and opens package project.
check the
control
file content;You have to give a description to you package, give the os_target and the version of you package.
Hint
os_target for unix is linux
Warning
version in you
control
file must start at 0, not the version number of the software, we don’t know precisely from apt/yum repo which version will be.Original control file
package : tis-vlc version : 0-0 architecture : all section : base priority : optional maintainer : user description : automatic package for vlc
Modified control file
package : tis-vlc version : 0 architecture : all section : base priority : optional maintainer : Tranquil-IT Systems description : VLC for linux target_os : linux min_wapt_version : 1.8
Note
It is to be noted that a sub-version -1 has been added. It is the packaging version of WAPT package.
It allows the Package Developer to release several WAPT package versions of the same software.
make changes to the code in the
setup.py
file accordingly;:emphasize-lines: 8 # -*- coding: utf-8 -*- from setuphelpers import * uninstallkey = [] def install(): apt_install('vlc')
save the package;
Managing the uninstallation¶
make changes to the
setup.py
file with an uninstall ;
def uninstall(): apt_remove('vlc')
launch a remove from VSCode Run Configurations;
check that the software has been correctly removed
dpkg -l | grep vlc
Hint
In the uninstall() function, it is not possible to call for files included inside the WAPT package. To call files from the package, it is necessary to copy/ paste the files in a temporary directory during package installation.
Managing the session-setup¶
make changes to the
setup.py
file with an session-setup ;In this example, you’ll need a
vlcrc
file in your package to copy in home user.ensure_dir
function andfilecopyto
are from setuphelpers, the first one will test if the path exists, the second one will copy your file from the WAPT package to its destination.def session-setup(): vlcdir = os.path.join(os.environ['HOME'], '.config', 'vlc') ensure_dir(vlcdir) filecopyto('vlcrc',vlcdir)
launch a session-setup from VSCode Run Configurations;
Build and upload the package¶
Once the installation and the de-installation are configured and tested and the package is customized to your satisfaction, you may build and upload your new WAPT package onto your WAPT repository.
If you have built packages on a different machine (ex: Windows
for building your Windows WAPT packages), you have to copy your .pem
and .crt keys on your Linux machine with WinSCP
or equivalent. Usually, this certificate bundle will be located
in C:\private
on your Windows computer.
Then, provide the path to the certificates in /opt/wapt/wapt-get.ini
.
sudo vim /opt/wapt/wapt-get.ini
provide the path to your certificate;
personnal_certificate_path=/opt/wapt/private/mykey.crt
then launch a build-upload from VSCode Run Configurations;
provide the password to your private key then admin/password of your waptconsole;
Your package is now uploaded and available in your private repository on your WAPT server.