Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this organization
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
mariux64
/
bee
Public
Notifications
You must be signed in to change notification settings
Fork
2
Star
0
Code
Issues
7
Pull requests
3
Actions
Projects
0
Wiki
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security
Insights
Files
3dc76d1
conf
src
beecut
beesep
beesh.d
beeversion
bee-check.sh.in
bee-init.sh.in
bee-install.sh.in
bee-list.sh.in
bee-query.sh.in
bee-remove.sh.in
bee.sh.in
beefind.pl
beelib.config.sh.in
beesh.sh.in
.gitattributes
.gitignore
Makefile
TODO
Breadcrumbs
bee
/
src
/
beesh.sh.in
Blame
Blame
Latest commit
History
History
executable file
·
658 lines (501 loc) · 16.1 KB
Breadcrumbs
bee
/
src
/
beesh.sh.in
Top
File metadata and controls
Code
Blame
executable file
·
658 lines (501 loc) · 16.1 KB
Raw
#!/bin/bash set -e #architecture ARCH=$(arch) # Version BEE_VERSION="@BEE_VERSION@" VERSION=${BEE_VERSION} : ${BEE_SYSCONFDIR:=@SYSCONFDIR@} : ${BEE_DEFCONFDIR:=@DEFCONFDIR@} : ${BEE_DATADIR:=@DATADIR@} : ${BEE_LIBDIR:=@LIBDIR@} : ${BEE_LIBEXECDIR:=@LIBEXECDIR@} # load libs . ${BEE_LIBEXECDIR}/bee/beelib.config.sh function print_info() { echo -e "${COLOR_BRACKET}[${COLOR_BRCONTENT}BEE${COLOR_BRACKET}] ${COLOR_INFO}${@}${COLOR_NORMAL}" } function print_error() { echo -e "${COLOR_BRACKET}[${COLOR_BRCONTENT}BEE${COLOR_BRACKET}] ${COLOR_ERROR}${@}${COLOR_NORMAL}" } ############################################################################### ############################################################################### ############################################################################### function log_enter() { print_info "=> entering ${@} .." } function log_leave() { print_info "<= leaving ${@} .." } function start_cmd() { print_info "${COLOR_CYAN}${@}" "${@}" } ############################################################################### ############################################################################### ############################################################################### #### create_meta() ############################################################ function create_meta() { echo >>${D}/META "BEEMETAFORMAT=1" echo >>${D}/META "BEEPKG='${PKGALLPKG}'" echo >>${D}/META "PGRP=( ${PGRP[@]} )" } #### show_help() ############################################################## function show_help() { cat <<-EOF beesh v${VERSION} 2009-2011 by Marius Tolzmann and Tobias Dreyer <{tolzmann,dreyer}@molgen.mpg.de> Max Planck Institute for Molecular Genetics Berlin Dahlem Usage: beesh [options] <pkg>.bee Options: -c | --cleanup may be used to clean up <pkg>-related directory tree before build process is started -i | --install after build process is successful and <pkg> is built, <pkg>.tgz is install by bee_install -f | --force-install same as -i; bee_install is invoked with --force -h | --help display this help EOF } function check_repositories() { r=0 print_info "==> checking repositories .." mkdir -pv ${BEE_REPOSITORY_BEEDIR} mkdir -pv ${BEE_REPOSITORY_PKGDIR} mkdir -pv ${BEE_REPOSITORY_BUILDARCHIVEDIR} if [ ! -w ${BEE_REPOSITORY_BEEDIR} ] ; then print_error " !! ${BEE_REPOSITORY_BEEDIR} not writable" r=1 fi if [ ! -w ${BEE_REPOSITORY_PKGDIR} ] ; then print_error " !! ${BEE_REPOSITORY_PKGDIR} not writable" r=1 fi if [ ! -w ${BEE_REPOSITORY_BUILDARCHIVEDIR} ] ; then print_error " !! ${BEE_REPOSITORY_BEEDIR} not writable" r=1 fi if [ "$r" != "0" ] ; then exit 1 fi } function build_in_sourcedir() { B=${S} } #### bee_init_builddir() ###################################################### function bee_init_builddir() { print_info "==> initializing build environment .." if [ -d "${W}" ] ; then if [ "${OPT_CLEANUP}" = "yes" ] ; then print_info " -> cleaning work dir ${W} .." rm -fr ${W} else print_error "error initializing build-dir ${W}" print_error "please use -c to force a cleanup." exit 1 fi fi print_info " -> creating source dir ${S}" mkdir -p ${S} if [ "${B}" == "${S}" ] ; then B=${BEEWORKDIR}/build print_info " -> B=S linking build dir ${B} to source dir" ln -s source ${B} else print_info " -> creating build dir ${B}" mkdir -p ${B} fi print_info " -> creating image dir ${D}" mkdir -p ${D} } #### bee_getsources() ######################################################### # fetch_one_file <url> [filename] function fetch_one_file() { url=$1 file=${2:-${url##*/}} if [ "${url:0:8}" = "file:///" ] ; then url=${url:7} fi if [ "${url:0:1}" = "/" ] ; then print_info "copying file ${url}" cp -v "${url}" "${F}/${file}" else if [ ${url:0:5} == "https" ] ; then nocheck="--no-check-certificate" else nocheck="" fi if [ ! -s "${F}/${file}" ] ; then rm -vf ${F}/${file} fi trap "rm -f ${F}/${file}" EXIT print_info "fetching $url" wget \ ${nocheck} \ --output-document="${F}/${file}" \ --no-clobber \ "${url}" || true trap EXIT ls -ld "${F}/${file}" fi bee_FETCHED_FILE="${F}/${file}" bee_FETCHED_FILES=( ${bee_FETCHED_FILES[@]} "${F}/${file}" ) } function fetch_one_archive() { fetch_one_file $@ bee_SOURCEFILES=( ${bee_SOURCEFILES[@]} ${bee_FETCHED_FILE} ) } function fetch_one_patch() { fetch_one_file $@ bee_PATCHFILES=( ${bee_PATCHFILES[@]} ${bee_FETCHED_FILE} ) } function bee_getsrcurl() { local -a archives=( "${@}" ) for a in "${archives[@]}" ; do fetch_one_archive ${a} done } function bee_getpatchurl() { local -a patches=( "${@}" ) for p in "${patches[@]}" ; do fetch_one_patch ${p} done } # bee_getsources # SRCURL[] = "<url> [filename]" # e.g.: # SRCURL=("<url> [filename]" "<url> [filename]") # SRCURL="<url> [filename]" # SRCURL[0]="<url> [filename]" # SRCURL[1]="<url> [filename]" function bee_getsources() { mkdir -p "${F}" if [ -z "${SRCURL}" ] ; then unset SRCURL fi bee_getsrcurl "${SRCURL[@]}" if [ -z "${PATCHURL}" ] ; then unset PATCHURL fi if [ -z "{PATCHES}" ] ; then unset PATCHES fi if [ -z "${PATCHURL}" ] && [ -n "${PATCHES}" ] ; then print_error 'warning .. you are using deprecated variable ${PATCHES} .. please use ${PATCHURL} instead' PATCHURL=( "${PATCHES[@]}" ) fi bee_getpatchurl "${PATCHURL[@]}" } #### bee_extract() ############################################################# function bee_extract() { local bee_S bee_S=( "$@" ) if is_func mee_unpack ; then print_error "#BEE-WARNING# function 'mee_unpack()' is deprecated .. use 'mee_extract()' instead .." >&2 mee_unpack "${@}" return fi if [ -z "${bee_S[0]}" ] ; then return fi s=${bee_S[0]} print_info " -> extracting main source ${s} .." tar xof ${s} --strip-components 1 -C ${S} unset bee_S[0] for s in ${bee_S[@]} ; do print_info " -> extracting additional source ${s} .." tar xof ${s} -C ${S} done print_info " -> all sources extracted to: ${S} .." } #### bee_patch() ############################################################## function bee_patch() { local bee_P bee_P=( "$@" ) if [ ${#bee_P[@]} == 0 ] ; then bee_P=( ${bee_PATCHFILES[@]} ) fi for p in ${bee_P[@]} ; do print_info "applying patch ${p} .." patch -Np1 -i ${p} done } #### bee_configure() ########################################################## function bee_configure() { print_info "action 'configure' not defined: skipping.." } #### bee_build() ############################################################## function bee_build() { print_info "action 'build' not defined: skipping.." } #### bee_install() ############################################################ function bee_install() { print_info "action 'install' not defined: skipping.." } #### bee_pkg_pack() ########################################################### # $EXCLUDE is read from .bee file # $BEE_SKIPLIST is found in $BEEFAULTS function bee_pkg_pack() { aex=$(@BINDIR@/beecut -d '/' -p '^' -a '$' -n ${BEE_AUTO_EXCLUDE} | sort -u) for e in ${EXCLUDE} ${aex} ; do exargs="${exargs} --exclude=${e}"; done beefind.pl ${BEE_SKIPLIST:+--excludelist=${BEE_SKIPLIST}} \ --exclude='^/FILES$' ${exargs} \ --cutroot=${D} ${D} > ${D}/FILES 2>/dev/null DUMP=${BEE_TMP_TMPDIR}/bee.$$.dump beefind.pl --dump ${D}/FILES | sed -e "s,^,${D}," - > ${DUMP} cp ${BEE} ${D}/BUILD create_meta if [ -n "${bee_PATCHFILES[0]}" ] ; then mkdir -pv ${D}/PATCHES fi for p in ${bee_PATCHFILES[@]} ; do cp ${p} ${D}/PATCHES done if [ ! -d "${BEE_REPOSITORY_PKGDIR}" ] ; then mkdir -pv ${BEE_REPOSITORY_PKGDIR} fi pkgname=${PKGALLPKG}.bee.tar.bz2 pkgfile=${BEE_REPOSITORY_PKGDIR}/${pkgname} print_info " -> creating package ${pkgname} .." print_info "${COLOR_CYAN}${pkgfile}" tar cjvvf ${pkgfile} \ -T ${DUMP} \ --transform="s,${D},," \ --show-transformed-names \ --sparse \ --absolute-names \ --no-recursion \ --transform="s,^/FILES$,FILES," \ --transform="s,^/BUILD$,BUILD," \ --transform="s,^/META$,META," \ --transform="s,^/PATCHES,PATCHES," \ ${D}/{FILES,BUILD,META} \ ${bee_PATCHFILES:+${D}/PATCHES} \ ${bee_PATCHFILES:+${D}/PATCHES/*} rm ${DUMP} beefilename=${BEE##*/} beefiledest=${BEE_REPOSITORY_BEEDIR}/${beefilename} print_info "-> saving bee-file ${beefilename} .." print_info "${COLOR_CYAN}${beefiledest}" if [ ! -d "${BEE_REPOSITORY_BEEDIR}" ] ; then mkdir -pv ${BEE_REPOSITORY_BEEDIR} fi cp -v ${BEE} ${BEE_REPOSITORY_BEEDIR} } function bee_archivebuild() { [ "${OPT_ARCHIVE_BUILD}" != "yes" ] && return if [ ! -d "${BEE_REPOSITORY_BUILDARCHIVEDIR}" ] ; then mkdir -pv ${BEE_REPOSITORY_BUILDARCHIVEDIR} fi archive="${BEE_REPOSITORY_BUILDARCHIVEDIR}/${PKGALLPKG}.beebuild.tar.bz2" print_info " -> saving build environment.." print_info "${COLOR_CYAN}${archive}" tar -cjf ${archive} \ --show-transformed-names \ --sparse \ --absolute-names \ ${S} ${B} \ ${bee_FETCHED_FILES[@]} \ ${BEE_REPOSITORY_BEEDIR}/${BEE##*/} \ --transform="s,^${BEEWORKDIR},${PKGALLPKG}," \ --transform="s,^${F},${PKGALLPKG}/files," \ --transform="s,^${BEE_REPOSITORY_BEEDIR},${PKGALLPKG}/files," } function load_buildmagic() { local oIFS=${IFS} local IFS=":${IFS}" local magic=$1 if [ ! -z "${BEE_BUILDTYPE}" ] ; then return fi for dir in ${XDG_CONFIG_HOME} ${XDG_CONFIG_DIRS} ${BEE_LIBEXECDIR} ; do local IFS=${oIFS} xdgmagic="${dir}/bee/beesh.d/${magic}.sh" if [ -r "${xdgmagic}" ] ; then . ${xdgmagic} if [ ! -z "${BEE_BUILDTYPE}" ] ; then break fi fi done if [ ! -z "${BEE_BUILDTYPE}" ] ; then print_info "using magic buildtype '${BEE_BUILDTYPE}' from '${xdgmagic}' .." fi } ############################################################################### ############################################################################### ############################################################################### function dump_variables() { for i in P{,N{,F,E},F,V{,E,F,R},S,R} ${!PKG*} ${!BEE*} ${!DEF*} ${!OPT*} ${!DOT*} R F W S B D ; do eval echo "${i}=\${${i}}" done } function is_func() { [ "$(type -t ${1})" == "function" ] return $? } function bee_run() { action=${1} shift if is_func "mee_${action}" ; then log_enter "mee_${action}()" mee_${action} "${@}" log_leave "mee_${action}()" elif is_func "bee_${action}" ; then log_enter "bee_${action}()" bee_${action} "${@}" log_leave "bee_${action}()" else print_error "don't know how to run '${action}'" exit fi } config_init_colors echo -e "${COLOR_CYAN}BEE v${BEE_VERSION} 2009-2011 - mariux64 package magic " echo -e " by Marius Tolzmann und Tobias Dreyer <{tolzmann,dreyer}@molgen.mpg.de>" echo -e " Max Planck Institute for Molecular Genetics Berlin Dahlem" echo -e "${COLOR_NORMAL}" config_init config_set_skiplist print_info " BEE_SKIPLIST ${BEE_SKIPLIST}" print_info " BEE_REPOSITORY_PREFIX ${BEE_REPOSITORY_PREFIX}" print_info " BEE_METADIR ${BEE_METADIR}" print_info " BEE_TMP_TMPDIR ${BEE_TMP_TMPDIR}" print_info " BEE_TMP_BUILDROOT ${BEE_TMP_BUILDROOT}" ############################################################################### OPTIONS=$(getopt -n bee-option-parser \ -o hifcs \ --long help,install,force-install,cleanup,silent-build,debug: \ --long archive-build,no-archive-build \ -- "$@") if [ $? != 0 ] ; then print_info "Terminating..." >&2 exit 1 fi eval set -- "${OPTIONS}" : ${OPT_INSTALL:="no"} : ${OPT_CLEANUP:="no"} : ${OPT_ARCHIVE_BUILD:="yes"} while true ; do case "$1" in -h|--help) show_help exit 0 ;; -i|--install) OPT_INSTALL="yes" shift ;; -f|--force-install) OPT_INSTALL="yes" OPT_FORCE="yes" shift ;; -c|--cleanup) OPT_CLEANUP="yes" shift ;; --no-archive-build) OPT_ARCHIVE_BUILD="no" shift ;; --archive-build) OPT_ARCHIVE_BUILD="yes" shift ;; --debug) DEBUG=$2 shift 2 ;; --) shift break ;; *) print_error "Internal error!" exit 1 ;; esac done ############################################################################### ############################################################################### ############################################################################### BEE=$1 if [ "${BEE:0:1}" != "/" ] ; then BEE=${PWD}/$BEE fi if [ ! -f ${BEE} ] ; then print_error "${BEE}: No such File." exit 1 fi ### define pkg variables eval $(@BINDIR@/beeversion ${BEE}) PN=${PKGNAME} PV=( ${PKGVERSION[@]} ) PS=${PKGEXTRAVERSION} PR=${PKGREVISION} P=${PKGFULLNAME}-${PKGFULLVERSION} BEEPKGROOT="${BEE_TMP_BUILDROOT}/${PKGNAME}" BEEWORKDIR="${BEEPKGROOT}/${PKGFULLPKG}" R=${BEEPKGROOT} W=${BEEWORKDIR} F=${BEEPKGROOT}/files S=${BEEWORKDIR}/source B=${BEEWORKDIR}/build D=${BEEWORKDIR}/image ############################################################################### # clear PKGALLPKG since we can't trust PKGARCH in this state PKGALLPKG= # source file.bee . ${BEE} # now set PKGARCH if set or changed by user via ARCH=.. and not given via file.arch.bee : ${PKGARCH:=${ARCH}} # since PKGARCH is now known reconstruct PKGALLPKG : ${PKGALLPKG:=${PKGFULLPKG}.${PKGARCH}} expand_prefix_variables ############################################################################### print_info "current working directory: ${PWD}" bee_init_builddir check_repositories print_info "==> building ${PKGALLPKG} .." bee_run getsources bee_run extract ${bee_SOURCEFILES[@]} print_info "changing to source directory: ${S}" cd ${S} bee_run patch ${bee_PATCHFILES[@]} BEE_BUILDTYPE="" load_buildmagic cmake load_buildmagic configure load_buildmagic autogen load_buildmagic perl-module load_buildmagic perl-module-makemaker load_buildmagic make load_buildmagic python-module print_info "changing to build directory: ${B}" cd ${B} bee_run configure bee_run build bee_run install print_info "changing to image directory: ${D}" cd ${D} bee_pkg_pack cd ${BEEWORKDIR} bee_archivebuild echo print_info "===================================================================" print_info "build summary:" print_info "" print_info "source directory: ${COLOR_NORMAL}${S}" print_info " build directory: ${COLOR_NORMAL}${B}" print_info " image directory: ${COLOR_NORMAL}${D}" print_info "" print_info " bee-file: ${COLOR_NORMAL}${beefiledest}" print_info " pkg-file: ${COLOR_NORMAL}${pkgfile}" print_info "build-archive: ${COLOR_NORMAL}${archive}" print_info "===================================================================" echo if [ "${OPT_INSTALL}" = "yes" ] ; then print_info "installing ${PKGALLPKG} .." bee install ${OPT_FORCE:+-f} ${BEE_REPOSITORY_PKGDIR}/${PKGALLPKG}.bee.tar.bz2 fi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
You can’t perform that action at this time.