unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / Atom feed
* [bug#48232] [PATCH 0/2] Add mercurial-commitsigs and some changes to Mercurial.
       [not found] <cover.1620159508.git.public@yoctocell.xyz>
@ 2021-05-04 20:58 ` Xinglu Chen
  2021-05-04 21:00 ` [bug#48232] [PATCH 1/2] gnu: Add mercurial-commitsigs Xinglu Chen
  2021-05-04 21:00 ` [bug#48232] [PATCH 2/2] gnu: mercurial: Add PYTHONPATH to Xinglu Chen
  2 siblings, 0 replies; 3+ messages in thread
From: Xinglu Chen @ 2021-05-04 20:58 UTC (permalink / raw)
  To: 48232

The first patch adds the commitsigs extension for Mercurial, it allows
users to sign Mercurial changesets (equivalent to Git commits) with
GnuPG or OpenSSL.

The second patch adds PYTHONPATH to the ‘native-search-paths’ field of
Mercurial, this allows Mercurial to automatically find third-party
extensions (like commitsigs) installed in
/gnu/store/...-profile/lib/python3.8/site-packages/hgext3rd.  By
default, it only looks at
/gnu/store/...-mercurial/lib/python3.8/site-packages/hgext3rd.

However, I am not sure this is the best approach since it messes with
PYTHONPATH, AFAIK there is no such things as a HGEXTENSIONS variable I
could set.  Another problem is that I have to hardcode “python3.8”, this
would obviously have to be updated if the default Python version gets
updated.  I did try to do something like this:

#+begin_src scheme
(string-append
  "lib/python"
  (string-join
    (drop-right (string-split (package-version python) #\.) 1)
    ".")
  "/site-packages/hgext3rd")
#+end_src

but it just gave me a confusing error message when trying to build it;
it worked fine if I hit {C-x C-e} in Emacs, though.

What we could do instead is to delegate the work of installing Mercurial
extensions to Guix Home[1] (I am currently working on adding a service
for Mercurial[2]) and add a ‘mercurial-extension-file-path’ key to the
‘properties’ field of Mercurial extensions so Guix Home can tell
Mercurial where to find the extension by the relevant lines in hgrc.  We
could have a package definition like this:

#+begin_src scheme
(package
  (name "mercurial-commitsigs")
  ...
  (properties
   '((mercurial-extension-file-path . "commitsigs.py"))))
#+end_src

hgrc:

#+begin_src
[extensions]
commitsigs = /gnu/store/...-mercurial-commitsigs/commitsigs.py
#+end_src

[1]: https://yhetil.org/guix-devel/878s6u2pco.fsf@trop.in/
[2]: https://lists.sr.ht/~abcdw/rde-devel/patches/22421

Xinglu Chen (2):
  gnu: Add mercurial-commitsigs.
  gnu: mercurial: Add PYTHONPATH to ‘native-search-paths’.

 gnu/packages/version-control.scm | 68 ++++++++++++++++++++++++++++++++
 1 file changed, 68 insertions(+)


base-commit: aa7eeabe9a782afc2535581298990050d16b1895
-- 
2.31.1




^ permalink raw reply	[flat|nested] 3+ messages in thread

* [bug#48232] [PATCH 1/2] gnu: Add mercurial-commitsigs.
       [not found] <cover.1620159508.git.public@yoctocell.xyz>
  2021-05-04 20:58 ` [bug#48232] [PATCH 0/2] Add mercurial-commitsigs and some changes to Mercurial Xinglu Chen
@ 2021-05-04 21:00 ` Xinglu Chen
  2021-05-04 21:00 ` [bug#48232] [PATCH 2/2] gnu: mercurial: Add PYTHONPATH to Xinglu Chen
  2 siblings, 0 replies; 3+ messages in thread
From: Xinglu Chen @ 2021-05-04 21:00 UTC (permalink / raw)
  To: 48232

* gnu/packages/version-control.scm (mercurial-commitsigs): New variable.
---
Note: I am using ‘git-version’ and ‘git-file-name’, maybe we should add
the equivalent procedures in (guix hg-download) ?

 gnu/packages/version-control.scm | 63 ++++++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)

diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
index 0cad83c4b0..3a1cb33fc3 100644
--- a/gnu/packages/version-control.scm
+++ b/gnu/packages/version-control.scm
@@ -62,6 +62,7 @@
   #:use-module (guix download)
   #:use-module (guix git-download)
   #:use-module (guix hg-download)
+  #:use-module (guix build python-build-system)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system copy)
   #:use-module (guix build-system gnu)
@@ -88,6 +89,7 @@
   #:use-module (gnu packages gl)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages gnome)
+  #:use-module (gnu packages gnupg)
   #:use-module (gnu packages golang)
   #:use-module (gnu packages groff)
   #:use-module (gnu packages guile)
@@ -1741,6 +1743,67 @@ and offers an easy and intuitive interface.")
 history.  It implements the changeset evolution concept for Mercurial.")
     (license license:gpl2)))
 
+(define-public mercurial-commitsigs
+  ;; Latest tag is 11 years old.
+  (let ((changeset "b53eb6862bff")
+        (revision "0"))
+    (package
+      (name "mercurial-commitsigs")
+      (version (git-version "0.1.0" revision changeset))
+      (source (origin
+                (method hg-fetch)
+                (uri (hg-reference
+                      (url "https://foss.heptapod.net/mercurial/commitsigs")
+                      (changeset changeset)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "059gm66q06m6ayl4brsc517zkw3ahmz249b6xm1m32ac5y24wb9x"))))
+      (build-system copy-build-system)
+      (arguments
+       `(#:imported-modules ((guix build python-build-system)
+                             ,@%copy-build-system-modules)
+         #:modules ((srfi srfi-1)
+                    (guix build python-build-system)
+                    ;; Don't use `%copy-build-system-modules' because
+                    ;; `standard-phases' from (guix build gnu-build-system)
+                    ;; shadows the one from (guix build copy-build-system),
+                    ;; which is the one we actually want.
+                    (guix build copy-build-system)
+                    ((guix build gnu-build-system) #:prefix gnu)
+                    (guix build utils)
+                    (guix build gremlin)
+                    (ice-9 ftw)
+                    (guix elf))
+         #:phases
+         (modify-phases %standard-phases
+           (add-after 'unpack 'patch-paths
+           (lambda* (#:key inputs #:allow-other-keys)
+             (let ((gpg (string-append (assoc-ref inputs "gnupg")
+                                       "/bin/gpg"))
+                   (openssl (string-append (assoc-ref inputs "openssl")
+                                           "/bin/openssl")))
+               (substitute* "commitsigs.py"
+                 (("b'gpg',") (string-append "b'" gpg "',"))
+                 (("b'openssl',") (string-append "b'" openssl "',")))))))
+         #:install-plan
+         `(("commitsigs.py" ,(string-append "lib/python"
+                                            (python-version
+                                             (assoc-ref %build-inputs "python"))
+                                            "/site-packages/hgext3rd/commitsigs.py")))))
+      (native-inputs
+       `(("python" ,python)))
+      (inputs
+       `(("gnupg" ,gnupg)
+         ("openssl" ,openssl)))
+      (home-page "https://foss.heptapod.net/mercurial/commitsigs")
+      (synopsis "Automatic signing of changeset hashes")
+      (description "This package provides a Mercurial extension for signing
+the changeset hash of commits.  The signure is embedded directly in the
+changeset itself; there won't be any extra commits.  Either GnuPG or OpenSSL
+can be used for signing.")
+      (license license:gpl3+))))
+
 (define-public neon
   (package
     (name "neon")
-- 
2.31.1






^ permalink raw reply	[flat|nested] 3+ messages in thread

* [bug#48232] [PATCH 2/2] gnu: mercurial: Add PYTHONPATH to
       [not found] <cover.1620159508.git.public@yoctocell.xyz>
  2021-05-04 20:58 ` [bug#48232] [PATCH 0/2] Add mercurial-commitsigs and some changes to Mercurial Xinglu Chen
  2021-05-04 21:00 ` [bug#48232] [PATCH 1/2] gnu: Add mercurial-commitsigs Xinglu Chen
@ 2021-05-04 21:00 ` Xinglu Chen
  2 siblings, 0 replies; 3+ messages in thread
From: Xinglu Chen @ 2021-05-04 21:00 UTC (permalink / raw)
  To: 48232

This will make Mercurial be able to find third-party extensions.

* gnu/packages/version-control.scm (mercurial)[native-search-paths]: Add
PYTHONPATH.
---
 gnu/packages/version-control.scm | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
index 3a1cb33fc3..9711516609 100644
--- a/gnu/packages/version-control.scm
+++ b/gnu/packages/version-control.scm
@@ -1709,6 +1709,11 @@ execution of any hook written in any language before every commit.")
      `(("python-nose" ,python-nose)
        ("unzip" ,unzip)
        ("which" ,which)))
+    ;; Find third-party extensions.
+    (native-search-paths
+     (list (search-path-specification
+            (variable "PYTHONPATH")
+            (files '("lib/python3.8/site-packages/hgext3rd")))))
     (home-page "https://www.mercurial-scm.org/")
     (synopsis "Decentralized version control system")
     (description
-- 
2.31.1






^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-05-04 21:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <cover.1620159508.git.public@yoctocell.xyz>
2021-05-04 20:58 ` [bug#48232] [PATCH 0/2] Add mercurial-commitsigs and some changes to Mercurial Xinglu Chen
2021-05-04 21:00 ` [bug#48232] [PATCH 1/2] gnu: Add mercurial-commitsigs Xinglu Chen
2021-05-04 21:00 ` [bug#48232] [PATCH 2/2] gnu: mercurial: Add PYTHONPATH to Xinglu Chen

unofficial mirror of guix-patches@gnu.org 

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://yhetil.org/guix-patches/1 guix-patches/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 guix-patches guix-patches/ https://yhetil.org/guix-patches \
		guix-patches@gnu.org
	public-inbox-index guix-patches

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://news.yhetil.org/yhetil.gnu.guix.patches


AGPL code for this site: git clone http://ou63pmih66umazou.onion/public-inbox.git