How to set version numbers and package file names via dpkg-buildpackge for automated builds on a build server?
Have a look at git-buildpackage:
Customizing snapshot numbers
If the auto incrementing of the snapshot number doesn't suite you needs you can give any python expression that evaluates to a positive integer to calculate the new snapshot number:
gbp dch -S -a --snapshot-number=1 gbp dch -S -a --snapshot-number='snapshot + 2' gbp dch -S -a --snapshot-number='os.popen("git-log --pretty=oneline | wc -l").readlines()[0]' gbp dch -S -a --snapshot-number=`git-log --pretty=oneline debian/0.3.3 | wc -l`
You can also add the snapshot-number calculation to
gbp.conf
:[DEFAULT] snapshot-number = os.popen("git-log --pretty=oneline | wc -l").readlines()[0]
Related videos on Youtube
Stefan
Updated on September 18, 2022Comments
-
Stefan almost 2 years
Our build server builds ubuntu packages (*.deb) via
dpkg-buildpackage
. The server checks out the source code via git and runs the build viamake <target>
. The source directory contains thedebian/
subdirectory where the dpkg configuration files are.I would like to add the internal build counter number to the current package version and further set the package file name but
dpkg-buildpackage
does not let me control how the resultingpackage_version_arch.deb
looks like. How can I achieve this? -
Stefan almost 10 years
dch
alone does neither accept-S
nor--snapshot-number
. -
Stefan almost 10 yearsI know, but I need to do it in an automated way. For instance, the Version in the control file could be
1.2.3ubuntu3~ppa3
and I want to add my build number as well =>1.2.3ubuntu3~ppa3-<buildnumber>
-
msnfreaky almost 10 yearsFor that you need to keep one more tmp control file for adding the <buildNumber> to the deb package. once the build number is ready and you can sed/replace the build number to tmp control file and save it to the original control file. like Version: 1.0.0.$$BUILD$$
-
Stefan almost 10 yearsHow can I specify a custom control file to
dpkg-buildpackage
? -
muru almost 10 years@Stefan why should it, when that is an option provided by
git-buildpackage
? Think ofdch
in this case as a command togbp
, like commit, and not as executable passed on todch
as an argument. See the man page: manpages.ubuntu.com/manpages/trusty/man1/gbp-dch.1.html -
Stefan almost 10 yearsI understand. Still I do not want to use
git-buildpackage
butdpkg-buildpackage
alone asgit-buildpackage
again has certain requirements for project/directory layout. -
muru almost 10 years@Stefan, does setting a version manually using the
--newversion
option ofdch
work?