| 1 |
|
|---|
| 2 | function all_packages ()
|
|---|
| 3 | {
|
|---|
| 4 | top=$1
|
|---|
| 5 | shift
|
|---|
| 6 |
|
|---|
| 7 | if test -d ${base}/${release}/${top}/cmt; then
|
|---|
| 8 | cd ${base}/${release}/${top}/cmt
|
|---|
| 9 | else
|
|---|
| 10 | cd ${base}/${release}/${top}/*/cmt
|
|---|
| 11 | if test ! $? = 0; then
|
|---|
| 12 | echo "run_create_kit.sh> Cannot move to the top package as [${base}/${release}/${top}/*/cmt]"
|
|---|
| 13 | exit
|
|---|
| 14 | fi
|
|---|
| 15 | fi
|
|---|
| 16 |
|
|---|
| 17 | select_opt=
|
|---|
| 18 | if test ! "${selected}" = ""; then
|
|---|
| 19 | select_opt="-select='${selected}'"
|
|---|
| 20 | fi
|
|---|
| 21 |
|
|---|
| 22 | echo "all_packages> cmt broadcast -global -select=${selected} - ${dep}/create_kit.sh -release ${release} ${patch_opt} ${cycles_opt} ${platform_opt} ${pacman_cache} ${override_opt} ${source_opt}"
|
|---|
| 23 |
|
|---|
| 24 | cmt broadcast -global -select="${selected}" - \
|
|---|
| 25 | ${dep}/create_kit.sh \
|
|---|
| 26 | -release ${release} \
|
|---|
| 27 | ${patch_opt} \
|
|---|
| 28 | ${cycles_opt} \
|
|---|
| 29 | ${platform_opt} \
|
|---|
| 30 | ${pacman_cache} \
|
|---|
| 31 | ${override_opt} \
|
|---|
| 32 | ${source_opt} 2>&1 | cat
|
|---|
| 33 | }
|
|---|
| 34 |
|
|---|
| 35 | function CMT ()
|
|---|
| 36 | {
|
|---|
| 37 | #
|
|---|
| 38 | # CMT itself
|
|---|
| 39 | #
|
|---|
| 40 |
|
|---|
| 41 | cmtversion=`cmt -quiet version`
|
|---|
| 42 |
|
|---|
| 43 | echo "create_all_kits.sh> Constructing the pacman kit for CMT ${cmtversion} [${platform}] into ${pacman_cache}"
|
|---|
| 44 |
|
|---|
| 45 | cat ${dep}/CMTCONFIG.pacman | \
|
|---|
| 46 | sed -e 's#${cmtversion}#'"${cmtversion}"'#g' \
|
|---|
| 47 | -e 's#${CMTCONFIG}#'"${CMTCONFIG}"'#g' >| ${pacman_cache}/cache/CMTCONFIG-${cmtversion}-${platform}.pacman
|
|---|
| 48 |
|
|---|
| 49 | cat ${dep}/CMT.pacman | \
|
|---|
| 50 | sed -e 's#${cmtversion}#'"${cmtversion}"'#g' >| ${pacman_cache}/cache/CMT-${cmtversion}.pacman
|
|---|
| 51 | }
|
|---|
| 52 |
|
|---|
| 53 | function help ()
|
|---|
| 54 | {
|
|---|
| 55 | echo "create_all_kits.sh"
|
|---|
| 56 | echo ""
|
|---|
| 57 | echo " External parameters:"
|
|---|
| 58 | echo ' ${CMTPATH} : as for the normal release usage'
|
|---|
| 59 | echo ' ${PACMAN_CACHE} : where to create the kit'
|
|---|
| 60 | echo ""
|
|---|
| 61 | echo " Arguments:"
|
|---|
| 62 | echo " --help : get this help"
|
|---|
| 63 | echo " -base <base> : the base directory of the release [no default]"
|
|---|
| 64 | echo " -release <rel> : the release id [no default]"
|
|---|
| 65 | echo " -top <top> : the top package [no default]"
|
|---|
| 66 | echo " -p <package> : select this package instead of all [can be multiple]"
|
|---|
| 67 | echo " -cmtversion <v> : the CMT version"
|
|---|
| 68 | echo " -patches <dir> : location of patches for requirements files"
|
|---|
| 69 | echo " -cycles <file> : text file containing the output of cmt show cycles"
|
|---|
| 70 | echo " -platform <plat> : suffix characterizing the platform"
|
|---|
| 71 | echo " -override : override existings kits [default is to keep them]"
|
|---|
| 72 | echo " -step <step> : one of (projects|all|CMT)"
|
|---|
| 73 | echo " -source : create source kits"
|
|---|
| 74 | echo " [<addon> ...] : list of missing packages to manually add to this release"
|
|---|
| 75 | echo ""
|
|---|
| 76 | }
|
|---|
| 77 |
|
|---|
| 78 |
|
|---|
| 79 | #-----------------------------------------
|
|---|
| 80 | # main
|
|---|
| 81 | #-----------------------------------------
|
|---|
| 82 |
|
|---|
| 83 | ##set -x
|
|---|
| 84 |
|
|---|
| 85 | echo "create_all_kits> args=[$*]"
|
|---|
| 86 |
|
|---|
| 87 | # generic definitions
|
|---|
| 88 | dep=`dirname $0`
|
|---|
| 89 | dep=`(cd ${dep}; pwd)`
|
|---|
| 90 |
|
|---|
| 91 | export SITEROOT=/afs/cern.ch
|
|---|
| 92 |
|
|---|
| 93 | top=
|
|---|
| 94 | cmtversion=`cmt version`
|
|---|
| 95 | patch_dir=
|
|---|
| 96 | patch_opt=
|
|---|
| 97 | cycles_file=
|
|---|
| 98 | cycles_opt=
|
|---|
| 99 | platform=
|
|---|
| 100 | platform_suffix=
|
|---|
| 101 | platform_opt=
|
|---|
| 102 | override_opt=
|
|---|
| 103 | selected=
|
|---|
| 104 | source_opt=
|
|---|
| 105 |
|
|---|
| 106 | while test ! $# = 0; do
|
|---|
| 107 | arg=$1
|
|---|
| 108 | ##echo "arg=[${arg}]"
|
|---|
| 109 | if test "${arg}" = "-step"; then
|
|---|
| 110 | shift
|
|---|
| 111 | step=$1
|
|---|
| 112 | elif test "${arg}" = "-base"; then
|
|---|
| 113 | shift
|
|---|
| 114 | base=$1
|
|---|
| 115 | elif test "${arg}" = "-top"; then
|
|---|
| 116 | shift
|
|---|
| 117 | top=$1
|
|---|
| 118 | elif test "${arg}" = "-release"; then
|
|---|
| 119 | shift
|
|---|
| 120 | release=$1
|
|---|
| 121 | elif test "${arg}" = "-p"; then
|
|---|
| 122 | shift
|
|---|
| 123 | package=$1
|
|---|
| 124 | package=`echo ${package} | sed -e 's#^[^/]#/&#' -e 's#[^/]$#&/#'`
|
|---|
| 125 | selected="${selected} ${package}"
|
|---|
| 126 | elif test "${arg}" = "-cmtversion"; then
|
|---|
| 127 | shift
|
|---|
| 128 | cmtversion=$1
|
|---|
| 129 | elif test "${arg}" = "-patches"; then
|
|---|
| 130 | shift
|
|---|
| 131 | patch_dir=$1
|
|---|
| 132 | patch_opt="-patches ${patch_dir}"
|
|---|
| 133 | elif test "${arg}" = "-cycles"; then
|
|---|
| 134 | shift
|
|---|
| 135 | cycles_file=$1
|
|---|
| 136 | cycles_opt="-cycles ${cycles_file}"
|
|---|
| 137 | elif test "${arg}" = "-platform"; then
|
|---|
| 138 | shift
|
|---|
| 139 | platform=$1
|
|---|
| 140 | platform_suffix="-${platform}";
|
|---|
| 141 | platform_opt="-platform ${platform}";
|
|---|
| 142 | elif test "${arg}" = "-override"; then
|
|---|
| 143 | shift
|
|---|
| 144 | override_opt="-override"
|
|---|
| 145 | elif test "${arg}" = "-source"; then
|
|---|
| 146 | shift
|
|---|
| 147 | source_opt="-source"
|
|---|
| 148 | platform="src"
|
|---|
| 149 | platform_suffix="-${platform}";
|
|---|
| 150 | platform_opt="-platform ${platform}";
|
|---|
| 151 | elif test "${arg}" = "--help"; then
|
|---|
| 152 | help
|
|---|
| 153 | exit
|
|---|
| 154 | fi
|
|---|
| 155 | shift
|
|---|
| 156 | done
|
|---|
| 157 |
|
|---|
| 158 | #
|
|---|
| 159 | # Checking effective arguments
|
|---|
| 160 | #
|
|---|
| 161 |
|
|---|
| 162 | if test "${CMTPATH}" = ""; then
|
|---|
| 163 | echo "CMTPATH must be defined first."
|
|---|
| 164 | help
|
|---|
| 165 | exit
|
|---|
| 166 | fi
|
|---|
| 167 |
|
|---|
| 168 | if test "${PACMAN_CACHE}" = ""; then
|
|---|
| 169 | echo "PACMAN_CACHE must be defined first."
|
|---|
| 170 | help
|
|---|
| 171 | exit
|
|---|
| 172 | fi
|
|---|
| 173 |
|
|---|
| 174 | if test "${base}" = ""; then
|
|---|
| 175 | echo "Please specify the base directory of the release using the -base option."
|
|---|
| 176 | help
|
|---|
| 177 | exit
|
|---|
| 178 | fi
|
|---|
| 179 |
|
|---|
| 180 | if test "${release}" = ""; then
|
|---|
| 181 | echo "Please specify the release id using the -release option."
|
|---|
| 182 | help
|
|---|
| 183 | exit
|
|---|
| 184 | fi
|
|---|
| 185 |
|
|---|
| 186 | if test "${top}" = ""; then
|
|---|
| 187 | echo "Please specify the top package using the -top option."
|
|---|
| 188 | help
|
|---|
| 189 | exit
|
|---|
| 190 | fi
|
|---|
| 191 |
|
|---|
| 192 | pacman_cache=${PACMAN_CACHE}
|
|---|
| 193 |
|
|---|
| 194 | kits_dir=${pacman_cache}/kits
|
|---|
| 195 | cache_dir=${pacman_cache}/cache
|
|---|
| 196 |
|
|---|
| 197 | if test ! -d ${kits_dir}; then
|
|---|
| 198 | mkdir -p ${kits_dir}
|
|---|
| 199 | fi
|
|---|
| 200 |
|
|---|
| 201 | if test ! -d ${cache_dir}; then
|
|---|
| 202 | mkdir -p ${cache_dir}
|
|---|
| 203 | fi
|
|---|
| 204 |
|
|---|
| 205 | #echo step=${step}
|
|---|
| 206 | #echo "selected=[${selected}]"
|
|---|
| 207 | #echo "patch_opt=[${patch_opt}]"
|
|---|
| 208 | #echo "cycles_opt=[${cycles_opt}]"
|
|---|
| 209 | #echo "platform_opt=[${platform_opt}]"
|
|---|
| 210 | #echo "pacman_cache=[${pacman_cache}]"
|
|---|
| 211 | #echo "override_opt=[${override_opt}]"
|
|---|
| 212 | #echo "source_opt=[${source_opt}]"
|
|---|
| 213 |
|
|---|
| 214 | if test ! "${source_opt}" = ""; then
|
|---|
| 215 | ${dep}/create_project_kits.sh ${platform_opt}
|
|---|
| 216 | all_packages ${top}
|
|---|
| 217 | elif test "${step}" = ""; then
|
|---|
| 218 | CMT
|
|---|
| 219 | ${dep}/create_project_kits.sh ${platform_opt}
|
|---|
| 220 | all_packages ${top}
|
|---|
| 221 | else
|
|---|
| 222 | if test "${step}" = "projects"; then
|
|---|
| 223 | ${dep}/create_project_kits.sh ${platform_opt}
|
|---|
| 224 | elif test "${step}" = "all"; then
|
|---|
| 225 | all_packages ${top}
|
|---|
| 226 | elif test "${step}" = "CMT"; then
|
|---|
| 227 | CMT
|
|---|
| 228 | fi
|
|---|
| 229 | fi
|
|---|
| 230 |
|
|---|