Re: [PATCH] gnu: magit: Update to 2.2.0.

2015-08-22 Thread Alex Kost
Mark H Weaver (2015-08-22 20:31 +0300) wrote:

> Alex Kost  writes:
>
>> From 55e67d4f3867f11a77b9a91d4c3c54599846cc83 Mon Sep 17 00:00:00 2001
>> From: Alex Kost 
>> Date: Mon, 17 Aug 2015 21:44:40 +0300
>> Subject: [PATCH] gnu: magit: Update to 2.2.0.
>>
>> * gnu/packages/emacs.scm (magit): Update to 2.2.0.
>>   [inputs]: Remove 'git:gui'.
>>   [propagated-inputs]: Add 'dash', remove 'git-modes'.
>>   [arguments]: Enable tests.  Add VERSION, PREFIX and DASH_DIR to
>>   'make-flags'.  Remove 'configure', 'augment-load-path' and
>>   'post-install' phases.
>
> [...]
>
>> +   #:make-flags
>> +   (list (string-append "VERSION=" ,version)
>
> Interesting, you have to tell it what it's own version number is?

Yes, it tries to define the version using "git describe --tags ..." and
then it generates "magit-version.el" which is used only to set 'magit-version'
variable.

I think the main problem with this package (and many other packages,
sigh) is that there is no configure script, so there are some
workarounds to reinvent the wheel.

>>   (add-before
>>'build 'patch-exec-paths
>>(lambda* (#:key inputs #:allow-other-keys)
>> -(let ((git (assoc-ref inputs "git"))
>> -  (git:gui (assoc-ref inputs "git:gui")))
>> -  (emacs-substitute-variables "magit.el"
>> -("magit-git-executable" (string-append git "/bin/git"))
>> -("magit-gitk-executable" (string-append git:gui
>> -"/bin/gitk"))
>
> Does magit 2 no longer use gitk?

I don't see any sign of gitk (I don't understand why it was used before).

>> - (add-before
>> -  'build 'augment-load-path
>> -  (lambda* (#:key inputs #:allow-other-keys)
>> -;; Allow git-commit-mode.el & co. to be found.
>> -(let ((git-modes (assoc-ref inputs "git-modes")))
>> -  (setenv "EMACSLOADPATH"
>> -  (string-append ":" git-modes 
>> "/share/emacs/site-lisp"))
>> -  #t)))
>> - (add-after
>> -  'install 'post-install
>> -  (lambda* (#:key outputs #:allow-other-keys)
>> -(emacs-generate-autoloads
>> - ,name (string-append (assoc-ref outputs "out")
>> -  "/share/emacs/site-lisp/")))
>
> Are the autoloads installed by magit 2?

Yes.

>> +(let ((git (assoc-ref inputs "git")))
>> +  (emacs-substitute-variables "lisp/magit-git.el"
>> +("magit-git-executable" (string-append git 
>> "/bin/git")
>
> Return #t from this phase procedure.

Ah, OK.  At first I blindly thought if 'emacs-substitute-variables'
succeeds, it returns #t, but now I see that it's not the case.  I see
that other emacs packages (except 'emacs-w3m') don't return #t after
this "substitute vars" phase.  So perhaps it would be better to modify
'emacs-batch-edit-file' (and 'emacs-batch-eval') from (guix build
emacs-utils) to return #t if everything was OK.  WDYT?

> Otherwise, looks good to me!  I haven't yet tried magit 2, but for now I
> will take your word for it that we don't need magit 1 anymore.  We can
> always add it later if there's demand for it.

OK, but I don't think it should be done, because it is obsolete and
there will be no Magit 1.4.3 or 1.5, only 2.X.X.

But switching from Magit 1.4 to 2 requires some… I don't know how to
say… attention, especially if you have many settings for the old Magit.
The new magit was mostly rewritten, so its settings differ a lot.

-- 
Alex



Re: [PATCH] gnu: magit: Update to 2.2.0.

2015-08-22 Thread Mark H Weaver
Alex Kost  writes:

> From 55e67d4f3867f11a77b9a91d4c3c54599846cc83 Mon Sep 17 00:00:00 2001
> From: Alex Kost 
> Date: Mon, 17 Aug 2015 21:44:40 +0300
> Subject: [PATCH] gnu: magit: Update to 2.2.0.
>
> * gnu/packages/emacs.scm (magit): Update to 2.2.0.
>   [inputs]: Remove 'git:gui'.
>   [propagated-inputs]: Add 'dash', remove 'git-modes'.
>   [arguments]: Enable tests.  Add VERSION, PREFIX and DASH_DIR to
>   'make-flags'.  Remove 'configure', 'augment-load-path' and
>   'post-install' phases.

[...]

> +   #:make-flags
> +   (list (string-append "VERSION=" ,version)

Interesting, you have to tell it what it's own version number is?

>   (add-before
>'build 'patch-exec-paths
>(lambda* (#:key inputs #:allow-other-keys)
> -(let ((git (assoc-ref inputs "git"))
> -  (git:gui (assoc-ref inputs "git:gui")))
> -  (emacs-substitute-variables "magit.el"
> -("magit-git-executable" (string-append git "/bin/git"))
> -("magit-gitk-executable" (string-append git:gui
> -"/bin/gitk"))

Does magit 2 no longer use gitk?

> - (add-before
> -  'build 'augment-load-path
> -  (lambda* (#:key inputs #:allow-other-keys)
> -;; Allow git-commit-mode.el & co. to be found.
> -(let ((git-modes (assoc-ref inputs "git-modes")))
> -  (setenv "EMACSLOADPATH"
> -  (string-append ":" git-modes "/share/emacs/site-lisp"))
> -  #t)))
> - (add-after
> -  'install 'post-install
> -  (lambda* (#:key outputs #:allow-other-keys)
> -(emacs-generate-autoloads
> - ,name (string-append (assoc-ref outputs "out")
> -  "/share/emacs/site-lisp/")))

Are the autoloads installed by magit 2?

> +(let ((git (assoc-ref inputs "git")))
> +  (emacs-substitute-variables "lisp/magit-git.el"
> +("magit-git-executable" (string-append git 
> "/bin/git")

Return #t from this phase procedure.

Otherwise, looks good to me!  I haven't yet tried magit 2, but for now I
will take your word for it that we don't need magit 1 anymore.  We can
always add it later if there's demand for it.

 Thanks!
   Mark



Re: [PATCH] gnu: magit: Update to 2.2.0.

2015-08-18 Thread Alex Kost
Thompson, David (2015-08-17 22:38 +0300) wrote:

> The patch looks good to me.  Just one question: Should we leave the
> magit 1.4 package around for awhile?  Magit 2.0 is a pretty huge
> change.  I don't have a preference, but figured I'd throw it out
> there.

Magit 1.4 is obsolete and "Magit 1 series" is not developed anymore.  So
in my opinion it should just be updated, but I don't mind to keep it if
others would like to have it.

-- 
Alex



Re: [PATCH] gnu: magit: Update to 2.2.0.

2015-08-18 Thread Thompson, David
On Tue, Aug 18, 2015 at 3:19 AM, Alex Kost  wrote:
> Thompson, David (2015-08-17 22:38 +0300) wrote:
>
>> The patch looks good to me.  Just one question: Should we leave the
>> magit 1.4 package around for awhile?  Magit 2.0 is a pretty huge
>> change.  I don't have a preference, but figured I'd throw it out
>> there.
>
> Magit 1.4 is obsolete and "Magit 1 series" is not developed anymore.  So
> in my opinion it should just be updated, but I don't mind to keep it if
> others would like to have it.

OK, sounds like just upgrading it is the right thing!

- Dave



Re: [PATCH] gnu: magit: Update to 2.2.0.

2015-08-18 Thread Thompson, David
On Mon, Aug 17, 2015 at 2:56 PM, Alex Kost  wrote:
> Thanks, Mark, for the hint about using (package-version emacs-dash) to
> define its elisp directory.

The patch looks good to me.  Just one question: Should we leave the
magit 1.4 package around for awhile?  Magit 2.0 is a pretty huge
change.  I don't have a preference, but figured I'd throw it out
there.

- Dave



[PATCH] gnu: magit: Update to 2.2.0.

2015-08-17 Thread Alex Kost
Thanks, Mark, for the hint about using (package-version emacs-dash) to
define its elisp directory.

>From 55e67d4f3867f11a77b9a91d4c3c54599846cc83 Mon Sep 17 00:00:00 2001
From: Alex Kost 
Date: Mon, 17 Aug 2015 21:44:40 +0300
Subject: [PATCH] gnu: magit: Update to 2.2.0.

* gnu/packages/emacs.scm (magit): Update to 2.2.0.
  [inputs]: Remove 'git:gui'.
  [propagated-inputs]: Add 'dash', remove 'git-modes'.
  [arguments]: Enable tests.  Add VERSION, PREFIX and DASH_DIR to
  'make-flags'.  Remove 'configure', 'augment-load-path' and
  'post-install' phases.
---
 gnu/packages/emacs.scm | 69 ++
 1 file changed, 25 insertions(+), 44 deletions(-)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index b73d80c..56083f2 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -2,7 +2,7 @@
 ;;; Copyright © 2014 Taylan Ulrich Bayirli/Kammer 
 ;;; Copyright © 2013, 2014, 2015 Ludovic Courtès 
 ;;; Copyright © 2014, 2015 Mark H Weaver 
-;;; Copyright © 2014 Alex Kost 
+;;; Copyright © 2014, 2015 Alex Kost 
 ;;; Copyright © 2015 Federico Beffa 
 ;;; Copyright © 2015 Ricardo Wurmus 
 ;;;
@@ -311,21 +311,21 @@ configuration files, such as .gitattributes, .gitignore, and .git/config.")
 (define-public magit
   (package
 (name "magit")
-(version "1.4.2")
+(version "2.2.0")
 (source (origin
- (method url-fetch)
- (uri (string-append
-   "https://github.com/magit/magit/releases/download/";
-   version "/" name "-" version ".tar.gz"))
- (sha256
-  (base32
-   "1g3bxvgabiis2y338jziycx4b61vrim4lzmqnzv78094s8azzb52"
+  (method url-fetch)
+  (uri (string-append
+"https://github.com/magit/magit/archive/";
+version ".tar.gz"))
+  (file-name (string-append name "-" version ".tar.gz"))
+  (sha256
+   (base32
+"1jfak9yypvhlbxjdvpl9w28zz0lyymz0pm9fvb6cpnss3nb4fz4l"
 (build-system gnu-build-system)
 (native-inputs `(("texinfo" ,texinfo)
  ("emacs" ,emacs-no-x)))
-(inputs `(("git" ,git)
-  ("git:gui" ,git "gui")))
-(propagated-inputs `(("git-modes" ,git-modes)))
+(inputs `(("git" ,git)))
+(propagated-inputs `(("dash" ,emacs-dash)))
 (arguments
  `(#:modules ((guix build gnu-build-system)
   (guix build utils)
@@ -334,45 +334,26 @@ configuration files, such as .gitattributes, .gitignore, and .git/config.")
(guix build emacs-utils))
 
#:test-target "test"
-   #:tests? #f  ;'tests/magit-tests.el' is missing
 
-   #:make-flags (list
- ;; Don't put .el files in a sub-directory.
- (string-append "lispdir=" (assoc-ref %outputs "out")
-"/share/emacs/site-lisp"))
+   #:make-flags
+   (list (string-append "VERSION=" ,version)
+ (string-append "PREFIX=" %output)
+ ;; Don't put .el files in a sub-directory.
+ (string-append "lispdir=" %output "/share/emacs/site-lisp")
+ (string-append "DASH_DIR="
+(assoc-ref %build-inputs "dash")
+"/share/emacs/site-lisp/guix.d/dash-"
+,(package-version emacs-dash)))
 
#:phases
(modify-phases %standard-phases
- (replace
-  'configure
-  (lambda* (#:key outputs #:allow-other-keys)
-(let ((out (assoc-ref outputs "out")))
-  (substitute* "Makefile"
-(("/usr/local") out)
-(("/etc") (string-append out "/etc"))
+ (delete 'configure)
  (add-before
   'build 'patch-exec-paths
   (lambda* (#:key inputs #:allow-other-keys)
-(let ((git (assoc-ref inputs "git"))
-  (git:gui (assoc-ref inputs "git:gui")))
-  (emacs-substitute-variables "magit.el"
-("magit-git-executable" (string-append git "/bin/git"))
-("magit-gitk-executable" (string-append git:gui
-"/bin/gitk"))
- (add-before
-  'build 'augment-load-path
-