unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Efraim Flashner <efraim@flashner.co.il>
To: "Clément Lassieur" <clement@lassieur.org>
Cc: guix-devel@gnu.org
Subject: Re: [PATCH] gnu: Add git-review.
Date: Fri, 9 Sep 2016 18:00:21 +0300	[thread overview]
Message-ID: <20160909150021.GD5507@macbook42.flashner.co.il> (raw)
In-Reply-To: <87oa3xfpmv.fsf@lassieur.org>


[-- Attachment #1.1: Type: text/plain, Size: 1869 bytes --]

On Fri, Sep 09, 2016 at 10:23:20AM +0200, Clément Lassieur wrote:
> Efraim Flashner <efraim@flashner.co.il> writes:
> 
> > On Thu, Sep 08, 2016 at 10:28:37PM +1000, Ben Woodcroft wrote:
> 
> >> 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
> >> 
> >
> > Try it with the attached patch
> 
> Hi, sorry for the mess and thanks for the reviews.
> 
> I did not know about the "guix environment -C -N" way of testing
> packages, and I'm very happy to learn this.
> 
> The attached patch seems to work for git, but the same error now happens
> with ssh.
> 
> -- 
> Clément

I found ssh and I found an instance of scp, so this should be better.

-- 
Efraim Flashner   <efraim@flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

[-- Attachment #1.2: 0001-gnu-python-git-review-Find-outside-commands.patch --]
[-- Type: text/plain, Size: 2778 bytes --]

From a4169c369d850da7859e94152f96dc71acb42e4f Mon Sep 17 00:00:00 2001
From: Efraim Flashner <efraim@flashner.co.il>
Date: Thu, 8 Sep 2016 21:31:32 +0300
Subject: [PATCH] gnu: python-git-review: Find outside commands.

* gnu/packages/openstack.scm (python-git-review)[arguments]: Hardcode
the location of `git', `ssh' and `scp' so that `git-review' can find
it natively.
[inputs]: Add openssh.
---
 gnu/packages/openstack.scm | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/openstack.scm b/gnu/packages/openstack.scm
index 4cb38a9..65bc296 100644
--- a/gnu/packages/openstack.scm
+++ b/gnu/packages/openstack.scm
@@ -20,6 +20,7 @@
 
 (define-module (gnu packages openstack)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages ssh)
   #:use-module (gnu packages tls)
   #:use-module (gnu packages version-control)
   #:use-module (guix build-system python)
@@ -796,11 +797,33 @@ permanence.")
         (base32
          "07d1jn9ryff5j5ic6qj5pbk10m1ccmpllj0wyalrcms1q9yhlzh8"))))
     (build-system python-build-system)
-    (arguments `(#:tests? #f)) ; tests require a running Gerrit server
+    (arguments
+     `(#:tests? #f ; tests require a running Gerrit server
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'hardcode-outside-programs
+           (lambda _
+             (let* ((git  (string-append
+                            (assoc-ref %build-inputs "git") "/bin/git"))
+                    (base (assoc-ref %build-inputs "openssh"))
+                    (ssh  (string-append base "/bin/ssh"))
+                    (scp  (string-append base "/bin/scp")))
+               (substitute* '("git_review/cmd.py" "git_review/tests/test_git_review.py"
+                              "git_review/tests/test_unit.py" "git_review/tests/utils.py")
+                            (("\"git ") (string-append "\"" git " "))
+                            (("\"git\"") (string-append "\"" git "\""))
+                            (("'git'") (string-append "'" git "'")))
+               (substitute* "git_review/cmd.py"
+                            (("\"ssh\"") (string-append "\"" ssh "\""))
+                            (("'ssh'") (string-append "'" ssh "'"))
+                            (("\"scp\"") (string-append "\"" scp "\""))
+                            (("'scp") (string-append "'" scp)))
+               #t))))))
     (native-inputs
      `(("python-pbr" ,python-pbr)))
     (inputs
      `(("python-requests" ,python-requests)
+       ("openssh" ,openssh)
        ("git" ,git)))
     (home-page "http://docs.openstack.org/infra/git-review/")
     (synopsis "Command-line tool for Gerrit")
-- 
2.10.0


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2016-09-09 15:00 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-08  7:06 [PATCH] gnu: Add git-review Clément Lassieur
2016-09-08  7:37 ` Vincent Legoll
2016-09-08 10:16 ` Efraim Flashner
2016-09-08 12:28   ` [PATCH] gnu: Add python-git-review Clément Lassieur
2016-09-08 17:45     ` Efraim Flashner
2016-09-08 12:28 ` [PATCH] gnu: Add git-review Ben Woodcroft
2016-09-08 17:58   ` Efraim Flashner
2016-09-09 16:24     ` Clément Lassieur
2016-09-09 20:27       ` Clément Lassieur
2016-09-08 18:32   ` Efraim Flashner
2016-09-09  8:23     ` Clément Lassieur
2016-09-09 15:00       ` Efraim Flashner [this message]
2016-09-09 16:09         ` Clément Lassieur
2016-09-10 19:05           ` Efraim Flashner
2016-09-10 21:13             ` [PATCH] gnu: python-git-review: Wrap it so 'git', 'ssh' and 'scp' are found Clément Lassieur
2016-09-11  7:05               ` Efraim Flashner
2016-09-10 21:25             ` [PATCH] gnu: Add git-review Clément Lassieur
2016-09-09 18:49         ` Alex Kost

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160909150021.GD5507@macbook42.flashner.co.il \
    --to=efraim@flashner.co.il \
    --cc=clement@lassieur.org \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).