commit:     cb9b2f139fb89bd77e9b0572ef5a92a68ee6cee2
Author:     Alexis Ballier <aballier <AT> gentoo <DOT> org>
AuthorDate: Thu Jun  8 15:09:22 2017 +0000
Commit:     Alexis Ballier <aballier <AT> gentoo <DOT> org>
CommitDate: Thu Jun  8 15:09:22 2017 +0000
URL:        https://gitweb.gentoo.org/proj/tex.git/commit/?id=cb9b2f13

generate license from texlive files instead of parsing html with regexpes...

 scripts/texlive/tlpsrc/Makefile                    | 13 +++++-----
 scripts/texlive/tlpsrc/Makefile-dist               |  6 -----
 .../tlpsrc/cataloguelicense2gentoolicense.sh       | 30 ++++++++++++++++++++++
 scripts/texlive/tlpsrc/getlicense.sh               |  2 +-
 4 files changed, 37 insertions(+), 14 deletions(-)

diff --git a/scripts/texlive/tlpsrc/Makefile b/scripts/texlive/tlpsrc/Makefile
index e35bcd9..900fad3 100644
--- a/scripts/texlive/tlpsrc/Makefile
+++ b/scripts/texlive/tlpsrc/Makefile
@@ -30,7 +30,7 @@ unpacked : $(FULLDESC:%=%.unpacked)
 %.srclist: %.tlpobj
        ./gensrc.sh $(shell cat $(<:%.tlpobj=%.list)) > $@
 
-%.licenselist: %.cataloguehtml
+%.licenselist: %.tlplic
        ./getlicense.sh $(shell cat $(@:%.licenselist=%.list)) | sort | uniq | 
tr '\n' ' ' > $@
 
 %.gentoolicense: %.licenselist
@@ -65,6 +65,7 @@ clean:
        $(RMF) $(FULLDESC:%=%.list)
        $(RMF) $(FULLDESC:%=%.srclist)
        $(RMF) $(FULLDESC:%=%.doclist)
+       $(RMF) $(FULLDESC:%=%.fulllist)
        $(RMF) $(FULLDESC:%=%.licenselist)
        $(RMF) $(FULLDESC:%=%.base)
        $(RMF) $(FULLDESC:%=%.versionnedzips)
@@ -76,7 +77,6 @@ clean:
        $(RMF) $(DESC:%=%.metadata)
        $(RMF) *.tlpobj
        $(RMF) *.tlplic
-       $(RMF) *.cataloguehtml
        $(RMF) *.unpacked
        $(RMF) tldir
 
@@ -100,12 +100,11 @@ clean:
        $(MAKE) CONTENTS="$(shell cat $<)" -f Makefile-dist tlpobj
        touch $@
 
-%.tlplic: %.list
-       $(MAKE) CONTENTS="$(shell cat $<)" -f Makefile-dist tlplic
-       touch $@
+%.fulllist: %.list %.doclist %.srclist
+       cat $^ | tr '\n' ' ' > $@
 
-%.cataloguehtml: %.list
-       $(MAKE) CONTENTS="$(shell cat $<)" -f Makefile-dist cataloguehtml
+%.tlplic: %.fulllist
+       $(MAKE) CONTENTS="$(shell cat $<)" -f Makefile-dist tlplic
        touch $@
 
 %-post-ebuild:

diff --git a/scripts/texlive/tlpsrc/Makefile-dist 
b/scripts/texlive/tlpsrc/Makefile-dist
index 3a7c625..023e141 100644
--- a/scripts/texlive/tlpsrc/Makefile-dist
+++ b/scripts/texlive/tlpsrc/Makefile-dist
@@ -22,12 +22,6 @@ tlplic: $(CONTENTS:%=%.tlplic)
 %.tlpobj: $(TL_TRUNK)/Master/tlpkg/tlpsrc/%.tlpsrc
        $(TL_TRUNK)/Master/tlpkg/bin/tl-update-tlpdb -master=$(TL_TRUNK)/Master 
-output=$@ --tlpsrc-from-cmdline $<
 
-%.cataloguehtml:
-       curl -I http://www.ctan.org/pkg/$(@:%.cataloguehtml=%) | grep 404 || 
wget -O $@ http://www.ctan.org/pkg/$(@:%.cataloguehtml=%)
-       touch $@
-
-cataloguehtml: $(CONTENTS:%=%.cataloguehtml)
-
 tldir:
        mkdir tlunpackdir
        touch $@

diff --git a/scripts/texlive/tlpsrc/cataloguelicense2gentoolicense.sh 
b/scripts/texlive/tlpsrc/cataloguelicense2gentoolicense.sh
index 512022a..6a13b4d 100755
--- a/scripts/texlive/tlpsrc/cataloguelicense2gentoolicense.sh
+++ b/scripts/texlive/tlpsrc/cataloguelicense2gentoolicense.sh
@@ -13,6 +13,10 @@ while [ $# -gt 0 ] ; do
             echo "GPL-3";;
         gpl3+)
             echo "GPL-3+";;
+        gpl3+cc-by-sa-4)
+            $0 gpl3+ cc-by-sa-4;;
+        gplofllppl)
+            $0 gpl ofl lppl;;
         lppl1)
             echo "LPPL-1.3";;
         lppl)
@@ -23,6 +27,18 @@ while [ $# -gt 0 ] ; do
             echo "LPPL-1.3";;
         lppl1.3c)
             echo "LPPL-1.3c";;
+        # Some tlpobj from texlive have this like that. This means both and are
+        # only few of them, so split manually.
+        lppl1.3ofl)
+            $0 lppl1.3 ofl;;
+        lppl1.3lppl1.3)
+            $0 lppl1.3;;
+        lpplgpl)
+            $0 lppl gpl;;
+        lpplgpl2)
+            $0 lppl gpl2;;
+        lppllppl)
+            $0 lppl;;
         gfl)
             echo "LPPL-1.3";;
         gfsl)
@@ -37,6 +53,10 @@ while [ $# -gt 0 ] ; do
             echo "GPL-2";;
         other-free)
             echo "TeX-other-free";;
+        other-freelppl)
+            $0 other-free lppl;;
+        other-freelppl1.3)
+            $0 other-free lppl1.3;;
         #other)
         #    echo "TeX-other";;
         other-nonfree)
@@ -49,6 +69,8 @@ while [ $# -gt 0 ] ; do
             echo "LGPL-3";;
         pd)
             echo "public-domain";;
+        pdgpl3)
+            $0 pd gpl3;;
         apache2)
             echo "Apache-2.0";;
         artistic2)
@@ -65,10 +87,18 @@ while [ $# -gt 0 ] ; do
             echo "FDL-1.1";;
         ofl)
             echo "OFL";;
+        oflapache2lppl1.3)
+            $0 ofl apache2 lppl1.3;;
+        ofllppl)
+            $0 ofl lppl;;
+        ofllppl1.3)
+            $0 ofl lppl1.3;;
         opl)
             echo "OPL";;
         mit)
             echo "MIT";;
+        mitlppl)
+            $0 mit lppl;;
         bsd2)
             echo "BSD-2";;
         #nosell)

diff --git a/scripts/texlive/tlpsrc/getlicense.sh 
b/scripts/texlive/tlpsrc/getlicense.sh
index 4ab1779..a417e22 100755
--- a/scripts/texlive/tlpsrc/getlicense.sh
+++ b/scripts/texlive/tlpsrc/getlicense.sh
@@ -1,5 +1,5 @@
 #!/bin/bash
 while [ $# -gt 0 ] ; do
-    cat $1.cataloguehtml | tr '"' '\n' | grep '\/license\/' | tr '/' ' ' | awk 
'{print $2}'
+    grep '^catalogue-license' $1.tlplic | awk '{print $2}'
     shift
 done

Reply via email to