[PATCH 0/3] Add Ada parsers.

  • Done
  • quality assurance status badge
Details
3 participants
  • Danny Milosavljevic
  • Paul Eggert
  • Ludovic Courtès
Owner
unassigned
Submitted by
Danny Milosavljevic
Severity
normal
D
D
Danny Milosavljevic wrote on 7 Mar 2018 01:26
(address . guix-patches@gnu.org)(name . Danny Milosavljevic)(address . dannym@scratchpost.org)
20180307002657.31473-1-dannym@scratchpost.org
Danny Milosavljevic (3):
gnu: Add python2-langkit.
gnu: Add python2-quex.
gnu: Add python2-libadalang.

gnu/packages/adacore.scm | 138 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 138 insertions(+)
create mode 100644 gnu/packages/adacore.scm
D
D
Danny Milosavljevic wrote on 7 Mar 2018 02:05
[PATCH 1/3] gnu: Add python2-langkit.
(address . 30739@debbugs.gnu.org)(name . Danny Milosavljevic)(address . dannym@scratchpost.org)
20180307010545.31530-1-dannym@scratchpost.org
* gnu/packages/adacore.scm: New file.
---
gnu/packages/adacore.scm | 43 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
create mode 100644 gnu/packages/adacore.scm

Toggle diff (49 lines)
diff --git a/gnu/packages/adacore.scm b/gnu/packages/adacore.scm
new file mode 100644
index 000000000..34415db8a
--- /dev/null
+++ b/gnu/packages/adacore.scm
@@ -0,0 +1,43 @@
+(define-module (gnu packages adacore)
+ #:use-module ((guix licenses) #:prefix license:)
+ #:use-module (guix build-system gnu)
+ #:use-module (guix build-system python)
+ #:use-module (guix packages)
+ #:use-module (guix download)
+ #:use-module (guix git-download)
+ #:use-module (gnu packages)
+ #:use-module (gnu packages check)
+ #:use-module (gnu packages compression)
+ #:use-module (gnu packages python))
+
+(define-public python2-langkit
+ (let ((commit "fe0bc8bf60dbd2937759810df76ac420d99fc15f")
+ (revision "0"))
+ (package
+ (name "python2-langkit")
+ (version (git-version "0.0.0" revision commit))
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/AdaCore/langkit.git")
+ (commit commit)))
+ (sha256
+ (base32
+ "1abqgw2p8pb1pm54my5kkbbixfhc6l0bwajdv1xlzyrh31xki3wx"))
+ (file-name (string-append name "-" version "-checkout"))))
+ (build-system python-build-system)
+ (propagated-inputs
+ `(("python2-docutils" ,python2-docutils)
+ ("python2-enum34" ,python2-enum34)
+ ("python2-funcy" ,python2-funcy)
+ ("python2-mako" ,python2-mako)))
+ (arguments
+ `(#:python ,python-2
+ #:tests? #f)) ; Tests would requite gprbuild (Ada).
+ (synopsis "Semantic analysis tool generator in Python")
+ (description "@code{Langkit} is a tool whose purpose is to make it easy
+to create syntactic and semantic analysis engines. Write a language
+specification in our Python DSL and Langkit will generate for you an
+Ada library with bindings for the C and Python programming languages.")
+ (home-page "https://github.com/AdaCore/langkit/")
+ (license license:gpl3+)))) ; and gcc runtime library exception
D
D
Danny Milosavljevic wrote on 7 Mar 2018 02:05
[PATCH 2/3] gnu: Add python2-quex.
(address . 30739@debbugs.gnu.org)(name . Danny Milosavljevic)(address . dannym@scratchpost.org)
20180307010545.31530-2-dannym@scratchpost.org
* gnu/packages/adacore.scm (python2-quex): New variable.
(python2-quex-0.67.3): New variable.
---
gnu/packages/adacore.scm | 55 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 55 insertions(+)

Toggle diff (63 lines)
diff --git a/gnu/packages/adacore.scm b/gnu/packages/adacore.scm
index 34415db8a..d1f5abd2c 100644
--- a/gnu/packages/adacore.scm
+++ b/gnu/packages/adacore.scm
@@ -41,3 +41,58 @@ specification in our Python DSL and Langkit will generate for you an
Ada library with bindings for the C and Python programming languages.")
(home-page "https://github.com/AdaCore/langkit/")
(license license:gpl3+)))) ; and gcc runtime library exception
+
+;; Note: non-Ada
+(define-public python2-quex-0.67.3
+ (package
+ (name "python2-quex")
+ (version "0.67.3")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (string-append "https://sourceforge.net/projects/quex/files/HISTORY/0.67/quex-" version ".zip/download"))
+ (sha256
+ (base32
+ "14gv8ll3ipqv4kyc2xiy891nrmjl4ic823zfyx8hassagyclyppw"))
+ (file-name (string-append name "-" version ".zip"))))
+ (build-system python-build-system)
+ (native-inputs
+ `(("unzip" ,unzip)))
+ (arguments
+ `(#:python ,python-2
+ #:tests? #f
+ #:phases
+ (modify-phases %standard-phases
+ (delete 'configure)
+ (delete 'build)
+ (replace 'install
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (share/quex (string-append out "/share/quex"))
+ (bin (string-append out "/bin")))
+ (copy-recursively "." share/quex)
+ (mkdir-p bin)
+ (symlink (string-append share/quex "/quex-exe.py")
+ (string-append bin "/quex"))
+ #t))))))
+ (native-search-paths
+ (list (search-path-specification
+ (variable "QUEX_PATH")
+ (files '("share/quex")))))
+ (home-page "http://quex.sourceforge.net/")
+ (synopsis "Lexical analyzer generator in Python")
+ (description "@code{quex} is a lexical analyzer generator in Python.")
+ (license license:lgpl2.1+))) ; Non-military
+
+(define-public python2-quex
+ (package (inherit python2-quex-0.67.3)
+ (name "python2-quex")
+ (version "0.68.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (string-append "https://sourceforge.net/projects/quex/files/DOWNLOAD/quex-" version ".tar.gz/download"))
+ (sha256
+ (base32
+ "0svc9nla3b9145d6b7fb9dizx412l3difzqw0ilh9lz52nsixw8j"))
+ (file-name (string-append name "-" version ".zip"))))))
D
D
Danny Milosavljevic wrote on 7 Mar 2018 02:05
[PATCH 3/3] gnu: Add python2-libadalang.
(address . 30739@debbugs.gnu.org)(name . Danny Milosavljevic)(address . dannym@scratchpost.org)
20180307010545.31530-3-dannym@scratchpost.org
* gnu/packages/adacore.scm (python2-libadalang): New variable.
---
gnu/packages/adacore.scm | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)

Toggle diff (48 lines)
diff --git a/gnu/packages/adacore.scm b/gnu/packages/adacore.scm
index d1f5abd2c..267fa2041 100644
--- a/gnu/packages/adacore.scm
+++ b/gnu/packages/adacore.scm
@@ -96,3 +96,43 @@ Ada library with bindings for the C and Python programming languages.")
(base32
"0svc9nla3b9145d6b7fb9dizx412l3difzqw0ilh9lz52nsixw8j"))
(file-name (string-append name "-" version ".zip"))))))
+
+(define-public python2-libadalang
+ (let ((commit "9b205e9bacdd50a68117727332e16fbef5f6ac49")
+ (revision "0"))
+ (package
+ (name "python2-libadalang")
+ (version (git-version "0.0.0" revision commit))
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/AdaCore/libadalang.git")
+ (commit commit)))
+ (sha256
+ (base32
+ "06hsnzj2syqpq2yhg1bb0zil7ydbyqkdmkjbf8j9b5sdgkyh5xrp"))
+ (file-name (string-append name "-" version "-checkout"))))
+ (build-system python-build-system)
+ (native-inputs
+ `(("python2-langkit" ,python2-langkit)
+ ("python2-quex" ,python2-quex-0.67.3)))
+ (arguments
+ `(#:python ,python-2
+ #:phases
+ (modify-phases %standard-phases
+ (replace 'build
+ (lambda _
+ (invoke "python2" "ada/manage.py" "generate")
+ (invoke "python2" "ada/manage.py" "build")))
+ (replace 'check
+ (lambda _
+ (invoke "python2" "ada/manage.py" "test")))
+ (replace 'install
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out")))
+ (invoke "python2" "ada/manage.py" "install" out)))))))
+ (synopsis "Semantic Analysis for Ada in Python")
+ (description "@code{libadalang} provides a high-performance semantic
+engine for the Ada programming language.")
+ (home-page "https://github.com/AdaCore/libadalang")
+ (license license:gpl3)))) ; and gcc runtime gcc lib exception
P
P
Paul Eggert wrote on 11 Mar 2018 09:27
Re: Invalid timezone (tzalloc failure) treated as out-of-memory
(name . Valery Ushakov)(address . uwe@stderr.spb.ru)(address . 30739-done@debbugs.gnu.org)
1370cc81-6aea-ed58-fcc0-1adc32f4252c@cs.ucla.edu
Thanks for reporting the problem. I have installed the attached two patches,
which I think should fix the problem so I'm closing the bug report. Please give
them a try on NetBSD (as I typically don't use NetBSD).
From f7c07930b581b1bcfdfb1874b6883233516bdf11 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Tue, 16 May 2017 14:19:36 -0700
Subject: [PATCH] Fix minor timezone memory leak

* src/editfns.c (wall_clock_tz): Remove; unused.
---
src/editfns.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)

Toggle diff (26 lines)
diff --git a/src/editfns.c b/src/editfns.c
index ecb8e3f083..75eb75a729 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -81,10 +81,8 @@ static Lisp_Object styled_format (ptrdiff_t, Lisp_Object *, bool);
enum { tzeqlen = sizeof "TZ=" - 1 };
-/* Time zones equivalent to current local time, to wall clock time,
- and to UTC, respectively. */
+/* Time zones equivalent to current local time and to UTC, respectively. */
static timezone_t local_tz;
-static timezone_t wall_clock_tz;
static timezone_t const utc_tz = 0;
/* The cached value of Vsystem_name. This is used only to compare it
@@ -269,7 +267,6 @@ init_editfns (bool dumping)
/* Set the time zone rule now, so that the call to putenv is done
before multiple threads are active. */
- wall_clock_tz = xtzalloc (0);
tzlookup (tz ? build_string (tz) : Qwall, true);
pw = getpwuid (getuid ());
--
2.14.3
From 46844ad78968cd804d0e5fc98ce49b46b3d8a53d Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Sun, 11 Mar 2018 00:18:34 -0800
Subject: [PATCH] Port to NetBSD tzalloc

Problem reported by Valery Ushakov (Bug#30738).
* src/editfns.c (xtzalloc): Remove.
(invalid_time_zone_specification): New function.
(tzlookup): Port to NetBSD, where tzalloc can fail when the TZ
string has an invalid value.
---
src/editfns.c | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)

Toggle diff (43 lines)
diff --git a/src/editfns.c b/src/editfns.c
index 3a34dd0980..debe10572d 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -117,14 +117,10 @@ emacs_mktime_z (timezone_t tz, struct tm *tm)
return t;
}
-/* Allocate a timezone, signaling on failure. */
-static timezone_t
-xtzalloc (char const *name)
+static _Noreturn void
+invalid_time_zone_specification (Lisp_Object zone)
{
- timezone_t tz = tzalloc (name);
- if (!tz)
- memory_full (SIZE_MAX);
- return tz;
+ xsignal2 (Qerror, build_string ("Invalid time zone specification"), zone);
}
/* Free a timezone, except do not free the time zone for local time.
@@ -205,9 +201,15 @@ tzlookup (Lisp_Object zone, bool settz)
}
}
else
- xsignal2 (Qerror, build_string ("Invalid time zone specification"),
- zone);
- new_tz = xtzalloc (zone_string);
+ invalid_time_zone_specification (zone);
+
+ new_tz = tzalloc (zone_string);
+ if (!new_tz)
+ {
+ if (errno == ENOMEM)
+ memory_full (SIZE_MAX);
+ invalid_time_zone_specification (zone);
+ }
}
if (settz)
--
2.14.3
Closed
P
P
Paul Eggert wrote on 11 Mar 2018 09:34
(address . 30739@debbugs.gnu.org)
cc821404-3e76-ab7e-fcfc-116bf5fbbda1@cs.ucla.edu
Please ignore my previous message to 30739@debbugs.gnu.org, which was intended
for a different bug report.
L
L
Ludovic Courtès wrote on 12 Mar 2018 15:33
Re: [bug#30739] [PATCH 1/3] gnu: Add python2-langkit.
(name . Danny Milosavljevic)(address . dannym@scratchpost.org)(address . 30739@debbugs.gnu.org)
87y3ixnz2b.fsf@gnu.org
Hi Danny,

Danny Milosavljevic <dannym@scratchpost.org> skribis:

Toggle quote (2 lines)
> * gnu/packages/adacore.scm: New file.

Reminds me of one of these discussions we had while wandering in
Brussels. :-)

Should it be simply ada.scm, given that “AdaCore” is the name of the
company?

Toggle quote (5 lines)
> --- /dev/null
> +++ b/gnu/packages/adacore.scm
> @@ -0,0 +1,43 @@
> +(define-module (gnu packages adacore)

Please add a copyright header.

If ‘guix lint’ is happy, go ahead!

Ludo’.
L
L
Ludovic Courtès wrote on 12 Mar 2018 15:35
Re: [bug#30739] [PATCH 2/3] gnu: Add python2-quex.
(name . Danny Milosavljevic)(address . dannym@scratchpost.org)(address . 30739@debbugs.gnu.org)
87tvtlnyzu.fsf@gnu.org
Danny Milosavljevic <dannym@scratchpost.org> skribis:

Toggle quote (3 lines)
> * gnu/packages/adacore.scm (python2-quex): New variable.
> (python2-quex-0.67.3): New variable.

[...]

Toggle quote (3 lines)
> +;; Note: non-Ada
> +(define-public python2-quex-0.67.3

Move to python.scm?

Also please add a comment saying with the old version is kept around.

Toggle quote (2 lines)
> + (uri (string-append "https://sourceforge.net/projects/quex/files/HISTORY/0.67/quex-"version ".zip/download"))

Rather mirror://sourceforge and a shorter line.

Toggle quote (2 lines)
> + (uri (string-append "https://sourceforge.net/projects/quex/files/DOWNLOAD/quex-"version ".tar.gz/download"))

Ditto.

OK with these changes!

Ludo’.
L
L
Ludovic Courtès wrote on 12 Mar 2018 15:35
Re: [bug#30739] [PATCH 3/3] gnu: Add python2-libadalang.
(name . Danny Milosavljevic)(address . dannym@scratchpost.org)(address . 30739@debbugs.gnu.org)
87po49nyz6.fsf@gnu.org
Danny Milosavljevic <dannym@scratchpost.org> skribis:

Toggle quote (2 lines)
> * gnu/packages/adacore.scm (python2-libadalang): New variable.

LGTM, thanks!
D
D
Danny Milosavljevic wrote on 13 Mar 2018 20:57
Re: [bug#30739] [PATCH 1/3] gnu: Add python2-langkit.
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 30739@debbugs.gnu.org)
20180313205743.16542bf3@scratchpost.org
On Mon, 12 Mar 2018 15:33:32 +0100
ludo@gnu.org (Ludovic Courtès) wrote:

Toggle quote (3 lines)
> Reminds me of one of these discussions we had while wandering in
> Brussels. :-)

Hehe yep :D

Toggle quote (3 lines)
> Should it be simply ada.scm, given that “AdaCore” is the name of the
> company?

Sure.

I've applied this one to master.
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAlqoLTcACgkQ5xo1VCww
uqVm5gf+LvufOzWHhwPnTlQpopjBj3C8I4DLwQOcPDIAJjTmVUC0G2z9jA7luGcg
ie0YBpccErTdSApTlGz7LthE/g/gCuy+IAH9OrzOcQ7K0efMe7gQSkmUVjVRumHT
6StzW+B/k0oSw3NQt2W2KxeUaptXWBuncLnzE90VjCbgk9Jqui+X7YR20wKu7PCP
khSMWCcQY+XvIk7XFZCtt5l1kmB6nGhyccxdiOaot6Fctw+uUhR3z67vXEeUY8e7
W7fbf6j3vZ7dIACuMoFIkojfZ4w81zSpj0lHYqYaZPPIMhyT4xnwk+7O54ehijZS
atzGlHKRBP1bL4SySdSknZJo2rYIVQ==
=+54q
-----END PGP SIGNATURE-----


D
D
Danny Milosavljevic wrote on 13 Mar 2018 20:58
Re: [bug#30739] [PATCH 2/3] gnu: Add python2-quex.
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 30739@debbugs.gnu.org)
20180313205837.60459c28@scratchpost.org
Hi Ludo,

Toggle quote (5 lines)
> > +;; Note: non-Ada
> > +(define-public python2-quex-0.67.3
>
> Move to python.scm?

Sure.

Toggle quote (4 lines)
> > + (uri (string-append "https://sourceforge.net/projects/quex/files/HISTORY/0.67/quex-"version ".zip/download"))
>
> Rather mirror://sourceforge and a shorter line.

I tried, but how does the mirror://sourceforge look like? Can't get it to work in this case...
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAlqoLW0ACgkQ5xo1VCww
uqWvWQf/XDfHzBA8DAifHanmfI8V+eouCH/eHu0YXhfmjkx/EZ4jcncGjEorgMV6
K83D38lKhChLmsGbiyX3DtjvsaEPU9R6PxUHhY7CZoYtDuuctkJ7H5ZJfPOHmiiu
JNtpnqeojIf/b4R/89dXE4A7HsFaGktivYWk4+yJRQqpgi5/4rbkCF38Lu/vQLar
RhfRaIIgzaO5FF6wQFZnBnQoxYzLv2qCAfc1E5RcwsZpEqGTUjHGnLrmV9JOqVsf
rwkECkSeTc06AAG1tcOt4plGRFUwa/RG8eQPX0K5ZZ6otRC9/Fu2WDRzzIS5T7DM
Q00EnqoiMYk80RLeRJf6eKh6phaZiw==
=m3Ns
-----END PGP SIGNATURE-----


L
L
Ludovic Courtès wrote on 13 Mar 2018 22:09
(name . Danny Milosavljevic)(address . dannym@scratchpost.org)(address . 30739@debbugs.gnu.org)
87h8pj1y3s.fsf@gnu.org
Danny Milosavljevic <dannym@scratchpost.org> skribis:

Toggle quote (6 lines)
>> > + (uri (string-append "https://sourceforge.net/projects/quex/files/HISTORY/0.67/quex-"version ".zip/download"))
>>
>> Rather mirror://sourceforge and a shorter line.
>
> I tried, but how does the mirror://sourceforge look like? Can't get it to work in this case...

Yeah it always takes me some trial and error to find the right scheme.
It should be along the lines of
“mirror://sourceforge/quex/HISTORY/0.67/quex-0.6.7.zip” but I can’t get
it right.

At worst it’s OK to keep the above URL.

Ludo’.
D
D
Danny Milosavljevic wrote on 13 Mar 2018 22:29
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 30739@debbugs.gnu.org)
20180313222932.51e2996a@scratchpost.org
I found it now by manually downloading it from the sourceforge site and waiting until it redirects me.

mirror://sourceforge/quex/HISTORY/0.67/quex-0.67.3.zip

Not so bad, but yeah, takes some tries.
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAlqoQrwACgkQ5xo1VCww
uqVfdgf+JP7UA86WhNHhQvTPXEdiW1l/FWoQhr5gUGWD9o7UIl0aauuLHUA3aV5i
48+oojhz79Srg6nR8DzWIHnRdN7+exOJoKECEI+8GU5ksvANI5XAgYjFXAL40Z/6
m2qtPJmQ/MUsCszVwdUt8JKPVpLMNd8WTAzPFvYxHtQZ4xZ3LzO2Srh/o37quHbY
onlLgP8nL1J6AFtRmnHDW9kdhRDdRS67ZTB14h1mc0tviy7CGPdTn8JaL354PWMj
eTvMz6GK/nhhpWhewo8iDff6zOH6oiibmoeSuOCihZtCkBCYrZr/g+LElTfqZlAu
f1rmMKiWAYoA/p2am4REliatJCb+dw==
=K0Js
-----END PGP SIGNATURE-----


L
L
Ludovic Courtès wrote on 16 Mar 2018 12:03
(name . Danny Milosavljevic)(address . dannym@scratchpost.org)(address . 30739@debbugs.gnu.org)
87a7v8xoxq.fsf@gnu.org
Danny Milosavljevic <dannym@scratchpost.org> skribis:

Toggle quote (6 lines)
> I found it now by manually downloading it from the sourceforge site and waiting until it redirects me.
>
> mirror://sourceforge/quex/HISTORY/0.67/quex-0.67.3.zip
>
> Not so bad, but yeah, takes some tries.

Indeed. Congrats anyway! :-)

Ludo’.
L
L
Ludovic Courtès wrote on 17 Mar 2018 23:00
control message for bug #30739
(address . control@debbugs.gnu.org)
871sgil5vm.fsf@gnu.org
tags 30739 fixed
close 30739
?