[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Git policy



David Paleino wrote:

> I will shortly post a patch to policy.xml for review.

Here's a patch. It's a general guideline, it can be improved (but ENOTIME 
right now :))

Regarding my "helper tools", here's an example:

---8<---
$ cat /home/neo/bin/cow-lenny

#!/bin/bash
sudo cowbuilder $* --basepath /usr/src/base-lenny.cow/

$ cat /home/neo/bin/git-pbuilder-lenny

#!/bin/sh
set -e

pdebuild --pbuilder cowbuilder \
        --debbuildopts "-i\.git -I.git $*" -- \
        --basepath /usr/src/base-lenny.cow/
rm ../*_source.changes

$ alias git-b-lenny
alias git-b-lenny='git-b --git-builder=~/bin/git-pbuilder-lenny'
$ alias git-b
alias git-b='git-buildpackage --git-ignore-new'
$
--->8---

Obviously change "lenny" with whatever you wish. Just running "git-b-lenny" 
on the master branch, will build the package for lenny (after a "cow-lenny 
--update").

If anyone feels like including this in Policy as well.. :)

Kindly,
David

-- 
 . ''`.  Debian maintainer | http://wiki.debian.org/DavidPaleino
 : :'  : Linuxer #334216 --|-- http://www.hanskalabs.net/
 `. `'`  GPG: 1392B174 ----|---- http://snipr.com/qa_page
   `-   2BAB C625 4E66 E7B8 450A C3E1 E6AA 9017 1392 B174
Index: policy.xml
===================================================================
--- policy.xml	(revisione 4319)
+++ policy.xml	(copia locale)
@@ -330,6 +330,8 @@
 
 		<sect2>
 			<title>Injecting a new package</title>
+            <sect3>
+			<title>Subversion</title>
 			<para>To inject a new package to the SVN repository, you must have
 			write access to it; i.e. you must be a member of the <emphasis>debian-med</emphasis> group on Alioth.</para>
 			<para>You can inject a new package only after successfully building
@@ -350,9 +352,102 @@
 			debian-med Blend package in SVN. Normally maintainer watch the changes in
 			the Debian Med packaging pool but it helps if the maintainer of a
 			certain package verifies that everything is in the right place.</para>
-		</sect2>
-		<sect2>
+		</sect3>
+		<sect3>
+                <title>Git</title>
+                <sect4>
+                    <title>Creating a local repository</title>
+                    <para>Just a few instructions to get you started:</para>
+                    <blockquote>
+                        <para><userinput>
+                            <command>mkdir</command>
+                            <filename class="directory">package-version</filename>
+                            <option># this is just to make dh_make happy</option>
+                        </userinput></para>
+                        <para><userinput>
+                            <command>cd</command>
+                            <filename class="directory">package-version</filename>
+                        </userinput></para>
+                        <para><userinput>
+                            <command>git</command>
+                            <option>init</option>
+                        </userinput></para>
+                        <para><userinput>
+                            <command>git import-orig</command>
+                            <filename>/path/to/package_version.orig.tar.gz</filename>
+                        </userinput></para>
+                        <para><userinput>
+                            <command>dh_make</command>
+                        </userinput></para>
+                    </blockquote>
+                    <para>The above steps will create a repository with the appropriate layout for
+                    <command>git-buildpackage</command>, with three branches: <filename>master</filename>
+                    (where the Debian development will happen), <filename>pristine-tar</filename>,
+                    used by the <command>pristine-tar</command> tool during the package build process
+                    to recreate the original tarball, and <filename>upstream</filename>, which will
+                    contain the upstream source.</para>
+                    <para>After you create your <filename class="directory">debian/</filename> (be sure
+                    to commit it!), you should add a <quote>remote</quote> to the repository. A remote is
+                    where the commits will be pushed to, and the default remote is called <quote>origin</quote>.</para>
+                    <para>If you are going to push to our Alioth repository, please do the following inside your
+                    local repository:</para>
+                    <blockquote>
+                        <para><userinput>
+                            <command>git remote add origin</command>
+                            <filename class="directory">git+ssh://alioth.debian.org/git/debian-med/package.git</filename>
+                        </userinput></para>
+                    </blockquote>
+                    <para>The next step is to create the remote repository on Alioth.</para>
+                </sect4>
+                <sect4>
+                    <title>Creating the remote repository</title>
+                    <blockquote>
+                        <para><userinput>
+                            <command>ssh</command>
+                            <filename class="directory">alioth.debian.org</filename>
+                        </userinput></para>
+                        <para><userinput>
+                            <command>cd</command>
+                            <filename class="directory">/git/debian-med</filename>
+                        </userinput></para>
+                        <para><userinput>
+                            <command>./setup-repository</command>
+                            <option>packagename</option>
+                            <option>"Description of the package"</option>
+                        </userinput></para>
+                    </blockquote>
+                    <para>This will create a <filename class="directory">packagename.git</filename> repository on
+                    Alioth, with the proper hooks set up for our team.</para>
+                </sect4>
+                <sect4>
+                    <title>Pushing the package</title>
+                    <para>To push the package (make sure you've added the alioth remote!), do the following:</para>
+                    <blockquote>
+                        <para><userinput>
+                            <command>git push origin master</command>
+                        </userinput></para>
+                        <para><userinput>
+                            <command>git push</command>
+                            <option>--all</option>
+                        </userinput></para>
+                        <para><userinput>
+                            <command>git push</command>
+                            <option>--tags</command>
+                        </userinput></para>
+                    </blockquote>
+                    <para>For the first push, it's necessary to specify <quote>origin master</quote>. The next time
+                    you will push, a <command>git push</command> will suffice. Remember that this will only push the
+                    <quote>master</quote> branch (and the other two only if master is somehow related to the new
+                    branches), so be sure to also do a run with <option>--all</option>, and one with
+                    <option>--tags</option> (if you obviously changed anything in the other branches/tags).</para>
+                </sect4>
+            </sect3>
+        </sect2>
+        <sect2>
+            <sect3>
 			<title>Building the packages</title>
+            <sect4>
+            <title>Subversion</title>
 			<para>To build the package, just use the tools that <command>svn-buildpackage</command>
 			carries. First of all, we suggest you to define some aliases for the
 			most common commands:</para>
@@ -390,9 +485,47 @@
 			section), or send the result of svn diff to the
 			<ulink url="mailto:debian-med@lists.debian.org";>mailing list</ulink>
 			(<command>gzip -9</command> it, if it's too large).</para>
+            </sect4>
+            <sect4>
+                <title>Git</title>
+                <para>You should use <command>git-buildpackage</command> to build the
+                packages with git. Be sure to run it from the <quote>master</quote>
+                branch.</para>
+                <para>Unfortunately, by default <command>git-buildpackage</command>
+                builds the package without using any chroot (the same as
+                <command>svn-buildpackage</command>), but it's configurable to run
+                it inside a chroot.</para>
+                <para>You can use this configuration file, <filename>~/.gbp.conf</filename>:</para>
+                <blockquote>
+                    <programlisting>[DEFAULT]
+builder = ~/bin/git-pbuilder
+cleaner = fakeroot debian/rules clean
+pristine-tar = True
+
+[git-buildpackage]
+# use this for more svn-buildpackage like behaviour:
+export-dir = ../build-area/
+tarball-dir = ../tarballs/</programlisting>
+                </blockquote>
+                <para>With this configuration file you're specifying that
+                <command>git-buildpackage</command> will use <filename>~/bin/git-pbuilder</filename>
+                as the builder script. This is an example script you can use:</para>
+                <blockquote>
+                    <programlisting>#!/bin/sh
+set -e
+
+pdebuild --pbuilder cowbuilder --debbuildopts "-i\.git -I.git $*"
+rm ../*_source.changes</programlisting>
+                </blockquote>
+                <para>This will build the package inside the default cowbuilder chroot, while
+                passing any more parameters directly do <command>dpkg-buildpackage</command>.</para>
+            </sect4>
+            </sect3>
 		</sect2>
 		<sect2>
+            <sect3>
 			<title>Tagging packages</title>
+            <sect4>Subversion</sect4>
 			<para>It may happen that a package version has been uploaded to Debian
 			repositories, and you forgot to tag the last build with</para>
 			<blockquote>
@@ -433,6 +566,32 @@
 				</userinput></para>
 			</blockquote>
 			<para>(--svn-no-autodch avoids <filename>debian/changelog</filename> to be marked as UNRELEASED).</para>
+            </sect4>
+                <sect4>
+                    <title>Git</title>
+                    <para>Tagging a release with git is pretty straightforward:</para>
+                    <blockquote>
+                        <para><userinput>
+                            <command>git tag</command>
+                            <option>tagname</option>
+                        </userinput></para>
+                    </blockquote>
+                    <para>The tag names usually follow the scheme <quote>debian/x.y-z</quote>,
+                    this will ensure compatibility with other tools as well (like
+                    <command>git import-dsc</command>).</para>
+                    <para>You can also easily retroactively make tags:</para>
+                    <blockquote>
+                        <para><userinput>
+                            <command>git checkout</command>
+                            <option>&lt;commit hash&gt;</option>
+                        </userinput></para>
+                    </blockquote>
+                    <para>You're now at the point in history when you released the package.
+                    Just tag it as you would normally do.</para>
+                    <para>After tagging, be sure to <command>git push --tags</command>, so that
+                    other people can benefit from it too.</para>
+                </sect4>
+            </sect3>
 		</sect2>
 		<sect2>
 			<title>Handling patches</title>


Reply to: