The manual of gbp tells following:
First, create an empty repository:
mkdir package-0.1 cd package-0.1 git init
Then, you import the upstream sources, branch off the upstream-branch branch and add the Debian files (eg via dh_make):
gbp import-orig -u 0.1 ../package-0.1.tar.gz dh_make
That'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 gbp
is:
Upstream usually is an .orig.tar.gz
, but following works with ZIP
too. For all supported archive types, please see man gbp-import-orig
.
This variables are used, that you can use copy and paste with the following lines of the recipe.
PACKAGENAME=mypackagename
UPSTREAMVERSION=0.1.2.3-up4
UPSTREAMARCHIVE=../upstreampackage-$UPSTREAMVERSION.zip
# Following should start/end with a number and only contain
# numbers, lowercase letters and single dots (.)
MYDIST=stable
MYBASEVERSION=0example.com1
TEMPLATEGIT=https://github.com/hilbig/templates.git
TEMPLATEBRANCH=gbp
git init $PACKAGENAME
cd $PACKAGENAME
Initialize the repo
git commit --allow-empty -m empty
git branch upstream
git fetch $TEMPLATEGIT $TEMPLATEBRANCH
git merge FETCH_HEAD
echo $PACKAGENAME | fakeroot gbp import-orig --upstream-version=$UPSTREAMVERSION $UPSTREAMARCHIVE
debian/
dh_make --indep -a -p ${PACKAGENAME}_$UPSTREAMVERSION
git add debian
git commit -m "dh_make --indep -a -p ${PACKAGENAME}_$UPSTREAMVERSION"
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 of debian/
as those are handled using quilt/patchqueues (AKA debian/patches/
) later on. Be sure to edit debian/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 like debianized upstream XXX into package YYY
. git config
settings (which is kept in ~/.gitconfig
). Do it now: git config --global user.name "Your Name" git config --global user.email you@example.com If everything is set up in debian/
, then commit it:
git add -A debian
# Use "git status" to see, that only file in "debian/" are changed
git commit -m 'edited directory debian/'
gbp dch
Following is rubbish. I still try to figure out how do do it properly, because the needed tags are not created automatically as I thought they should.
If you want to use gbp dch --auto
(which is recommended) this needs a properly set git tag
.As you can change the format of those tags in debian/gbp.conf
it is recommended to create the first tag using gbp dch --since
(you can create it manually if you like, but we want to automate, right?) like this:
gbp dch --commit -D "$MYRELEASE" -N "`git describe --tags --abbrev=0 upstream | sort | head -1 | sed s/^[^0-9]*//`-$MYBASEVERSION" --since HEAD^ vim debian/changelog git commit --amend debian/changelog
When pushing to your git
server, be sure always to include the tags:
git push origin --tags
Those (uncommented) tags are used for various reference/tracking purpose.
The git fetch
populates FETCH_HEAD
with branch $TEMPLATEBRANCH
from the git
repo $TEMPLATEGIT
, so it can be merged easily. This should create debian/gbp.conf
with your favorite settings which include pristine-tar
being enabled.
echo $PACKAGENAME | fakeroot gbp ...
echo $PACKAGENAME | fakeroot gbp ...
does 2 things:
gbp
will ask for the package name. Unfortunately there is no commandline option for this. Hence it is echo
ed into it to be able to run it batch-like. fakeroot
fixes a glitch where option pristine-tar
(which can be missing from the commandline if set in gbp.conf
) will create a .tar
file with your user instead of root:root
. dh_make
needs -a
to populate the debian/
directory, as there already is one which only contains gbp.conf
.
If there is no debian/gbp.conf
when you first call gbp
, then you need to add the option pristine-tar
to gbp import-orig
. Without it looks like it works, but there will be no usable .orig.tar.gz
(which can be named .bz2
or .xz
, too). gbp
is 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 of gbp
(either --git-pristine-tar
or --pristine-tar
), so it is better to have it in gbp.conf
.
Notes:
In future there will be gbp init
to improve these steps, however my current variant of gbp
does not include this yet.
File debian/gbp.conf
shall look like following. Above it is supposed to be merged via git merge FETCH_HEAD
from branch $TEMPLATEBRANCH
of repo $TEMPLATEGIT
. Perhaps create your own git
template repository for this, see also https://github.com/hilbix/templates/tree/gbp
:
debian/gbp.conf
:
[DEFAULT]
pristine-tar = True
debian-branch = master
debian-tag = v%(version)s
[dch]
full = True
git-author = True
[pq]
patch-num-format = PATCH-%04d-
[import-orig]
merge-mode = replace
Afterwards you can follow the usual gbp
workflow, 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).
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.gz
is 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:
gbp buildpackage --dist="$MYDIST" --git-builder=sbuild --arch=amd64 --arch-all --source --force-orig-source
gbp buildpackage --dist="$MYDIST" --git-builder=sbuild --arch=i386
Notes:
--git-builder=sbuild
is an example. If you have trouble, just leave this away. Some newer gbp
also 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
If you need to change things outside of debian/
, this is the way to go:
gbp pq import
# now edit everything here
# if you are happy with it:
gbp pq export
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 buildpackage
knows about patchqueues. They will be applied automatically, so you do not need to apply them yourself.
Before creating a new release, you perhaps want to cleanup your git
commit log. Do this with:
git rebase -i COMMIT
COMMIT
stands for the first commit you are happy with. git rebase
is a very powerful tool, but beware: Do not try to rebase beyond merge
-Commits, as those then will be wiped out. If your git
commit history is clean (see git log
), create the next debian/changelog
:
gbp dch --commit -D $MYDIST
Leave away --commit
to do the commit yourself, or alter the options of this as it suits you.
Set the parameters for the new upstream and then do:
echo $PACKAGENAME | fakeroot gbp import-orig --upstream-version=$UPSTREAMVERSION $UPSTREAMARCHIVE
Please note that this fails if your repo is not clean. ( git status --porcelain
does not output anything).
Then create a new debian/changlog
entry for this:
gbp dch --commit -D "$MYDIST" -N "`git describe --tags --abbrev=0 upstream | sort | head -1 | sed s/^[^0-9]*//)-$MYBASEVERSION"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.