Message ID | a00b3a55-c5da-2ff3-14d9-ccc2b58d15f2@raghavgururajan.name |
---|---|
State | Accepted |
Headers | show |
Series | [bug#45954] Telegram-CLI (v7) | expand |
Context | Check | Description |
---|---|---|
cbaines/applying patch | fail | View Laminar job |
cbaines/issue | success | View issue |
Am Montag, den 01.02.2021, 17:08 -0500 schrieb Raghav Gururajan: > +(define-public telegram-cli > + (let ((commit "6547c0b21b977b327b3c5e8142963f4bc246187a") > + (revision "324")) > + (package > + (name "telegram-cli") > + (version > + (git-version "1.3.1" revision commit)) I didn't notice this before, but is there a reason to package this version over 1.3.1? > (getenv "TEMP") Please stop trying to use this as a snippet to mean "the root of the source and build directory". It is extremely obscure and people are already using "../source" just fine. (Just do an rgrep if you aren't convinced.) > > You might want to write that in terms of copy-build-system. > > Hmm. I tried but couldn't come up with a way to do it like that. :( You can still try harder for v8 ;) > The script may only be used on foreign-distro for now. For guix > system, > we need to define a service for it. > > Also, running telegram-cli doesn't require daemon, but vice-versa. > The > daemon is intended to be a complimentary feature to run telegram-cli > on > headless server. In that case, does the daemon script have any value of its own? Given that the latest release of telegram-cli is about six years old, I doubt there is – foreign distros should already have it in their repos and Guix as a package manager makes no claim to manage system stuff like services on foreign distros. > The file is a run-time script. That means literally nothing. The wrap phase exists for a reason, some programs and script are even wrapped twice. > Using (getenv "PATH") will instead use the value of PATH inside the > build environment. So you'll inadvertently have some native-inputs in it, is what you're trying to say? Of course, there are better ways of wrapping PATH, but in this case wouldn't it be wise to limit it to just the expected paths? Again, assuming that there is even merit in shipping this file, which is yet to be proven. Regards, Leo
Hi Leo! > I didn't notice this before, but is there a reason to package this > version over 1.3.1? Yeah, there are quite a lot of improvements after the 1.3.1 release. > Please stop trying to use this as a snippet to mean "the root of the > source and build directory". It is extremely obscure and people are > already using "../source" just fine. (Just do an rgrep if you aren't > convinced.) Fixed in v8. >> Hmm. I tried but couldn't come up with a way to do it like that. :( > You can still try harder for v8 ;) I tried different ways but the arguments key-words between gnu and copy differ a lot. I am unable use key-words from both build systems at the same time. Like using #:configure-flags (from gnu) and #:install (from copy). Also, I spent significant amount time to come up the phase I have. So if there are no critical issues, I would like to keep it as-is. :-) >> The script may only be used on foreign-distro for now. For guix >> system, >> we need to define a service for it. >> >> Also, running telegram-cli doesn't require daemon, but vice-versa. >> The >> daemon is intended to be a complimentary feature to run telegram-cli >> on >> headless server. > In that case, does the daemon script have any value of its own? Given > that the latest release of telegram-cli is about six years old, I doubt > there is – foreign distros should already have it in their repos and > Guix as a package manager makes no claim to manage system stuff like > services on foreign distros. > >> The file is a run-time script. > That means literally nothing. The wrap phase exists for a reason, some > programs and script are even wrapped twice. > >> Using (getenv "PATH") will instead use the value of PATH inside the >> build environment. > So you'll inadvertently have some native-inputs in it, is what you're > trying to say? Of course, there are better ways of wrapping PATH, but > in this case wouldn't it be wise to limit it to just the expected > paths? Again, assuming that there is even merit in shipping this file, > which is yet to be proven. I don't know what I was thinking. XD. It is pretty useless to ship. I removed it in v8. Regards, RG.
Hi Raghav, Am Montag, den 01.02.2021, 21:33 -0500 schrieb Raghav Gururajan: > Hi Leo! > > > I didn't notice this before, but is there a reason to package this > > version over 1.3.1? > > Yeah, there are quite a lot of improvements after the 1.3.1 release. Anything particularly worth noting? > > Please stop trying to use this as a snippet to mean "the root of > > the > > source and build directory". It is extremely obscure and people > > are > > already using "../source" just fine. (Just do an rgrep if you > > aren't > > convinced.) > > Fixed in v8. "Fixed". While it is true, that you're no longer using getenv, binding source for string-append later on is not a particularly elegant solution either. > > > Hmm. I tried but couldn't come up with a way to do it like that. > > > :( > > You can still try harder for v8 ;) > > I tried different ways but the arguments key-words between gnu and > copy > differ a lot. I am unable use key-words from both build systems at > the > same time. Like using #:configure-flags (from gnu) and #:install > (from > copy). Use something along the lines of (replace 'install (lambda args (apply (assoc-ref copy:%standard-phases 'install) #:install-plan <your install plan> args))) Phases should be written in a way, that gratuitous arguments will not be read, but passing it in arguments through the package-arguments fields remains tricky. Though even if it were possible, the snippet above has better locality. > Also, I spent significant amount time to come up the phase I have. So > if > there are no critical issues, I would like to keep it as-is. :-) I personally regard readability as a severe issue in this case. Of course there would be ways of doing this without invoking copy-build- system, but in my personal opinion an install plan would likely be the most concise here. For instance instead of using string-append source everywhere, you could just use a directory excursion. But more importantly, why is it, that all of the stuff you're installing is located in the source directory? Do you even build anything that ends up in the installation? Would it make more sense to have #:out-of-source? #f? In tgl, you use several directory excursions when arguably only one would be needed. Try to simplify your install process, so that you need to bind as few variables as possible. Regards, Leo
Hi Leo! > Anything particularly worth noting? Not sure. But based on commit messages, it seems lot of bug fixes. >>> Please stop trying to use this as a snippet to mean "the root of >>> the >>> source and build directory". It is extremely obscure and people >>> are >>> already using "../source" just fine. (Just do an rgrep if you >>> aren't >>> convinced.) >> >> Fixed in v8. > "Fixed". While it is true, that you're no longer using getenv, binding > source for string-append later on is not a particularly elegant > solution either. > >>>> Hmm. I tried but couldn't come up with a way to do it like that. >>>> :( >>> You can still try harder for v8 ;) >> >> I tried different ways but the arguments key-words between gnu and >> copy >> differ a lot. I am unable use key-words from both build systems at >> the >> same time. Like using #:configure-flags (from gnu) and #:install >> (from >> copy). > Use something along the lines of > (replace 'install > (lambda args > (apply (assoc-ref copy:%standard-phases 'install) > #:install-plan <your install plan> > args))) > Phases should be written in a way, that gratuitous arguments will not > be read, but passing it in arguments through the package-arguments > fields remains tricky. Though even if it were possible, the snippet > above has better locality. > >> Also, I spent significant amount time to come up the phase I have. So >> if >> there are no critical issues, I would like to keep it as-is. :-) > I personally regard readability as a severe issue in this case. Of > course there would be ways of doing this without invoking copy-build- > system, but in my personal opinion an install plan would likely be the > most concise here. > > For instance instead of using string-append source everywhere, you > could just use a directory excursion. But more importantly, why is it, > that all of the stuff you're installing is located in the source > directory? Do you even build anything that ends up in the > installation? Would it make more sense to have #:out-of-source? #f? > > In tgl, you use several directory excursions when arguably only one > would be needed. Try to simplify your install process, so that you > need to bind as few variables as possible. Agreed. I have updated the pack-def in v9. :-) Regards, RG.
From f7bb371f28dfac22dc52e2091c7fc5adb88dd3a4 Mon Sep 17 00:00:00 2001 From: Raghav Gururajan <rg@raghavgururajan.name> Date: Mon, 1 Feb 2021 16:49:04 -0500 Subject: [PATCH 3/3] gnu: Add telegram-cli. * gnu/packages/telegram.scm (telegram-cli): New variable. --- gnu/packages/telegram.scm | 120 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) diff --git a/gnu/packages/telegram.scm b/gnu/packages/telegram.scm index 2ff30c209e..1e83e33dfa 100644 --- a/gnu/packages/telegram.scm +++ b/gnu/packages/telegram.scm @@ -43,14 +43,19 @@ #:use-module (gnu packages libreoffice) #:use-module (gnu packages linux) #:use-module (gnu packages lxqt) + #:use-module (gnu packages lua) + #:use-module (gnu packages perl) #:use-module (gnu packages pkg-config) #:use-module (gnu packages protobuf) #:use-module (gnu packages pulseaudio) #:use-module (gnu packages python) #:use-module (gnu packages qt) + #:use-module (gnu packages readline) + #:use-module (gnu packages textutils) #:use-module (gnu packages telephony) #:use-module (gnu packages tls) #:use-module (gnu packages video) + #:use-module (gnu packages web) #:use-module (gnu packages xiph) #:use-module (gnu packages xorg) #:use-module ((guix licenses) #:prefix license:) @@ -704,3 +709,118 @@ a part of telegram-cli, but now being maintained separately.") (description "TGL is the telegram library for telegram-cli.") (home-page "https://github.com/vysheng/tgl") (license license:lgpl2.1+)))) + +(define-public telegram-cli + (let ((commit "6547c0b21b977b327b3c5e8142963f4bc246187a") + (revision "324")) + (package + (name "telegram-cli") + (version + (git-version "1.3.1" revision commit)) + (source + (origin + (method git-fetch) + (uri + (git-reference + (url "https://github.com/vysheng/tg.git") + (commit commit))) + (file-name + (git-file-name name version)) + (sha256 + (base32 "0c1w7jgska71jjbvg1y09v52549pwa4zkdjly18yxywn7gayd2p6")))) + (build-system gnu-build-system) + (arguments + `(#:tests? #f ; No target + #:configure-flags + (list + ;; Use gcrypt instead of openssl. + "--disable-openssl") + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'trigger-bootstrap + (lambda _ + (delete-file "configure") + #t)) + (add-after 'trigger-bootstrap 'patch-tgl-and-tlparser + (lambda* (#:key inputs #:allow-other-keys) + (for-each delete-file + (list + "Makefile.tgl" + "Makefile.tl-parser")) + (substitute* "Makefile.in" + (("include \\$\\{srcdir\\}/Makefile\\.tl-parser") + "") + (("include \\$\\{srcdir\\}/Makefile\\.tgl") + "") + (("-I\\$\\{srcdir\\}/tgl") + (string-append "-I" (assoc-ref inputs "tgl") + "/include/tgl")) + (("AUTO=auto") + (string-append "AUTO=" (assoc-ref inputs "tgl") + "/include/tgl/auto")) + (("LIB=libs") + (string-append "LIB=" (assoc-ref inputs "tgl") + "/lib/tgl"))) + #t)) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (source (string-append (getenv "TEMP") "/source"))) + ;; Install client. + (install-file + (string-append source "/bin/telegram-cli") + (string-append out "/bin")) + ;; Install daemon. + (install-file + (string-append source "/start-telegram-daemon") + (string-append out "/bin")) + ;; Install daemon script. + (install-file + (string-append source "/telegram-daemon") + (string-append out "/etc/init.d")) + ;; Install server public-key. + (install-file + (string-append source "/server.pub") + (string-append out "/etc/telegram-cli"))) + #t)) + (add-after 'install 'patch-daemon-files + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out"))) + (with-directory-excursion out + (substitute* "etc/init.d/telegram-daemon" + (("KOT\\'s meta engine") + "Telegram Messaging System") + (("/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin") + "$PATH") + (("\\$ROOT/usr/share/telegram-daemon/bin") + (string-append out "/bin")) + (("/etc/init\\.d") + (string-append out "/etc/init.d"))) + (substitute* "bin/start-telegram-daemon" + (("msg-search-engine") + "telegram-cli") + (("\\$root/usr/share/telegram-daemon/bin") + (string-append out "/bin"))))) + #t))))) + (native-inputs + `(("autoconf" ,autoconf) + ("automake" ,automake) + ("libtool" ,libtool) + ("pkg-config" ,pkg-config))) + (inputs + `(("jansson" ,jansson) + ("libconfig" ,libconfig) + ("libevent" ,libevent) + ("libgcrypt" ,libgcrypt) + ("lua" ,lua) + ("openssl" ,openssl) + ("perl" ,perl) + ("python" ,python) + ("readline" ,readline) + ("tgl" ,tgl) + ("tl-parser" ,tl-parser) + ("zlib" ,zlib))) + (synopsis "Telegram Messenger CLI") + (description "TG is the command-line interface for Telegram Messenger.") + (home-page "https://github.com/vysheng/tg") + (license license:gpl2+)))) -- 2.30.0