diff mbox

gnu: Add git-review.

Message ID 20160908070630.18458-1-clement@lassieur.org
State New
Headers show

Commit Message

Clément Lassieur Sept. 8, 2016, 7:06 a.m. UTC
* gnu/packages/openstack.scm (git-review): New variable.
---
 gnu/packages/openstack.scm | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

Comments

Vincent Legoll Sept. 8, 2016, 7:37 a.m. UTC | #1
Hello,

On Thu, Sep 8, 2016 at 9:06 AM, Clément Lassieur <clement@lassieur.org> wrote:
> * gnu/packages/openstack.scm (git-review): New variable.

Yay !

Cannot comment on the input / native-input thing, but otherwise LGTM...

BTW, do any high-level Guix contributor have experience with git-review+gerrit ?

I have a little, I like it, even it it can be felt as a bit heavy,
maybe worth investigating
as a way to enhance contributor workflow, dunno...
Efraim Flashner Sept. 8, 2016, 10:16 a.m. UTC | #2
On Thu, Sep 08, 2016 at 09:06:30AM +0200, Clément Lassieur wrote:
> * gnu/packages/openstack.scm (git-review): New variable.
> ---
>  gnu/packages/openstack.scm | 29 +++++++++++++++++++++++++++++
>  1 file changed, 29 insertions(+)
> 
> diff --git a/gnu/packages/openstack.scm b/gnu/packages/openstack.scm
> index 8474904..2a54a20 100644
> --- a/gnu/packages/openstack.scm
> +++ b/gnu/packages/openstack.scm
> @@ -1,6 +1,7 @@
>  ;;; GNU Guix --- Functional package management for GNU
>  ;;; Copyright © 2015 Cyril Roelandt <tipecaml@gmail.com>
>  ;;; Copyright © 2015, 2016 Efraim Flashner <efraim@flashner.co.il>
> +;;; Copyright © 2016 Clément Lassieur <clement@lassieur.org>
>  ;;;
>  ;;; This file is part of GNU Guix.
>  ;;;
> @@ -20,6 +21,7 @@
>  (define-module (gnu packages openstack)
>    #:use-module (gnu packages python)
>    #:use-module (gnu packages tls)
> +  #:use-module (gnu packages version-control)
>    #:use-module (guix build-system python)
>    #:use-module (guix download)
>    #:use-module ((guix licenses)
> @@ -781,3 +783,30 @@ permanence.")
>           ("python2-oslosphinx" ,python2-oslosphinx)
>           ,@(fold alist-delete (package-native-inputs swiftclient)
>              '("python-keystoneclient" "python-oslosphinx")))))))
> +
> +(define-public git-review
> +  (package
> +    (name "git-review")
> +    (version "1.25.0")
> +    (source
> +     (origin
> +       (method url-fetch)
> +       (uri (string-append
> +             "https://pypi.python.org/packages/source/g/git-review/git-review-"
> +             version ".tar.gz"))

This should be (uri (pypi-uri "git-review" version))

> +       (sha256
> +        (base32
> +         "07d1jn9ryff5j5ic6qj5pbk10m1ccmpllj0wyalrcms1q9yhlzh8"))))
> +    (build-system python-build-system)
> +    (arguments `(#:tests? #f)) ; tests require a running Gerrit server
> +    (native-inputs
> +     `(("python-pbr" ,python-pbr)))
> +    (inputs
> +     `(("python-requests" ,python-requests)
> +       ("git" ,git)))
> +    (home-page "http://docs.openstack.org/infra/git-review/")
> +    (synopsis "Command-line tool for Gerrit")
> +    (description
> +     "Git-review is a command-line tool that helps submitting Git branches to
> +Gerrit for review, or fetching existing ones.")
> +    (license asl2.0)))
> -- 
> 2.10.0
> 
> 

Does this also build for python-2?
Ben Woodcroft Sept. 8, 2016, 12:28 p.m. UTC | #3
Hi there, thanks for the patch. I do not have any experience with Gerrit 
but some comments below:


On 08/09/16 17:06, Clément Lassieur wrote:
> [..]
> +    (source
> +     (origin
> +       (method url-fetch)
> +       (uri (string-append
> +             "https://pypi.python.org/packages/source/g/git-review/git-review-"
> +             version ".tar.gz"))

Rather: (uri (pypi-uri "git-review" version))

> +       (sha256
> +        (base32
> +         "07d1jn9ryff5j5ic6qj5pbk10m1ccmpllj0wyalrcms1q9yhlzh8"))))
> +    (build-system python-build-system)
> +    (arguments `(#:tests? #f)) ; tests require a running Gerrit server
> +    (native-inputs
> +     `(("python-pbr" ,python-pbr)))
> +    (inputs
> +     `(("python-requests" ,python-requests)
> +       ("git" ,git)))

I think including git simply as an input is problematic because 
git-review calls git via 'subprocess', as evidenced by

$ ./pre-inst-env guix environment -C --ad-hoc git-review
$ git-review
[..]
   File 
"/gnu/store/m4gc2wx4q9if1vrhgclpspdil7rqsn21-python-3.4.3/lib/python3.4/subprocess.py", 
line 1457, in _execute_child
     raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: 'git'

So, I think we need to patch the source code to call the full path to 
git, or otherwise wrap the 'git-review' executable.

> +    (home-page "http://docs.openstack.org/infra/git-review/")
> +    (synopsis "Command-line tool for Gerrit")
> +    (description
> +     "Git-review is a command-line tool that helps submitting Git branches to
> +Gerrit for review, or fetching existing ones.")
> +    (license asl2.0)))
Otherwise seems OK to me. Can you test with environment -C -N?
ben
Efraim Flashner Sept. 8, 2016, 5:58 p.m. UTC | #4
On Thu, Sep 08, 2016 at 10:28:37PM +1000, Ben Woodcroft wrote:
> Hi there, thanks for the patch. I do not have any experience with Gerrit but
> some comments below:
> 
> 
> On 08/09/16 17:06, Clément Lassieur wrote:
> > [..]
> > +    (source
> > +     (origin
> > +       (method url-fetch)
> > +       (uri (string-append
> > +             "https://pypi.python.org/packages/source/g/git-review/git-review-"
> > +             version ".tar.gz"))
> 
> Rather: (uri (pypi-uri "git-review" version))
> 
> > +       (sha256
> > +        (base32
> > +         "07d1jn9ryff5j5ic6qj5pbk10m1ccmpllj0wyalrcms1q9yhlzh8"))))
> > +    (build-system python-build-system)
> > +    (arguments `(#:tests? #f)) ; tests require a running Gerrit server
> > +    (native-inputs
> > +     `(("python-pbr" ,python-pbr)))
> > +    (inputs
> > +     `(("python-requests" ,python-requests)
> > +       ("git" ,git)))
> 
> I think including git simply as an input is problematic because git-review
> calls git via 'subprocess', as evidenced by
> 
> $ ./pre-inst-env guix environment -C --ad-hoc git-review
> $ git-review
> [..]
>   File "/gnu/store/m4gc2wx4q9if1vrhgclpspdil7rqsn21-python-3.4.3/lib/python3.4/subprocess.py",
> line 1457, in _execute_child
>     raise child_exception_type(errno_num, err_msg)
> FileNotFoundError: [Errno 2] No such file or directory: 'git'
> 
> So, I think we need to patch the source code to call the full path to git,
> or otherwise wrap the 'git-review' executable.
> 
> > +    (home-page "http://docs.openstack.org/infra/git-review/")
> > +    (synopsis "Command-line tool for Gerrit")
> > +    (description
> > +     "Git-review is a command-line tool that helps submitting Git branches to
> > +Gerrit for review, or fetching existing ones.")
> > +    (license asl2.0)))
> Otherwise seems OK to me. Can you test with environment -C -N?
> ben
> 

Oh no! I just pushed this.
Clément Lassieur Sept. 9, 2016, 4:24 p.m. UTC | #5
Efraim Flashner <efraim@flashner.co.il> writes:

> Oh no! I just pushed this.

With the patch already pushed, I get this error:

--8<---------------cut here---------------start------------->8---
Using global/system git-review config files (/etc/git-review/git-review.conf) is deprecated
Downloading refs/changes/73/36373/1 from gerrit
Traceback (most recent call last):
  File "/gnu/store/ss27c082a95dzra46lsv9fwg0sw6x7zg-python-git-review-1.25.0/bin/.git-review-real", line 10, in <module>
    sys.exit(main())
  File "/gnu/store/ss27c082a95dzra46lsv9fwg0sw6x7zg-python-git-review-1.25.0/lib/python3.4/site-packages/git_review/cmd.py", line 1522, in main
    _main()
  File "/gnu/store/ss27c082a95dzra46lsv9fwg0sw6x7zg-python-git-review-1.25.0/lib/python3.4/site-packages/git_review/cmd.py", line 1437, in _main
    checkout_review(local_branch, remote, remote_branch)
  File "/gnu/store/ss27c082a95dzra46lsv9fwg0sw6x7zg-python-git-review-1.25.0/lib/python3.4/site-packages/git_review/cmd.py", line 1123, in checkout_review
    branch_name, "FETCH_HEAD")
  File "/gnu/store/ss27c082a95dzra46lsv9fwg0sw6x7zg-python-git-review-1.25.0/lib/python3.4/site-packages/git_review/cmd.py", line 160, in run_command_exc
    (rc, output) = run_command_status(*argv, **env)
  File "/gnu/store/ss27c082a95dzra46lsv9fwg0sw6x7zg-python-git-review-1.25.0/lib/python3.4/site-packages/git_review/cmd.py", line 144, in run_command_status
    env=newenv)
  File "/gnu/store/m4gc2wx4q9if1vrhgclpspdil7rqsn21-python-3.4.3/lib/python3.4/subprocess.py", line 859, in __init__
    restore_signals, start_new_session)
  File "/gnu/store/m4gc2wx4q9if1vrhgclpspdil7rqsn21-python-3.4.3/lib/python3.4/subprocess.py", line 1395, in _execute_child
    restore_signals, start_new_session, preexec_fn)
UnicodeEncodeError: 'ascii' codec can't encode character '\xe9' in position 9: ordinal not in range(128)
--8<---------------cut here---------------end--------------->8---

I'm sorry I didn't test it well enough. Maybe we should revert it, since
it's probably unusable.
Clément Lassieur Sept. 9, 2016, 8:27 p.m. UTC | #6
Clément Lassieur <clement@lassieur.org> writes:

> With the patch already pushed, I get this error:
>
> --8<---------------cut here---------------start------------->8---
> Using global/system git-review config files (/etc/git-review/git-review.conf) is deprecated
> Downloading refs/changes/73/36373/1 from gerrit
> Traceback (most recent call last):
>   File "/gnu/store/ss27c082a95dzra46lsv9fwg0sw6x7zg-python-git-review-1.25.0/bin/.git-review-real", line 10, in <module>
>     sys.exit(main())
>   File "/gnu/store/ss27c082a95dzra46lsv9fwg0sw6x7zg-python-git-review-1.25.0/lib/python3.4/site-packages/git_review/cmd.py", line 1522, in main
>     _main()
>   File "/gnu/store/ss27c082a95dzra46lsv9fwg0sw6x7zg-python-git-review-1.25.0/lib/python3.4/site-packages/git_review/cmd.py", line 1437, in _main
>     checkout_review(local_branch, remote, remote_branch)
>   File "/gnu/store/ss27c082a95dzra46lsv9fwg0sw6x7zg-python-git-review-1.25.0/lib/python3.4/site-packages/git_review/cmd.py", line 1123, in checkout_review
>     branch_name, "FETCH_HEAD")
>   File "/gnu/store/ss27c082a95dzra46lsv9fwg0sw6x7zg-python-git-review-1.25.0/lib/python3.4/site-packages/git_review/cmd.py", line 160, in run_command_exc
>     (rc, output) = run_command_status(*argv, **env)
>   File "/gnu/store/ss27c082a95dzra46lsv9fwg0sw6x7zg-python-git-review-1.25.0/lib/python3.4/site-packages/git_review/cmd.py", line 144, in run_command_status
>     env=newenv)
>   File "/gnu/store/m4gc2wx4q9if1vrhgclpspdil7rqsn21-python-3.4.3/lib/python3.4/subprocess.py", line 859, in __init__
>     restore_signals, start_new_session)
>   File "/gnu/store/m4gc2wx4q9if1vrhgclpspdil7rqsn21-python-3.4.3/lib/python3.4/subprocess.py", line 1395, in _execute_child
>     restore_signals, start_new_session, preexec_fn)
> UnicodeEncodeError: 'ascii' codec can't encode character '\xe9' in position 9: ordinal not in range(128)
> --8<---------------cut here---------------end--------------->8---
>
> I'm sorry I didn't test it well enough. Maybe we should revert it, since
> it's probably unusable.

I had this error on a Debian/Guix laptop (without guix environment), but
I don't have it with my GuixSD laptop.
diff mbox

Patch

diff --git a/gnu/packages/openstack.scm b/gnu/packages/openstack.scm
index 8474904..2a54a20 100644
--- a/gnu/packages/openstack.scm
+++ b/gnu/packages/openstack.scm
@@ -1,6 +1,7 @@ 
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2015 Cyril Roelandt <tipecaml@gmail.com>
 ;;; Copyright © 2015, 2016 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2016 Clément Lassieur <clement@lassieur.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -20,6 +21,7 @@ 
 (define-module (gnu packages openstack)
   #:use-module (gnu packages python)
   #:use-module (gnu packages tls)
+  #:use-module (gnu packages version-control)
   #:use-module (guix build-system python)
   #:use-module (guix download)
   #:use-module ((guix licenses)
@@ -781,3 +783,30 @@  permanence.")
          ("python2-oslosphinx" ,python2-oslosphinx)
          ,@(fold alist-delete (package-native-inputs swiftclient)
             '("python-keystoneclient" "python-oslosphinx")))))))
+
+(define-public git-review
+  (package
+    (name "git-review")
+    (version "1.25.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append
+             "https://pypi.python.org/packages/source/g/git-review/git-review-"
+             version ".tar.gz"))
+       (sha256
+        (base32
+         "07d1jn9ryff5j5ic6qj5pbk10m1ccmpllj0wyalrcms1q9yhlzh8"))))
+    (build-system python-build-system)
+    (arguments `(#:tests? #f)) ; tests require a running Gerrit server
+    (native-inputs
+     `(("python-pbr" ,python-pbr)))
+    (inputs
+     `(("python-requests" ,python-requests)
+       ("git" ,git)))
+    (home-page "http://docs.openstack.org/infra/git-review/")
+    (synopsis "Command-line tool for Gerrit")
+    (description
+     "Git-review is a command-line tool that helps submitting Git branches to
+Gerrit for review, or fetching existing ones.")
+    (license asl2.0)))