dev-lang/teyjus: Fix #677904 sandbox issue
authorMark Wright <gienah@gentoo.org>
Thu, 22 Aug 2019 10:26:38 +0000 (20:26 +1000)
committerMark Wright <gienah@gentoo.org>
Thu, 22 Aug 2019 10:26:38 +0000 (20:26 +1000)
Closes: https://bugs.gentoo.org/677904
Package-Manager: Portage-2.3.71, Repoman-2.3.17
Signed-off-by: Mark Wright <gienah@gentoo.org>
dev-lang/teyjus/Manifest
dev-lang/teyjus/files/teyjus-2.1-p001-Fixes-arity-for-pervasive-modulo-operation.patch [new file with mode: 0644]
dev-lang/teyjus/files/teyjus-2.1-p002-Add-string-literals-from-proper-character-groups.patch [new file with mode: 0644]
dev-lang/teyjus/files/teyjus-2.1-p003-Removing-deprecated-function-String.set.patch [new file with mode: 0644]
dev-lang/teyjus/teyjus-2.1-r1.ebuild [moved from dev-lang/teyjus/teyjus-2.0.2.ebuild with 74% similarity]

index 17912760ca1732fd85817958ce3b311b014d7e1c..4f5eeec88c8fd05494aea2e0170be7b252beb961 100644 (file)
@@ -1,2 +1 @@
 DIST teyjus-2.1.tar.gz 723763 BLAKE2B ab6a98c2d2291620b586ab0b419a214b0f7c0b27aad444324e5a417c1a0b27382e2d5c622f798ea88cab77853bca3305ec37904c50a7304ace20237afb993b91 SHA512 1f71d19502f4f4da00f635d2c3d4e141403182d65f039e0d43660edf84c5fcd900e7225ac92dc5bdbe0c8379c4e2ce6e27879af504fcfafddf2695a0c8a13379
-DIST teyjus-source-2.0-b2.tar.gz 465815 BLAKE2B 29d8cc2626144a77551a4cb47631a3b55d6edc33b3bf957c2b732144ce9566adb8d472b7ac423168605dcbabab507a4a3cd05b465b02fa0bbc3967a57183fc7c SHA512 071a25cd5341f7562f07dcaae1f87c35eb394ddab94a5160826c7fb2d9a51efea909b41947205503ebcc58df04388baf9eaf9f5a614186701940da29db1c1b29
diff --git a/dev-lang/teyjus/files/teyjus-2.1-p001-Fixes-arity-for-pervasive-modulo-operation.patch b/dev-lang/teyjus/files/teyjus-2.1-p001-Fixes-arity-for-pervasive-modulo-operation.patch
new file mode 100644 (file)
index 0000000..0eb366f
--- /dev/null
@@ -0,0 +1,28 @@
+commit 4e53477a6685b515363f7123dbeeece4f60f103a
+Author: Fabien Renaud <fafounet@gmail.com>
+Date:   Sun Aug 9 21:15:16 2015 +0200
+
+    Fixes arity for pervasive modulo operation
+
+diff --git a/source/tables_gen/pervasives/pervasives.in b/source/tables_gen/pervasives/pervasives.in
+index 2a332da..fcac330 100644
+--- a/source/tables_gen/pervasives/pervasives.in
++++ b/source/tables_gen/pervasives/pervasives.in
+@@ -91,8 +91,6 @@
+       TYPE      7      int -> int
+         /* unary minus on integers */
+        56  %i~        intuminus  0 0  0  TRUE   FALSE  MAX PREFIX   NOCODE -
+-        /* modulus */
+-       61  mod        mod        0 0  0  TRUE   TRUE   160 INFIXL   NOCODE 
+         /* integer abs */
+        63  %iabs        iabs       0 0  0  TRUE   TRUE   0   NOFIXITY NOCODE abs
+       ;;
+@@ -107,6 +105,8 @@
+        59  %i*        intmult    0 0  0  TRUE   FALSE  160 INFIXL   NOCODE *
+         /* integer division */
+        60  div        intdiv     0 0  0  TRUE   FALSE  160 INFIXL   NOCODE
++        /* modulus */
++       61  mod        mod        0 0  0  TRUE   TRUE   160 INFIXL   NOCODE
+       ;;
+       /* int -> int -> o */  
diff --git a/dev-lang/teyjus/files/teyjus-2.1-p002-Add-string-literals-from-proper-character-groups.patch b/dev-lang/teyjus/files/teyjus-2.1-p002-Add-string-literals-from-proper-character-groups.patch
new file mode 100644 (file)
index 0000000..0d5e4ac
--- /dev/null
@@ -0,0 +1,45 @@
+commit 78ba2ba7e42d06e64a7a10915259a4e419aa4ce4
+Merge: 4e53477 bb9ba6a
+Author: fafounet <fafounet@gmail.com>
+Date:   Sat Feb 27 13:10:59 2016 +0100
+
+    Merge pull request #104 from robblanco/string-literals
+    
+    Add string literals from proper character groups
+
+commit bb9ba6a57969c9eeab5841923ca822756860163c
+Author: Rob Blanco <roberto.blanco@inria.fr>
+Date:   Wed Feb 24 19:01:06 2016 +0100
+
+    Add string literals from proper character groups
+    
+    Escape prefixes were included in the strings being passed to the
+    character composition functions, resulting in incorrect characters
+    being generated (in the case of control characters) or exceptions
+    being thrown (in octal and hex literals, in combination with the
+    OCaml-specific prefixes).
+
+diff --git a/source/compiler/lplex.mll b/source/compiler/lplex.mll
+index 6cb28cd..6b2576a 100644
+--- a/source/compiler/lplex.mll
++++ b/source/compiler/lplex.mll
+@@ -215,11 +215,14 @@ and stringstate = parse
+ | "\\\""        {addChar '"'; stringstate lexbuf}
+ | "\"\""        {addChar '"'; stringstate lexbuf}
+-| "\\^"['@'-'z'] as text            {addControl text; stringstate lexbuf}
+-| "\\" OCTAL as text                {addOctal text; stringstate lexbuf}
+-| "\\" (OCTAL OCTAL OCTAL) as text  {addOctal text; stringstate lexbuf}
+-| "\\x" HEX as text                 {addHex text; stringstate lexbuf}
+-| "\\x" (HEX HEX) as text           {addHex text; stringstate lexbuf}
++| "\\^" (['@'-'z'] as text)         {addControl (String.make 1 text);
++                                     stringstate lexbuf}
++| "\\" (OCTAL as text)              {addOctal (String.make 1 text);
++                                     stringstate lexbuf}
++| "\\" (OCTAL OCTAL OCTAL as text)  {addOctal text; stringstate lexbuf}
++| "\\x" (HEX as text)               {addHex (String.make 1 text);
++                                     stringstate lexbuf}
++| "\\x" (HEX HEX as text)           {addHex text; stringstate lexbuf}
+ | "\\x" _         {Errormsg.error lexbuf.lex_curr_p 
+                     "Illegal hex character specification";
diff --git a/dev-lang/teyjus/files/teyjus-2.1-p003-Removing-deprecated-function-String.set.patch b/dev-lang/teyjus/files/teyjus-2.1-p003-Removing-deprecated-function-String.set.patch
new file mode 100644 (file)
index 0000000..a6724a9
--- /dev/null
@@ -0,0 +1,51 @@
+commit 38772fa56ed7edef88e71df8a69eea4f341968ed
+Author: Giselle Reis <giselle.mnr@gmail.com>
+Date:   Fri Jul 26 15:28:03 2019 +0300
+
+    Removing deprecated function String.set
+    
+    Teyjus will not build with a typecheck error
+    because String.set takes bytes, not a string. This
+    commit fixes this issue.
+    String.set is deprecated, so Bytes.set is used
+    instead.
+
+diff --git a/source/compiler/bytecode.ml b/source/compiler/bytecode.ml
+index 957c276..655ddab 100644
+--- a/source/compiler/bytecode.ml
++++ b/source/compiler/bytecode.ml
+@@ -248,28 +248,28 @@ let readWord () = readNBytes (getInChannel ()) (getWordSize ())
+ let readString () =
+   let input = getInChannel () in
+   let length = readNBytes input 4 in
+-  let myString = String.make length ' ' in
++  let myString = Bytes.make length ' ' in
+   let rec readStringAux index =
+       if (index = length) then ()
+       else 
+-        (String.set myString index (input_char input);
++        (Bytes.set myString index (input_char input);
+          readStringAux (index + 1))
+   in
+   readStringAux 0;
+-  myString 
++  Bytes.to_string myString 
+ let readLongString () = 
+   let input = getInChannel() in
+   let length = readNBytes input 4 in
+-  let myString = String.make length ' ' in
++  let myString = Bytes.make length ' ' in
+   let rec readStringAux index =
+       if (index = length) then ()
+       else 
+-        (String.set myString index (input_char input);
++        (Bytes.set myString index (input_char input);
+          readStringAux (index + 1))
+   in
+   readStringAux 0;
+-  myString 
++  Bytes.to_string myString 
+ (* skip n bytes   *)
+ let skipNBytes numberBytes =
similarity index 74%
rename from dev-lang/teyjus/teyjus-2.0.2.ebuild
rename to dev-lang/teyjus/teyjus-2.1-r1.ebuild
index 41a6ffe77a029ea96650ec98e0fe75573da23574..4a0f0073b3ed4bb347ca81b1468a1564a9e4d341 100644 (file)
@@ -1,16 +1,13 @@
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2019 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI="6"
+EAPI="7"
 
-inherit elisp-common multilib versionator
-
-MY_PN="${PN}-source"
-MY_P=$(version_format_string '${MY_PN}-$1.$2-b$3')
+inherit elisp-common multilib
 
 DESCRIPTION="Higher-order logic programming language Lambda Prolog"
 HOMEPAGE="http://teyjus.cs.umn.edu/"
-SRC_URI="https://teyjus.googlecode.com/files/${MY_P}.tar.gz"
+SRC_URI="https://github.com/teyjus/teyjus/archive/v${PV}.tar.gz -> ${P}.tar.gz"
 
 SLOT="0/${PV}"
 KEYWORDS="~amd64 ~x86"
@@ -22,15 +19,18 @@ RDEPEND=">=sys-devel/binutils-2.17:*
        >=dev-lang/ocaml-3.10[ocamlopt?]
        emacs? ( virtual/emacs )"
 DEPEND="${RDEPEND}
+       app-text/dos2unix
        dev-util/omake"
 
-S=${WORKDIR}/${PN}
-
 SITEFILE=50${PN}-gentoo.el
 
+PATCHES=( "${FILESDIR}/${P}-p001-Fixes-arity-for-pervasive-modulo-operation.patch"
+                 "${FILESDIR}/${P}-p002-Add-string-literals-from-proper-character-groups.patch"
+                 "${FILESDIR}/${P}-p003-Removing-deprecated-function-String.set.patch")
+
 src_prepare() {
+       find . -type f -exec dos2unix {} \;
        default
-       eapply "${FILESDIR}/${PN}-2.0.2-flags.patch"
        local cflags=""
        for i in ${CFLAGS}
        do
@@ -41,9 +41,8 @@ src_prepare() {
        do
                lflags="${lflags} -cclib ${i}"
        done
-       sed -e "s@CFLAGS +=@CFLAGS += ${CFLAGS}@" \
-               -e "s@LDFLAGS +=@LDFLAGS += ${LDFLAGS}@" \
-               -e "s@OCAMLFLAGS +=@OCAMLFLAGS +=${cflags}${lflags}@" \
+       sed     -e "s@\(OCAMLFLAGS= -w -A\)@\1 ${cflags}${lflags}@" \
+               -e "s@\(CFLAGS +=\) -g@\1 ${CFLAGS}\nLDFLAGS += ${LDFLAGS}@" \
                -i "${S}/source/OMakefile" \
                || die "Could not set flags in ${S}/teyjus/source/OMakefile"
        if has_version ">=dev-lang/ocaml-4.03.0"; then
@@ -60,12 +59,8 @@ src_prepare() {
 }
 
 src_compile() {
-       addpredict "/usr/$(get_libdir)/omake/Pervasives.omc"
-       addpredict "/usr/$(get_libdir)/omake/build/C.omc"
-       addpredict "/usr/$(get_libdir)/omake/build/Common.omc"
-       addpredict "/usr/$(get_libdir)/omake/configure/Configure.omc"
-       addpredict "/usr/$(get_libdir)/omake/build/OCaml.omc"
-       omake --verbose all || die "omake all failed"
+       export HOME="${T}"
+       omake --verbose --force-dotomake all || die "omake all failed"
        if use emacs ; then
                pushd "${S}/emacs" || die "Could change directory to emacs"
                elisp-compile *.el || die "emacs elisp compile failed"
@@ -86,7 +81,7 @@ src_install() {
        newbin source/tjdis.opt tjdis
        newbin source/tjlink.opt tjlink
        newbin source/tjsim.opt tjsim
-       dodoc README
+       dodoc README.md QUICKSTART
        if use emacs ; then
                elisp-install ${PN} emacs/*.{el,elc}
                cp "${FILESDIR}"/${SITEFILE} "${S}"