xpam.pl

Lib packaging for your own repo

This is a note to self about the release procedure and distro packaging of a development library.

This instructions expect aptly and createrepo to be preinstalled on your repo server together with a valid GPG key.

Packaging a .deb

1. Checkout the release tag and build the deb according to README. Each build should be done on the same machine as the target distribution. If I am packaging for Centos 6 I am also building on Centos 6. If CMake and CPack are set up correctly it usually boils down to:

cmake -G "Unix makefiles" -H./ -B./build
cd build
make
cpack -G "DEB"

If the project is missing CMake, refuse to package it.

2. Check that deb info is correct:
dpkg-deb -I bncsutil-1.4.1-Linux.deb
3. Rename it to distro you are building on, then scp to your repo server
mv bncsutil-1.4.1-Linux.deb bncsutil-1.4.1-Debian9.deb
4. If aptly repo does not exist yet, create it
aptly repo create -comment="Debian 9 repo" -component="main" -distribution="bnetdocs-stretch" debian9
Ideally you only create the repo the first time, for future updates you create a snapshot of it, add a package, then switch the repo to new snapshot. See aptly docs for more.

Alternatively, you can just add more packages and update the repo with
aptly publish update bnetdocs-stretch debian9
 

5. Add package to repo
aptly repo add debian9 deb_archives/bncsutil-1.4.1-Debian9.deb
6. Publish repo
aptly publish repo debian9 debian9
7. On target machine, add repo to /etc/apt/sources.list and fetch public key
deb http://apt.xpam.pl/debian8/ bnetdocs-stretch main
wget -qO - https://apt.xpam.pl/xpam.pl-pubkey.asc | sudo apt-key add -
8. Update and then check if package info is correct
apt-cache show bncsutil
9. If big mistakes were made
aptly publish drop debian9 debian9
..and start over. Repeat for Debian 8 etc.

Packaging an .rpm

1. See the previous #1. The only difference is
cpack -G "RPM"
2. Check that rpm info is correct
rpm -qip bncsutil-1.4.1-Linux.rpm
3. Rename it to distro you are building on, then scp to your repo server
mv bncsutil-1.4.1-Linux.rpm bncsutil-1.4.1-Centos7.rpm
4. Make sure you have .rpmmacros file in home dir with uid of gpg signing key (check out your keys with gpg –list-keys). If you don’t have one, generate it. Entry in the file should look like:
%_gpg_name <uid here>
5. Sign rpm
rpm --addsign rpm_archives/bncsutil-1.4.1-Centos7.rpm
4. Move to appropriate repo that was created by createrepo earlier (see createrepo docs)
mv rpm_archives/bncsutil-1.4.1-Centos7.rpm .createrepo-centos7/
5. Update repo metadata
createrepo --update ./.createrepo-centos7/
6. Add your repo on the target machine

yum -y install yum-utils
yum-config-manager --add-repo https://centos7.rpm.xpam.pl
yum-config-manager --enable https://centos7.rpm.xpam.pl
rpm --import https://centos7.rpm.xpam.pl/xpam.pl-pubkey.asc

Since createrepo is pretty much just an http server you can simply delete an rpm and update the metadata in case things go south.

Repeat for Centos 6 etc.

1924 Total Views 2 Views Today


Cen
GitHub
Eurobattle.net
Lagabuse.com
Bnetdocs

Posted

in

,

by

Tags: