Skip to content

Uploading and Releasing

matty0ung edited this page Aug 13, 2022 · 23 revisions

Uploading and Releasing

Users have to get the binaries somehow. We make binary packages for redhat and debian systems, and post them to Launchpad. This document explains how to do the building and uploading.

Note that, as of the 2.4.0 release, we have retired the debian-packaging and redhat-packaging repositories (which were previously used to do somewhat manual creation of .deb and .rpm packages for Linux). Instead we now build Linux packages from the main repository via CMake/CPack, which should be considerably less work to maintain.

Overview

  1. Sanity check that everything builds and main functionality seems to work, per https://github.com/Brewtarget/brewtarget/wiki/Release-Checks
  2. (TBD) Create release branch on GitHub? (Major vs point release -- eg 2.4 vs 2.4.1?)
  3. Create source packages
  4. Create 64-bit redhat and debian packages
  5. Create 32-bit windows NSIS installer
  6. (TBD) Create some sort of package for Mac?
  7. Upload to github Brewtarget release page
  8. Create special source packages for Ubuntu PPA
  9. Upload those to "brewtarget-releases" Ubuntu PPA
  10. (TBD) Upload releases to GitHub?

For the purposes of this tutorial, I will assume that the brewtarget git repository is going to be in ~/brewtarget-release and that we are building the 2.4.0 version. Further, I assume we have the debian and redhat packaging repositories cloned to ~/debian-packaging and ~/redhat-packaging.

You will also need gpg to be set up with a set of keys to do signing. My public key has a fingerprint that ends with 414D03F7. Whatever yours is, replace ${GPG_KEY} with that value when you see it in this document.

First, we need to checkout the correct version of brewtarget and its packaging. You should do this from the original repo, not your clone. Some of the commands below will obviously only be needed the first time you build a release. But note in particular that we want to ensure the files in ~/debian-packaging/debian are up-to-date, and that there is no build output in ~/brewtarget-release. (The packaging process involves running the build from scratch with "release" compile flags which are a bit different than the ones typically used during development.)

  $ cd ~/brewtarget-release
  $ git clone https://github.com/Brewtarget/brewtarget.git .
  $ git checkout stable/2.4.0
  $ ./configure
  $ cd build
  $ make clean
  $ cd ..
  $ mkdir ../debian-packaging
  $ cd ../debian-packaging
  $ git clone https://github.com/Brewtarget/debian-packaging.git .
  $ mkdir ../redhat-packaging
  $ cd ../redhat-packaging
  $ git clone https://github.com/Brewtarget/redhat-packaging.git .

Debian Binaries

Start here, because we can cheat a little and save ourselves some work.

As explained at https://www.debian.org/doc/manuals/debmake-doc/ch05.en.html and https://wiki.debian.org/Packaging/SourcePackage, Debian packages come in two forms:

  • source package is (at minimum) a *.dsc description file and a *.tar.gz tarball file (containing all the source and build scripts etc necessary to build the application)
  • binary package is a single *.deb special archive file which holds a set of installable binary data with its associated information

We currently build both, though most end users are just going to need the binary package.

  $ cd ~/brewtarget-release
  $ cd ../debian-packaging
  $ ./createorig.sh ../brewtarget-release 2.4.0
  $ cd brewtarget-2.4.0
  $ dpkg-checkbuilddeps

If the last command lists unmet dependencies then you need to fix these before proceeding. Most probably this is out-of-date info in /debian-packaging/debian/control. Now we run dpkg-buildpackage to build the Debian package, as part of which all our source code gets compiled. (The -us and -uc options on mean "Do not sign the source package" and "Do not sign the .buildinfo and .changes files".)

  $ dpkg-buildpackage -us -uc
  $ cd ..
  $ lintian --pedantic *.changes --profile debian
  P: brewtarget source: uses-debhelper-compat-file

The lintian command checks the package we just built for "common inconsistencies and errors". (See https://lintian.debian.org/manual/index.html for more info.) If you are really on Debian, you won't need the --profile debian switch. I use Ubuntu for brewtarget work, so I had to. I found no way to get rid of the warning from lintian, and the dpkg-buildpackage will die if the file isn't there.

Check the output of lintian. If there are errors (lines beginning E: ) or warnings (lines beginning W: ), you'll want to fix these and rebuild the package. Ideally we should also have as few pedantic warnings (lines beginning P: ) as possible.

Once dpkg-buildpackage and lintian run clean, we should have a bunch of files. We are interested in:

* brewtarget_2.4.0-1.debian.tar.xz, 
* brewtarget_2.4.0-1_amd64.deb, 
* brewtarget_2.4.0-1_amd64.changes, 
* brewtarget_2.4.0-1.dsc, and
* brewtarget_2.4.0.orig.tar.xz

We can use that last file as input to the Redhat build process, so copy that from your ubuntu system to your redhat/centos/opensuse system.

Redhat Binaries

Put the source tarball where rpmbuild expects and build

    $ cp ~/brewtarget_2.4.0.orig.tar.xz ~/rpmbuild/SOURCES/
    $ rpmbuild -ba ~/redhat-packaging/brewtarget.spec

The RPMs we need will be:

* ~/rpmbuild/RPMS/x86_64/brewtarget-2.4.0-1.x86_64.rpm, and
* ~/rpmbuild/SRPMS/brewtarget-2.4.0-1.src.rpm.

Windows build

This is the hard one. I am not going to explain how to set up a full Windows build system here, because I am not honestly certain I know how I did it. I do find I need an odd combination of powershell and qt-creator to make this work -- qt creator to generate the cmake files and build directory, and powershell to run the make.

* get the most recent version of NSIS (Null Soft Installer System), which is what we use for this.
* make sure makensis.exe can be found in your path. 
* install the Locate plugin. At the time of the 2.4.0 release, I found I had to manually copy the Locate.dll into NSIS\plugins\x86-ansi directory.
* install the nsilog plugin as well

Once you have all that, open a PowerShell and run this:

  $ G:
  $ cd distbuild/brewtarget/build
  $ /QT/Tools/mingw810_32/bin/mingw32-make.exe package
  ...
  ...
  Run CPack packaging tool...
  CPack: Create package using NSIS
  CPack Warning: CPACK_SET_DESTDIR is set to ON but it is usually a bad idea to do that with 'NSIS' generator. Use at your own risk.
  CPack: Install projects
  CPack: - Run preinstall target for: brewtarget
  CPack: - Install project: brewtarget []
  CPack: Create package
  CPack: - package: G:/distbuild/brewtarget/build/brewtarget_2.4.0_AMD64.exe generated.

The executable you need is mentioned at the end

This all needs fixed, but I am not there yet. We don't use launchpad and I don't know if need the gpg stuff yet.

Launchpad Upload

For each file to upload, sign it with

$ gpg --armor --sign --detach-sig ${FILE}

where ${FILE} is the file to upload. Launchpad will ask for the file as well as this signature when you upload.

Go to the Launchpad release page and upload

  • ~/brewtarget_2.1.0.orig.tar.xz
  • ~/brewtarget_2.1.0-1.debian.tar.xz
  • ~/brewtarget_2.1.0-1.*.src.rpm
  • ~/brewtarget_2.1.0-1_i386.deb
  • ~/brewtarget_2.1.0-1_amd64.deb
  • ~/brewtarget_2.1.0-1.*.i686.rpm
  • ~/brewtarget_2.1.0-1.*.x86_64.rpm

Ubuntu PPA Source Packages

Refer to the Launchpad PPA Uploading guide. The brewtarget-releases PPA is a package repository that Ubuntu users can add to their apt sources to grab the newest version of brewtarget when they upgrade their packages.

First, install dput and modify ~/.dput.cf to include the brewtarget-releases PPA.

[brewtarget-releases]
fqdn = ppa.launchpad.net
method = ftp 
incoming = ~brewtarget-devs/brewtarget-releases/ubuntu
login = anonymous
allow_unsigned_uploads = 0

Now create a special changelog for the PPA.

$ cd ~/brewtarget-2.1.0/debian

In the changelog, change

brewtarget (2.1.0-1) unstable; urgency=low

to

brewtarget (2.1.0-1ppa1~trusty1) trusty; urgency=low

Then, build the "trusty" source package:

$ cd ..
$ debuild -S -k${GPG_KEY}

Upload with:

$ dput brewtarget-releases *.trusty1_source.changes

The Launchpad PPA server will then build the source package for the Trusty Tahr distribution in i386 and amd64 variants. If successfully built, the packages will become available for users who have added the PPA in their /etc/apt/sources.list file, and their old brewtarget package will be replaced by the new version when they do a package upgrade.