[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: git-buildpackage: can it recreate the orig.tar.gz without the pristine-tar?



On 12/03/2012 10:30 PM, Antonio Ospite wrote:
> in debian/gbp.conf there are just these lines:
>     	[DEFAULT]
>     	debian-branch = debian
>     	upstream-branch = master
>     	upstream-tag = v%(version)s
>
> By just running "git buildpackage" the package builds fine, and
> the .orig.tar.gz generated gets generated.
>
> In _my_ case having the "upstream-tag" reflect the format of the tags
> marking stable release in the "upstream-branch" branch was the key to
> make git-buildpackage generate the .orig.tar.gz archives.
>
> Regards,
>    Antonio

Yeah, we use that with the Openstack packaging. Though it's nicer to
use the xz format. Here's what we have in our unified debian/rules
included Makefile:

DEBVERS         ?= $(shell dpkg-parsechangelog | sed -n -e 's/^Version:
//p')
VERSION         ?= $(shell echo '$(DEBVERS)' | sed -e
's/^[[:digit:]]*://' -e 's/[-].*//')
DEBFLAVOR       ?= $(shell dpkg-parsechangelog | grep -E ^Distribution:
| cut -d" " -f2)
DEBPKGNAME      ?= $(shell dpkg-parsechangelog | grep -E ^Source: | cut
-d" " -f2)
UPSTREAM_GIT    ?= git://github.com/openstack/$(DEBPKGNAME).git
GIT_TAG         ?= $(shell echo '$(VERSION)' | sed -e 's/~/_/')

# Activate xz compression
override_dh_builddeb:
        dh_builddeb -- -Zxz -z9

get-vcs-source:
        git remote add upstream $(UPSTREAM_GIT) || true 
        git fetch upstream
        if [ ! -f ../$(DEBPKGNAME)_$(VERSION).orig.tar.xz ] ; then \
                git archive --prefix=$(DEBPKGNAME)-$(GIT_TAG)/
$(GIT_TAG) | xz >../$(DEBPKGNAME)_$(VERSION).orig.tar.xz ; \
        fi
        if ! git checkout master ; then \
                echo "No upstream branch: checking out" ; \
                git checkout -b master upstream/master ; \
        fi
        git checkout debian/$(DEBFLAVOR)

Whenever upstream "releases" (which only means, for us, that a
new tag is available on github), I just do:

git fetch upstream
git merge -X theirs <upstream-tag>
dch -i (and edit debian/changelog to match new upstream tag)
./debian/rules get-vcs-source

And that's it! Quite strait forward and very convenient. This is also
explained here:
http://openstack.alioth.debian.org/

Another cool feature is that you can make snapshots of the upstream
git repo if you need to do that. You only need to push your own tag to
Alioth (and doesn't even need the master branch to be stored there).
For example:

git checkout master
git pull
git tag 2013.1_g0.2+36eccfb76a
git checkout debian/experimental
git push --tags

And this explains why I define GIT_TAG with the sed call in debian/rules:
git doesn't allow the ~ (eg: tilde), so we use _ (eg: underscore) instead.

Then reproduce what's above to create your orig.tar.xz.

I hope that helps.
Cheers,

Thomas


Reply to: