[PATCH] Telega test suite and change in revision

  • Done
  • quality assurance status badge
Details
2 participants
  • Brett Gilio
  • Leo Prikler
Owner
unassigned
Submitted by
Brett Gilio
Severity
normal

Debbugs page

Brett Gilio wrote 5 years ago
(address . guix-patches@gnu.org)
87r21mh0pt.fsf@posteo.net
Hi all, the following patches modify the emacs-telega package to
carefully use the ert and server test suites it has, and also includes
an increase in the revision to use a newer commit. Let me know what you think!

--
Brett M. Gilio
Brett Gilio wrote 5 years ago
[PATCH 1/2] gnu: emacs-telega: Use test suites.
(address . 38463@debbugs.gnu.org)
87mucah0nb.fsf@posteo.net
From 03a2617b29c92dc83828495305d73ec4074a5102 Mon Sep 17 00:00:00 2001
From: Brett Gilio <brettg@posteo.net>
Date: Mon, 2 Dec 2019 15:26:27 -0600
Subject: [PATCH 1/2] gnu: emacs-telega: Use test suites.

* gnu/packages/emacs-xyz.scm (emacs-telega)[arguments]: Adds support for
running the ert and server test suites.
---
gnu/packages/emacs-xyz.scm | 39 +++++++++++++++++++++++++++++++++-----
1 file changed, 34 insertions(+), 5 deletions(-)

Toggle diff (74 lines)
diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index 8efa4a17c8..ad78209ebb 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -19974,7 +19974,7 @@ fish-completion. It can be used in both Eshell and M-x shell.")
(file-name (git-file-name name version))))
(build-system gnu-build-system)
(arguments
- `(#:tests? #f
+ `(#:test-target "test"
#:modules ((guix build gnu-build-system)
((guix build emacs-build-system) #:prefix emacs:)
(guix build utils)
@@ -19984,17 +19984,45 @@ fish-completion. It can be used in both Eshell and M-x shell.")
(guix build emacs-utils))
#:phases
(modify-phases %standard-phases
- (add-after 'unpack 'unpack-patch
+ (add-after 'unpack 'prefix-patch
(lambda _
(substitute* "server/Makefile"
(("CC=cc")
"CC=gcc")
(("INSTALL_PREFIX=\\$\\(HOME\\)/.telega")
(string-append "INSTALL_PREFIX=" (assoc-ref %outputs "out")
- "/bin")))
+ "/bin"))
+ ;; Manually invoke `run_tests.py` after install phase.
+ (("python3 run_tests.py")
+ ""))
+ #t))
+ ;; The telega test suite checks for a version of Emacs
+ ;; compiled with imagemagick and svg support. Since we
+ ;; are using `emacs-minimal`, this step will fail.
+ ;; Grok the failing test, and remove problematic assertions.
+ (add-after 'unpack 'ert-suite-patch
+ (lambda _
+ (substitute* "telega-core.el"
+ (("\\(image-type-available-p 'imagemagick\\) nil")
+ "t")
+ (("\\(image-type-available-p 'svg\\) nil")
+ "t"))
+ #t))
+ ;; The server test suite has a hardcoded path.
+ ;; Reset this behavior to use the proper path.
+ (add-after 'unpack 'server-suite-patch
+ (lambda _
+ (substitute* "server/run_tests.py"
+ (("~/.telega/telega-server")
+ (string-append (assoc-ref %outputs "out")
+ "/bin/telega-server")))
+ #t))
+ (add-after 'install 'run-server-suite
+ (lambda _
+ (invoke "python3" "server/run_tests.py")
#t))
(delete 'configure)
-
+
;; Build emacs-side using `emacs-build-system'
(add-after 'compress-documentation 'emacs-add-source-to-load-path
(assoc-ref emacs:%standard-phases 'add-source-to-load-path))
@@ -20008,7 +20036,8 @@ fish-completion. It can be used in both Eshell and M-x shell.")
`(("emacs-visual-fill-column" ,emacs-visual-fill-column)))
(native-inputs
`(("tdlib" ,tdlib)
- ("emacs" ,emacs-minimal)))
+ ("emacs" ,emacs-minimal)
+ ("python" ,python)))
(synopsis "GNU Emacs client for the Telegram messenger")
(description
"Telega is full-featured, unofficial client for the Telegram messaging
--
2.24.0
Brett Gilio wrote 5 years ago
[PATCH 2/2] gnu: emacs-telega: Update to 0.4.4-2
(address . 38463@debbugs.gnu.org)
87immyh0mx.fsf@posteo.net
From 04e417466dcd7e1a39ce69d04b9afc60c41bd603 Mon Sep 17 00:00:00 2001
From: Brett Gilio <brettg@posteo.net>
Date: Mon, 2 Dec 2019 15:28:39 -0600
Subject: [PATCH 2/2] gnu: emacs-telega: Update to 0.4.4-2

* gnu/packages/emacs-xyz.scm (emacs-telega): Bump the package to use a newer
git revision, which includes additional client features.
---
gnu/packages/emacs-xyz.scm | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

Toggle diff (26 lines)
diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index ad78209ebb..4fa5cafd8d 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -19956,8 +19956,8 @@ fish-completion. It can be used in both Eshell and M-x shell.")
(license license:gpl3+))))
(define-public emacs-telega
- (let ((commit "019e923f933370d75dbe0a8473a18eb66fe94c0e")
- (revision "1")
+ (let ((commit "56aef884921d99e5170d5425dbe0fce645620511")
+ (revision "2")
(version "0.4.4"))
(package
(name "emacs-telega")
@@ -19970,7 +19970,7 @@ fish-completion. It can be used in both Eshell and M-x shell.")
(commit commit)))
(sha256
(base32
- "058814agkq8mp9ajpj8sz51rm9nigs2xpsdij05wjkxhfq30kqva"))
+ "0a8k3j20nz4xwswg9qp9xpaakk3q3ibiz8mkryk92zmrdmaah5mi"))
(file-name (git-file-name name version))))
(build-system gnu-build-system)
(arguments
--
2.24.0
Brett Gilio wrote 5 years ago
Re: [bug#38463] [PATCH] Telega test suite and change in revision
(address . 38463@debbugs.gnu.org)
87k17b6224.fsf@posteo.net
Brett Gilio <brettg@posteo.net> writes:

Toggle quote (5 lines)
> Hi all, the following patches modify the emacs-telega package to
> carefully use the ert and server test suites it has, and also includes
> an increase in the revision to use a newer commit. Let me know what
> you think!

Is there any critique of this patch? Sorry for pestering!

--
Brett M. Gilio
Brett Gilio wrote 5 years ago
[PATCH 3/3] gnu: emacs-telega: Properly install alists.
(address . 38463@debbugs.gnu.org)
877e3ax4n5.fsf@posteo.net
From 5b4430dce26b607cc0ebf443a33a3607a3b33eb1 Mon Sep 17 00:00:00 2001
From: Brett Gilio <brettg@posteo.net>
Date: Thu, 5 Dec 2019 07:48:30 -0600
Subject: [PATCH 3/3] gnu: emacs-telega: Properly install alists.

* gnu/packages/emacs-xyz.scm (emacs-telega)[arguments]: Telega has an etc
directory that needs to be installed to emacs site-lisp dir. This patch adds
that functionality.
---
gnu/packages/emacs-xyz.scm | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)

Toggle diff (33 lines)
diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index 60d27ca3de..d5110e96da 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -20019,11 +20019,23 @@ fish-completion. It can be used in both Eshell and M-x shell.")
;; Build emacs-side using `emacs-build-system'
(add-after 'compress-documentation 'emacs-add-source-to-load-path
(assoc-ref emacs:%standard-phases 'add-source-to-load-path))
- (add-after 'emacs-set-emacs-load-path 'emacs-install
+ (add-after 'emacs-add-source-to-load-path 'emacs-install
(assoc-ref emacs:%standard-phases 'install))
- (add-after 'emacs-install 'emacs-build
+ ;; This step adds subdir /etc to the site-lisp dir
+ ;; which is needed for images, notification sounds,
+ ;; and various alists.
+ ;; TODO: Replace with `#:include' method used by
+ ;; emacs-build-system.
+ (add-after 'emacs-install 'emacs-install-etc
+ (lambda* (#:key outputs #:allow-other-keys)
+ (with-directory-excursion "."
+ (invoke "cp" "-r" "etc/"
+ (string-append (assoc-ref outputs "out")
+ "/share/emacs/site-lisp/")))
+ #t))
+ (add-after 'emacs-install-etc 'emacs-build
(assoc-ref emacs:%standard-phases 'build))
- (add-after 'emacs-install 'emacs-make-autoloads
+ (add-after 'emacs-build 'emacs-make-autoloads
(assoc-ref emacs:%standard-phases 'make-autoloads)))))
(propagated-inputs
`(("emacs-visual-fill-column" ,emacs-visual-fill-column)))
--
2.24.0
Leo Prikler wrote 5 years ago
(address . brettg@posteo.net)(address . 38463@debbugs.gnu.org)
3566e38523f0ff4badf50ade8c1498006f1cb872.camel@student.tugraz.at
Hi Brett,

Am Donnerstag, den 05.12.2019, 07:48 -0600 schrieb Brett Gilio
Toggle quote (6 lines)
> * gnu/packages/emacs-xyz.scm (emacs-telega)[arguments]: Telega has an
> etc
> directory that needs to be installed to emacs site-lisp dir. This
> patch adds
> that functionality.

Out of curiosity, would it be possible to make this a subfolder of the
telega installation directory? It appears, as though these files are
accessed via telega-etc-file in telega-util.el, so it should still
function in the same way with the right substitutions.

Regards,
Leo
Brett Gilio wrote 5 years ago
(name . Leo Prikler)(address . leo.prikler@student.tugraz.at)(address . 38463@debbugs.gnu.org)
87fthyd54z.fsf@posteo.net
Leo Prikler <leo.prikler@student.tugraz.at> writes:

Toggle quote (9 lines)
> Out of curiosity, would it be possible to make this a subfolder of the
> telega installation directory? It appears, as though these files are
> accessed via telega-etc-file in telega-util.el, so it should still
> function in the same way with the right substitutions.
>
> Regards,
> Leo
>

Hi Leo,

I want to make sure I understand clearly what you are saying. The telega
installation directory seems to be just the
<profile>/share/emacs/site-lisp. What subdirectory are you speaking of
exactly? I will send a revised patch once I get some more information
:).

Thanks!

--
Brett M. Gilio
Leo Prikler wrote 5 years ago
(name . Brett Gilio)(address . brettg@posteo.net)(address . 38463@debbugs.gnu.org)
3a8ad02f296ee82a82149e949ba7d5c367950df8.camel@student.tugraz.at
Am Donnerstag, den 05.12.2019, 12:00 -0600 schrieb Brett Gilio:
Toggle quote (25 lines)
> Leo Prikler <leo.prikler@student.tugraz.at> writes:
>
> > Out of curiosity, would it be possible to make this a subfolder of
> > the
> > telega installation directory? It appears, as though these files
> > are
> > accessed via telega-etc-file in telega-util.el, so it should still
> > function in the same way with the right substitutions.
> >
> > Regards,
> > Leo
> >
>
> Hi Leo,
>
> I want to make sure I understand clearly what you are saying. The
> telega
> installation directory seems to be just the
> <profile>/share/emacs/site-lisp. What subdirectory are you speaking
> of
> exactly? I will send a revised patch once I get some more information
> :).
>
> Thanks!

Hi Brett,

That's my bad, I haven't looked at the structure of share/emacs/site-
lisp since the last change has been made. I expected, that packages
still had their own folders, just with guix.d in the middle being
removed, but just now found out that everything is at top-level.

I still don't feel comfortable with data being at the top of site-lisp,
though. Perhaps something similar to emacs-yasnippet-snippets, where
you store the data in share/emacs/telega-data would be more
appropriate.

WDYT?
Leo
Brett Gilio wrote 5 years ago
(name . Leo Prikler)(address . leo.prikler@student.tugraz.at)(address . 38463@debbugs.gnu.org)
877e3ad2zk.fsf@posteo.net
Leo Prikler <leo.prikler@student.tugraz.at> writes:

Toggle quote (8 lines)
>
> Hi Brett,
>
> That's my bad, I haven't looked at the structure of share/emacs/site-
> lisp since the last change has been made. I expected, that packages
> still had their own folders, just with guix.d in the middle being
> removed, but just now found out that everything is at top-level.

I know how you feel. The recent changes has thrown me into a whirlpool
of confusion. That is why I made the note about eventually replacing the
installation of that directory to use the system usually used by
`emacs-build-system` because I figure this would cause less issues in
the future if for some reason the emacs site-lisp directory structure
were to change again.

Toggle snippet (4 lines)
;; TODO: Replace with `#:include' method used by
;; emacs-build-system.

But I don't think it is a pressing issue to do it so cleanly.
Or maybe it is. Idk.


Toggle quote (5 lines)
> I still don't feel comfortable with data being at the top of site-lisp,
> though. Perhaps something similar to emacs-yasnippet-snippets, where
> you store the data in share/emacs/telega-data would be more
> appropriate.

I was ACTUALLY going to do it this way originally, but I was really
uncertain of it so I just sent the patch as is. I like the idea more, so
I am going to revise the patch. Otherwise, once I get this revision in
everything should be good to go. I'll also substitute the functions to
reflect that changed path.

While I am at it, I want to do a shameless plug for Evgeny Zajcev who
has been supportive of me making additions to his repository to include
instructions on installing `telega` from Guix, including a local-build
`guix.scm`, adding a tag for Guix on the repo description, and adding an
issue label for Guix as well. If any of you are reading this and use
Telegram as a messaging client, join https://t.me/emacs_telegaand give
him (@zevlg) and I (@brettmg) a hello. The work he has been doing has
been great, even though the build recipe for it for Guix is well over
100 LoC now. Ha.

Alright, carry on! Patch will be available soon.

--
Brett M. Gilio
Brett Gilio wrote 5 years ago
[PATCH 3/3] gnu: emacs-telega: Install telega-data to site-lisp.
(address . 38463@debbugs.gnu.org)
87fthyzgmu.fsf@posteo.net
This patch is a reworked version of [PATCH 3/3] sent earlier in the
list. Thanks to Leo Prikler who I have marked as a co-author for their
help.

Everything should be good to merge now!

--
Brett M. Gilio
From 62ad3f8a8a62fddc4e83cdbc43d2701dcd476224 Mon Sep 17 00:00:00 2001
From: Brett Gilio <brettg@posteo.net>
Date: Thu, 5 Dec 2019 13:51:14 -0600
Subject: [PATCH 3/3] gnu: emacs-telega: Install telega-data to site-lisp.

* gnu/packages/emacs-xyz.scm (emacs-telega)[arguments]: This commit revises a
previous patch and gives the source etc/ directory a unique installation pth
in the site-lisp directory stucture.

Co-authored-by: Leo Prikler <leo.prikler@student.tugraz.at>
---
gnu/packages/emacs-xyz.scm | 26 +++++++++++++++++++++++---
1 file changed, 23 insertions(+), 3 deletions(-)

Toggle diff (48 lines)
diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index 60d27ca3de..1c0a5acc38 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -19989,6 +19989,13 @@ fish-completion. It can be used in both Eshell and M-x shell.")
(("python3 run_tests.py")
""))
#t))
+ ;; Modify telega-util to reflect unique dir name in
+ ;; `telega-install-data' phase.
+ (add-after 'unpack 'telega-data-patch
+ (lambda _
+ (substitute* "telega-util.el"
+ (("etc/") "telega-data/"))
+ #t))
;; The telega test suite checks for a version of Emacs
;; compiled with imagemagick and svg support. Since we
;; are using `emacs-minimal`, this step will fail.
@@ -20019,11 +20026,24 @@ fish-completion. It can be used in both Eshell and M-x shell.")
;; Build emacs-side using `emacs-build-system'
(add-after 'compress-documentation 'emacs-add-source-to-load-path
(assoc-ref emacs:%standard-phases 'add-source-to-load-path))
- (add-after 'emacs-set-emacs-load-path 'emacs-install
+ (add-after 'emacs-add-source-to-load-path 'emacs-install
(assoc-ref emacs:%standard-phases 'install))
- (add-after 'emacs-install 'emacs-build
+ ;; This step adds subdir /etc to the site-lisp dir and
+ ;; gives it a unique name which is needed for images,
+ ;; notification sounds, and various alists.
+ ;; TODO: Replace with `#:include' method used by
+ ;; emacs-build-system.
+ (add-after 'emacs-install 'telega-install-data
+ (lambda* (#:key outputs #:allow-other-keys)
+ (with-directory-excursion "."
+ (invoke "cp" "-r" "etc/"
+ (string-append (assoc-ref outputs "out")
+ "/share/emacs/site-lisp/"
+ "telega-data/")))
+ #t))
+ (add-after 'telega-install-data 'emacs-build
(assoc-ref emacs:%standard-phases 'build))
- (add-after 'emacs-install 'emacs-make-autoloads
+ (add-after 'emacs-build 'emacs-make-autoloads
(assoc-ref emacs:%standard-phases 'make-autoloads)))))
(propagated-inputs
`(("emacs-visual-fill-column" ,emacs-visual-fill-column)))
--
2.24.0
Leo Prikler wrote 5 years ago
Re: [bug#38463] [PATCH 3/3] gnu: emacs-telega: Properly install alists.
(name . Brett Gilio)(address . brettg@posteo.net)(address . 38463@debbugs.gnu.org)
24b5011d36a76fbb4a64e16d8eeaf540b4ba92df.camel@student.tugraz.at
Am Donnerstag, den 05.12.2019, 12:46 -0600 schrieb Brett Gilio:
Toggle quote (13 lines)
> That is why I made the note about eventually replacing the
> installation of that directory to use the system usually used by
> `emacs-build-system` because I figure this would cause less issues in
> the future if for some reason the emacs site-lisp directory structure
> were to change again.
>
> --8<---------------cut here---------------start------------->8---
> ;; TODO: Replace with `#:include' method used by
> ;; emacs-build-system.
> --8<---------------cut here---------------end--------------->8---
>
> But I don't think it is a pressing issue to do it so cleanly.
> Or maybe it is. Idk.
Perhaps you're right, but as far as I can see the Emacs build system
does not yet tell us how to proceed with data. It also has a unique
way of handling documentation, first putting it into site-lisp before
moving it to share/info where it should belong.

Toggle quote (19 lines)
> > I still don't feel comfortable with data being at the top of site-
> > lisp,
> > though. Perhaps something similar to emacs-yasnippet-snippets,
> > where
> > you store the data in share/emacs/telega-data would be more
> > appropriate.
>
> I was ACTUALLY going to do it this way originally, but I was really
> uncertain of it so I just sent the patch as is. I like the idea more,
> so
> I am going to revise the patch. Otherwise, once I get this revision
> in
> everything should be good to go. I'll also substitute the functions
> to
> reflect that changed path.
>
> [...]
>
> Alright, carry on! Patch will be available soon.
Looking at your revised patch, I still feel a bit uneasy about putting
data into the load-path. I therefore proprose a revised revised (R^2,
if you will) patch, which I've attached to this message.

Regards,
Leo
From 59918d4a486c453463e6c59487047177f3b54205 Mon Sep 17 00:00:00 2001
From: Brett Gilio <brettg@posteo.net>
Date: Thu, 5 Dec 2019 13:51:14 -0600
Subject: [PATCH 3/3] gnu: emacs-telega: Install telega-data to site-lisp.

* gnu/packages/emacs-xyz.scm (emacs-telega)[arguments]: This commit revises a
previous patch and gives the source etc/ directory a unique installation pth
in the site-lisp directory stucture.

Co-authored-by: Leo Prikler <leo.prikler@student.tugraz.at>
---
gnu/packages/emacs-xyz.scm | 25 ++++++++++++++++++++++---
1 file changed, 22 insertions(+), 3 deletions(-)

Toggle diff (47 lines)
diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index f8f65f0e7e..c4aa44d8d0 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -19989,6 +19989,16 @@ fish-completion. It can be used in both Eshell and M-x shell.")
(("python3 run_tests.py")
""))
#t))
+ ;; Modify telega-util to reflect unique dir name in
+ ;; `telega-install-data' phase.
+ (add-after 'unpack 'telega-data-patch
+ (lambda _
+ (substitute* "telega-util.el"
+ (("\\(concat \"etc/\" filename\\) telega--lib-directory")
+ "(concat \"telega-data/\" filename)
+ (locate-dominating-file telega--lib-directory
+ \"telega-data\")"))
+ #t))
;; The telega test suite checks for a version of Emacs
;; compiled with imagemagick and svg support. Since we
;; are using `emacs-minimal`, this step will fail.
@@ -20019,11 +20029,20 @@ fish-completion. It can be used in both Eshell and M-x shell.")
;; Build emacs-side using `emacs-build-system'
(add-after 'compress-documentation 'emacs-add-source-to-load-path
(assoc-ref emacs:%standard-phases 'add-source-to-load-path))
- (add-after 'emacs-set-emacs-load-path 'emacs-install
+ (add-after 'emacs-add-source-to-load-path 'emacs-install
(assoc-ref emacs:%standard-phases 'install))
- (add-after 'emacs-install 'emacs-build
+ ;; This step installs subdir /etc, which contains images, sounds and
+ ;; various other data, next to the site-lisp dir.
+ (add-after 'emacs-install 'telega-install-data
+ (lambda* (#:key outputs #:allow-other-keys)
+ (copy-recursively
+ "etc"
+ (string-append (assoc-ref outputs "out")
+ "/share/emacs/telega-data/"))
+ #t))
+ (add-after 'telega-install-data 'emacs-build
(assoc-ref emacs:%standard-phases 'build))
- (add-after 'emacs-install 'emacs-make-autoloads
+ (add-after 'emacs-build 'emacs-make-autoloads
(assoc-ref emacs:%standard-phases 'make-autoloads)))))
(propagated-inputs
`(("emacs-visual-fill-column" ,emacs-visual-fill-column)))
--
2.24.0
Brett Gilio wrote 5 years ago
Re: [bug#38463] [PATCH 3/3] gnu: emacs-telega: Install telega-data to site-lisp.
(address . control@debbugs.gnu.org)
87h828n6mn.fsf@posteo.net
close 38463
thanks
?
Your comment

This issue is archived.

To comment on this conversation send an email to 38463@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 38463
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help