めんてなのおしごと

Fri, Oct 13, 2017 in debian

gbpの使い方をざっと教えて というリクエストを頂いたのでざっくりメモ。


$ git clone https://anonscm.debian.org/git/collab-maint/cutter-testing-framework.git
Cloning into 'cutter-testing-framework'...
remote: Counting objects: 3334, done.
remote: Compressing objects: 100% (949/949), done.
remote: Total 3334 (delta 2336), reused 3323 (delta 2336)
Receiving objects: 100% (3334/3334), 3.69 MiB | 442.00 KiB/s, done.
Resolving deltas: 100% (2336/2336), done.

$ cd cutter-testing-framework/

$ gbp import-orig --uscan --pristine-tar
gbp:error: 
Repository does not have branch 'upstream' for upstream sources. If there is none see
file:///usr/share/doc/git-buildpackage/manual-html/gbp.import.html#GBP.IMPORT.CONVERT
on howto create it otherwise use --upstream-branch to specify it.

$ git checkout upstream
Branch 'upstream' set up to track remote branch 'upstream' from 'origin'.
Switched to a new branch 'upstream'
$ git checkout pristine-tar 
Branch 'pristine-tar' set up to track remote branch 'pristine-tar' from 'origin'.
Switched to a new branch 'pristine-tar'
$ git checkout master 
Switched to branch 'master'
Your branch is up to date with 'origin/master'.

$ gbp import-orig --uscan --pristine-tar
gbp:info: Launching uscan...
uscan: Newest version of cutter-testing-framework on remote site is 1.2.6, local version is 1.2.4
uscan:    => Newer package available from
      http://cutter.sourceforge.net/archives/debian/cutter-testing-framework-1.2.6.tar.gz
gbp:info: using ../cutter-testing-framework_1.2.6.orig.tar.gz
What is the upstream version? [1.2.6] 
gbp:info: Importing '../cutter-testing-framework_1.2.6.orig.tar.gz' to branch 'upstream'...
gbp:info: Source package is cutter-testing-framework
gbp:info: Upstream version is 1.2.6
gbp:info: Replacing upstream source on 'master'
gbp:info: Successfully imported version 1.2.6 of ../cutter-testing-framework_1.2.6.orig.tar.gz
(色々編集してコミット...)
$ dch -v 1.2.6-1
$ dch -r
$ gbp buildpackage --git-pbuilder --git-pristine-tar

  • upstream archiveのimportの際に --pristine-tar でpristine-tarブランチにコミットしておくのを忘れない
  • 最初にupstreamブランチとpristine-tarブランチをchekoutしないとビルドの際にエラー(面倒くさいけど)
    • --git-pbuilder でpbuilder/cowbuilder環境を使う
    • --git-pristine-tar で pristine-tar ブランチのファイルを使う

これぐらいかな。今回はmasterブランチが=debian作業のブランチだけど、debianブランチを分けて作ってる場合は --git-ignore-branch 付けてビルドが必要。