Hi Jonathan,
On Tue, Jul 06, 2010 at 03:22:51AM -0500, Jonathan Nieder wrote:
> Here’s a try.
Applied, thanks! I fixed the missing self. in the os.path.join and did
some minor renaming.
> I am not so happy about how the documentation (especially gbp.conf) since
> unlike the existing hooks, this one is not a ready-made thing. I
> considered
>
> # update build scripts before building:
> #prebuild = autoreconf -fi
>
> which is a nice and simple example, but it is imho bad practice that I
> do not want to encourage.
I think the autogen.sh example is quiet o.k. for now.
> Maybe it would be nice to have a git-upstream-changelog command so
> anyone could use
>
> prebuild = git-upstream-changelog >debian/changelog.upstream
>
> The tricky bit is coming up with generic code to find the tag
> corresponding to a given upstream version (as listed in
> debian/changelog).
Having that would indeed be nice but can be added later. In case you
want to work on this, this would be very welcome.
Another alternative would be a hook that generates an upstream changelog
from git (like for all those packages that stopped shipping an upstream
changelog at all (e.g. lots of the GNOME stuff).
Cheers and thanks,
-- Guido
>
> Thoughts?
>
> docs/chapters/building.sgml | 3 ++-
> docs/manpages/git-buildpackage.sgml | 12 ++++++++++++
> gbp.conf | 2 ++
> gbp/config.py | 1 +
> gbp/git.py | 3 +++
> git-buildpackage | 7 +++++++
> 6 files changed, 27 insertions(+), 1 deletions(-)
>
> diff --git a/docs/chapters/building.sgml b/docs/chapters/building.sgml
> index 2205940..f68e378 100644
> --- a/docs/chapters/building.sgml
> +++ b/docs/chapters/building.sgml
> @@ -78,7 +78,8 @@ export-dir=../build-area
> Besides the commands for cleaning the package build dir
> (<option>cleaner</option> and building the package
> (<option>builder</option>) you can also invoke hooks during the package
> - build: after a succesful build (<option>postbuild</option>) and after
> + build: immediately before a build (<option>prebuild</option>,
> + after a succesful build (<option>postbuild</option>) and after
> creating a tag (<option>posttag</option>). Typical applications are
> running
> <productname>lintian</productname> or pushing changes into a remote
> repository.
> diff --git a/docs/manpages/git-buildpackage.sgml
> b/docs/manpages/git-buildpackage.sgml
> index a1eac1f..3f2ed28 100644
> --- a/docs/manpages/git-buildpackage.sgml
> +++ b/docs/manpages/git-buildpackage.sgml
> @@ -31,6 +31,7 @@
>
> <arg><option>--git-keyid=</option><replaceable>gpg-keyid</replaceable></arg>
>
> <arg><option>--git-posttag=</option><replaceable>command</replaceable></arg>
>
> <arg><option>--git-postbuild=</option><replaceable>command</replaceable></arg>
> +
> <arg><option>--git-prebuild=</option><replaceable>command</replaceable></arg>
>
> <arg><option>--git-debian-tag=</option><replaceable>tag-format</replaceable></arg>
> <arg><option>--git-force-create</option></arg>
> <arg><option>--git-no-create-orig</option></arg>
> @@ -193,6 +194,17 @@
> </listitem>
> </varlistentry>
> <varlistentry>
> +
> <term><option>--git-prebuild=</option><replaceable>command</replaceable>
> + </term>
> + <listitem>
> + <para>execute <replaceable>command</replaceable> from the build
> + directory before calling <application>debuild</application>
> + or the application specified via
> <option>--git-builder</option>.</para>
> + <para>Exported environment variables are:
> + <envar>GBP_GIT_DIR</envar> (the repository the package is being
> built from),
> + <envar>GBP_BUILD_DIR</envar> (the build dir).
> + </listitem>
> + <varlistentry>
>
> <term><option>--git-debian-tag=</option><replaceable>tag-format</replaceable>
> </term>
> <listitem>
> diff --git a/gbp.conf b/gbp.conf
> index 9fe94e5..6024922 100644
> --- a/gbp.conf
> +++ b/gbp.conf
> @@ -28,6 +28,8 @@
> #posttag = git-push git.example.com
> # call lintian after a successful build:
> #postbuild = lintian $GBP_CHANGES_FILE
> +# let package generate upstream changelog before build:
> +#prebuild = GIT_DIR=$GBP_GIT_DIR debian/autogen.sh
> # use this for more svn-buildpackage like behaviour:
> #export-dir = ../build-area/
> #tarball-dir = ../tarballs/
> diff --git a/gbp/config.py b/gbp/config.py
> index 7c93200..a0ca547 100644
> --- a/gbp/config.py
> +++ b/gbp/config.py
> @@ -37,6 +37,7 @@ class GbpOptionParser(OptionParser):
> 'keyid' : '',
> 'posttag' : '',
> 'postbuild' : '',
> + 'prebuild' : '',
> 'postimport' : '',
> 'debian-tag' : 'debian/%(version)s',
> 'upstream-tag' : 'upstream/%(version)s',
> diff --git a/gbp/git.py b/gbp/git.py
> index 8546a83..4a1f2eb 100644
> --- a/gbp/git.py
> +++ b/gbp/git.py
> @@ -62,6 +62,9 @@ class GitRepository(object):
> stdin = None
> return stdin
>
> + def git_dir(self):
> + return os.path.join(path,'.git')
> +
> def has_branch(self, branch, remote=False):
> """
> check if the repository has branch 'branch'
> diff --git a/git-buildpackage b/git-buildpackage
> index dba20a9..96520c6 100755
> --- a/git-buildpackage
> +++ b/git-buildpackage
> @@ -258,6 +258,8 @@ def main(argv):
> help="command to build the Debian package, default is
> '%(builder)s'")
> cmd_group.add_config_file_option(option_name="cleaner", dest="cleaner",
> help="command to clean the working copy, default is
> '%(cleaner)s'")
> + cmd_group.add_config_file_option(option_name="prebuild", dest="prebuild",
> + help="command to run before a build, default is
> '%(prebuild)s'")
> cmd_group.add_config_file_option(option_name="postbuild",
> dest="postbuild",
> help="hook run after a successful build, default is
> '%(postbuild)s'")
> cmd_group.add_config_file_option(option_name="posttag", dest="posttag",
> @@ -376,6 +378,11 @@ def main(argv):
> else:
> build_dir = repo_dir
>
> + if options.prebuild:
> + RunAtCommand(options.prebuild, shell=True,
> + extra_env={'GBP_GIT_DIR': repo.git_dir(),
> + 'GBP_BUILD_DIR':
> build_dir})(dir=build_dir)
> +
> # Finally build the package:
> RunAtCommand(options.builder, dpkg_args, shell=True,
> extra_env={'GBP_BUILD_DIR':
> build_dir})(dir=build_dir)
> --
> 1.7.2.rc1.527.gff41c3.dirty
>
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]