.\" Automatically generated by Pod::Man 4.07 (Pod::Simple 3.32) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .if !\nF .nr F 0 .if \nF>0 \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "dgit-maint-merge 7" .TH dgit-maint-merge 7 "Debian Project" "perl v5.24.1" "dgit" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" dgit \- tutorial for package maintainers, using a workflow centered around git\-merge(1) .SH "INTRODUCTION" .IX Header "INTRODUCTION" This document describes elements of a workflow for maintaining a non-native Debian package using \fBdgit\fR. The workflow makes the following opinionated assumptions: .IP "\(bu" 4 Git histories should be the non-linear histories produced by \&\fIgit\-merge\fR\|(1), preserving all information about divergent development that was later brought together. .IP "\(bu" 4 Maintaining convenient and powerful git workflows takes priority over the usefulness of the raw Debian source package. The Debian archive is thought of as an output format. .Sp For example, we don't spend time curating a series of quilt patches. However, in straightforward cases, the information such a series would contain is readily available from \fBdgit-repos\fR. .IP "\(bu" 4 It is more important to have the Debian package's git history be a descendent of upstream's git history than to use exactly the orig.tar that upstream makes available for download. .PP This workflow is less suitable for some packages. When the Debian delta contains multiple pieces which interact, or which you aren't going to be able to upstream soon, it might be preferable to maintain the delta as a rebasing patch series. For such a workflow see for example \&\fIdgit\-maint\-gbp\fR\|(7). .SH "INITIAL DEBIANISATION" .IX Header "INITIAL DEBIANISATION" This section explains how to start using this workflow with a new package. It should be skipped when converting an existing package to this workflow. .SS "When upstream tags releases in git" .IX Subsection "When upstream tags releases in git" Suppose that the latest stable upstream release is 1.2.2, and this has been tagged '1.2.2' by upstream. .Sp .Vb 5 \& % git clone \-oupstream https://some.upstream/foo.git \& % cd foo \& % git verify\-tag 1.2.2 \& % git reset \-\-hard 1.2.2 \& % git branch \-\-unset\-upstream .Ve .PP The final command detaches your master branch from the upstream remote, so that git doesn't try to push anything there, or merge unreleased upstream commits. If you want to maintain a copy of your packaging branch on \fBalioth.debian.org\fR in addition to \fBdgit-repos\fR, you can do something like this: .Sp .Vb 2 \& % git remote add \-f origin git.debian.org:/git/collab\-maint/foo.git \& % git push \-\-follow\-tags \-u origin master .Ve .PP Now go ahead and Debianise your package. Just make commits on the master branch, adding things in the \fIdebian/\fR directory. If you need to patch the upstream source, just make commits that change files outside of the \fIdebian/\fR directory. It is best to separate commits that touch \fIdebian/\fR from commits that touch upstream source, so that the latter can be cherry-picked by upstream. .PP Note that there is no need to maintain a separate 'upstream' branch, unless you also happen to be involved in upstream development. We work with upstream tags rather than any branches, except when forwarding patches (see \s-1FORWARDING PATCHES UPSTREAM,\s0 below). .PP Finally, you need an orig tarball: .Sp .Vb 1 \& % git deborig .Ve .PP See \fIgit\-deborig\fR\|(1) if this fails. .PP This tarball is ephemeral and easily regenerated, so we don't commit it anywhere (e.g. with tools like \fIpristine\-tar\fR\|(1)). .PP \fIVerifying upstream's tarball releases\fR .IX Subsection "Verifying upstream's tarball releases" .Sp .RS 4 It can be a good idea to compare upstream's released tarballs with the release tags, at least for the first upload of the package. If they are different, you might need to add some additional steps to your \&\fIdebian/rules\fR, such as running autotools. .Sp A convenient way to perform this check is to import the tarball as described in the following section, using a different value for \&'upstream\-tag', and then use \fIgit\-diff\fR\|(1) to compare the imported tarball to the release tag. If they are the same, you can use upstream's tarball instead of running \fIgit\-deborig\fR\|(1). .RE .SS "When upstream releases only tarballs" .IX Subsection "When upstream releases only tarballs" We need a virtual upstream branch with virtual release tags. \&\fIgbp\-import\-orig\fR\|(1) can manage this for us. To begin .Sp .Vb 3 \& % mkdir foo \& % cd foo \& % git init .Ve .PP Now create \fIdebian/gbp.conf\fR: .Sp .Vb 4 \& [DEFAULT] \& upstream\-branch = upstream \& debian\-branch = master \& upstream\-tag = %(version)s \& \& sign\-tags = True \& pristine\-tar = False \& pristine\-tar\-commit = False .Ve .PP Then we can import the upstream version: .Sp .Vb 2 \& % git add debian/gbp.conf && git commit \-m "create gbp.conf" \& % gbp import\-orig ../foo_1.2.2.orig.tar.xz .Ve .PP You are now ready to proceed as above, making commits to both the upstream source and the \fIdebian/\fR directory. .PP If you want to maintain a copy of your repository on \&\fBalioth.debian.org\fR, you should push both the origin and the upstream branches: .Sp .Vb 2 \& % git remote add \-f origin git.debian.org:/git/collab\-maint/foo.git \& % git push \-\-follow\-tags \-u origin master upstream .Ve .SH "CONVERTING AN EXISTING PACKAGE" .IX Header "CONVERTING AN EXISTING PACKAGE" This section explains how to convert an existing Debian package to this workflow. It should be skipped when debianising a new package. .SS "No existing git history" .IX Subsection "No existing git history" .Vb 3 \& % dgit clone foo \& % cd foo \& % git remote add \-f upstream https://some.upstream/foo.git .Ve .SS "Existing git history using another workflow" .IX Subsection "Existing git history using another workflow" First, dump any existing patch queue: .Sp .Vb 2 \& % git rm \-rf debian/patches \& % git commit \-m "drop existing quilt patch queue" .Ve .PP Then make new upstream tags available: .Sp .Vb 1 \& % git remote add \-f upstream https://some.upstream/foo.git .Ve .PP Now you simply need to ensure that your git \s-1HEAD\s0 is dgit-compatible, i.e., it is exactly what you would get if you ran \fBdpkg-buildpackage \&\-i\e.git/ \-I.git \-S\fR and then unpacked the resultant source package. .PP To achieve this, you might need to delete \&\fIdebian/source/local\-options\fR. One way to have dgit check your progress is to run \fBdgit build-source\fR. .PP The first dgit push will require \fI\-\-overwrite\fR. .SH "SOURCE PACKAGE CONFIGURATION" .IX Header "SOURCE PACKAGE CONFIGURATION" .SS "debian/source/options" .IX Subsection "debian/source/options" We set some source package options such that dgit can transparently handle the \*(L"dropping\*(R" and \*(L"refreshing\*(R" of changes to the upstream source: .Sp .Vb 2 \& single\-debian\-patch \& auto\-commit .Ve .PP You don't need to create this file if you are using the version 1.0 source package format. .SS "Sample text for debian/source/patch\-header" .IX Subsection "Sample text for debian/source/patch-header" It is a good idea to explain how a user can obtain a breakdown of the changes to the upstream source: .Sp .RS 4 The Debian packaging of foo is maintained in git, using the merging workflow described in \fIdgit\-maint\-merge\fR\|(7). There isn't a patch queue that can be represented as a quilt series. .Sp A detailed breakdown of the changes is available from their canonical representation \- git commits in the packaging repository. For example, to see the changes made by the Debian maintainer in the first upload of upstream version 1.2.3, you could use: .Sp .Vb 3 \& % git clone https://git.dgit.debian.org/foo \& % cd foo \& % git log \-\-oneline 1.2.3..debian/1.2.3\-1 \-\- . \*(Aq:!debian\*(Aq .Ve .RE .RS 4 .Sp (If you have dgit, use `dgit clone foo`, rather than plain `git clone`.) .Sp A single combined diff, containing all the changes, follows. .RE .PP Alternatively, this text could be added to \s-1README\s0.source. However, this might distract from more important information present in the latter file. .SH "BUILDING AND UPLOADING" .IX Header "BUILDING AND UPLOADING" Use \fBdgit build\fR, \fBdgit sbuild\fR, \fBdgit build-source\fR, and \fBdgit push\fR as detailed in \fIdgit\fR\|(1). If any command fails, dgit will provide a carefully-worded error message explaining what you should do. If it's not clear, file a bug against dgit. Remember to pass \fI\-\-new\fR for the first upload. .PP As an alternative to \fBdgit build\fR and friends, you can use a tool like \fIgitpkg\fR\|(1). This works because like dgit, \fIgitpkg\fR\|(1) enforces that \&\s-1HEAD\s0 has exactly the contents of the source package. \fIgitpkg\fR\|(1) is highly configurable, and one dgit user reports using it to produce and test multiple source packages, from different branches corresponding to each of the current Debian suites. .PP If you want to skip dgit's checks while iterating on a problem with the package build (for example, you don't want to commit your changes to git), you can just run \fIdpkg\-buildpackage\fR\|(1) or \fIdebuild\fR\|(1) instead. .SH "NEW UPSTREAM RELEASES" .IX Header "NEW UPSTREAM RELEASES" .SS "When upstream tags releases in git" .IX Subsection "When upstream tags releases in git" It's a good idea to preview the merge of the new upstream release. First, just check for any new or deleted files that may need accounting for in your copyright file: .Sp .Vb 2 \& % git remote update \& % git diff \-\-stat master..1.2.3 \-\- . \*(Aq:!debian\*(Aq .Ve .PP You can then review the full merge diff: .Sp .Vb 1 \& % git merge\-tree \`git merge\-base master 1.2.3\` master 1.2.3 | $PAGER .Ve .PP Once you're satisfied with what will be merged, update your package: .Sp .Vb 4 \& % git merge 1.2.3 \& % dch \-v1.2.3\-1 New upstream release. \& % git add debian/changelog && git commit \-m changelog \& % git deborig .Ve .PP and you are ready to try a build. .SS "When upstream releases only tarballs" .IX Subsection "When upstream releases only tarballs" You will need the \fIdebian/gbp.conf\fR from \*(L"When upstream releases only tarballs\*(R", above. .PP Then, either .Sp .Vb 1 \& % gbp import\-orig ../foo_1.2.2.orig.tar.xz .Ve .PP or if you have a working watch file .Sp .Vb 1 \& % gbp import\-orig \-\-uscan .Ve .SH "HANDLING DFSG-NON-FREE MATERIAL" .IX Header "HANDLING DFSG-NON-FREE MATERIAL" .SS "When upstream tags releases in git" .IX Subsection "When upstream tags releases in git" We create a DFSG-clean tag to merge to master: .Sp .Vb 6 \& % git checkout \-b pre\-dfsg 1.2.3 \& % git rm evil.bin \& % git commit \-m "upstream version 1.2.3 DFSG\-cleaned" \& % git tag \-s 1.2.3+dfsg \& % git checkout master \& % git branch \-D pre\-dfsg .Ve .PP Before merging the new 1.2.3+dfsg tag to master, you should first determine whether it would be legally dangerous for the non-free material to be publicly accessible in the git history on \&\fBdgit-repos\fR. .PP If it would be dangerous, there is a big problem; in this case please consult your archive administrators (for Debian this is the dgit administrator dgit\-owner@debian.org and the ftpmasters ftpmaster@ftp\-master.debian.org). .SS "When upstream releases only tarballs" .IX Subsection "When upstream releases only tarballs" The easiest way to handle this is to add a \fBFiles-Excluded\fR field to \&\fIdebian/copyright\fR, and a \fBuversionmangle\fR setting in \&\fIdebian/watch\fR. See \fIuscan\fR\|(1). Alternatively, see the \fI\-\-filter\fR option detailed in \fIgbp\-import\-orig\fR\|(1). .SH "FORWARDING PATCHES UPSTREAM" .IX Header "FORWARDING PATCHES UPSTREAM" The basic steps are: .IP "1." 4 Create a new branch based off upstream's master branch. .IP "2." 4 \&\fIgit\-cherry\-pick\fR\|(1) commits from your master branch onto your new branch. .IP "3." 4 Push the branch somewhere and ask upstream to merge it, or use \&\fIgit\-format\-patch\fR\|(1) or \fIgit\-request\-pull\fR\|(1). .PP For example (and it is only an example): .Sp .Vb 7 \& % # fork foo.git on GitHub \& % git remote add \-f fork git@github.com:spwhitton/foo.git \& % git checkout \-b fix\-error upstream/master \& % git config branch.fix\-error.pushRemote fork \& % git cherry\-pick master^2 \& % git push \& % # submit pull request on GitHub .Ve .PP Note that when you merge an upstream release containing your forwarded patches, git and dgit will transparently handle \*(L"dropping\*(R" the patches that have been forwarded, \*(L"retaining\*(R" the ones that haven't. .SH "INCORPORATING NMUS" .IX Header "INCORPORATING NMUS" .Vb 1 \& % dgit pull .Ve .PP Alternatively, you can apply the \s-1NMU\s0 diff to your repository. The next push will then require \fI\-\-overwrite\fR. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fIdgit\fR\|(1), \fIdgit\fR\|(7) .SH "AUTHOR" .IX Header "AUTHOR" This tutorial was written and is maintained by Sean Whitton . It contains contributions from other dgit contributors too \- see the dgit copyright file.