From 3dd3c8e883d49770696fea854910bc3468cb80ff Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Wed, 18 May 2016 14:26:58 +0200 Subject: [PATCH 1/8] bee-init: recognize github.molgen.mpg.de tag/release URLs eg bee init https://github.molgen.mpg.de/donald/clusterd/archive/v1.104.tar.gz would create clusterd-1.104-0.bee --- src/bee-init.sh.in | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/bee-init.sh.in b/src/bee-init.sh.in index 76d74e6..bc53b0f 100644 --- a/src/bee-init.sh.in +++ b/src/bee-init.sh.in @@ -210,6 +210,10 @@ function initialize() { surl="${surl} ${pname}.tar.gz" fi + if [[ $surl =~ ^https://github\.molgen\.mpg\.de/([^/]+)/([^/]+)/archive/(.+)\.tar\.gz$ ]] ; then + pname="${BASH_REMATCH[2]}-${BASH_REMATCH[3]#v}" + fi + if [[ "${OPT_BUILDTYPE}" = "r-package" || "${surl}" = http://cran.r-project.org/src/contrib/* ]] ; then local cran_pname local cran_version From abd65070e33db21b47d8367691202453d133ee76 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Tue, 31 May 2016 12:00:35 +0200 Subject: [PATCH 2/8] bee_cache: allow pattern metacharacter in package names --- src/bee-cache.sh.in | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/bee-cache.sh.in b/src/bee-cache.sh.in index 9bf1cdd..b1e2b2e 100644 --- a/src/bee-cache.sh.in +++ b/src/bee-cache.sh.in @@ -35,6 +35,10 @@ VERSION=${BEE_VERSION} : ${BEECACHE_CACHEDIR=${BEE_CACHEDIR}/bee-cache} : ${BEECACHE_INVENTORY=${BEECACHE_CACHEDIR}/INVENTORY} +function ere_quote() { + sed 's/[]\.|$(){}?+*^]/\\&/g' <<< "$*" +} + function cache_verify() { if ${BEEFLOCK} --shared "${BEECACHE_INVENTORY}" \ sort -c -u -r -k8 -k1 "${BEECACHE_INVENTORY}" 2>/dev/null ; then @@ -92,7 +96,7 @@ function print_conflicts() { grep --file=<(print_conflicting_files "${pkg}" | cut -d ' ' -f8- | sed -e 's,.*, &$,') \ <( tmp_merge_install_inventory_files "${TMPINSTALL[@]}" ) \ - | grep -v -E "^${pkgfullname}-[^-]+-[^-]+ " + | grep -v -E "^$(ere_quote "${pkgfullname}")-[^-]+-[^-]+ " } function cache_conflicts() { @@ -118,7 +122,7 @@ function print_conflicting_files_for_pkg() { local inventory=$2 cache_conflicts ${inventory} \ - | grep -E "^${pkg} " + | grep -E "^$(ere_quote "${pkg}")" } function cache_uniq() { @@ -144,7 +148,7 @@ function print_uniq_files_for_pkg() { local inventory=$2 cache_uniq ${inventory} \ - | grep -E "^${pkg} " + | grep -E "^$(ere_quote "${pkg}")" } function print_missing_files() { @@ -161,7 +165,7 @@ function print_missing_files() { echo "${line}" fi done < <( tmp_merge_install_inventory_files "${TMPINSTALL[@]}" ) \ - | grep -E "^${pkg} " + | grep -E "^$(ere_quote "${pkg}")" } function tmp_merge_install_inventory_files() { From a9d49da787aa98550fcbc0768f94b1b9f4f0542e Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Fri, 1 Jul 2016 00:17:46 +0200 Subject: [PATCH 3/8] beesh: fix parsing of PKGFULLNAME and PKGFULLVERSION when modified in bee file. This fixes the case, when the updated PKGFULLNAME or PKGFULLVERSION do not contain an EXTRA with underscore. --- src/beesh.sh.in | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/beesh.sh.in b/src/beesh.sh.in index 7231b61..c4788b4 100644 --- a/src/beesh.sh.in +++ b/src/beesh.sh.in @@ -729,7 +729,11 @@ function verify_new_package_variables() { exit 1 fi PKGNAME=${PKGFULLNAME//_*} - PKGEXTRANAME=${PKGFULLNAME#*_} + if [ "$PKGNAME" = "$PKGFULLNAME" ] ; then + PKGEXTRANAME="" + else + PKGEXTRANAME=${PKGFULLNAME#*_} + fi fi PKGFULLNAME="${PKGNAME}${PKGEXTRANAME:+_${PKGEXTRANAME}}" @@ -740,7 +744,11 @@ function verify_new_package_variables() { exit 1 fi PKGVERSION=${PKGFULLVERSION//_*} - PKGEXTRAVERSION=${PKGFULLVERSION#*_} + if [ "$PKGVERSION" = "$PKGFULLVERSION" ] ; then + PKGEXTRAVERSION="" + else + PKGEXTRAVERSION=${PKGFULLVERSION#*_} + fi fi PKGFULLVERSION="${PKGVERSION}${PKGEXTRAVERSION:+_${PKGEXTRAVERSION}}" } From fd993dccb0f93a50b158b1e6529bd8f7952d59e2 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Tue, 5 Jul 2016 16:18:41 +0200 Subject: [PATCH 4/8] beesh: always set ARCH we need to always recompute PKGALLPKG after PKGFULLPKG was changed. --- src/beesh.sh.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/beesh.sh.in b/src/beesh.sh.in index c4788b4..987d720 100644 --- a/src/beesh.sh.in +++ b/src/beesh.sh.in @@ -788,7 +788,7 @@ function extract_new_package_variables() { PKGFULLPKG=${PKGFULLNAME}-${PKGFULLVERSION}-${PKGREVISION} # since PKGARCH is now known reconstruct PKGALLPKG - : ${PKGALLPKG:=${PKGFULLPKG}.${PKGARCH}} + PKGALLPKG="${PKGFULLPKG}.${PKGARCH}" eval $("${BEE_BINDIR}/beeversion" "${PKGALLPKG}") } From d59c718ccd4b4b9bab0611fbdd635833214d9b16 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Tue, 5 Jul 2016 17:04:21 +0200 Subject: [PATCH 5/8] bee-init: remove dangling whitespace from template --- src/bee-init.sh.in | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bee-init.sh.in b/src/bee-init.sh.in index bc53b0f..330816c 100644 --- a/src/bee-init.sh.in +++ b/src/bee-init.sh.in @@ -305,6 +305,7 @@ function initialize() { sed -e "s,@DEFAULT_CONFIGURE_OPTIONS@,${DEFAULT_CONFIGURE_OPTIONS}," \ -e "s,@DEFAULT_CONFIGURE_OPTIONS_NOTSET@,${DEFAULT_CONFIGURE_OPTIONS_NOTSET}," \ + -e 's/\s$//' \ -i ${beefile} for i in prefix eprefix bindir sbindir libexecdir sysconfdir \ From 17a0e1f17bb1999e7cf4c3a9f70163c24e136ce5 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Fri, 8 Jul 2016 10:10:41 +0200 Subject: [PATCH 6/8] bee-install: fail early if package is not a tar archive --- src/bee-install.sh.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/bee-install.sh.in b/src/bee-install.sh.in index b01adbd..647a5a3 100644 --- a/src/bee-install.sh.in +++ b/src/bee-install.sh.in @@ -387,7 +387,8 @@ function do_install_file() { --transform="s,^META$,${BEE_METADIR}/${pkg}/META," \ --transform="s,^PATCHES,${BEE_METADIR}/${pkg}/PATCHES," \ --transform="s,^DEPENDENCIES$,${BEE_METADIR}/${pkg}/DEPENDENCIES.deprecated," \ - --show-transformed-names + --show-transformed-names \ + || exit 1 if [ ! -e "${BEE_METADIR}/${pkg}/CONTENT.INSTALL" ] ; then # create CONTENT.INSTALL from CONTENT.FILES From 0e08ceee7ba7b7466cf82e87125b15170d1c4bfb Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Fri, 22 Apr 2016 11:49:18 +0200 Subject: [PATCH 7/8] beesh: set umask to defined value --- src/beesh.sh.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/beesh.sh.in b/src/beesh.sh.in index 987d720..018ca0f 100644 --- a/src/beesh.sh.in +++ b/src/beesh.sh.in @@ -47,6 +47,8 @@ VERSION=${BEE_VERSION} # load libs . ${BEE_LIBEXECDIR}/bee/beelib.config.sh +umask 022 + function bee-cache() { ${BEE_LIBEXECDIR}/bee/bee.d/bee-cache "${@}" } From bc116c0e661c41a6fa225f92d8e8251b406c0153 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Thu, 25 Feb 2016 20:31:39 +0100 Subject: [PATCH 8/8] add hook for kernel modules --- Makefile | 1 + hooks/kernel-modules.sh | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100755 hooks/kernel-modules.sh diff --git a/Makefile b/Makefile index 0c181ff..d760e9f 100644 --- a/Makefile +++ b/Makefile @@ -99,6 +99,7 @@ HELPER_HOOKS_SHELL+=mandb HELPER_HOOKS_SHELL+=systemd-tmpfiles HELPER_HOOKS_SHELL+=gconf-install-schemas HELPER_HOOKS_SHELL+=info-dir +HELPER_HOOKS_SHELL+=kernel-modules MANPAGES+=bee.1 MANPAGES+=bee-check.1 diff --git a/hooks/kernel-modules.sh b/hooks/kernel-modules.sh new file mode 100755 index 0000000..65e1f98 --- /dev/null +++ b/hooks/kernel-modules.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# +action=${1} +pkg=${2} +content=${3} +: ${content:=${BEE_METADIR}/${pkg}/CONTENT} + +if [ -z ${BEE_VERSION} ] ; then + echo >&2 "BEE-ERROR: cannot call $0 from the outside of bee .." + exit 1 +fi + +: ${DEPMOD:=depmod} + +if [ ! type -p ${DEPMOD} >/dev/null 2>&1 ; then + exit 0 +fi + +if [ ! -r "${BEE_METADIR}/${pkg}/META" ] ; then + exit 0 +fi + +. ${BEE_METADIR}/${pkg}/META + +if [ ! "${BEEMETAFORMAT:=0}" -ge 2 ] ; then + exit 0 +fi + +case "${action}" in + "post-install"|"post-remove") + for ver in $(grep -Po ':file=/lib/modules/\K([^/]+)(?=/)' ${content}|sort -u) ; do + echo "$DEPMOD $ver" + test -e /lib/modules/$ver/modules.builtin && $DEPMOD $ver + done + ;; +esac