The manual of gbp tells following:
First, create an empty repository:
mkdir package-0.1 cd package-0.1 git initThen, you import the upstream sources, branch off the upstream-branch branch and add the Debian files (e.g. via dh_make):
gbp import-orig -u 0.1 ../package-0.1.tar.gz dh_makeThat's it, you're done.
But this fails with a zip because there is no .orig.tar.gz. Invoking dh_make --createorig creates an .orig.tar.gz, but this then includes the .git/ subdirectory, so it is invalid.
Also the pristine-tar branch is missing this way and pristine-tar commit does not know how to handle zip files.
How do I start a Debian package if the upstream only provides a zip-file? How to handle pristine-tar in that case?
(this here still is a bit untested)
For the benefit of the reader, this is what I came up with. I am not sure that this is BCP, but it works. On Linux and probably CygWin, too.
My current workflow to create a Debian repository from scratch with
gbpis:Import upstream
Upstream usually is an
.orig.tar.gz, but following works withZIPtoo. For all supported archive types, please seeman gbp-import-orig.Set some variables
This variables are used, that you can use copy and paste with the following lines of the recipe.
Create the git repo
Initialize the repo
First import of upstream
Create
debian/Edit files in
debian/Now change all files in
debian/to your needs and deleted unwanted files (hint:rm -f *.ex). Sorry, I found no way to automate this properly. Do not alter files outside ofdebian/as those are handled using quilt/patchqueues (AKAdebian/patches/) later on. Be sure to editdebian/changelog:unstable(in the first line) to the value of$MYDIST. (It does not hurt if you don't.)* Initial release (Closes: #nnnn) ...to something better likedebianized upstream XXX into package YYY.git configsettings (which is kept in~/.gitconfig). Do it now: git config --global user.name "Your Name" git config --global user.email [email protected]If everything is set up in
debian/, then commit it:Setup
gbp dchIf you want to usegbp dch --auto(which is recommended) this needs a properly setgit tag. As you can change the format of those tags indebian/gbp.confit is recommended to create the first tag usinggbp dch --since(you can create it manually if you like, but we want to automate, right?) like this:Push it to your git-server
When pushing to your
gitserver, be sure always to include the tags:Those (uncommented) tags are used for various reference/tracking purpose.
Explained
The
git fetchpopulatesFETCH_HEADwith branch$TEMPLATEBRANCHfrom thegitrepo$TEMPLATEGIT, so it can be merged easily. This should createdebian/gbp.confwith your favorite settings which includepristine-tarbeing enabled.echo $PACKAGENAME | fakeroot gbp ...does 2 things:gbpwill ask for the package name. Unfortunately there is no commandline option for this. Hence it isechoed into it to be able to run it batch-like.fakerootfixes a glitch where optionpristine-tar(which can be missing from the commandline if set ingbp.conf) will create a.tarfile with your user instead ofroot:root.dh_makeneeds-ato populate thedebian/directory, as there already is one which only containsgbp.conf.If there is no
debian/gbp.confwhen you first callgbp, then you need to add the optionpristine-tartogbp import-orig. Without it looks like it works, but there will be no usable.orig.tar.gz(which can be named.bz2or.xz, too).gbpis the only tool recognizing.zip-files, so you will get into some trouble if you forget this. Unfortunately the option's name differs between versions ofgbp(either--git-pristine-taror--pristine-tar), so it is better to have it ingbp.conf.Notes:
In future there will be
gbp initto improve these steps, however my current variant ofgbpdoes not include this yet.File
debian/gbp.confshall look like following. Above it is supposed to be merged viagit merge FETCH_HEADfrom branch$TEMPLATEBRANCHof repo$TEMPLATEGIT. Perhaps create your owngittemplate repository for this, see alsohttps://github.com/hilbix/templates/tree/gbp:debian/gbp.conf:Follow the usual workflow
Afterwards you can follow the usual
gbpworkflow, so all other typical recipes on the web on how to change a Debian package can be used.Here is, how I do it (sort of).
Build the package
Simple packages are easy. However some packages need more than that, like being compiled for 64bit, with sources, and parts are even for arch
all. Also the.orig.tar.gzis missing after you cloned everything. Hence you need quite a trainload of options to handle that all properly.Following assumes that you want to create for Intel platform and (optionally) providing 32 bit for older systems:
Notes:
--git-builder=sbuildis an example. If you have trouble, just leave this away. Some newergbpalso renamed this option.Build often leaves some aritfacts. Do a cleanup with (Caution! This will unconditionally remove all uncommited edits if there are any!):
git reset --hard
Use quilt format (patchqueues) to alter upstream
If you need to change things outside of
debian/, this is the way to go:You definitively want to use patchqueues, because you do not want to touch the upstream version which was merged into
master. This way you do not accidentally loose all of your changes when a new upstream comes along, and moreover, new upstreams will merge more cleanly.Please note that
gbp buildpackageknows about patchqueues. They will be applied automatically, so you do not need to apply them yourself.Create a new release
Before creating a new release, you perhaps want to cleanup your
gitcommit log. Do this with:COMMITstands for the first commit you are happy with.git rebaseis a very powerful tool, but beware: Do not try to rebase beyondmerge-Commits, as those then will be wiped out. If yourgitcommit history is clean (seegit log), create the nextdebian/changelog:Leave away
--committo do the commit yourself, or alter the options of this as it suits you.Import a new upstream
Set the parameters for the new upstream and then do:
Please note that this fails if your repo is not clean. (
git status --porcelaindoes not output anything).Then create a new
debian/changlogentry for this: