From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47174) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f36bZ-00089q-18 for guix-patches@gnu.org; Mon, 02 Apr 2018 17:03:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f36bW-0004Mo-D4 for guix-patches@gnu.org; Mon, 02 Apr 2018 17:03:05 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:55804) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f36bW-0004M2-1t for guix-patches@gnu.org; Mon, 02 Apr 2018 17:03:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1f36bV-0005KR-OM for guix-patches@gnu.org; Mon, 02 Apr 2018 17:03:01 -0400 Subject: [bug#31017] [PATCH] gnu: Add subdl Resent-Message-ID: Date: Mon, 2 Apr 2018 17:02:29 -0400 From: Leo Famulari Message-ID: <20180402210229.GC3852@jasmine.lan> References: <20180401151502.26423-1-ambrevar@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="/3yNEOqWowh/8j+e" Content-Disposition: inline In-Reply-To: <20180401151502.26423-1-ambrevar@gmail.com> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Pierre Neidhardt Cc: 31017@debbugs.gnu.org --/3yNEOqWowh/8j+e Content-Type: multipart/mixed; boundary="f0KYrhQ4vYSV2aJu" Content-Disposition: inline --f0KYrhQ4vYSV2aJu Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Apr 01, 2018 at 08:45:02PM +0530, Pierre Neidhardt wrote: > * gnu/packages/video.scm (subdl): New variable. Thanks! > +(define-public subdl > + (let > + ((commit "4cf5789b11f0ff3f863b704b336190bf968cd471") > + (revision "1")) It's okay to put 'commit' on the same line as 'let' :) > + (package > + (name "subdl") > + (version (string-append "1.0.3-" revision "." (string-take commit = 7))) Here we can use the git-version procedure and forget about how many characters of the Git hash we are supposed to use: (version (git-version "1.0.3" revision commit)) I was curious where the "1.0.3" comes from, since the upstream repo lacks any version tags, but I found it in the subdl source code. > + (source (origin > + (method git-fetch) And likewise in here, one should use git-file-name so that the source archive is named descriptively: (file-name (git-file-name name version)) > + (build-system trivial-build-system) > + (arguments > + `(#:modules ((guix build utils)) > + #:builder (begin > + (use-modules (guix build utils)) > + (let* ((out (assoc-ref %outputs "out")) > + (bin (string-append out "/bin")) > + (source (assoc-ref %build-inputs "source")) > + (python (assoc-ref %build-inputs "python"))) > + (mkdir-p bin) > + (with-directory-excursion bin > + (copy-file (string-append source "/subdl") "sub= dl") > + (patch-shebang "subdl" > + (list (string-append python "/bi= n"))) > + (chmod "subdl" #o555)))))) You asked about this chmod in your followup message. In this case it's unnecessary since the file is installed #o555 regardless. And we can even simplify the code to this: (install-file (string-append source "/subdl") bin)=20 (patch-shebang (string-append bin "/subdl") (list (string-append python "/bin"))) The (install-file) procedure conveniently combines (mkdir-p) and (copy-file). I can commit with the changes in the attached diff, but which name and email should I use for your copyright statement? --f0KYrhQ4vYSV2aJu Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=diff Content-Transfer-Encoding: quoted-printable diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm index fe1badee9..6ccced8fa 100644 --- a/gnu/packages/video.scm +++ b/gnu/packages/video.scm @@ -2824,18 +2824,20 @@ changed. Or in other words, it can detect motion.") (license license:gpl2))) =20 (define-public subdl - (let - ((commit "4cf5789b11f0ff3f863b704b336190bf968cd471") - (revision "1")) + (let ((commit "4cf5789b11f0ff3f863b704b336190bf968cd471") + (revision "1")) (package (name "subdl") - (version (string-append "1.0.3-" revision "." (string-take commit 7)= )) + (version (git-version "1.0.3" revision commit)) (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/alexanderwink/subdl.git") (commit commit))) - (sha256 (base32 "0kmk5ck1j49q4ww0lvas2767kwnzhkq0vdwkmjypd= x5zkxz73fn8")))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "0kmk5ck1j49q4ww0lvas2767kwnzhkq0vdwkmjypdx5zkxz73fn8"))= )) (build-system trivial-build-system) (arguments `(#:modules ((guix build utils)) @@ -2845,18 +2847,14 @@ changed. Or in other words, it can detect motion.") (bin (string-append out "/bin")) (source (assoc-ref %build-inputs "source")) (python (assoc-ref %build-inputs "python"))) - (mkdir-p bin) - (with-directory-excursion bin - (copy-file (string-append source "/subdl") "subdl= ") - (patch-shebang "subdl" - (list (string-append python "/bin"= ))) - (chmod "subdl" #o555)))))) + (install-file (string-append source "/subdl") bin) + (patch-shebang (string-append bin "/subdl") + (list (string-append python "/bin"))= ))))) (inputs `(("python" ,python))) (synopsis "Command-line tool for downloading subtitles from opensubt= itles.org") - (description - "Subdl is a command-line tool for downloading subtitles from opensu= btitles.org. -By default, it will search for English subtitles, display the results, -download the highest-rated result in the requested language and save it to= the -appropriate filename.") + (description "Subdl is a command-line tool for downloading subtitles= from +opensubtitles.org. By default, it will search for English subtitles, disp= lay +the results, download the highest-rated result in the requested language a= nd +save it to the appropriate filename.") (license license:gpl3+) (home-page "https://github.com/alexanderwink/subdl")))) --f0KYrhQ4vYSV2aJu-- --/3yNEOqWowh/8j+e Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEsFFZSPHn08G5gDigJkb6MLrKfwgFAlrCml8ACgkQJkb6MLrK fwhkAg//ZpCUxq8NhEnPwOS7MPa8In8HsCqpwZaVw5gUarSljARqZhYCgPulrEQw iPz/3uNQkOUIRvfwlu/XaKkeQtS054WreKRv249SmMczuG8molbfkKkV+HGO2qmv J5Zkfn15bGwkkdG2h4PBJE6ltsVx+b7+Otfj75HAMnNTAg5ypUAkY1oQn5dxt9Ak RGih/CHGC9SAK0P+xVz4qJyMneG2VgkWtDNpDfT1IK4YWRXlaiVHd0AIo8w9nj36 1J6YH7x9lhMW3mCR0xD3fSPfyi6Ays+eKAM/cIYmRNXrU8An23Cv2BNehf1t6+k4 VcK/jf/tsWdSq8mU92Z1PTEefhAYH3AaIQTAJ7Gut4Us1avWfXIg4rIJr3YBb3Tp laVM6aH0D9qID0bes3nefChVcCdR/MozTFNY/PQ2nSkJFpcG95sf1ZsGBJJS0dAx B1y6JQfkngZQ7Pa4eWywCfhn9nezozfEMq9yXi5/Zq8r6uKUzxFngWKgaeMFkB3U IGHPssFu8ZIHdDgiYQ+BrPk2qW8LhtvJcVYrq/yu3A2+ZNOU4hDcsFDL/acMmm2C mTAr/Gz9fFuwP6bgBHffdzTOclojjarvblrwTrLcoIzCaEoq6tvHVuYB0+Lmvzfa W5eHuUXYqw0D8Ocs98ZrAesCKGwSfpkKR2PncsuRji/Yz/vrblk= =L8pm -----END PGP SIGNATURE----- --/3yNEOqWowh/8j+e--