From 53fc988c4110e5a809d5780483c6a072c2dfae4e Mon Sep 17 00:00:00 2001 From: Einhard Leichtfuß Date: Sun, 23 Dec 2018 17:31:46 +0100 Subject: Allow for different licenses Therefore, separate types of dictionaries in the configuration sections. Reason: The dictionaries imported from wikdict are differently licensed. --- TODO | 1 - basic.sh | 17 +++++++++-------- bin/sample.PKGBUILD | 2 +- src/sample.PKGBUILD | 2 +- svn/sample.PKGBUILD | 2 +- update.sh | 24 ++++++++++++++++++------ 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 '$'\n' @@ -55,8 +56,22 @@ contrs[fra-eng-bin]=\ contrs[eng-fra-bin]=\ '# Contributor: Benjamin Vanderford '$'\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 -- cgit v1.2.3