[Aptitude-devel] how to build deb package from git sources?

Axel Beckert abe at debian.org
Thu Jan 28 22:03:16 UTC 2016


Hi Matthias,

matthias.hinkfoth2 at uni-rostock.de wrote:
> > You probably missed that there are multiple branches. To understand
> > what's going on, these branch are probably of interest for you:
> > 
> > * master = upstream development
> > * upstream = upstream code as in the upstream tar ball of Debian, i.e.
> >   updated only with every upstream release (by using "gbp import-orig"
> >   on the upstream tar ball generated with "make dist" or so from the
> >   code in the master branch).
> > * debian-sid = current debian packaging branch, contains "upstream"
> >   branch plus packaging (i.e. the "debian/" directory).
> 
> I am still a bit confused, since there are even more branches.

There are. But these are the most important once. Most others are
probably legacy feature branches.

There's one exception which I deliberately did not mention as it makes
things slightly more complicated and I expected that you don't run
into it -- but you did: the pristine-tar branch. More on that later.

> > To build the 0.6.11-1 package from source (0.6.11-1+b1 has the same
> > source, but is a different build, e.g. against updated libraries),
> > checkout the git tag "debian/0.6.11-1" and build from there, i.e. use
> > these commands:
> > 
> > $ git checkout debian/0.6.11-1
> > $ dpkg-buildpackage -b
> 
> This worked fine. :-)

Great!

> > ("gbp buildpackage --ignore-debian-branch" should work, too, but the
> > additional checks of gbp like "is the working copy clean?" etc. are
> > probably not needed in your case.)
> 
> I have not found --ignore-debian-branch, instead I ran:
> 
> $ gbp buildpackage --git-ignore-branch

Actually I didn't remember the correct name of that option. (There is
also a --debian-branch option and I mixed those two up.) But you
found the right one as I indeed meant --git-ignore-branch.

> gbp:warning: Pristine-tar branch "pristine-tar" not found
> fatal: Path 'aptitude_0.6.11.orig.tar.gz.delta' does not exist in 'refs/remotes/origin/pristine-tar'
> pristine-tar: git show refs/remotes/origin/pristine-tar:aptitude_0.6.11.orig.tar.gz.delta failed
> gbp:error: Couldn't checkout "aptitude_0.6.11.orig.tar.gz": it exited with 128
> 
> 
> I do not really understand the error.

This is because we declared in debian/gbp.conf that we use
pristine-tar. pristine-tar stores meta data from the tar ball that git
can't represent (like time stamps and owners of files, etc.) in a
separate branch so that we can regenerate a bit for bit identical copy
of the imported .orig.tar.gz solely from a checkout of the git
repository.

> But I tried to build a source package the following way:
> 
> $ git checkout debian/0.6.11-1
> $ dpkg-buildpackage -S
> dpkg-buildpackage: source package aptitude
> dpkg-buildpackage: source version 0.6.11-1
> dpkg-buildpackage: source distribution unstable
> dpkg-buildpackage: source changed by Daniel Hartwig <mandyke at gmail.com>
>  dpkg-source --before-build aptitude-git
>  fakeroot debian/rules clean
> dh clean --parallel --builddirectory=build-arch --dbg-package=aptitude-dbg
>    dh_testdir -O--parallel -O--builddirectory=build-arch -O--dbg-package=aptitude-dbg
>    dh_auto_clean -O--parallel -O--builddirectory=build-arch -O--dbg-package=aptitude-dbg
>    dh_clean -O--parallel -O--builddirectory=build-arch -O--dbg-package=aptitude-dbg
>  dpkg-source -b aptitude-git
> dpkg-source: error: can't build with source format '3.0 (quilt)': no upstream tarball found at ../aptitude_0.6.11.orig.tar.{bz2,gz,lzma,xz}
> dpkg-buildpackage: error: dpkg-source -b aptitude-git gave error exit status 255

That's because building a source package requires an upstream tar ball
(if a distinction between packaging and upstream is made) and
pristine-tar can (and tried to) give you that one.

You can solve that in two ways:

* Also create a local pristine-tar branch: "git checkout -b
  pristine-tar origin/pristine-tar" and then try "gbp buildpackage"
  again.

* Or use the origtargz tool from the devscripts package. It knows many
  ways to get the according upstream tar ball (including pristine-tar
  which is usually its first try if that branch exists) and will try
  them until it succeeds or runs out of methods. Usually the easiest
  way to solve that problem as it doesn't require much thinking which
  method is the right one in the current case and how are the
  according commands.

Hope this helps.

		Regards, Axel
-- 
 ,''`.  |  Axel Beckert <abe at debian.org>, http://people.debian.org/~abe/
: :' :  |  Debian Developer, ftp.ch.debian.org Admin
`. `'   |  4096R: 2517 B724 C5F6 CA99 5329  6E61 2FF9 CD59 6126 16B5
  `-    |  1024D: F067 EA27 26B9 C3FC 1486  202E C09E 1D89 9593 0EDE



More information about the Aptitude-devel mailing list