| Building Debian Packages with git-buildpackage |
|---|
If the Git repository wasn't created with git-import-dsc you have to tell git-buildpackage and friends where to find the upstream sources.
If the upstream sources are already on a separate branch things are pretty simple. You can either rename that branch to upstream with:
mv .git/theupstream-branch .git/upstream
or you can tell git-buildpackage the name of the branch:
cat <<EOF > .git/gbp.conf
[DEFAULT]
# this is the upstream-branch:
upstream-branch=theupstream-branch
If you use git-import-orig to import new upstream sources, they will
end up on theupstream-branch and merged to
master.
If you don't have an upstream branch but started your repository with only the upstream sources (not the debian patch) you can simply branch from that point. So use gitk or git-log to locate the commit-id of that commit and create the upstream branch from there, e.g.:
COMMIT_ID=`git log --pretty=oneline | tail -1 | awk '{ print $1 }'`
git branch upstream $COMMIT_ID
The important thing here is that the COMMIT_ID specifies a
point on the master branch that carried only the
upstream sources and not the debian modifications. The above example
assumes that this was the first commit to that repository.
| Warning |
There's currently no easy way to create the upstream branch if you never had the upstream sources as a single commit. Using git-import-orig on such repositories might lead to unexpected merge results. |
In order to fix this you can prepend the upstream sources as a single commit to your tree using Git's grafts. Afterwards you can simply create a branch as explained above and git-import-orig should work as expected.
| <<< Importing a new upstream version | Starting a Debian package from scratch >>> |