aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEinhard Leichtfuß <alguien@respiranto.de>2018-12-23 17:31:46 +0100
committerEinhard Leichtfuß <alguien@respiranto.de>2018-12-23 17:31:46 +0100
commit53fc988c4110e5a809d5780483c6a072c2dfae4e (patch)
tree12183aedea03c778d36629f894cc57de00cebb32
parent92d20f8fd6b0e8036da83abe8e3c4e98b1e8e029 (diff)
downloadaur-fd-scripts-53fc988c4110e5a809d5780483c6a072c2dfae4e.tar.gz
aur-fd-scripts-53fc988c4110e5a809d5780483c6a072c2dfae4e.tar.xz
Allow for different licenses
Therefore, separate types of dictionaries in the configuration sections. Reason: The dictionaries imported from wikdict are differently licensed.
-rw-r--r--TODO1
-rw-r--r--basic.sh17
-rw-r--r--bin/sample.PKGBUILD2
-rw-r--r--src/sample.PKGBUILD2
-rw-r--r--svn/sample.PKGBUILD2
-rwxr-xr-xupdate.sh24
6 files changed, 30 insertions, 18 deletions
diff --git a/TODO b/TODO
index 8647680..b838630 100644
--- a/TODO
+++ b/TODO
@@ -4,7 +4,6 @@ TODO file for aur-fd-scripts
* Move dictd make dependency to freedict-tools.
* Use updpkgsums from pacman-contrib.
* (Better) error handling.
-* Allow for different licenses per package.
* Avoid looping over all packages when only one is to be updated.
* [consider] Unify the different sample.PKGBUILDs.
* [consider] Split off a (bash) configuration file.
diff --git a/basic.sh b/basic.sh
index 891d9c5..0cb5186 100644
--- a/basic.sh
+++ b/basic.sh
@@ -25,14 +25,7 @@
# All methods operate on the file "$tmp".
-typeset -a langs
-langs=(
- fra-deu deu-fra
- deu-eng eng-deu
- fra-eng eng-fra
- spa-eng eng-spa
- )
-
+# Dictionaries in the VCS tree, GPL2 assumed.
typeset -a vcs_langs
vcs_langs=(
deu-eng eng-deu
@@ -40,6 +33,14 @@ vcs_langs=(
spa-eng eng-spa
)
+typeset -a wikdict_langs
+wikdict_langs=(
+ fra-deu deu-fra
+ )
+
+typeset -a langs
+langs=( ${vcs_langs[@]} ${wikdict_langs[@]} )
+
function init
{
tmp_d="$(mktemp -d)"
diff --git a/bin/sample.PKGBUILD b/bin/sample.PKGBUILD
index 8d6d3be..7b72147 100644
--- a/bin/sample.PKGBUILD
+++ b/bin/sample.PKGBUILD
@@ -9,7 +9,7 @@ pkgrel=1
pkgdesc="%LANG_A% -> %LANG_B% dictionary for dictd et al. from Freedict.org"
arch=('any')
url="https://freedict.org/"
-license=('GPL')
+license=(%LICENSES%)
optdepends=('dictd: dict client and server')
provides=(${_pkgname})
conflicts=(${_pkgname})
diff --git a/src/sample.PKGBUILD b/src/sample.PKGBUILD
index 02a358c..b0fd9b8 100644
--- a/src/sample.PKGBUILD
+++ b/src/sample.PKGBUILD
@@ -8,7 +8,7 @@ pkgrel=1
pkgdesc="%LANG_A% -> %LANG_B% dictionary for dictd et al. from Freedict.org"
arch=('any')
url="https://freedict.org/"
-license=('GPL')
+license=(%LICENSES%)
optdepends=('dictd: dict client and server')
makedepends=('dictd' 'freedict-tools')
install=${pkgname}.install
diff --git a/svn/sample.PKGBUILD b/svn/sample.PKGBUILD
index df2b604..75ece84 100644
--- a/svn/sample.PKGBUILD
+++ b/svn/sample.PKGBUILD
@@ -9,7 +9,7 @@ pkgrel=2
pkgdesc="%LANG_A% -> %LANG_B% dictionary for dictd et al. from Freedict.org"
arch=('any')
url="https://freedict.org/"
-license=('GPL')
+license=(%LICENSES%)
optdepends=('dictd: dict client and server')
makedepends=('subversion' 'dictd' 'freedict-tools')
provides=(${_pkgname})
diff --git a/update.sh b/update.sh
index 5ba1556..d58f45b 100755
--- a/update.sh
+++ b/update.sh
@@ -33,6 +33,7 @@
script_path="$(realpath "$0")"
script_dir="${script_path%/*}"
+. "${script_dir}/basic.sh"
## Some configuration.
@@ -44,7 +45,7 @@ long[deu]=German
long[eng]=English
long[spa]=Spanish
-# Contributors for some specific PKGBUILDs.
+# Contributors for some specific PKGBUILDs (indexed by $lang$ext).
typeset -A contrs
contrs[deu-eng-bin]=\
'# Contributor: akane <grangerspit@gmail.com> <xmpp:heiß@neko.im>'$'\n'
@@ -55,8 +56,22 @@ contrs[fra-eng-bin]=\
contrs[eng-fra-bin]=\
'# Contributor: Benjamin Vanderford <hazor_at_swrpg_dot_info>'$'\n'
-# prepare() functions.
+# Licenses (indexed by $lang)
+typeset -A licenses
+for lang in ${vcs_langs[@]}
+do
+ licenses[$lang]="'GPL'"
+done
+
+for lang in ${wikdict_langs[@]}
+do
+ licenses[$lang]="'CCPL:by-sa' 'FDL'"
+done
+
+# prepare() functions (indexed by $lang$ext).
typeset -A prepare
+
+# Does not work for deu-fra-bin, since the index file must stay in sync.
prepare[deu-fra]=\
'prepare()
{
@@ -72,10 +87,6 @@ prepare[deu-fra]=\
## End configuration
-
-. "${script_dir}/basic.sh"
-
-
function main
{
if [ "$#" -lt 2 ]
@@ -133,6 +144,7 @@ function update
replace '%LANG_A%' "$lang_a"
replace '%LANG_B%' "$lang_b"
replace '%VER%' "$convver"
+ replace '%LICENSES%' "${licenses[$lang]}"
replace '%CHECKSUM%' "$checksum"
replace_line '%CONTRS%' "${contrs[${lang}${ext}]}" normal