git

Differences between revisions 2 and 3
Revision 2 as of 2018-05-11 17:14:04
Size: 3243
Editor: laney
Comment: first go
Revision 3 as of 2018-06-13 08:22:24
Size: 4709
Editor: laney
Comment: how to convert a repo
Deletions are marked like this. Additions are marked like this.
Line 86: Line 86:

= convert a package to git for the first time =

XXX: flesh this out

 * clone debian's repository
 * `git remote add gnome <url to gnome git repository>; git fetch gnome`
 * `git remote add lp <url to lp>`
 * find the place we diverged from Debian, and make an `ubuntu/master` branch at that tag - for example if we're on `3.28.1-2ubuntu9`, branch from `debian/3.28.1-2`; if we're on 3.28.2-0ubuntu1, go back in history until you find a non-0 version.
 * on `ubuntu/master`, run `gbp import-dsc --debian-branch=ubuntu/master --debian-tag='ubuntu/%(version)s' ../path/to/the/current/dsc`
 * Fix up `debian/control.in` - mention the Launchpad URLs in `Vcs-*` and copy Debian's to `XS-Debian-Vcs-*`
 * Modify or create `gbp.conf` containing:

{{{
[DEFAULT]
pristine-tar = True
debian-branch=ubuntu/master
upstream-branch=upstream/latest
upstream-vcs-tag = %(version)s
debian-tag = ubuntu/%(version)s
}}}

note for a stable release that'll be something like

{{{
[DEFAULT]
pristine-tar = True
debian-branch=ubuntu/bionic
upstream-branch=upstream/3.28.x
upstream-vcs-tag = %(version)s
debian-tag = ubuntu/%(version)s
}}}

  * Add a changelog entry for the above and commit it
  * Now you can work with the repository
  * When finished, push the `ubuntu/` branch and tags, any relevant `upstream/` branches and tags and the `pristine-tar` branch. Visit the repository page on Launchpad, and set the default branch to `ubuntu/master`.

The DesktopTeam uses git to manage its packages. Here's how to do some common things. You need git-buildpackage installed for most of this.

default ~/.gbp.conf

git-buildpackage uses this file for its default configuration; some tweaks are recommended. See gbp.conf(5) and the various --help for more options.

[DEFAULT]
# the default clean command:
cleaner = fakeroot debian/rules clean
# use pristine-tar:
pristine-tar = True

# Options only affecting git-buildpackage
[buildpackage]
# automatically GPG sign tags
sign-tags = True
# keyid to GPG sign tags with
keyid = 0xYOURKEYIDHERE
# use this for more svn-buildpackage like behaviour:
export-dir = ../build-area/
tarball-dir = ../tarballs/
# ignore uncommitted changes
ignore-new = True

check out a package

If the Vcs-Git field is correct, you can

ubuntu@gbp-demo:~$ debcheckout --git-track=* glib2.0
declared git repository at https://git.launchpad.net/~ubuntu-desktop/ubuntu/+source/glib2.0
git clone https://git.launchpad.net/~ubuntu-desktop/ubuntu/+source/glib2.0 glib2.0 ...
Cloning into 'glib2.0'...
remote: Counting objects: 133911, done.
remote: Compressing objects: 100% (24298/24298), done.
remote: Total 133911 (delta 109608), reused 133521 (delta 109263)
Receiving objects: 100% (133911/133911), 64.44 MiB | 880.00 KiB/s, done.
Resolving deltas: 100% (109608/109608), done.
Branch 'pristine-tar' set up to track remote branch 'pristine-tar' from 'origin'.
Branch 'upstream/2.56.x' set up to track remote branch 'upstream/2.56.x' from 'origin'.
Branch 'upstream/latest' set up to track remote branch 'upstream/latest' from 'origin'.

Otherwise, you can check out any git-buildpackage repository

ubuntu@gbp-demo:~$ gbp clone https://git.launchpad.net/~ubuntu-desktop/ubuntu/+source/glib2.0
gbp:info: Cloning from 'https://git.launchpad.net/~ubuntu-desktop/ubuntu/+source/glib2.0'

build a source package

ubuntu@gbp-demo:~/glib2.0$ gbp buildpackage -S
dh clean --with gnome,python3 --buildsystem=autoconf
   dh_auto_clean -O--buildsystem=autoconf
   dh_gnome_clean -O--buildsystem=autoconf
   debian/rules override_dh_clean
make[1]: Entering directory '/home/ubuntu/glib2.0'
rm -rf /home/ubuntu/glib2.0/debian/build \
       /home/ubuntu/glib2.0/debian/install \
       /home/ubuntu/glib2.0/debian/tmp-xdg-runtime-dir
dh_clean -Xorg.gtk.test.gschema.xml.orig
make[1]: Leaving directory '/home/ubuntu/glib2.0'
gbp:info: Tarballs 'glib2.0_2.56.1.orig.tar.xz' not found at '../tarballs/'
gbp:info: Creating /home/ubuntu/build-area/glib2.0_2.56.1.orig.tar.xz
gbp:info: Exporting 'HEAD' to '/home/ubuntu/build-area/glib2.0-tmp'
gbp:info: Moving '/home/ubuntu/build-area/glib2.0-tmp' to '/home/ubuntu/build-area/glib2.0-2.56.1'
gbp:info: Performing the build
...

If you used the gbp.conf given above, the source package is in ../build-area. We didn't have the orig.tar.xz to hand before this, but gbp used pristine-tar to reconstruct the same one you get from upstream. Check the sha256sum.

release a package

merge a new upstream version

merge with debian

cherry pick a patch

write a new patch

convert a package to git for the first time

XXX: flesh this out

  • clone debian's repository
  • git remote add gnome <url to gnome git repository>; git fetch gnome

  • git remote add lp <url to lp>

  • find the place we diverged from Debian, and make an ubuntu/master branch at that tag - for example if we're on 3.28.1-2ubuntu9, branch from debian/3.28.1-2; if we're on 3.28.2-0ubuntu1, go back in history until you find a non-0 version.

  • on ubuntu/master, run gbp import-dsc --debian-branch=ubuntu/master --debian-tag='ubuntu/%(version)s' ../path/to/the/current/dsc

  • Fix up debian/control.in - mention the Launchpad URLs in Vcs-* and copy Debian's to XS-Debian-Vcs-*

  • Modify or create gbp.conf containing:

[DEFAULT]
pristine-tar = True
debian-branch=ubuntu/master
upstream-branch=upstream/latest
upstream-vcs-tag = %(version)s
debian-tag = ubuntu/%(version)s

note for a stable release that'll be something like

[DEFAULT]
pristine-tar = True
debian-branch=ubuntu/bionic
upstream-branch=upstream/3.28.x
upstream-vcs-tag = %(version)s
debian-tag = ubuntu/%(version)s
  • Add a changelog entry for the above and commit it
  • Now you can work with the repository
  • When finished, push the ubuntu/ branch and tags, any relevant upstream/ branches and tags and the pristine-tar branch. Visit the repository page on Launchpad, and set the default branch to ubuntu/master.

DesktopTeam/git (last edited 2023-09-07 19:36:06 by bandali)