* [bug#56759] [PATCH 00/20] gnu: Add AnyStyle.
@ 2022-07-25 12:13 Philip McGrath
2022-07-25 12:16 ` [bug#56759] [PATCH 01/20] gnu: Add ruby-wapiti Philip McGrath
` (21 more replies)
0 siblings, 22 replies; 23+ messages in thread
From: Philip McGrath @ 2022-07-25 12:13 UTC (permalink / raw)
To: 56759; +Cc: Philip McGrath
Hi,
This patch series adds AnyStyle, a Ruby library and command-line tool
for parsing academic reference lists and bibliographies. (There as also
an AGPL web application that runs at <https://anystyle.io>, but I
haven't packaged that in this series.)
-Philip
Philip McGrath (20):
gnu: Add ruby-wapiti.
gnu: Add ruby-namae.
gnu: Add itex2mml.
gnu: Add ruby-ritex.
gnu: Add ruby-latex-decode.
gnu: Add ruby-link-header.
gnu: Add ruby-rdf.
gnu: Add ruby-rdf-vocab.
gnu: Add ruby-bibtex-ruby.
gnu: Add ruby-unicode-scripts.
gnu: Add ruby-citeproc.
gnu: Add ruby-edtf.
gnu: Add ruby-gli.
gnu: Add ruby-anystyle-data.
gnu: Add ruby-anystyle.
gnu: Add anystyle.
gnu: ruby-anystyle-data: Don't write to installed gem.
gnu: ruby-anystyle: Initialize dictionary files.
gnu: anystyle: Add tests for dictionary adapters.
gnu: anystyle: Use GDBM by default.
gnu/local.mk | 3 +
gnu/packages/maths.scm | 53 ++
...ruby-anystyle-data-immutable-install.patch | 40 +
...uby-anystyle-fix-dictionary-populate.patch | 94 +++
.../patches/ruby-latex-decode-fix-test.patch | 66 ++
gnu/packages/ruby.scm | 751 ++++++++++++++++++
6 files changed, 1007 insertions(+)
create mode 100644 gnu/packages/patches/ruby-anystyle-data-immutable-install.patch
create mode 100644 gnu/packages/patches/ruby-anystyle-fix-dictionary-populate.patch
create mode 100644 gnu/packages/patches/ruby-latex-decode-fix-test.patch
base-commit: 212ca81895b2baa819ea11a308ad21880b84a546
--
2.32.0
^ permalink raw reply [flat|nested] 23+ messages in thread
* [bug#56759] [PATCH 01/20] gnu: Add ruby-wapiti.
2022-07-25 12:13 [bug#56759] [PATCH 00/20] gnu: Add AnyStyle Philip McGrath
@ 2022-07-25 12:16 ` Philip McGrath
2022-07-25 12:16 ` [bug#56759] [PATCH 02/20] gnu: Add ruby-namae Philip McGrath
` (20 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Philip McGrath @ 2022-07-25 12:16 UTC (permalink / raw)
To: 56759; +Cc: Philip McGrath
* gnu/packages/ruby.scm (ruby-wapiti): New variable.
---
gnu/packages/ruby.scm | 46 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)
diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index c1e3dca807..9a75118946 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -28,6 +28,7 @@
;;; Copyright © 2021 EuAndreh <eu@euandre.org>
;;; Copyright © 2020 Tomás Ortín Fernández <tomasortin@mailbox.org>
;;; Copyright © 2021 Giovanni Biscuolo <g@xelera.eu>
+;;; Copyright © 2022 Philip McGrath <philip@philipmcgrath.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -12984,3 +12985,48 @@ (define-public ruby-blather
(description "Blather is a XMPP DSL for Ruby written on top of EventMachine
and Nokogiri.")
(license license:expat)))
+
+(define-public ruby-wapiti
+ (package
+ (name "ruby-wapiti")
+ (version "2.0.0")
+ ;; the gem archive lacks tests
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/inukshuk/wapiti-ruby")
+ (commit version)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "1kawqw45j7mqk5zmwbn67x1vxiapdgm2ypqqz2bs9l5s7nglzr5b"))))
+ (build-system ruby-build-system)
+ (propagated-inputs
+ (list ruby-builder
+ ruby-rexml))
+ (native-inputs
+ (list ruby-byebug
+ ruby-pry
+ ruby-rake-compiler
+ ruby-rspec
+ ruby-simplecov))
+ (arguments
+ (list
+ #:test-target "spec"
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'replace-git-ls-files 'replace-another-git-ls-files
+ (lambda args
+ (substitute* "wapiti.gemspec"
+ (("`git ls-files spec`")
+ "`find spec -type f | sort`"))))
+ (add-before 'build 'compile
+ (lambda args
+ (invoke "rake" "compile"))))))
+ (home-page "https://github.com/inukshuk/wapiti-ruby")
+ (synopsis "Wicked fast Conditional Random Fields for Ruby")
+ (description
+ "The Wapiti-Ruby gem provides a wicked fast linear-chain @acronym{CRF,
+Conditional Random Fields} API for sequence segmentation and labelling. It is
+based on the codebase of @url{https://wapiti.limsi.fr, Wapiti}.")
+ (license license:bsd-2)))
--
2.32.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [bug#56759] [PATCH 02/20] gnu: Add ruby-namae.
2022-07-25 12:13 [bug#56759] [PATCH 00/20] gnu: Add AnyStyle Philip McGrath
2022-07-25 12:16 ` [bug#56759] [PATCH 01/20] gnu: Add ruby-wapiti Philip McGrath
@ 2022-07-25 12:16 ` Philip McGrath
2022-07-25 12:16 ` [bug#56759] [PATCH 03/20] gnu: Add itex2mml Philip McGrath
` (19 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Philip McGrath @ 2022-07-25 12:16 UTC (permalink / raw)
To: 56759; +Cc: Philip McGrath
* gnu/packages/ruby.scm (ruby-namae): New variable.
---
gnu/packages/ruby.scm | 39 +++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index 9a75118946..2f47d898db 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -13030,3 +13030,42 @@ (define-public ruby-wapiti
Conditional Random Fields} API for sequence segmentation and labelling. It is
based on the codebase of @url{https://wapiti.limsi.fr, Wapiti}.")
(license license:bsd-2)))
+
+(define-public ruby-namae
+ (package
+ (name "ruby-namae")
+ (version "1.1.1")
+ (source (origin
+ (method url-fetch)
+ (uri (rubygems-uri "namae" version))
+ (sha256
+ (base32
+ "1j3nl1klkx3gymrdxfc1hlq4a8qlvhhl9aj5v1v08b9fz27sky0l"))))
+ (build-system ruby-build-system)
+ (native-inputs
+ (list ruby-cucumber
+ ruby-rspec
+ ruby-simplecov))
+ (arguments
+ (list
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'extract-gemspec 'allow-newer-cucumber
+ (lambda args
+ (substitute* "Gemfile"
+ (("'cucumber', '[^']*'")
+ "'cucumber'"))))
+ (replace 'check
+ ;; Avoid 'rake' so we don't need jeweler.
+ (lambda* (#:key tests? #:allow-other-keys)
+ (when tests?
+ (apply invoke
+ "rspec"
+ (find-files "spec" "_spec\\.rb$"))))))))
+ (home-page "https://github.com/berkmancenter/namae")
+ (synopsis "Parser for human names")
+ (description
+ "Namae (名前) is a parser for human names. It recognizes personal names
+of various cultural backgrounds and tries to split them into their component
+parts (e.g., given and family names, honorifics etc.).")
+ (license (list license:bsd-2 license:agpl3+))))
--
2.32.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [bug#56759] [PATCH 03/20] gnu: Add itex2mml.
2022-07-25 12:13 [bug#56759] [PATCH 00/20] gnu: Add AnyStyle Philip McGrath
2022-07-25 12:16 ` [bug#56759] [PATCH 01/20] gnu: Add ruby-wapiti Philip McGrath
2022-07-25 12:16 ` [bug#56759] [PATCH 02/20] gnu: Add ruby-namae Philip McGrath
@ 2022-07-25 12:16 ` Philip McGrath
2022-07-25 12:16 ` [bug#56759] [PATCH 04/20] gnu: Add ruby-ritex Philip McGrath
` (18 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Philip McGrath @ 2022-07-25 12:16 UTC (permalink / raw)
To: 56759; +Cc: Philip McGrath
* gnu/packages/maths.scm (itex2mml): New variable.
---
gnu/packages/maths.scm | 53 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 53 insertions(+)
diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index 6a84f47468..648358c681 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -52,6 +52,7 @@
;;; Copyright © 2021 Pierre-Antoine Bouttier <pierre-antoine.bouttier@univ-grenoble-alpes.fr>
;;; Copyright © 2022 Zhu Zihao <all_but_last@163.com>
;;; Copyright © 2022 Sharlatan Hellseher <sharlatanus@gmail.com>
+;;; Copyright © 2022 Philip McGrath <philip@philipmcgrath.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -1738,6 +1739,58 @@ (define-public h5check
HDF5 file is encoded according to the HDF File Format Specification.")
(license (license:x11-style "file://COPYING"))))
+(define-public itex2mml
+ (package
+ (name "itex2mml")
+ (version "1.6.1")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "https://golem.ph.utexas.edu"
+ "/~distler/blog/files/itexToMML-"
+ version
+ ".tar.gz"))
+ (sha256
+ (base32
+ "0pz51c0hfh2mg8xli0wj7hf92s3b7yf5r4114g8z8722lcm5gwiy"))
+ (snippet
+ #~(begin
+ (use-modules (guix build utils))
+ (delete-file-recursively "itex-binaries")))))
+ (build-system gnu-build-system)
+ (native-inputs
+ (list bison
+ flex))
+ (arguments
+ (list
+ #:make-flags #~(list (string-append "BINDIR=" #$output "/bin/")
+ (string-append "CC=" #$(cc-for-target)))
+ #:tests? #f ;; there are none
+ #:phases
+ #~(modify-phases %standard-phases
+ (delete 'configure)
+ (add-before 'build 'chdir
+ (lambda args
+ (chdir "itex-src")))
+ (add-before 'install 'make-bindir
+ (lambda args
+ (mkdir-p (string-append #$output "/bin"))))
+ (add-after 'install 'install-doc
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((doc-prefix (or (assoc-ref outputs "doc")
+ #$output))
+ (itex2mml+version (strip-store-file-name #$output))
+ (doc-dir (string-append doc-prefix
+ "/share/doc/"
+ itex2mml+version)))
+ (install-file "../README" doc-dir)))))))
+ (home-page "https://golem.ph.utexas.edu/~distler/blog/itex2MML.html")
+ (synopsis "LaTeX to XHTML/MathML converter")
+ (description
+ "The @command{itex2MML} utility is a stream filter. It takes text with
+embedded itex equations, converts the itex equations to MathML, and outputs
+the resulting text.")
+ (license (list license:lgpl2.0+ license:gpl2+ license:mpl1.1))))
+
(define-public itpp
(package
(name "itpp")
--
2.32.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [bug#56759] [PATCH 04/20] gnu: Add ruby-ritex.
2022-07-25 12:13 [bug#56759] [PATCH 00/20] gnu: Add AnyStyle Philip McGrath
` (2 preceding siblings ...)
2022-07-25 12:16 ` [bug#56759] [PATCH 03/20] gnu: Add itex2mml Philip McGrath
@ 2022-07-25 12:16 ` Philip McGrath
2022-07-25 12:16 ` [bug#56759] [PATCH 05/20] gnu: Add ruby-latex-decode Philip McGrath
` (17 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Philip McGrath @ 2022-07-25 12:16 UTC (permalink / raw)
To: 56759; +Cc: Philip McGrath
* gnu/packages/ruby.scm (ruby-ritex): New variable.
---
gnu/packages/ruby.scm | 42 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)
diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index 2f47d898db..746bb9b6ce 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -13069,3 +13069,45 @@ (define-public ruby-namae
of various cultural backgrounds and tries to split them into their component
parts (e.g., given and family names, honorifics etc.).")
(license (list license:bsd-2 license:agpl3+))))
+
+(define-public ruby-ritex
+ (package
+ (name "ruby-ritex")
+ (version "1.0.1")
+ (source (origin
+ (method url-fetch)
+ (uri (rubygems-uri "ritex" version))
+ (sha256
+ (base32
+ "07rlm3nyz9sxzy1srxs6a31hw81r6w7swrb85fiwi393z8npwc3a"))))
+ (build-system ruby-build-system)
+ (native-inputs
+ (list itex2mml))
+ (arguments
+ ;; thanks to the Gentoo packagers for figuring this out
+ (list
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'extract-gemspec 'fix-tests
+ (lambda* (#:key native-inputs inputs #:allow-other-keys)
+ (substitute* "test/mathml.rb"
+ (("\\./itex2MML")
+ ;; don't use the absolute path to avoid keeping a reference
+ "itex2MML")
+ (("cmp ',\\\\,\\\\,,,\\\\,'" orig)
+ (string-append "# " orig " # patched for Guix")))
+ (substitute* "test/answer-key.yaml"
+ (("- ,\\\\,\\\\,,,\\\\," orig)
+ (string-append "# " orig " # patched for Guix")))))
+ (replace 'check
+ (lambda* (#:key tests? #:allow-other-keys)
+ (when tests?
+ (invoke "ruby" "-Ilib:." "test/all.rb")))))))
+ (home-page "https://rubygems.org/gems/ritex")
+ (synopsis "Convert expressions from WebTeX into MathML")
+ (description
+ "Ritex converts expressions from WebTeX into MathML. WebTeX is an
+adaptation of TeX math syntax for web display. Ritex makes inserting math
+into HTML pages easy. It supports most TeX math syntax as well as macros.")
+ ;; doesn't clearly state -only vs -or-later
+ (license license:gpl2)))
--
2.32.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [bug#56759] [PATCH 05/20] gnu: Add ruby-latex-decode.
2022-07-25 12:13 [bug#56759] [PATCH 00/20] gnu: Add AnyStyle Philip McGrath
` (3 preceding siblings ...)
2022-07-25 12:16 ` [bug#56759] [PATCH 04/20] gnu: Add ruby-ritex Philip McGrath
@ 2022-07-25 12:16 ` Philip McGrath
2022-07-25 12:16 ` [bug#56759] [PATCH 06/20] gnu: Add ruby-link-header Philip McGrath
` (16 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Philip McGrath @ 2022-07-25 12:16 UTC (permalink / raw)
To: 56759; +Cc: Philip McGrath
* gnu/packages/patches/ruby-latex-decode-fix-test.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/ruby.scm (ruby-latex-decode): New variable.
---
gnu/local.mk | 1 +
.../patches/ruby-latex-decode-fix-test.patch | 66 +++++++++++++++++++
gnu/packages/ruby.scm | 50 ++++++++++++++
3 files changed, 117 insertions(+)
create mode 100644 gnu/packages/patches/ruby-latex-decode-fix-test.patch
diff --git a/gnu/local.mk b/gnu/local.mk
index 0c4edf6e56..3bc947f30c 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1774,6 +1774,7 @@ dist_patch_DATA = \
%D%/packages/patches/rocm-comgr-3.1.0-dependencies.patch \
%D%/packages/patches/rocm-opencl-runtime-4.3-noclinfo.patch \
%D%/packages/patches/rocm-opencl-runtime-4.3-noopencl.patch \
+ %D%/packages/patches/ruby-latex-decode-fix-test.patch \
%D%/packages/patches/ruby-mustache-1.1.1-fix-race-condition-tests.patch \
%D%/packages/patches/ruby-sanitize-system-libxml.patch \
%D%/packages/patches/rustc-1.39.0-src.patch \
diff --git a/gnu/packages/patches/ruby-latex-decode-fix-test.patch b/gnu/packages/patches/ruby-latex-decode-fix-test.patch
new file mode 100644
index 0000000000..58d7d16258
--- /dev/null
+++ b/gnu/packages/patches/ruby-latex-decode-fix-test.patch
@@ -0,0 +1,66 @@
+From 698e39a251d433e2cd2934586a2dfc5e6582c4f9 Mon Sep 17 00:00:00 2001
+From: Philip McGrath <philip@philipmcgrath.com>
+Date: Sun, 24 Jul 2022 09:12:55 -0400
+Subject: [PATCH] Improve readability of whitespace tests
+
+This change fixes the test for `~x` in some environments in which it
+was previously failing.
+
+Related to https://github.com/inukshuk/latex-decode/issues/13
+---
+ features/step_definitions/latex.rb | 5 +++++
+ features/symbols.feature | 7 -------
+ features/whitespace.feature | 13 +++++++++++++
+ 3 files changed, 18 insertions(+), 7 deletions(-)
+ create mode 100644 features/whitespace.feature
+
+diff --git a/features/step_definitions/latex.rb b/features/step_definitions/latex.rb
+index 4b1b595..fca63c0 100644
+--- a/features/step_definitions/latex.rb
++++ b/features/step_definitions/latex.rb
+@@ -5,3 +5,8 @@ end
+ Then /^the result should be ('|")(.*)\1$/ do |quote,value|
+ expect(@result).to eq(value)
+ end
++
++# For whitespace or other characters that are hard to read in source code:
++Then /^I should get '([^']*)' \+ U\+(\h{4,}) \+ '([^']*)'$/ do |pre,code,post|
++ expect(@result).to eq(pre + code.hex.chr(Encoding::UTF_8) + post)
++end
+diff --git a/features/symbols.feature b/features/symbols.feature
+index 46d9a51..f8a5e84 100644
+--- a/features/symbols.feature
++++ b/features/symbols.feature
+@@ -12,10 +12,3 @@ Feature: Decode LaTeX symbol directives
+ | \\uparrow | ↑ |
+ | \\downarrow | ↓ |
+ | \\rightarrow | → |
+-
+- Scenarios: Whitespace
+- | latex | unicode | description |
+- | x\\,x | x x | small space |
+- | x~x | x x | non-breaking space |
+- | ~x | x | non-breaking space |
+-
+diff --git a/features/whitespace.feature b/features/whitespace.feature
+new file mode 100644
+index 0000000..fe5b208
+--- /dev/null
++++ b/features/whitespace.feature
+@@ -0,0 +1,13 @@
++Feature: Decode LaTeX whitespace directives
++ As a hacker who works with LaTeX
++ I want to be able to decode LaTeX whitespace
++
++ Scenario Outline: LaTeX to Unicode transformation
++ When I decode the string '<latex>'
++ Then I should get <pre> + U+<code> + <post>
++
++ Scenarios: Whitespace
++ | latex | pre | code | post | description |
++ | x~x | 'x' | 00A0 | 'x' | non-breaking space |
++ | ~y | '' | 00A0 | 'y' | leading non-breaking space |
++ | z\\,z | 'z' | 2009 | 'z' | small space |
+--
+2.32.0
+
diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index 746bb9b6ce..fb9d5c53b9 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -13111,3 +13111,53 @@ (define-public ruby-ritex
into HTML pages easy. It supports most TeX math syntax as well as macros.")
;; doesn't clearly state -only vs -or-later
(license license:gpl2)))
+
+(define-public ruby-latex-decode
+ (let ((commit "08cc2d4a2c1359abaeb2f1e1a9d78e16a546cf7c")
+ (revision "1"))
+ ;; The commit is a released version, but doesn't have a Git tag.
+ ;; Using Git rather than the gem makes it easier to patch.
+ (package
+ (name "ruby-latex-decode")
+ (version (git-version "0.3.2" revision commit))
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/inukshuk/latex-decode")
+ (commit commit)))
+ (sha256
+ (base32
+ "0clvnqms81i33iff3pr3zz8sbyknvg704zghd62ysqrlbi4jpcpk"))
+ (patches
+ ;; see https://github.com/inukshuk/latex-decode/issues/13
+ (search-patches "ruby-latex-decode-fix-test.patch"))
+ (file-name (git-file-name name version))))
+ (build-system ruby-build-system)
+ (native-inputs
+ (list ruby-byebug
+ ruby-cucumber
+ ruby-ritex
+ ruby-rspec))
+ (arguments
+ (list
+ #:test-target "cucumber"
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'extract-gemspec 'less-strict-dependencies
+ (lambda args
+ (substitute* "Gemfile"
+ (("'cucumber', '[^']*'")
+ "'cucumber'"))))
+ (add-after 'replace-git-ls-files 'replace-another-git-ls-files
+ (lambda args
+ (substitute* "latex-decode.gemspec"
+ (("`git ls-files -- [{]test,spec,features[}]/\\*`")
+ "`find {test,spec,features} -type f | sort`")))))))
+ (home-page "https://github.com/inukshuk/latex-decode")
+ (synopsis "Convert LaTeX to Unicode")
+ (description
+ "This package provides a gem to convert LaTeX input to Unicode. Its
+original use was as an input filter for BibTeX-Ruby, but it can be used
+independently to decode LaTeX. Many of the patterns used by this Ruby gem are
+based on François Charette's equivalent Perl module @code{LaTeX::Decode}.")
+ (license license:gpl3+))))
--
2.32.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [bug#56759] [PATCH 06/20] gnu: Add ruby-link-header.
2022-07-25 12:13 [bug#56759] [PATCH 00/20] gnu: Add AnyStyle Philip McGrath
` (4 preceding siblings ...)
2022-07-25 12:16 ` [bug#56759] [PATCH 05/20] gnu: Add ruby-latex-decode Philip McGrath
@ 2022-07-25 12:16 ` Philip McGrath
2022-07-25 12:16 ` [bug#56759] [PATCH 07/20] gnu: Add ruby-rdf Philip McGrath
` (15 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Philip McGrath @ 2022-07-25 12:16 UTC (permalink / raw)
To: 56759; +Cc: Philip McGrath
* gnu/packages/ruby.scm (ruby-link-header): New variable.
---
gnu/packages/ruby.scm | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index fb9d5c53b9..d03d13371c 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -13161,3 +13161,24 @@ (define-public ruby-latex-decode
independently to decode LaTeX. Many of the patterns used by this Ruby gem are
based on François Charette's equivalent Perl module @code{LaTeX::Decode}.")
(license license:gpl3+))))
+
+(define-public ruby-link-header
+ (package
+ (name "ruby-link-header")
+ (version "0.0.8")
+ (source (origin
+ (method url-fetch)
+ (uri (rubygems-uri "link_header" version))
+ (sha256
+ (base32
+ "1yamrdq4rywmnpdhbygnkkl9fdy249fg5r851nrkkxr97gj5rihm"))))
+ (build-system ruby-build-system)
+ (home-page "https://github.com/asplake/link_header")
+ (synopsis "Parse and format HTTP @code{Link} headers")
+ (description
+ "This gem provides the classes @code{LinkHeader} and
+@code{LinkHeader::Link}, which represent HTTP @code{Link} headers conforming
+to RFC 5988. Objects can be constructed from and converted to text or a
+JSON-friendly @code{Array} representation. They can also be used to generate
+corresponding HTML @code{link} elements.")
+ (license license:expat)))
--
2.32.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [bug#56759] [PATCH 07/20] gnu: Add ruby-rdf.
2022-07-25 12:13 [bug#56759] [PATCH 00/20] gnu: Add AnyStyle Philip McGrath
` (5 preceding siblings ...)
2022-07-25 12:16 ` [bug#56759] [PATCH 06/20] gnu: Add ruby-link-header Philip McGrath
@ 2022-07-25 12:16 ` Philip McGrath
2022-07-25 12:16 ` [bug#56759] [PATCH 08/20] gnu: Add ruby-rdf-vocab Philip McGrath
` (14 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Philip McGrath @ 2022-07-25 12:16 UTC (permalink / raw)
To: 56759; +Cc: Philip McGrath
* gnu/packages/ruby.scm (ruby-rdf): New variable.
---
gnu/packages/ruby.scm | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index d03d13371c..d3b50f3202 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -13182,3 +13182,25 @@ (define-public ruby-link-header
JSON-friendly @code{Array} representation. They can also be used to generate
corresponding HTML @code{link} elements.")
(license license:expat)))
+
+(define-public ruby-rdf
+ (package
+ (name "ruby-rdf")
+ (version "3.2.8")
+ (source (origin
+ (method url-fetch)
+ (uri (rubygems-uri "rdf" version))
+ (sha256
+ (base32
+ "1cj0k8ryd8hgbkgqb5swvy6fiygxny3y5bln0my5gv6dbfv3gm20"))))
+ (build-system ruby-build-system)
+ (propagated-inputs (list ruby-link-header))
+ (arguments
+ (list #:tests? #f)) ;; tests have many cyclic dependencies
+ (home-page "https://ruby-rdf.github.io/")
+ (synopsis "Linked Data for Ruby")
+ (description
+ "This gem contains the core algorithms and classes used for doing basic
+programming with @acronym{RDF, Resource Description Framework} data,
+implemented in pure Ruby.")
+ (license license:unlicense)))
--
2.32.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [bug#56759] [PATCH 08/20] gnu: Add ruby-rdf-vocab.
2022-07-25 12:13 [bug#56759] [PATCH 00/20] gnu: Add AnyStyle Philip McGrath
` (6 preceding siblings ...)
2022-07-25 12:16 ` [bug#56759] [PATCH 07/20] gnu: Add ruby-rdf Philip McGrath
@ 2022-07-25 12:16 ` Philip McGrath
2022-07-25 12:16 ` [bug#56759] [PATCH 09/20] gnu: Add ruby-bibtex-ruby Philip McGrath
` (13 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Philip McGrath @ 2022-07-25 12:16 UTC (permalink / raw)
To: 56759; +Cc: Philip McGrath
* gnu/packages/ruby.scm (ruby-rdf-vocab): New variable.
---
gnu/packages/ruby.scm | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index d3b50f3202..9cf5b531fb 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -13204,3 +13204,25 @@ (define-public ruby-rdf
programming with @acronym{RDF, Resource Description Framework} data,
implemented in pure Ruby.")
(license license:unlicense)))
+
+(define-public ruby-rdf-vocab
+ (package
+ (name "ruby-rdf-vocab")
+ (version "3.2.1")
+ (source (origin
+ (method url-fetch)
+ (uri (rubygems-uri "rdf-vocab" version))
+ (sha256
+ (base32
+ "1bqmp9rfjvd56ajjz68ij6jla1wjf1fqg7bi4dpnjrsmn4pwaq7l"))))
+ (build-system ruby-build-system)
+ (propagated-inputs
+ (list ruby-rdf))
+ (arguments
+ (list #:tests? #f)) ;; tests have many cyclic dependencies
+ (home-page "https://github.com/ruby-rdf/rdf-vocab")
+ (synopsis "Common RDF vocabularies")
+ (description
+ "This gem extends @code{ruby-rdf} with several common @acronym{RDF,
+Resource Description Framework} vocabularies.")
+ (license license:unlicense)))
--
2.32.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [bug#56759] [PATCH 09/20] gnu: Add ruby-bibtex-ruby.
2022-07-25 12:13 [bug#56759] [PATCH 00/20] gnu: Add AnyStyle Philip McGrath
` (7 preceding siblings ...)
2022-07-25 12:16 ` [bug#56759] [PATCH 08/20] gnu: Add ruby-rdf-vocab Philip McGrath
@ 2022-07-25 12:16 ` Philip McGrath
2022-07-25 12:16 ` [bug#56759] [PATCH 10/20] gnu: Add ruby-unicode-scripts Philip McGrath
` (12 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Philip McGrath @ 2022-07-25 12:16 UTC (permalink / raw)
To: 56759; +Cc: Philip McGrath
* gnu/packages/ruby.scm (ruby-bibtex-ruby): New variable.
---
gnu/packages/ruby.scm | 43 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index 9cf5b531fb..f0f7703b32 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -13226,3 +13226,46 @@ (define-public ruby-rdf-vocab
"This gem extends @code{ruby-rdf} with several common @acronym{RDF,
Resource Description Framework} vocabularies.")
(license license:unlicense)))
+
+(define-public ruby-bibtex-ruby
+ (package
+ (name "ruby-bibtex-ruby")
+ (version "6.0.0")
+ (source (origin
+ (method url-fetch)
+ (uri (rubygems-uri "bibtex-ruby" version))
+ (sha256
+ (base32
+ "0vynqa8q9hwghw6sdljr304b5gh11nqzy5nwqqwxmgy7pqyf7qw5"))))
+ (build-system ruby-build-system)
+ (propagated-inputs
+ (list ruby-latex-decode
+ ruby-rdf
+ ruby-rdf-vocab))
+ (native-inputs
+ (list ruby-byebug
+ ruby-cucumber
+ ruby-minitest
+ ruby-yard))
+ (arguments
+ (list
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'extract-gemspec 'avoid-bundler
+ (lambda args
+ (substitute* "Rakefile"
+ (("require 'bundler" orig)
+ (string-append "# " orig " # patched for Guix"))
+ (("Bundler\\.setup" orig)
+ (string-append "true # " orig " # patched for Guix"))))))))
+ (home-page "https://github.com/inukshuk/bibtex-ruby")
+ (synopsis "Rubyist's Swiss Army knife for all things BibTeX")
+ (description
+ "BibTeX-Ruby is the Rubyist's Swiss Army knife for all things BibTeX.
+It includes a parser for all common BibTeX objects and a sophisticated name
+parser that tokenizes correctly formatted names. BibTeX-Ruby recognizes
+BibTeX string replacements, joins values containing multiple strings or
+variables, supports cross-references, and decodes common LaTeX formatting
+instructions to unicode. If you are in a hurry, it also allows for easy
+export/conversion to formats such as YAML, JSON, CSL, and XML (BibTeXML).")
+ (license license:gpl3+)))
--
2.32.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [bug#56759] [PATCH 10/20] gnu: Add ruby-unicode-scripts.
2022-07-25 12:13 [bug#56759] [PATCH 00/20] gnu: Add AnyStyle Philip McGrath
` (8 preceding siblings ...)
2022-07-25 12:16 ` [bug#56759] [PATCH 09/20] gnu: Add ruby-bibtex-ruby Philip McGrath
@ 2022-07-25 12:16 ` Philip McGrath
2022-07-25 12:16 ` [bug#56759] [PATCH 11/20] gnu: Add ruby-citeproc Philip McGrath
` (11 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Philip McGrath @ 2022-07-25 12:16 UTC (permalink / raw)
To: 56759; +Cc: Philip McGrath
* gnu/packages/ruby.scm (ruby-unicode-scripts): New variable.
---
gnu/packages/ruby.scm | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index f0f7703b32..99380739c0 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -13269,3 +13269,25 @@ (define-public ruby-bibtex-ruby
instructions to unicode. If you are in a hurry, it also allows for easy
export/conversion to formats such as YAML, JSON, CSL, and XML (BibTeXML).")
(license license:gpl3+)))
+
+(define-public ruby-unicode-scripts
+ (package
+ (name "ruby-unicode-scripts")
+ (version "1.7.0")
+ (source (origin
+ (method url-fetch)
+ (uri (rubygems-uri "unicode-scripts" version))
+ (sha256
+ (base32
+ "1k7kbfk806zam129bp7pdiqkfb5hn51x149irzvjhs4xf22m4yvi"))))
+ (build-system ruby-build-system)
+ (native-inputs
+ (list ruby-minitest))
+ (arguments
+ (list #:test-target "spec"))
+ (home-page "https://github.com/janlelis/unicode-scripts")
+ (synopsis "Unicode script classification library")
+ (description
+ "This gem provides a simple interface for classifying Ruby strings using
+the Unicode @code{Script} and @code{Script_Extensions} properties.")
+ (license license:expat)))
--
2.32.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [bug#56759] [PATCH 11/20] gnu: Add ruby-citeproc.
2022-07-25 12:13 [bug#56759] [PATCH 00/20] gnu: Add AnyStyle Philip McGrath
` (9 preceding siblings ...)
2022-07-25 12:16 ` [bug#56759] [PATCH 10/20] gnu: Add ruby-unicode-scripts Philip McGrath
@ 2022-07-25 12:16 ` Philip McGrath
2022-07-25 12:16 ` [bug#56759] [PATCH 12/20] gnu: Add ruby-edtf Philip McGrath
` (10 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Philip McGrath @ 2022-07-25 12:16 UTC (permalink / raw)
To: 56759; +Cc: Philip McGrath
* gnu/packages/ruby.scm (ruby-citeproc): New variable.
---
gnu/packages/ruby.scm | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index 99380739c0..2cc83d2f82 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -13291,3 +13291,27 @@ (define-public ruby-unicode-scripts
"This gem provides a simple interface for classifying Ruby strings using
the Unicode @code{Script} and @code{Script_Extensions} properties.")
(license license:expat)))
+
+(define-public ruby-citeproc
+ (package
+ (name "ruby-citeproc")
+ (version "1.0.10")
+ (source (origin
+ (method url-fetch)
+ (uri (rubygems-uri "citeproc" version))
+ (sha256
+ (base32
+ "13vl5sjmksk5a8kjcqnjxh7kn9gn1n4f9p1rvqfgsfhs54p0m6l2"))))
+ (build-system ruby-build-system)
+ (propagated-inputs
+ (list ruby-namae))
+ (arguments
+ (list #:tests? #f)) ;; tests have a cyclic dependency
+ (home-page "https://github.com/inukshuk/citeproc")
+ (synopsis "Interface for Ruby citation processors")
+ (description
+ "CiteProc is a citation processor interface and citation data API based
+on the @acronym{CSL, Citation Style Language} specifications. To actually
+process citations, a dedicated processor engine is required: a pure Ruby
+engine is available in the @code{citeproc-ruby} gem.")
+ (license (list license:agpl3+ license:bsd-2))))
--
2.32.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [bug#56759] [PATCH 12/20] gnu: Add ruby-edtf.
2022-07-25 12:13 [bug#56759] [PATCH 00/20] gnu: Add AnyStyle Philip McGrath
` (10 preceding siblings ...)
2022-07-25 12:16 ` [bug#56759] [PATCH 11/20] gnu: Add ruby-citeproc Philip McGrath
@ 2022-07-25 12:16 ` Philip McGrath
2022-07-25 12:16 ` [bug#56759] [PATCH 13/20] gnu: Add ruby-gli Philip McGrath
` (9 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Philip McGrath @ 2022-07-25 12:16 UTC (permalink / raw)
To: 56759; +Cc: Philip McGrath
* gnu/packages/ruby.scm (ruby-edtf): New variable.
---
gnu/packages/ruby.scm | 60 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 60 insertions(+)
diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index 2cc83d2f82..32d5fe89ae 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -13315,3 +13315,63 @@ (define-public ruby-citeproc
process citations, a dedicated processor engine is required: a pure Ruby
engine is available in the @code{citeproc-ruby} gem.")
(license (list license:agpl3+ license:bsd-2))))
+
+(define-public ruby-edtf
+ (package
+ (name "ruby-edtf")
+ (version "3.1.0")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/inukshuk/edtf-ruby")
+ (commit (string-append "v" version))))
+ (sha256
+ (base32
+ "18j8xq8zmrn41cs2gpd1i87agi9905asvnjqndky2cqb5zg3q14g"))
+ (snippet
+ ;; remove generated file
+ #~(delete-file "lib/edtf/parser.rb"))
+ (file-name (git-file-name name version))))
+ (build-system ruby-build-system)
+ (propagated-inputs
+ (list ruby-activesupport))
+ (native-inputs
+ (list ruby-cucumber
+ ruby-rspec))
+ (arguments
+ (list
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'extract-gemspec 'avoid-bundler
+ (lambda args
+ (substitute* "Rakefile"
+ (("require 'bundler" orig)
+ (string-append "# " orig " # patched for Guix"))
+ (("bundle exec racc")
+ "racc")
+ (("Cucumber::Rake::Task\\.new[(]:cucumber[)]" orig)
+ (string-append orig " do |c|\n"
+ " c.bundler = false # patched for Guix\n"
+ "end"))
+ (("Bundler\\.setup" orig)
+ (string-append "true # " orig " # patched for Guix")))))
+ (add-after 'avoid-bundler 'patch-cucumber-options
+ (lambda args
+ (substitute* "cucumber.yml"
+ ;; this option is not supported, at least in our configuration
+ ((" --publish-quiet")
+ ""))))
+ (add-before 'build 'compile
+ (lambda args
+ (invoke "rake" "racc")))
+ (replace 'check
+ (lambda* (#:key tests? #:allow-other-keys)
+ (when tests?
+ (invoke "rake")))))))
+ (home-page "https://github.com/inukshuk/edtf-ruby")
+ (synopsis "Ruby implementation of Extended Date/Time Format")
+ (description
+ "EDTF-Ruby provides a parser and an API for the @acronym{EDTF, Extended
+Date/Time Format} standard, implemented as an extension to Ruby's @code{Date}
+class.")
+ (license license:bsd-2)))
--
2.32.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [bug#56759] [PATCH 13/20] gnu: Add ruby-gli.
2022-07-25 12:13 [bug#56759] [PATCH 00/20] gnu: Add AnyStyle Philip McGrath
` (11 preceding siblings ...)
2022-07-25 12:16 ` [bug#56759] [PATCH 12/20] gnu: Add ruby-edtf Philip McGrath
@ 2022-07-25 12:16 ` Philip McGrath
2022-07-25 12:16 ` [bug#56759] [PATCH 14/20] gnu: Add ruby-anystyle-data Philip McGrath
` (8 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Philip McGrath @ 2022-07-25 12:16 UTC (permalink / raw)
To: 56759; +Cc: Philip McGrath
* gnu/packages/ruby.scm (ruby-gli): New variable.
---
gnu/packages/ruby.scm | 52 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 52 insertions(+)
diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index 32d5fe89ae..53269423e3 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -13375,3 +13375,55 @@ (define-public ruby-edtf
Date/Time Format} standard, implemented as an extension to Ruby's @code{Date}
class.")
(license license:bsd-2)))
+
+(define-public ruby-gli
+ (package
+ (name "ruby-gli")
+ (version "2.21.0")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/davetron5000/gli")
+ (commit (string-append "v" version))))
+ (sha256
+ (base32
+ "09b1r9hlx4dy2yq036nk7hc2nbswhia6q3na9v11z94yibc8mgja"))
+ (file-name (git-file-name name version))))
+ (build-system ruby-build-system)
+ (native-inputs
+ (list ruby-minitest
+ ruby-rainbow
+ ruby-rdoc
+ ruby-sdoc))
+ (arguments
+ (list
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'extract-gemspec 'patch-gemspec-version
+ (lambda args
+ (substitute* "gli.gemspec"
+ ;; this trick fails in our build environment
+ (("require File\\.join[(]\\[" orig)
+ (string-append "# patched for Guix # " orig))
+ (("s\\.version = GLI::VERSION")
+ #$(string-append "s.version = '"
+ (package-version this-package)
+ "' # patched for Guix")))))
+ (add-after 'replace-git-ls-files 'replace-another-git-ls-files
+ (lambda args
+ (substitute* "gli.gemspec"
+ (("`git ls-files -- [{]test,spec,features[}]/\\*`")
+ "`find {test,spec,features} -type f | sort`"))))
+ (add-after 'replace-another-git-ls-files 'fix-rubyopt
+ (lambda args
+ (substitute* "Rakefile"
+ (("ENV\\[\"RUBYOPT\"]")
+ "(ENV['RUBYOPT'] || '')")))))))
+ (home-page "https://davetron5000.github.io/gli/")
+ (synopsis "Git-Like Interface command-line parser")
+ (description
+ "GLI allows you to create command-line applications in Ruby with Git-Like
+Interfaces: that is, they take subcommands in the style of @command{git} and
+@command{gem}. GLI uses a simple domain-specific language, but retains all
+the power of the built-in @code{OptionParser}.")
+ (license license:asl2.0)))
--
2.32.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [bug#56759] [PATCH 14/20] gnu: Add ruby-anystyle-data.
2022-07-25 12:13 [bug#56759] [PATCH 00/20] gnu: Add AnyStyle Philip McGrath
` (12 preceding siblings ...)
2022-07-25 12:16 ` [bug#56759] [PATCH 13/20] gnu: Add ruby-gli Philip McGrath
@ 2022-07-25 12:16 ` Philip McGrath
2022-07-25 12:16 ` [bug#56759] [PATCH 15/20] gnu: Add ruby-anystyle Philip McGrath
` (7 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Philip McGrath @ 2022-07-25 12:16 UTC (permalink / raw)
To: 56759; +Cc: Philip McGrath
* gnu/packages/ruby.scm (ruby-anystyle-data): New variable.
---
gnu/packages/ruby.scm | 51 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 51 insertions(+)
diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index 53269423e3..4efc3d5a41 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -13427,3 +13427,54 @@ (define-public ruby-gli
@command{gem}. GLI uses a simple domain-specific language, but retains all
the power of the built-in @code{OptionParser}.")
(license license:asl2.0)))
+
+(define-public ruby-anystyle-data
+ (package
+ (name "ruby-anystyle-data")
+ (version "1.2.0")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/inukshuk/anystyle-data")
+ (commit version)))
+ (sha256
+ (base32
+ "025mxa7r9d7izqn6bc1wr40ijp64da0jh211prlpjl6svilgd6rm"))
+ (snippet
+ ;; remove pre-built file
+ #~(delete-file "lib/anystyle/data/dict.txt.gz"))
+ (file-name (git-file-name name version))))
+ (build-system ruby-build-system)
+ (arguments
+ (list
+ #:tests? #f ;; there are none
+ #:modules
+ `((guix build ruby-build-system)
+ (guix build utils)
+ (srfi srfi-26))
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'replace-git-ls-files 'replace-another-git-ls-files
+ (lambda args
+ (substitute* "anystyle-data.gemspec"
+ (("`git ls-files lib README\\.md LICENSE`\\.split[(][^)]*[)]")
+ (string-append
+ "["
+ (string-join
+ (map (cut string-append "\"" <> "\"")
+ `("README.md"
+ "LICENSE"
+ "lib/anystyle/data.rb"
+ "lib/anystyle/data/dict.txt.gz"
+ "lib/anystyle/data/setup.rb"
+ "lib/anystyle/data/version.rb"))
+ ", ")
+ "]")))))
+ (add-before 'build 'compile-dict
+ (lambda args
+ (invoke "rake" "compile"))))))
+ (home-page "https://anystyle.io")
+ (synopsis "AnyStyle parser dictionary data")
+ (description
+ "This gem provides parser dictionary data for AnyStyle.")
+ (license license:bsd-2)))
--
2.32.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [bug#56759] [PATCH 15/20] gnu: Add ruby-anystyle.
2022-07-25 12:13 [bug#56759] [PATCH 00/20] gnu: Add AnyStyle Philip McGrath
` (13 preceding siblings ...)
2022-07-25 12:16 ` [bug#56759] [PATCH 14/20] gnu: Add ruby-anystyle-data Philip McGrath
@ 2022-07-25 12:16 ` Philip McGrath
2022-07-25 12:16 ` [bug#56759] [PATCH 16/20] gnu: Add anystyle Philip McGrath
` (6 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Philip McGrath @ 2022-07-25 12:16 UTC (permalink / raw)
To: 56759; +Cc: Philip McGrath
* gnu/packages/ruby.scm (ruby-anystyle): New variable.
---
gnu/packages/ruby.scm | 71 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 71 insertions(+)
diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index 4efc3d5a41..90f269e247 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -13478,3 +13478,74 @@ (define-public ruby-anystyle-data
(description
"This gem provides parser dictionary data for AnyStyle.")
(license license:bsd-2)))
+
+(define-public ruby-anystyle
+ (let ((commit "50f1dd547d28ab4b830e45d70e840cb1898a37b0")
+ (revision "1"))
+ ;; Releases point to specific commits, but recent releases haven't been
+ ;; tagged in Git. Meanwhile, the rubygems archive lacks tests.
+ (package
+ (name "ruby-anystyle")
+ (version (git-version "1.3.14" revision commit))
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/inukshuk/anystyle")
+ (commit commit)))
+ (sha256
+ (base32
+ "0f4qcrywl1kl6qysn24lj3yp85ln4i7za7b7ld2fglyzwcggxwb0"))
+ (snippet
+ ;; There is an optional dependency on
+ ;; <https://github.com/feedbackmine/language_detector>, which
+ ;; seems like it was intended to be free software, but
+ ;; doesn't have a clear license statement. Maybe someone can
+ ;; do more sleuthing, or else find a replacement? See also
+ ;; <https://github.com/inukshuk/anystyle/issues/186>. For
+ ;; now, patch it out, but leave a pointer to follow up.
+ #~(begin
+ (use-modules (guix build utils))
+ (substitute* "Gemfile"
+ (("gem 'language_detector', github: '[^']*'" orig)
+ (string-append "# " orig " # unclear license")))
+ (substitute* "spec/anystyle/parser_spec.rb"
+ (("language: 'en'," orig)
+ (string-append "# " orig " # no lanugage_detector")))))
+ (file-name (git-file-name name version))))
+ (build-system ruby-build-system)
+ (propagated-inputs
+ (list ruby-anystyle-data
+ ruby-bibtex-ruby
+ ruby-namae
+ ruby-wapiti))
+ (native-inputs
+ (list ruby-byebug
+ ruby-citeproc
+ ruby-edtf
+ ruby-rspec
+ ruby-unicode-scripts))
+ (arguments
+ (list
+ #:test-target "spec"
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'extract-gemspec 'avoid-bundler
+ (lambda args
+ (substitute* "Rakefile"
+ (("require 'bundler" orig)
+ (string-append "# " orig " # patched for Guix"))
+ (("Bundler\\.setup" orig)
+ (string-append "true # " orig " # patched for Guix")))))
+ (add-after 'replace-git-ls-files 'replace-another-git-ls-files
+ (lambda args
+ (substitute* "anystyle.gemspec"
+ (("`git ls-files spec`")
+ "`find spec -type f | sort`")))))))
+ (home-page "https://anystyle.io")
+ (synopsis "Fast and smart citation reference parsing (Ruby library)")
+ (description
+ "AnyStyle is a very fast and smart parser for academic reference lists
+and bibliographies. AnyStyle uses powerful machine learning heuristics based
+on Conditional Random Fields and aims to make it easy to train the model with
+data that is relevant to your parsing needs.")
+ (license license:bsd-2))))
--
2.32.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [bug#56759] [PATCH 16/20] gnu: Add anystyle.
2022-07-25 12:13 [bug#56759] [PATCH 00/20] gnu: Add AnyStyle Philip McGrath
` (14 preceding siblings ...)
2022-07-25 12:16 ` [bug#56759] [PATCH 15/20] gnu: Add ruby-anystyle Philip McGrath
@ 2022-07-25 12:16 ` Philip McGrath
2022-07-25 12:16 ` [bug#56759] [PATCH 17/20] gnu: ruby-anystyle-data: Don't write to installed gem Philip McGrath
` (5 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Philip McGrath @ 2022-07-25 12:16 UTC (permalink / raw)
To: 56759; +Cc: Philip McGrath
* gnu/packages/ruby.scm (anystyle): New variable.
(ruby-anystyle)[description]: Mention it.
---
gnu/packages/ruby.scm | 125 +++++++++++++++++++++++++++++++++++++++++-
1 file changed, 124 insertions(+), 1 deletion(-)
diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index 90f269e247..3feb07dcdc 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -66,6 +66,7 @@ (define-module (gnu packages ruby)
#:use-module (gnu packages libidn)
#:use-module (gnu packages linux)
#:use-module (gnu packages lsof)
+ #:use-module (gnu packages man)
#:use-module (gnu packages maths)
#:use-module (gnu packages ncurses)
#:use-module (gnu packages networking)
@@ -13547,5 +13548,127 @@ (define-public ruby-anystyle
"AnyStyle is a very fast and smart parser for academic reference lists
and bibliographies. AnyStyle uses powerful machine learning heuristics based
on Conditional Random Fields and aims to make it easy to train the model with
-data that is relevant to your parsing needs.")
+data that is relevant to your parsing needs.
+
+This package provides the Ruby module @code{AnyStyle}. AnyStyle can also be
+used via the @command{anystyle} command-line utility or a web application,
+though the later has not yet been packaged for Guix.")
(license license:bsd-2))))
+
+(define-public anystyle
+ (package
+ (name "anystyle")
+ (version "1.3.1")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/inukshuk/anystyle-cli")
+ (commit version)))
+ (sha256
+ (base32
+ "1bazzms04cra8516q7vydmcm31yd0a7si1pxk4waffqy7lh0pksg"))
+ (file-name (git-file-name name version))))
+ (build-system ruby-build-system)
+ (propagated-inputs
+ (list ruby-anystyle
+ ruby-bibtex-ruby
+ ruby-gli))
+ (native-inputs
+ (list txt2man))
+ (arguments
+ (list
+ #:modules
+ `((guix build ruby-build-system)
+ (ice-9 popen)
+ (guix build utils))
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'extract-gemspec 'less-strict-dependencies
+ (lambda args
+ (substitute* "anystyle-cli.gemspec"
+ (("'bibtex-ruby', '[^']*'")
+ "'bibtex-ruby'"))))
+ (delete 'check) ;; there are no upstream tests
+ (add-after 'wrap 'check-cli
+ (lambda* (#:key tests? outputs #:allow-other-keys)
+ (when tests?
+ (with-output-to-file "check-cli.in"
+ (lambda ()
+ (for-each
+ display
+ '("Derrida, J. (1967). L’écriture et la différence "
+ "(1 éd.). Paris: Éditions du Seuil.\n"))))
+ (invoke (search-input-file outputs "/bin/anystyle")
+ "parse"
+ "check-cli.in"))))
+ (add-after 'wrap 'generate-man-page
+ ;; generating a man page also tests that the command actually runs
+ (lambda args
+ (define (run-with-output-file file command . args)
+ (format (current-output-port)
+ "running: ~s\nwith output to: ~s\n"
+ (cons command args)
+ file)
+ (unless (zero?
+ (with-output-to-file file
+ (lambda ()
+ (status:exit-val
+ (close-pipe
+ (apply open-pipe* OPEN_WRITE command args))))))
+ (error "command failed")))
+ (let ((anystyle (string-append #$output "/bin/anystyle")))
+ (run-with-output-file "intro.txt"
+ anystyle "--help")
+ (for-each (lambda (cmd)
+ (let ((file (string-append cmd ".txt")))
+ (run-with-output-file file
+ anystyle cmd "--help")
+ ;; indent headings to create subsections
+ (substitute* file
+ (("^[A-Z]" orig)
+ (string-append " " orig)))
+ ;; generate a section heading
+ (call-with-output-file
+ (string-append "section-" file)
+ (lambda (out)
+ (format out "\n\n~a COMMAND\n\n"
+ (string-upcase cmd))))))
+ '("check" "find" "parse" "train"))
+ (substitute* `("intro.txt"
+ "check.txt" "find.txt" "parse.txt" "train.txt")
+ ;; format "tag list" for txt2man"
+ ((" - ")
+ " ")
+ ;; restore formatting of the "name" sections
+ (("(anystyle|check|find|parse|train) ([A-Z])" _ cmd post)
+ (string-append cmd " - " post)))
+ (run-with-output-file "anystyle.txt"
+ "cat"
+ "intro.txt"
+ "section-check.txt" "check.txt"
+ "section-find.txt" "find.txt"
+ "section-parse.txt" "parse.txt"
+ "section-train.txt" "train.txt")
+ (run-with-output-file
+ "anystyle.1"
+ "txt2man"
+ "-v" "General Commands Manual" "-t" "anystyle" "-s" "1"
+ "-r" #$(string-append "anystyle-cli "
+ (package-version this-package))
+ "-B" "check" "-B" "find" "-B" "parse" "-B" "train"
+ "anystyle.txt")
+ (install-file "anystyle.1"
+ (string-append #$output "/share/man/man1"))))))))
+ (home-page "https://anystyle.io")
+ (synopsis "Fast and smart citation reference parsing")
+ (description
+ "AnyStyle is a very fast and smart parser for academic reference lists
+and bibliographies. AnyStyle uses powerful machine learning heuristics based
+on Conditional Random Fields and aims to make it easy to train the model with
+data that is relevant to your parsing needs.
+
+This package provides the @command{anystyle} command-line utility. AnyStyle
+can also be used as a Ruby library or as a web application, though the later
+has not yet been packaged for Guix.")
+ (license license:bsd-2)
+ (properties `((upstream-name . "anystyle-cli")))))
--
2.32.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [bug#56759] [PATCH 17/20] gnu: ruby-anystyle-data: Don't write to installed gem.
2022-07-25 12:13 [bug#56759] [PATCH 00/20] gnu: Add AnyStyle Philip McGrath
` (15 preceding siblings ...)
2022-07-25 12:16 ` [bug#56759] [PATCH 16/20] gnu: Add anystyle Philip McGrath
@ 2022-07-25 12:16 ` Philip McGrath
2022-07-25 12:16 ` [bug#56759] [PATCH 18/20] gnu: ruby-anystyle: Initialize dictionary files Philip McGrath
` (4 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Philip McGrath @ 2022-07-25 12:16 UTC (permalink / raw)
To: 56759; +Cc: Philip McGrath
* gnu/packages/patches/ruby-anystyle-data-immutable-install.patch: New
patch.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/ruby.scm (ruby-anystyle-data)[patches]: Use it.
---
gnu/local.mk | 1 +
...ruby-anystyle-data-immutable-install.patch | 40 +++++++++++++++++++
gnu/packages/ruby.scm | 2 +
3 files changed, 43 insertions(+)
create mode 100644 gnu/packages/patches/ruby-anystyle-data-immutable-install.patch
diff --git a/gnu/local.mk b/gnu/local.mk
index 3bc947f30c..54ac9f2f9f 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1774,6 +1774,7 @@ dist_patch_DATA = \
%D%/packages/patches/rocm-comgr-3.1.0-dependencies.patch \
%D%/packages/patches/rocm-opencl-runtime-4.3-noclinfo.patch \
%D%/packages/patches/rocm-opencl-runtime-4.3-noopencl.patch \
+ %D%/packages/patches/ruby-anystyle-data-immutable-install.patch \
%D%/packages/patches/ruby-latex-decode-fix-test.patch \
%D%/packages/patches/ruby-mustache-1.1.1-fix-race-condition-tests.patch \
%D%/packages/patches/ruby-sanitize-system-libxml.patch \
diff --git a/gnu/packages/patches/ruby-anystyle-data-immutable-install.patch b/gnu/packages/patches/ruby-anystyle-data-immutable-install.patch
new file mode 100644
index 0000000000..d5d7149a67
--- /dev/null
+++ b/gnu/packages/patches/ruby-anystyle-data-immutable-install.patch
@@ -0,0 +1,40 @@
+From a6f5b37cd22daa6069d8fbef8cba9dc60a6731f6 Mon Sep 17 00:00:00 2001
+From: Philip McGrath <philip@philipmcgrath.com>
+Date: Sun, 24 Jul 2022 23:54:19 -0400
+Subject: [PATCH] `AnyStyle::Data.setup()`: adjust for immutable install
+
+Don't override the default paths for `Dictionary::Marshal`,
+`Dictionary::GDBM`, and `Dictionary:LDBM` to point to this gem: we can't
+populate such files without the 'anystyle' gem (which depends on this
+one), and we won't be able to write to the directory where this gem is
+installed later, so the files will never exist at those locations.
+---
+ lib/anystyle/data/setup.rb | 12 ------------
+ 1 file changed, 12 deletions(-)
+
+diff --git a/lib/anystyle/data/setup.rb b/lib/anystyle/data/setup.rb
+index 17efdf8..08246fa 100644
+--- a/lib/anystyle/data/setup.rb
++++ b/lib/anystyle/data/setup.rb
+@@ -4,18 +4,6 @@ module AnyStyle
+
+ def self.setup
+ Dictionary.defaults[:source] = File.join(ROOT, 'dict.txt.gz')
+-
+- if defined? Dictionary::Marshal
+- Dictionary::Marshal.defaults[:path] = File.join(ROOT, 'dict.marshal')
+- end
+-
+- if defined? Dictionary::GDBM
+- Dictionary::GDBM.defaults[:path] = File.join(ROOT, 'dict.db')
+- end
+-
+- if defined? Dictionary::LDBM
+- Dictionary::LDBM.defaults[:path] = ROOT
+- end
+ end
+ end
+ end
+--
+2.32.0
+
diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index 3feb07dcdc..32ba09d283 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -13444,6 +13444,8 @@ (define-public ruby-anystyle-data
(snippet
;; remove pre-built file
#~(delete-file "lib/anystyle/data/dict.txt.gz"))
+ (patches
+ (search-patches "ruby-anystyle-data-immutable-install.patch"))
(file-name (git-file-name name version))))
(build-system ruby-build-system)
(arguments
--
2.32.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [bug#56759] [PATCH 18/20] gnu: ruby-anystyle: Initialize dictionary files.
2022-07-25 12:13 [bug#56759] [PATCH 00/20] gnu: Add AnyStyle Philip McGrath
` (16 preceding siblings ...)
2022-07-25 12:16 ` [bug#56759] [PATCH 17/20] gnu: ruby-anystyle-data: Don't write to installed gem Philip McGrath
@ 2022-07-25 12:16 ` Philip McGrath
2022-07-25 12:16 ` [bug#56759] [PATCH 19/20] gnu: anystyle: Add tests for dictionary adapters Philip McGrath
` (3 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Philip McGrath @ 2022-07-25 12:16 UTC (permalink / raw)
To: 56759; +Cc: Philip McGrath
For the GDBM and Marshal dictionary adapters to be useful with their
default settings, we must initialize their data files during the package
build: upstream would initialize them lazily, but that doesn't work with
an immutable installation directory (at least, not without more complex
patches). Otherwise, we would always end up rebuilding the dictionary at
startup, which is “slow” and “not recommended”.
* gnu/packages/patches/ruby-anystyle-fix-dictionary-populate.patch: New
patch.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/ruby.scm (ruby-anystyle)[patches]: Use it.
[arguments]<#:phases>: Add 'populate-dictionaries' phase.
---
gnu/local.mk | 1 +
...uby-anystyle-fix-dictionary-populate.patch | 94 +++++++++++++++++++
gnu/packages/ruby.scm | 31 +++++-
3 files changed, 125 insertions(+), 1 deletion(-)
create mode 100644 gnu/packages/patches/ruby-anystyle-fix-dictionary-populate.patch
diff --git a/gnu/local.mk b/gnu/local.mk
index 54ac9f2f9f..cb7bd1dc23 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1775,6 +1775,7 @@ dist_patch_DATA = \
%D%/packages/patches/rocm-opencl-runtime-4.3-noclinfo.patch \
%D%/packages/patches/rocm-opencl-runtime-4.3-noopencl.patch \
%D%/packages/patches/ruby-anystyle-data-immutable-install.patch \
+ %D%/packages/patches/ruby-anystyle-fix-dictionary-populate.patch \
%D%/packages/patches/ruby-latex-decode-fix-test.patch \
%D%/packages/patches/ruby-mustache-1.1.1-fix-race-condition-tests.patch \
%D%/packages/patches/ruby-sanitize-system-libxml.patch \
diff --git a/gnu/packages/patches/ruby-anystyle-fix-dictionary-populate.patch b/gnu/packages/patches/ruby-anystyle-fix-dictionary-populate.patch
new file mode 100644
index 0000000000..b2e0498e8d
--- /dev/null
+++ b/gnu/packages/patches/ruby-anystyle-fix-dictionary-populate.patch
@@ -0,0 +1,94 @@
+From fae622c8b77feebac66a538d76e4211de8bd8eb3 Mon Sep 17 00:00:00 2001
+From: Philip McGrath <philip@philipmcgrath.com>
+Date: Sun, 24 Jul 2022 21:50:44 -0400
+Subject: [PATCH] fix saving `AnyStyle::Dictionary` after `populate!`
+
+Some of these fixes are more generally applicable.
+
+A more robust solution might find data files using
+e.g. `Gem.find_files()`.
+---
+ lib/anystyle/dictionary/gdbm.rb | 6 ++++++
+ lib/anystyle/dictionary/marshal.rb | 31 ++++++++++++++++++++++++------
+ 2 files changed, 31 insertions(+), 6 deletions(-)
+
+diff --git a/lib/anystyle/dictionary/gdbm.rb b/lib/anystyle/dictionary/gdbm.rb
+index 754903c..c814df2 100644
+--- a/lib/anystyle/dictionary/gdbm.rb
++++ b/lib/anystyle/dictionary/gdbm.rb
+@@ -1,5 +1,6 @@
+ module AnyStyle
+ require 'gdbm'
++ require 'fileutils'
+
+ class Dictionary
+ class GDBM < Dictionary
+@@ -17,8 +18,13 @@ module AnyStyle
+
+ def open
+ close
++ FileUtils.mkdir_p(File.dirname(options[:path]))
+ @db = ::GDBM.new(*options.values_at(:path, :mode, :flags))
+ self
++ rescue Errno::EACCES
++ # GDBM.new tries this if :flags is nil, but not necessarily otherwise
++ @db = ::GDBM.new(options[:path],options[:mode],::GDBM::READER)
++ self
+ ensure
+ populate! if empty?
+ end
+diff --git a/lib/anystyle/dictionary/marshal.rb b/lib/anystyle/dictionary/marshal.rb
+index 761ca36..b9529d0 100644
+--- a/lib/anystyle/dictionary/marshal.rb
++++ b/lib/anystyle/dictionary/marshal.rb
+@@ -1,4 +1,6 @@
+ module AnyStyle
++ require 'fileutils'
++ require 'tempfile'
+ class Dictionary
+ class Marshal < Dictionary
+ @defaults = {
+@@ -10,17 +12,34 @@ module AnyStyle
+ end
+
+ def open
+- if File.exists?(options[:path])
+- @db = ::Marshal.load(File.open(options[:path]))
+- else
+- @db = {}
++ File.open(options[:path]) do |file|
++ @db = ::Marshal.load(file)
+ end
+ self
++ rescue Errno::ENOENT
++ @db = {}
++ self
+ ensure
+ if empty?
+ populate!
+- if File.writable?(options[:path])
+- ::Marshal.dump(db, File.open(options[:path], 'wb'))
++ tmp = nil
++ begin
++ FileUtils.mkdir_p(File.dirname(options[:path]))
++ tmp = Tempfile.create(File.basename(options[:path]),
++ File.dirname(options[:path]),
++ mode: File::Constants::BINARY)
++ pth = tmp.path()
++ ::Marshal.dump(db, tmp)
++ tmp.close()
++ File.rename(tmp.path, options[:path]) # will overwrite if exists
++ tmp = nil
++ rescue SystemCallError => e
++ warn(e.message)
++ ensure
++ if tmp then
++ tmp.close()
++ tmp.unlink()
++ end
+ end
+ end
+ end
+--
+2.32.0
+
diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index 32ba09d283..608b1ebe89 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -13514,6 +13514,9 @@ (define-public ruby-anystyle
(substitute* "spec/anystyle/parser_spec.rb"
(("language: 'en'," orig)
(string-append "# " orig " # no lanugage_detector")))))
+ (patches
+ (search-patches
+ "ruby-anystyle-fix-dictionary-populate.patch"))
(file-name (git-file-name name version))))
(build-system ruby-build-system)
(propagated-inputs
@@ -13543,7 +13546,33 @@ (define-public ruby-anystyle
(lambda args
(substitute* "anystyle.gemspec"
(("`git ls-files spec`")
- "`find spec -type f | sort`")))))))
+ "`find spec -type f | sort`"))))
+ (add-after 'wrap 'populate-dictionaries
+ (lambda args
+ ;; We must initiallize these files here, or they will never be
+ ;; usable with the default settings. A more flexible approach
+ ;; might use something like `Gem.find_files()` or
+ ;; XDG_DATA_DIRS.
+ (with-output-to-file "initialize-dictionaries.rb"
+ (lambda ()
+ (display "
+require 'anystyle/dictionary' # must come before 'anystyle/data'
+require 'anystyle/data'
+[:marshal, :gdbm].each do |adapter|
+ AnyStyle::Dictionary.create({adapter: adapter}).open().close()
+end
+")))
+ (let* ((old-gems (getenv "GEM_PATH"))
+ (new-gems (string-append #$output
+ "/lib/ruby/vendor_ruby:"
+ old-gems)))
+ (dynamic-wind
+ (lambda ()
+ (setenv "GEM_PATH" new-gems))
+ (lambda ()
+ (invoke "ruby" "initialize-dictionaries.rb"))
+ (lambda ()
+ (setenv "GEM_PATH" old-gems)))))))))
(home-page "https://anystyle.io")
(synopsis "Fast and smart citation reference parsing (Ruby library)")
(description
--
2.32.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [bug#56759] [PATCH 19/20] gnu: anystyle: Add tests for dictionary adapters.
2022-07-25 12:13 [bug#56759] [PATCH 00/20] gnu: Add AnyStyle Philip McGrath
` (17 preceding siblings ...)
2022-07-25 12:16 ` [bug#56759] [PATCH 18/20] gnu: ruby-anystyle: Initialize dictionary files Philip McGrath
@ 2022-07-25 12:16 ` Philip McGrath
2022-07-25 12:16 ` [bug#56759] [PATCH 20/20] gnu: anystyle: Use GDBM by default Philip McGrath
` (2 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Philip McGrath @ 2022-07-25 12:16 UTC (permalink / raw)
To: 56759; +Cc: Philip McGrath
* gnu/packages/ruby.scm (anystyle)[arguments]: Instead of deleting the
'check' phase, replace it with a few tests. Add SRFI 1 to '#:modules'.
---
gnu/packages/ruby.scm | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index 608b1ebe89..8991eb0927 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -13611,6 +13611,7 @@ (define-public anystyle
#:modules
`((guix build ruby-build-system)
(ice-9 popen)
+ (srfi srfi-1)
(guix build utils))
#:phases
#~(modify-phases %standard-phases
@@ -13619,7 +13620,30 @@ (define-public anystyle
(substitute* "anystyle-cli.gemspec"
(("'bibtex-ruby', '[^']*'")
"'bibtex-ruby'"))))
- (delete 'check) ;; there are no upstream tests
+ (replace 'check
+ (lambda* (#:key tests? #:allow-other-keys)
+ ;; There are no tests, but let's use this opportunity to do a
+ ;; basic test of our own that things run ok. It works especially
+ ;; well to test this here since we know the 'ruby-anystile'
+ ;; package is in its final, immutable installed form.
+ (when tests?
+ (let ((common
+ `("require 'anystyle'"
+ ,(string-append
+ "pp AnyStyle.parse 'Derrida, J. (1967). L’écriture"
+ " et la différence (1 éd.). Paris: Éditions du"
+ " Seuil.'"))))
+ (for-each
+ (lambda (lines)
+ (apply invoke "ruby"
+ (fold-right (lambda (line lst)
+ (cons* "-e" line lst))
+ '()
+ lines)))
+ `(,common
+ ("require 'anystyle/dictionary'"
+ "AnyStyle::Dictionary.defaults[:adapter] = :gdbm"
+ ,@common)))))))
(add-after 'wrap 'check-cli
(lambda* (#:key tests? outputs #:allow-other-keys)
(when tests?
--
2.32.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [bug#56759] [PATCH 20/20] gnu: anystyle: Use GDBM by default.
2022-07-25 12:13 [bug#56759] [PATCH 00/20] gnu: Add AnyStyle Philip McGrath
` (18 preceding siblings ...)
2022-07-25 12:16 ` [bug#56759] [PATCH 19/20] gnu: anystyle: Add tests for dictionary adapters Philip McGrath
@ 2022-07-25 12:16 ` Philip McGrath
2022-07-25 15:10 ` [bug#56759] [PATCH v2 05/20] gnu: Add ruby-latex-decode Philip McGrath
2022-08-04 9:57 ` bug#56759: [PATCH 00/20] gnu: Add AnyStyle Ludovic Courtès
21 siblings, 0 replies; 23+ messages in thread
From: Philip McGrath @ 2022-07-25 12:16 UTC (permalink / raw)
To: 56759; +Cc: Philip McGrath
Since we have GDBM available, it offers a smaller memory footprint
and faster start-up.
* gnu/packages/ruby.scm (anystyle)[arguments]<#:phases>: Add phase
'change-default-dictionary-adapter'.
---
gnu/packages/ruby.scm | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index 8991eb0927..655f49e725 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -13620,6 +13620,14 @@ (define-public anystyle
(substitute* "anystyle-cli.gemspec"
(("'bibtex-ruby', '[^']*'")
"'bibtex-ruby'"))))
+ (add-before 'build 'change-default-dictionary-adapter
+ (lambda args
+ ;; Since we always have gdbm available, using it will give a
+ ;; faster startup time, which is particularly worth-while for
+ ;; a command-line tool.
+ (substitute* "bin/anystyle"
+ (("default_value: 'ruby',")
+ "default_value: 'gdbm', # patched for Guix"))))
(replace 'check
(lambda* (#:key tests? #:allow-other-keys)
;; There are no tests, but let's use this opportunity to do a
--
2.32.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [bug#56759] [PATCH v2 05/20] gnu: Add ruby-latex-decode.
2022-07-25 12:13 [bug#56759] [PATCH 00/20] gnu: Add AnyStyle Philip McGrath
` (19 preceding siblings ...)
2022-07-25 12:16 ` [bug#56759] [PATCH 20/20] gnu: anystyle: Use GDBM by default Philip McGrath
@ 2022-07-25 15:10 ` Philip McGrath
2022-08-04 9:57 ` bug#56759: [PATCH 00/20] gnu: Add AnyStyle Ludovic Courtès
21 siblings, 0 replies; 23+ messages in thread
From: Philip McGrath @ 2022-07-25 15:10 UTC (permalink / raw)
To: 56759; +Cc: Philip McGrath
* gnu/packages/ruby.scm (ruby-latex-decode): New variable.
---
Just about an hour after I sent this patch series, the upstream
maintainer of 'ruby-latex-decode' released a v0.4.0 incorporating the
patches I'd sent---so, here is a v2 of just this patch! I can re-send
the rest of the series if you want, but it seemed like that would be
more confusing.
-Philip
gnu/packages/ruby.scm | 52 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 52 insertions(+)
diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index 746bb9b6ce..5111b9ae2b 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -13111,3 +13111,55 @@ (define-public ruby-ritex
into HTML pages easy. It supports most TeX math syntax as well as macros.")
;; doesn't clearly state -only vs -or-later
(license license:gpl2)))
+
+(define-public ruby-latex-decode
+ (package
+ (name "ruby-latex-decode")
+ (version "0.4.0")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/inukshuk/latex-decode")
+ (commit (string-append "v" version))))
+ (sha256
+ (base32
+ "1f5j67ayd04pjkmzvn0hk7cr8yqvn0gyg9ns6a0vhzj2gwna9ihy"))
+ (file-name (git-file-name name version))))
+ (build-system ruby-build-system)
+ (native-inputs
+ (list ruby-cucumber
+ ruby-ritex
+ ruby-rspec))
+ (arguments
+ (list
+ #:test-target "cucumber"
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'extract-gemspec 'avoid-bundler
+ (lambda args
+ (substitute* "Rakefile"
+ (("require 'bundler" orig)
+ (string-append "# " orig " # patched for Guix"))
+ (("Cucumber::Rake::Task\\.new[(]:cucumber[)]" orig)
+ (string-append orig " do |c|\n"
+ " c.bundler = false # patched for Guix\n"
+ "end"))
+ (("Bundler\\.setup" orig)
+ (string-append "true # " orig " # patched for Guix")))
+ (substitute* "cucumber.yml"
+ ;; thanks to avoiding bundler, we can't use this option
+ ((" --publish-quiet")
+ ""))))
+ (add-after 'replace-git-ls-files 'replace-another-git-ls-files
+ (lambda args
+ (substitute* "latex-decode.gemspec"
+ (("`git ls-files -- [{]test,spec,features[}]/\\*`")
+ "`find {test,spec,features} -type f | sort`")))))))
+ (home-page "https://github.com/inukshuk/latex-decode")
+ (synopsis "Convert LaTeX to Unicode")
+ (description
+ "This package provides a gem to convert LaTeX input to Unicode. Its
+original use was as an input filter for BibTeX-Ruby, but it can be used
+independently to decode LaTeX. Many of the patterns used by this Ruby gem are
+based on François Charette's equivalent Perl module @code{LaTeX::Decode}.")
+ (license license:gpl3+)))
--
2.32.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* bug#56759: [PATCH 00/20] gnu: Add AnyStyle.
2022-07-25 12:13 [bug#56759] [PATCH 00/20] gnu: Add AnyStyle Philip McGrath
` (20 preceding siblings ...)
2022-07-25 15:10 ` [bug#56759] [PATCH v2 05/20] gnu: Add ruby-latex-decode Philip McGrath
@ 2022-08-04 9:57 ` Ludovic Courtès
21 siblings, 0 replies; 23+ messages in thread
From: Ludovic Courtès @ 2022-08-04 9:57 UTC (permalink / raw)
To: Philip McGrath; +Cc: 56759-done
Hi,
Philip McGrath <philip@philipmcgrath.com> skribis:
> This patch series adds AnyStyle, a Ruby library and command-line tool
> for parsing academic reference lists and bibliographies. (There as also
> an AGPL web application that runs at <https://anystyle.io>, but I
> haven't packaged that in this series.)
The tool looks quite impressive.
> gnu: Add ruby-wapiti.
> gnu: Add ruby-namae.
> gnu: Add itex2mml.
> gnu: Add ruby-ritex.
> gnu: Add ruby-latex-decode.
> gnu: Add ruby-link-header.
> gnu: Add ruby-rdf.
> gnu: Add ruby-rdf-vocab.
> gnu: Add ruby-bibtex-ruby.
> gnu: Add ruby-unicode-scripts.
> gnu: Add ruby-citeproc.
> gnu: Add ruby-edtf.
> gnu: Add ruby-gli.
> gnu: Add ruby-anystyle-data.
> gnu: Add ruby-anystyle.
> gnu: Add anystyle.
> gnu: ruby-anystyle-data: Don't write to installed gem.
> gnu: ruby-anystyle: Initialize dictionary files.
> gnu: anystyle: Add tests for dictionary adapters.
> gnu: anystyle: Use GDBM by default.
Applied, thanks!
Ludo’.
^ permalink raw reply [flat|nested] 23+ messages in thread
end of thread, other threads:[~2022-08-04 9:58 UTC | newest]
Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-25 12:13 [bug#56759] [PATCH 00/20] gnu: Add AnyStyle Philip McGrath
2022-07-25 12:16 ` [bug#56759] [PATCH 01/20] gnu: Add ruby-wapiti Philip McGrath
2022-07-25 12:16 ` [bug#56759] [PATCH 02/20] gnu: Add ruby-namae Philip McGrath
2022-07-25 12:16 ` [bug#56759] [PATCH 03/20] gnu: Add itex2mml Philip McGrath
2022-07-25 12:16 ` [bug#56759] [PATCH 04/20] gnu: Add ruby-ritex Philip McGrath
2022-07-25 12:16 ` [bug#56759] [PATCH 05/20] gnu: Add ruby-latex-decode Philip McGrath
2022-07-25 12:16 ` [bug#56759] [PATCH 06/20] gnu: Add ruby-link-header Philip McGrath
2022-07-25 12:16 ` [bug#56759] [PATCH 07/20] gnu: Add ruby-rdf Philip McGrath
2022-07-25 12:16 ` [bug#56759] [PATCH 08/20] gnu: Add ruby-rdf-vocab Philip McGrath
2022-07-25 12:16 ` [bug#56759] [PATCH 09/20] gnu: Add ruby-bibtex-ruby Philip McGrath
2022-07-25 12:16 ` [bug#56759] [PATCH 10/20] gnu: Add ruby-unicode-scripts Philip McGrath
2022-07-25 12:16 ` [bug#56759] [PATCH 11/20] gnu: Add ruby-citeproc Philip McGrath
2022-07-25 12:16 ` [bug#56759] [PATCH 12/20] gnu: Add ruby-edtf Philip McGrath
2022-07-25 12:16 ` [bug#56759] [PATCH 13/20] gnu: Add ruby-gli Philip McGrath
2022-07-25 12:16 ` [bug#56759] [PATCH 14/20] gnu: Add ruby-anystyle-data Philip McGrath
2022-07-25 12:16 ` [bug#56759] [PATCH 15/20] gnu: Add ruby-anystyle Philip McGrath
2022-07-25 12:16 ` [bug#56759] [PATCH 16/20] gnu: Add anystyle Philip McGrath
2022-07-25 12:16 ` [bug#56759] [PATCH 17/20] gnu: ruby-anystyle-data: Don't write to installed gem Philip McGrath
2022-07-25 12:16 ` [bug#56759] [PATCH 18/20] gnu: ruby-anystyle: Initialize dictionary files Philip McGrath
2022-07-25 12:16 ` [bug#56759] [PATCH 19/20] gnu: anystyle: Add tests for dictionary adapters Philip McGrath
2022-07-25 12:16 ` [bug#56759] [PATCH 20/20] gnu: anystyle: Use GDBM by default Philip McGrath
2022-07-25 15:10 ` [bug#56759] [PATCH v2 05/20] gnu: Add ruby-latex-decode Philip McGrath
2022-08-04 9:57 ` bug#56759: [PATCH 00/20] gnu: Add AnyStyle Ludovic Courtès
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.