Updating a PPA package

Last time I told you I could successfully create a source package for Ubuntu, with automatic building on Ubuntu servers. But what happens when a new version of the software is released and you want to update the package? This is the case where you followed Ubuntu package guide and you have setup a Bazaar repository on Launchpad. I will use PngOptimizer as an example of course.

Create a working directory:

mkdir ppa_update
cd ppa_update

Get the source code from your Bazaar repository on your Launchpad account. "lp:" is a shortcut for Launchpad address.

bzr branch lp:~psydk/+junk/pngoptimizer-pack
cd pngoptimizer-pack

Merge the content of pngoptimizer-pack with the new version of pngoptimizer. I got a zip file from GitHub to do that. I did the merge manually, but it looks like there are ways to do it automatically. They gave me errors so for now I have to use a manual process. Overwrite files that changed, add new ones and remove old ones.

bzr add some-new-file.cpp
bzr remove deprecated-file.txt

Look at the changes, check that they look good:

bzr status

One last change: updating the changelog file in the debian/ directory. To easily add an entry with the current date, and open a text editor to fine-tune the entry, use this command:

dch -i

In the text editor that opens, you have the opportunity to set the new version. That version is important as it will be reused to create the package file name.

Here is the added entry with the current state of my Bazaar repository:

pngoptimizer (2.6~beta.2-0ubuntu2) UNRELEASED; urgency=medium


 -- Hadrien Nilsson <hadrien@psydk.org>  Mon, 19 Nov 2018 22:11:04 +0100

Let's say I made a new beta version of PngOptimizer on GitHub, I will change the entry as follow:

pngoptimizer (2.6~beta.3-0ubuntu1) bionic; urgency=medium

  * Update from Git (commit 1f2ec94)

 -- Hadrien Nilsson <hadrien@psydk.org>  Mon, 19 Nov 2018 22:11:04 +0100
  • I used ~beta.3 (the tilde is important, I used to use a "-" character but it has another meaning for packages) and I reset the number after "ubuntu".
  • I changed UNRELEASED to my current version of Ubuntu: "bionic" (Ubuntu 18.04). I am not sure if this is the correct process though.
  • I put a comment explaining the change. As I track all changes through commits on GitHub, I put the minimal information required.

When you are done, save and exit the text editor. You are ready to commit your changes:

bzr commit -m "Update from Git"

Rebuild the package to test that everything is ok:

bzr builddeb -S --split

--split is important otherwise builddeb will look for a tar.gz of the source code, which makes no sense as the source code is already there in the Bazaar repository.

Go back in the parent directory and look at the content, you'll see new files and a new directory:

cd ..

New content:


You can now test the creation of the .deb package. At one moment, the commands may ask for your password. I still don't understand why but it only did once, maybe to install a needed package.

Here "bionic" is the version of Ubuntu I am running:

pbuilder-dist bionic build pngoptimizer_2.6~beta.3-0ubuntu1.dsc

If everything goes well, you will find plenty of new files in this directory: $HOME/pbuilder/bionic_result, all starting with pngoptimizer_2.6~beta.3.

The deb file is among them: pngoptimizer_2.6~beta.3-0ubuntu1_amd64.deb

As it looks good, you can now push the changes you made in your Bazaar repository to the Launchpad server:

cd pngoptimizer-pack
bzr push lp:~psydk/+junk/pngoptimizer-pack

Now go to your Launchpad account, and launch builds for your updated Bazaar repository. I choose the two latest stable versions of Ubuntu (16.04 and 18.04), the current unstable (18.10) and the version in progress (19.04).

Wait for the builds to complete. If they all go well, wait for about one hour for apt update to be aware of the change. You will then be able to upgrade to the new version.


PngOptimizer PPA

It took my a lot of time, but I finally learned how to distribute PngOptimizer through Ubuntu's PPA. This will make things easier to install and update PngOptimizer on Ubuntu. Now you can install it with these commands:

sudo add-apt-repository ppa:psydk/pngoptimizer
sudo apt update  # not needed on recent versions of Ubuntu
sudo apt install pngoptimizer

The package is available for Ubuntu 16.04, 18.04, 18.10 and 19.04. For now the version is still a beta but it's probably the last one before bumping the version for real.

I followed Ubuntu packaging guide and successfully created everything to be able to deliver my first package. However, what I missed in the guide, is a page explaining how to update the package when a new version of the software is released. It was quite tricky to find out, so in my next post I will write down the steps I did to successfully update the package, as a reminder for me and hopefully as a hint for other PPA package maintainer beginners.


PngOptimizer GUI redesign for GNOME

Last year I created a new git branch in order to redesign PngOptimizer GUI to match GNOME guidelines, after Ubuntu decided to use that desktop manager instead of their own one (Unity).

But at one moment, I lost my motivation because of one specific feature I could not convince myself that it would give a benefit for the user: the application menu.

Here is a screenshot of the current state of the branch. The application menu is on the top left:

There are several things I do not like about the application menu as it is, for example:

  • it is not obvious that additional items will be located there, like the Preferences or the About window;
  • there is a large distance between the application window and the menu;
  • it is not clear what strategy should be adopted when there are several application windows opened and a modal window, like the About window, opens.

So I let the branch rot for a while, though most of the work was done.

Then lately, GNOME 3.30 was released, with a very interesting changelog line:

application developers are recommended to remove their application menus in time for GNOME 3.32

So it seems I was not the only one having doubts about the usability of that application menu. This is good news, and it gives me the motivation to resume PngOptimizer adaptation for GNOME.

So now the next step will be to move the application menu content to a new menu called the "hamburger menu" which seems quite popular now. In GNOME, it is called the "primary menu".