control: forecmerge 679121 -1
control: tags 679121 -patch

Hi Michael,
thanks for the patch! I think we're heading in the right direction.

On Thu, Nov 24, 2016 at 12:26:19PM +0100, Michael Stapelberg wrote:
> Package: git-buildpackage
> Version: 0.8.6
> Severity: wishlist
> Tags: patch
> 
> I realize that https://bugs.debian.org/679121 is similar. In case you
> prefer to close this issue in favor of #679121, please update #679121
> with a clear decision as to how honouring DEBFULLNAME and DEBEMAIL in
> git-buildpackage should be implemented, and I’ll be happy to follow up.
> 
> Until that’s worked out, I’d like to propose a slightly different
> approach which I have been using for years: at clone-time, I set
> user.email to my debian email address.

The main reason 679121 is still open is that it wasn't clear to me where
exactly gbp should use DEBEMAIL/DEBFULLNAME and where not but what you
propose makes sense: use it everywhere gbp creates repos to set up sane
defaults:

* gbp clone
* gbp import-dsc
* gbp ipmort-srpm

But we need to make it configurable and add a test to make sure we don't
break it in the future (e.g. in tests/component/deb/test_clone.py).
Cheers,
 -- Guido

> 
> Please consider merging the attached patch. Thank you!
> 
> -- System Information:
> Debian Release: stretch/sid
>   APT prefers testing
>   APT policy: (990, 'testing'), (500, 'unstable')
> Architecture: amd64 (x86_64)
> Foreign Architectures: i386, armel, mipsel
> 
> Kernel: Linux 4.6.0-1-amd64 (SMP w/8 CPU cores)
> Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
> Shell: /bin/sh linked to /bin/dash
> Init: systemd (via /run/systemd/system)
> 
> Versions of packages git-buildpackage depends on:
> ii  devscripts            2.16.7
> ii  git                   1:2.9.3-1
> ii  man-db                2.7.5-1
> ii  python-dateutil       2.4.2-1
> ii  python-pkg-resources  25.2.0-1
> ii  python-six            1.10.0-3
> pn  python:any            <none>
> 
> Versions of packages git-buildpackage recommends:
> ii  cowbuilder       0.80
> ii  pbuilder         0.225.2
> ii  pristine-tar     1.34
> ii  python-requests  2.10.0-2
> ii  sbuild           0.71.0-2
> 
> Versions of packages git-buildpackage suggests:
> pn  python-notify  <none>
> ii  sudo           1.8.17p1-2
> ii  unzip          6.0-20
> 
> -- no debconf information

> >From 9d4f3ae0b3a783e8c96f1e83c9c2192c4fe0b56c Mon Sep 17 00:00:00 2001
> From: Michael Stapelberg <stapelb...@debian.org>
> Date: Thu, 24 Nov 2016 12:17:50 +0100
> Subject: [PATCH] gbp clone: configure user.email from DEBEMAIL
> 
> ---
>  gbp/git/repository.py | 10 ++++++++++
>  gbp/scripts/clone.py  |  3 +++
>  2 files changed, 13 insertions(+)
> 
> diff --git a/gbp/git/repository.py b/gbp/git/repository.py
> index 2f1b71b..d30ec07 100644
> --- a/gbp/git/repository.py
> +++ b/gbp/git/repository.py
> @@ -1063,6 +1063,16 @@ class GitRepository(object):
>              raise KeyError
>          return value[0][:-1]  # first line with \n ending removed
>  
> +    def set_user_email(self, email):
> +        """
> +        Sets the email address to use for git commits.
> +
> +        @param email: email address to use
> +        """
> +        args = GitArgs()
> +        args.add('user.email', email)
> +        self._git_command("config", args.args)
> +
>      def get_author_info(self):
>          """
>          Determine a sane values for author name and author email from git's
> diff --git a/gbp/scripts/clone.py b/gbp/scripts/clone.py
> index 63b1468..2313acf 100755
> --- a/gbp/scripts/clone.py
> +++ b/gbp/scripts/clone.py
> @@ -128,6 +128,9 @@ def main(argv):
>  
>          repo.set_branch(options.debian_branch)
>  
> +        if os.getenv('DEBEMAIL'):
> +            repo.set_user_email(os.getenv('DEBEMAIL'))
> +
>          if postclone:
>              Hook('Postclone', options.postclone,
>                   extra_env={'GBP_GIT_DIR': repo.git_dir},
> -- 
> 2.9.3
> 

Reply via email to