Read version of changelog file from variable for debian packaging

I don't think it is was created to be used that way. I mean practically within Debian/Ubuntu packaging workflow.

They usually have a preset version from original source archive by upstream developer. Then Debian/Ubuntu developer (who is making the Package) adds to it the packaging version as suffix. This version is put in a new/top entry of debian/changelog.

After all done the files are uploaded to repository, then binaries get built there. (without expecting such env variable).

What you can do, use dch (debchange) before launching the build. include the new version using cmd flags --newversion or -v with other flags to:

  • Add new entry
  • Or Edit last entry
  • Or Replace the file completely

If you don't want to edit code:

  1. Create a new changelog with a new name <newchangelog-file>

  2. Then tell dpkg-buildpackage to use it instead, as below

    dpkg-buildpackage ... --source-option=-l<newchangelog-file>