Zend certified PHP/Magento developer

How come rebuilt packages are seen as a downgrade in Debian / APT based distros?

I wanted to look into building packages for Debian, but the process is not as straightforward as in other distributions it seems, when it comes to writing the instructions on how to build the package, what it depends on, what version it is, etc. so I began by rebuilding a package already there.

I learned package definition is a bit of a headache (various files, complex structure), but the build and rebuild workflow is easy enough:

  • Ensure build-essential, dpkg-dev, devscripts are installed.
  • Ensure source repos are enabled in /etc/apt/sources.list or /dev/apt/sources.list.d/sth.list.
  • Get the package source via apt source *package*.
  • Install the package build dependencies via apt build-dep *package*.
  • Get into the package directory and build using dpkg-buildpackage.

I used the --no-sign flag because I am just testing, and chose bash as the package, everything went fine (there were lots to digest, I piped it into tee to see later on) and I have packages built in the parent directory. I built under root with the build dir being world writable, but I also checked using fakeroot as an unprivileged user.

However when attempting to install the package APT lets me know in capital leters that it would downgrade the installed one, I didn’t change anything really, the version remains the same. Why is that message shown? What would be the proper way?

Image showing how the package just built in the current directory matches the version of the one installed and also the one in the repository.