logo

drewdevault.com

[mirror] blog and personal website of Drew DeVault git clone https://hacktivis.me/git/mirror/drewdevault.com.git

How-to-make-your-downstreams-happy.md (3744B)


  1. ---
  2. title: How to make your downstream users happy
  3. date: 2021-02-09
  4. ---
  5. There are a number of things that your FOSS project can be doing which will make
  6. the lives of your downstream users easier, particularly if you're writing a
  7. library or programmer-facing tooling. Many of your downstreams (Linux distros,
  8. pkgsrc, corporate users, etc) are dealing with lots of packages, and some minor
  9. tweaks to your workflow will help them out a lot.
  10. The first thing to do is *avoid* using any build system or packaging system
  11. which is not the norm for your language. Also avoid incorporating information
  12. into your build which relies on being in your git repo — most packagers
  13. prefer to work with tarball snapshots, or to fetch your package from e.g. PyPI.
  14. These two issues are definitely the worst offenders. If you do have to use a
  15. custom build system, take your time to document it thoroughly, so that users who
  16. run into problems are well-equipped to address them. The typical build system or
  17. packaging process in use for your language already addressed most of those edge
  18. cases long ago, which is why we like it better. If you must fetch, say, version
  19. information from git, then please add a fallback, such as an environment
  20. variable.
  21. Speaking of environment variables, another good one to support is
  22. [SOURCE_DATE_EPOCH](https://reproducible-builds.org/docs/source-date-epoch/),
  23. for anything where the current date or time is incorporated into your build
  24. output. Many distros are striving for *reproducible* builds these days, which
  25. involves being able to run a build twice, or by two independent parties, and
  26. arrive at an identical checksum-verifiable result. You can probably imagine some
  27. other ways to prevent issues here — don't incorporate the full path to
  28. each file in your logs, for instance. There are more recommendations on the
  29. website linked earlier.
  30. Though we don't like to rely on it as part of the formal packaging process, a
  31. good git discipline will also help us with the informal parts. You may already
  32. be using [git tags][0] for your releases — consider putting a changelog
  33. into your annotated tags (git tag -a). If you have [good commit discipline][1]
  34. in your project, then you can easily use [git shortlog][2] to generate such a
  35. changelog from your commit messages. This helps us understand what we can expect
  36. when upgrading, which helps incentivize us to upgrade in the first place. In
  37. [How to fuck up software releases][3], I wrote about my [semver][4] tool, which
  38. you may find helpful in automating this process. It can also help you avoid
  39. forgetting to do things like update the version number somewhere in the code.
  40. [0]: https://git-scm.com/docs/git-tag
  41. [1]: https://drewdevault.com/2019/02/25/Using-git-with-discipline.html
  42. [2]: https://git-scm.com/docs/git-shortlog
  43. [3]: https://drewdevault.com/2019/10/12/how-to-fuck-up-releases.html
  44. [4]: https://git.sr.ht/~sircmpwn/dotfiles/tree/master/bin/semver
  45. <iframe src="https://asciinema.org/a/nzBvuMXjUMsoewLnrbTm7E28O/embed?" id="asciicast-iframe-nzBvuMXjUMsoewLnrbTm7E28O" name="asciicast-iframe-nzBvuMXjUMsoewLnrbTm7E28O" scrolling="no" allowfullscreen="true" style="overflow: hidden; border: 0px; width: 540px; float: none; visibility: visible; height: 404px;"></iframe>
  46. In short, to make your downstreams happy:
  47. 1. Don't rock the boat on builds and packaging.
  48. 2. Don't expect your code to always be in a git repo.
  49. 3. Consider reproducible builds.
  50. 4. Stick a detailed changelog in your annotated tag &mdash; which is easy if you
  51. have good commit discipline.
  52. Overall, this is pretty easy stuff, and good practices which pay off in other
  53. respects as well. Here's a big "thanks" in advance from your future downstreams
  54. for your efforts in this regard!