Post

Free Software Dev (MAC0470) Second Debian Contribution

Comments on my second contribution to the Debian Operational System as part of the discipline "Free and Open Source Software Development" (MAC0470) of IME-USP

Free Software Dev (MAC0470) Second Debian Contribution

Updating golang-github-knadh-go-pop3 package to new upstream version

Introduction

As a continuation to my first contribution, nothing better than sticking to the same package. Given that it needs to be updated to the newest upstream version (1.0.2), after talking to one of the Debian Brazillian maintainers, Charles, me and my pair, Guilherme, decided to choose this as our second contribution. The process was, although quite simple, really useful to learn a bit more about debian packaging. The contribution process, overall, was simple, having only one really subtle problem.

Overall contribution steps

We basically need to clone the package’s salsa repo, pull the upstream new version of the code, and push this change to the debian package repo again, making the necessary changes to all package management data stored in debian/. Therefore, the steps were:

  1. Clone the repository I forked from golang-github-knadh-go-pop3 original repository, available here.
  2. Pull the new version of the upstream code (here, there was a little problem)
  3. Add the commit of pulling this new version to debian/changelog
  4. Push the changes to the forked repo
  5. Create a merge request

Upstream Branch problem (step 2)

To pull the newest version of the upstream, we use the command:

1
gbp import-orig --uscan --no-pristine-tar

However, Go teams use a branch pattern slightly different than usual. Hence, this command, used to update the code, simply deleted the debian/ folder from my workspace. The reason behind this was this different pattern, identified by Charles, the Brazillian maintainer who helped me along this process.

Given this problem, the solution was to make git include all branches, instead of just the upstream and debian ones, by adding the flag --all when cloning my froked repo. Also, we added --add-upstream-vcs to make sure all the necessary remotes were mapped by our git workspace too.

Hence, from gbp clone --add-upstream-vcs --all git@salsa.debian.org:joaolinaris/golang-github-knadh-go-pop3.git, my clone command became gbp clone --add-upstream-vcs --all git@salsa.debian.org:joaolinaris/golang-github-knadh-go-pop3.git.

After doing this, we, now, had to pull the changes from the correct branch, which is, for Go packages, the upstream/latest branch. Also, we made the upstream git history be linked to the package commit graph using --upstream-vcs-tag parameter, so that the log history gets richer.

Then, the final import command was:

1
gbp import-orig --uscan --upstream-branch=upstream/latest --upstream-vcs-tag="v%(version)s"

With this the code successfully built. We also applied some changes lintian recommended (such as shortening the commit message lines length) and we were able to create the merge request seamlessly.

Why didn’t the packaging raise problems

The main reason to that is the fact that this Go package has no debian package dependency. It just depends on Go built-in packages and one github dependecy (it fetches directly from github, no need to declare debian dependency), as can be seen in the import field of the only go file (except from the unit test one) of the package here.

Conclusion

This process, although quite simple, taught me how nuanced can the packaging process be and how can teams adapt completely different development strategies (the Go packaging team decided to really diverge from the rest here). Additionally, I was able to get in deeper contact with the Brazillian Debian community by attending one of their meetings, which was a really nice experience. My thanks to Charles for making this process a lot more enjoyable than it could be. Now, I’m just waiting for my Merge Request to be approved so that me and Guilherme can say that we contributed twice to a debian package!

This post is licensed under CC BY 4.0 by the author.