| 1 |  | 
|---|
| 2 | if test ! "${KITDEBUG}" = ""; then | 
|---|
| 3 | set -x | 
|---|
| 4 | fi | 
|---|
| 5 |  | 
|---|
| 6 | #-------------------------------------------- | 
|---|
| 7 | # | 
|---|
| 8 | #  create_kit.sh [options] | 
|---|
| 9 | # | 
|---|
| 10 | #    options are: | 
|---|
| 11 | # | 
|---|
| 12 | #      -rpm               optional (default to norpm) | 
|---|
| 13 | #      -cycles <file>     optional cycles file (output of cmt show cycles) | 
|---|
| 14 | #      -release <release> optional current release id | 
|---|
| 15 | #      -platform <platf>  optional suffix for all kits | 
|---|
| 16 | #      output-directory   optional (default to current directory) | 
|---|
| 17 | # | 
|---|
| 18 | #  Acquire contents of a package and create a tar ball from it | 
|---|
| 19 | # | 
|---|
| 20 | #     - shared libraries obtained from | 
|---|
| 21 | #           ../$CMTCONFIG/*.so | 
|---|
| 22 | #     - applications obtained from either | 
|---|
| 23 | #           $(use_applications) | 
|---|
| 24 | #         and | 
|---|
| 25 | #           ../$CMTCONFIG/*.exe | 
|---|
| 26 | #     - runtime files obtained from either | 
|---|
| 27 | #           $(use_runtime) | 
|---|
| 28 | #         and | 
|---|
| 29 | #           ../share/* | 
|---|
| 30 | #     - header files obtained from | 
|---|
| 31 | #         ../<package>/* | 
|---|
| 32 | #     - the CMT files (requirements + make fragments) of the package | 
|---|
| 33 | #         ../cmt/requirements | 
|---|
| 34 | #         ../cmt/fragments | 
|---|
| 35 | # | 
|---|
| 36 | #  By default only a compressed (gzip) tar ball is constructed. With the | 
|---|
| 37 | #  -rpm option, a RPM is also constructed. | 
|---|
| 38 | # | 
|---|
| 39 | #-------------------------------------------- | 
|---|
| 40 |  | 
|---|
| 41 | #-------------------------------------------- | 
|---|
| 42 | macro_value () | 
|---|
| 43 | { | 
|---|
| 44 | name=$1 | 
|---|
| 45 | shift | 
|---|
| 46 |  | 
|---|
| 47 | grep "^${name}=" ${tempmacros} | sed -e "s#^${name}=##" | 
|---|
| 48 | } | 
|---|
| 49 |  | 
|---|
| 50 | #-------------------------------------------- | 
|---|
| 51 | standalone_macro_value () | 
|---|
| 52 | { | 
|---|
| 53 | name=$1 | 
|---|
| 54 | shift | 
|---|
| 55 |  | 
|---|
| 56 | grep "^${name}=" ${tempmacrosstandalone} | sed -e "s#^${name}=##" | 
|---|
| 57 | } | 
|---|
| 58 |  | 
|---|
| 59 | #-------------------------------------------- | 
|---|
| 60 | libraries () | 
|---|
| 61 | { | 
|---|
| 62 | grep "^library" ${tempconstituents} | 
|---|
| 63 | } | 
|---|
| 64 |  | 
|---|
| 65 | #-------------------------------------------- | 
|---|
| 66 | applications () | 
|---|
| 67 | { | 
|---|
| 68 | grep "^application" ${tempconstituents} | 
|---|
| 69 | } | 
|---|
| 70 |  | 
|---|
| 71 | #-------------------------------------------- | 
|---|
| 72 | purge_variables () | 
|---|
| 73 | { | 
|---|
| 74 | for e in `printenv | sed -e 's#=.*##' | egrep 'ROOT'`; do | 
|---|
| 75 | p=`echo $e | sed -e 's#ROOT##'` | 
|---|
| 76 |  | 
|---|
| 77 | is_cmt=0 | 
|---|
| 78 |  | 
|---|
| 79 | if test "${p}" = "CMT"; then | 
|---|
| 80 | is_cmt=1 | 
|---|
| 81 | fi | 
|---|
| 82 |  | 
|---|
| 83 | if test "${p}" = "NEWCMT"; then | 
|---|
| 84 | is_cmt=1 | 
|---|
| 85 | fi | 
|---|
| 86 |  | 
|---|
| 87 | if test ! "${is_cmt}" = "1"; then | 
|---|
| 88 | unset ${p}CONFIG | 
|---|
| 89 | unset ${p}ROOT | 
|---|
| 90 | fi | 
|---|
| 91 |  | 
|---|
| 92 | done | 
|---|
| 93 | } | 
|---|
| 94 |  | 
|---|
| 95 | #-------------------------------------------- | 
|---|
| 96 | filter_path () | 
|---|
| 97 | { | 
|---|
| 98 | root=$1 | 
|---|
| 99 | p=$2 | 
|---|
| 100 |  | 
|---|
| 101 | ##echo "filter_path for ${p}" | 
|---|
| 102 |  | 
|---|
| 103 | c=`ls ${p} 1>/dev/null 2>&1 ` | 
|---|
| 104 |  | 
|---|
| 105 | if test ! $? = 0 ; then | 
|---|
| 106 | p= | 
|---|
| 107 | else | 
|---|
| 108 | while `ls $p 1>/dev/null 2>&1` ; do | 
|---|
| 109 |  | 
|---|
| 110 | ##echo "in loop p=${p}" | 
|---|
| 111 |  | 
|---|
| 112 | a=`echo $p | sed -e "s#[.][.]/[^.][^/]*/##"` | 
|---|
| 113 |  | 
|---|
| 114 | ##echo "in loop a=${a}" | 
|---|
| 115 |  | 
|---|
| 116 | if test ${a} = ${p}; then | 
|---|
| 117 | break; | 
|---|
| 118 | else | 
|---|
| 119 |  | 
|---|
| 120 | c=`ls ${a} 1>/dev/null 2>&1` | 
|---|
| 121 |  | 
|---|
| 122 | if test ! $? = 0 ; then | 
|---|
| 123 |  | 
|---|
| 124 | ##echo "bad ls" | 
|---|
| 125 |  | 
|---|
| 126 | break | 
|---|
| 127 | else | 
|---|
| 128 |  | 
|---|
| 129 | ##echo "ls ok" | 
|---|
| 130 |  | 
|---|
| 131 | p=$a | 
|---|
| 132 | fi | 
|---|
| 133 | fi | 
|---|
| 134 | done | 
|---|
| 135 | fi | 
|---|
| 136 |  | 
|---|
| 137 | echo $p | sed -e "s#^[.][.]/##" -e "s#^${root}##" -e "s#[/][/]*#/#g" | 
|---|
| 138 | } | 
|---|
| 139 |  | 
|---|
| 140 | #-------------------------------------------- | 
|---|
| 141 | #  $1  is the name of a file containing a list of file specs | 
|---|
| 142 | #  $2  is the name of a directory where files will be transfered | 
|---|
| 143 | # | 
|---|
| 144 | #  ${copycmd} is the command to use for doing the transfer | 
|---|
| 145 | #  ${tempcopydir} is the base location of the transfer destination | 
|---|
| 146 | # | 
|---|
| 147 | transfer_files () | 
|---|
| 148 | { | 
|---|
| 149 | ##echo "transfer_files> args=[$*]" | 
|---|
| 150 |  | 
|---|
| 151 | kind=$1 | 
|---|
| 152 | shift | 
|---|
| 153 |  | 
|---|
| 154 | list=$1 | 
|---|
| 155 | shift | 
|---|
| 156 |  | 
|---|
| 157 | branch=$1 | 
|---|
| 158 | shift | 
|---|
| 159 |  | 
|---|
| 160 | alt= | 
|---|
| 161 | dir_prefix= | 
|---|
| 162 |  | 
|---|
| 163 | if test ! -f "${list}"; then return ; fi | 
|---|
| 164 |  | 
|---|
| 165 | cmt -quiet filter ${list} ${tempfile2}; mv ${tempfile2} ${list} | 
|---|
| 166 | sort -u ${list} >${tempfile2}; mv ${tempfile2} ${list} | 
|---|
| 167 |  | 
|---|
| 168 | n=`wc -w ${list} | awk '{print $1}'` | 
|---|
| 169 | if test "${n}" = 0; then | 
|---|
| 170 | /bin/rm -f ${list} | 
|---|
| 171 | return | 
|---|
| 172 | fi | 
|---|
| 173 |  | 
|---|
| 174 | echo "create_kit> Now acquiring ${kind}" | 
|---|
| 175 |  | 
|---|
| 176 | #cat ${list} | 
|---|
| 177 |  | 
|---|
| 178 | for f in `cat ${list} | sort -u`; do | 
|---|
| 179 |  | 
|---|
| 180 | alt=`echo ${f} | egrep '^[-]s='` | 
|---|
| 181 |  | 
|---|
| 182 | if test ! "${alt}" = ""; then | 
|---|
| 183 | alt= | 
|---|
| 184 | dir_prefix=`echo ${f} | sed -e 's#^[-]s=##'` | 
|---|
| 185 | else | 
|---|
| 186 |  | 
|---|
| 187 | test_absolute=`echo ${f} | egrep '^/'` | 
|---|
| 188 |  | 
|---|
| 189 | if test ! $? = 0; then | 
|---|
| 190 | if test ! "${dir_prefix}" = ""; then | 
|---|
| 191 | f=${dir_prefix}/${f} | 
|---|
| 192 | fi | 
|---|
| 193 | fi | 
|---|
| 194 |  | 
|---|
| 195 | ##echo "1) $f" | 
|---|
| 196 |  | 
|---|
| 197 | n=`(set -f; basename ${f})` | 
|---|
| 198 | d=`(set -f; dirname ${f})` | 
|---|
| 199 |  | 
|---|
| 200 | if test -d ${d}; then | 
|---|
| 201 | d=`(cd ${d}; pwd)` | 
|---|
| 202 | ff=${d}/${n} | 
|---|
| 203 |  | 
|---|
| 204 | #echo "2) $ff ${tempcopydir}/${branch} d=${d}" | 
|---|
| 205 |  | 
|---|
| 206 | mkdir -p ${tempcopydir}/${branch} | 
|---|
| 207 |  | 
|---|
| 208 | is_dir=0 | 
|---|
| 209 | if test "`(set -f; echo ${ff}) | grep '[*]'`" = ""; then | 
|---|
| 210 | if test -d `(set -f; echo ${ff})`; then | 
|---|
| 211 | is_dir=1 | 
|---|
| 212 | fi | 
|---|
| 213 | fi | 
|---|
| 214 |  | 
|---|
| 215 | ##------------------------------------ | 
|---|
| 216 | ## We compare ${d} and ${branch} | 
|---|
| 217 | ## is ${branch} strictly included in ${d} ? | 
|---|
| 218 | ## if yes, compute the offset to be added to ${branch} | 
|---|
| 219 | ## | 
|---|
| 220 |  | 
|---|
| 221 | off= | 
|---|
| 222 |  | 
|---|
| 223 | aaa=`echo ${d} | grep -e ${branch}` | 
|---|
| 224 |  | 
|---|
| 225 | if test $? = 0; then | 
|---|
| 226 | # echo "There may be an offset d=${d} branch=${branch}" | 
|---|
| 227 | off=`echo "${d}" | sed -e 's#.*'"${branch}"'##' -e 's#^[/]##g'` | 
|---|
| 228 | if test ! "${off}" = ""; then | 
|---|
| 229 | off="/${off}" | 
|---|
| 230 | mkdir -p ${tempcopydir}/${branch}${off} | 
|---|
| 231 | fi | 
|---|
| 232 | ##echo "off=${off}" | 
|---|
| 233 | fi | 
|---|
| 234 |  | 
|---|
| 235 | ##echo "3) is_dir=$is_dir" | 
|---|
| 236 |  | 
|---|
| 237 | if test ${is_dir} = 1; then | 
|---|
| 238 | ##echo "  > directory ${ff}" | 
|---|
| 239 |  | 
|---|
| 240 | ##echo "4) copycmd=[$copycmd]" | 
|---|
| 241 |  | 
|---|
| 242 | ${copycmd} ${ff} ${tempcopydir}/${branch}${off}/${n} | 
|---|
| 243 | else | 
|---|
| 244 | a=`eval "ls ${ff} 2>/dev/null"` | 
|---|
| 245 |  | 
|---|
| 246 | ##echo "4) a=[$a]" | 
|---|
| 247 |  | 
|---|
| 248 | for g in `echo ${a}`; do | 
|---|
| 249 | nn=`basename ${g}` | 
|---|
| 250 | ##echo "  > file ${g} branch=${branch}${off}" | 
|---|
| 251 | if test ! -e ${tempcopydir}/${branch}${off}/${nn}; then | 
|---|
| 252 | ${copycmd} ${g} ${tempcopydir}/${branch}${off}/${nn} | 
|---|
| 253 | fi | 
|---|
| 254 | done | 
|---|
| 255 | fi | 
|---|
| 256 | else | 
|---|
| 257 | echo "create_kit> Warning: Directory ${d} not found for file ${f}" | 
|---|
| 258 | fi | 
|---|
| 259 | fi | 
|---|
| 260 | done | 
|---|
| 261 |  | 
|---|
| 262 | /bin/rm -f ${list} | 
|---|
| 263 | } | 
|---|
| 264 |  | 
|---|
| 265 | get_libraries () | 
|---|
| 266 | { | 
|---|
| 267 | package=$1 | 
|---|
| 268 | shift | 
|---|
| 269 |  | 
|---|
| 270 | if test -d ../$CMTCONFIG; then | 
|---|
| 271 | cd ../$CMTCONFIG | 
|---|
| 272 |  | 
|---|
| 273 | pwd=`pwd` | 
|---|
| 274 |  | 
|---|
| 275 | libraries | \ | 
|---|
| 276 | egrep -v '[.]java' | \ | 
|---|
| 277 | awk '{if ($3 == "-no_share") ext=".a"; else ext=".so"; print "'${pwd}/'lib" $2 ext}' | 
|---|
| 278 |  | 
|---|
| 279 | fi | 
|---|
| 280 |  | 
|---|
| 281 | ##macro_value ${package}_libraries | 
|---|
| 282 | } | 
|---|
| 283 |  | 
|---|
| 284 | acquire_libraries () | 
|---|
| 285 | { | 
|---|
| 286 | #--------------- | 
|---|
| 287 | #  Acquire all exported shared libraries | 
|---|
| 288 | # | 
|---|
| 289 | #   Result is stored (symlinked) in ${tempcopydir}/lib | 
|---|
| 290 | # | 
|---|
| 291 |  | 
|---|
| 292 | get_libraries ${package} >| ${tempfile1} | 
|---|
| 293 |  | 
|---|
| 294 | transfer_files "libraries" ${tempfile1} ${project_install_area}/${CMTCONFIG}/lib | 
|---|
| 295 | } | 
|---|
| 296 |  | 
|---|
| 297 | get_java () | 
|---|
| 298 | { | 
|---|
| 299 | if test -d ../classes; then | 
|---|
| 300 | cd ../classes | 
|---|
| 301 |  | 
|---|
| 302 | pwd=`pwd` | 
|---|
| 303 |  | 
|---|
| 304 | find . -name '*.jar' | sed -e 's#[.]/#'${pwd}'/#' | 
|---|
| 305 | fi | 
|---|
| 306 | } | 
|---|
| 307 |  | 
|---|
| 308 | acquire_java () | 
|---|
| 309 | { | 
|---|
| 310 | #--------------- | 
|---|
| 311 | #  Acquire all exported java stuff | 
|---|
| 312 | # | 
|---|
| 313 | #   Result is stored (symlinked) in ${tempcopydir}/classes | 
|---|
| 314 | # | 
|---|
| 315 |  | 
|---|
| 316 | get_java >| ${tempfile1} | 
|---|
| 317 |  | 
|---|
| 318 | transfer_files "java files" ${tempfile1} ${project_install_area}/share/lib | 
|---|
| 319 | } | 
|---|
| 320 |  | 
|---|
| 321 | get_applications () | 
|---|
| 322 | { | 
|---|
| 323 | if test -d ../$CMTCONFIG; then | 
|---|
| 324 | cd ../$CMTCONFIG | 
|---|
| 325 |  | 
|---|
| 326 | pwd=`pwd` | 
|---|
| 327 |  | 
|---|
| 328 | applications | \ | 
|---|
| 329 | egrep -v '[.]java' | \ | 
|---|
| 330 | awk '{print "'${pwd}/'" $2 ".exe"}' | 
|---|
| 331 |  | 
|---|
| 332 | ##find . -name '*.exe' -type f | sed -e 's#[.]/#'${pwd}'/#' | 
|---|
| 333 | fi | 
|---|
| 334 | } | 
|---|
| 335 |  | 
|---|
| 336 | acquire_applications () | 
|---|
| 337 | { | 
|---|
| 338 | #--------------- | 
|---|
| 339 | #  Acquire all exported applications | 
|---|
| 340 | # | 
|---|
| 341 | #   Result is stored (symlinked) in ${tempcopydir}/bin | 
|---|
| 342 | # | 
|---|
| 343 |  | 
|---|
| 344 | get_applications >| ${tempfile1} | 
|---|
| 345 |  | 
|---|
| 346 | macro_value use_applications | \ | 
|---|
| 347 | grep -e "Package ${package} " | \ | 
|---|
| 348 | sed -e "s#.*use_applications : '##" -e "s#' for .*##" >>${tempfile1} | 
|---|
| 349 |  | 
|---|
| 350 | transfer_files "applications" ${tempfile1} ${project_install_area}/${CMTCONFIG}/bin | 
|---|
| 351 | } | 
|---|
| 352 |  | 
|---|
| 353 | acquire_runtime_files () | 
|---|
| 354 | { | 
|---|
| 355 | #--------------- | 
|---|
| 356 | #  Acquire runtime files | 
|---|
| 357 | # | 
|---|
| 358 | #   Result is stored (symlinked) in ${tempcopydir}/share | 
|---|
| 359 | # | 
|---|
| 360 |  | 
|---|
| 361 | echo '$('"${package}"'_runtime)' >>${tempfile1} | 
|---|
| 362 |  | 
|---|
| 363 | transfer_files "runtime files" ${tempfile1} ${project_install_area}/share | 
|---|
| 364 | } | 
|---|
| 365 |  | 
|---|
| 366 | acquire_xml_files () | 
|---|
| 367 | { | 
|---|
| 368 | #--------------- | 
|---|
| 369 | #  Acquire XML files | 
|---|
| 370 | # | 
|---|
| 371 | #   Result is stored (symlinked) in ${tempcopydir}/XML | 
|---|
| 372 | # | 
|---|
| 373 |  | 
|---|
| 374 | echo '$('"${package}"'_xmls)' >>${tempfile1} | 
|---|
| 375 |  | 
|---|
| 376 | transfer_files "XML files" ${tempfile1} ${project_install_area}/XML/${package} | 
|---|
| 377 | } | 
|---|
| 378 |  | 
|---|
| 379 | acquire_jo_files () | 
|---|
| 380 | { | 
|---|
| 381 | #--------------- | 
|---|
| 382 | #  Acquire jobOption files | 
|---|
| 383 | # | 
|---|
| 384 | #   Result is stored (symlinked) in ${tempcopydir}/jobOptions | 
|---|
| 385 | # | 
|---|
| 386 |  | 
|---|
| 387 | echo '$('"${package}"'_joboptions)' >>${tempfile1} | 
|---|
| 388 |  | 
|---|
| 389 | transfer_files "jobOption files" ${tempfile1} ${project_install_area}/jobOptions/${package} | 
|---|
| 390 | } | 
|---|
| 391 |  | 
|---|
| 392 | acquire_scripts_files () | 
|---|
| 393 | { | 
|---|
| 394 | #--------------- | 
|---|
| 395 | #  Acquire scripts files | 
|---|
| 396 | # | 
|---|
| 397 | #   Result is stored (symlinked) in ${tempcopydir}/share/bin | 
|---|
| 398 | # | 
|---|
| 399 |  | 
|---|
| 400 | echo '$('"${package}"'_scripts)' >>${tempfile1} | 
|---|
| 401 |  | 
|---|
| 402 | transfer_files "scripts files" ${tempfile1} ${project_install_area}/share/bin | 
|---|
| 403 | } | 
|---|
| 404 |  | 
|---|
| 405 | acquire_python_modules_files () | 
|---|
| 406 | { | 
|---|
| 407 | #--------------- | 
|---|
| 408 | #  Acquire python_modules files | 
|---|
| 409 | # | 
|---|
| 410 | #   Result is stored (symlinked) in ${tempcopydir}/share/bin | 
|---|
| 411 | # | 
|---|
| 412 |  | 
|---|
| 413 | echo '$('"${package}"'_python_modules)' >>${tempfile1} | 
|---|
| 414 |  | 
|---|
| 415 | transfer_files "python_modules files" ${tempfile1} ${project_install_area}/python/${package} | 
|---|
| 416 | } | 
|---|
| 417 |  | 
|---|
| 418 | acquire_headers () | 
|---|
| 419 | { | 
|---|
| 420 | #--------------- | 
|---|
| 421 | #  Acquire header files | 
|---|
| 422 | # | 
|---|
| 423 | #   Result is stored (symlinked) in ${tempcopydir}/include/<package>/<package> | 
|---|
| 424 | # | 
|---|
| 425 |  | 
|---|
| 426 | if test -d ../${package}; then | 
|---|
| 427 |  | 
|---|
| 428 | pwd=`(cd ../${package}; pwd)` | 
|---|
| 429 | echo ${pwd} >${tempfile1} | 
|---|
| 430 |  | 
|---|
| 431 | transfer_files "header files" ${tempfile1} ${project_install_area}/include/${package} | 
|---|
| 432 |  | 
|---|
| 433 | fi | 
|---|
| 434 | } | 
|---|
| 435 |  | 
|---|
| 436 | acquire_CMT_files () | 
|---|
| 437 | { | 
|---|
| 438 | #--------------- | 
|---|
| 439 | #  Acquire the CMT files (requirements + make_fragments) file | 
|---|
| 440 | # | 
|---|
| 441 | #   Result is stored (symlinked) in ${tempcopydir}/cmt | 
|---|
| 442 | # | 
|---|
| 443 |  | 
|---|
| 444 | echo `pwd` >${tempfile1} | 
|---|
| 445 | if test -d ../fragments; then | 
|---|
| 446 | up=`(cd ..; pwd)` | 
|---|
| 447 | echo ${up}/fragments >>${tempfile1} | 
|---|
| 448 | fi | 
|---|
| 449 |  | 
|---|
| 450 | if test -f version.cmt; then | 
|---|
| 451 | versiondir="" | 
|---|
| 452 | else | 
|---|
| 453 | versiondir="/${version}" | 
|---|
| 454 | fi | 
|---|
| 455 |  | 
|---|
| 456 | tempcmtbase=${project}/${offset}${package}${versiondir} | 
|---|
| 457 |  | 
|---|
| 458 | macro_value ${package}_CMT_files >>${tempfile1} | 
|---|
| 459 |  | 
|---|
| 460 | old_copycmd=${copycmd} | 
|---|
| 461 | copycmd="cp -r" | 
|---|
| 462 |  | 
|---|
| 463 | transfer_files "CMT files" ${tempfile1} ${tempcmtbase} | 
|---|
| 464 |  | 
|---|
| 465 | copycmd=${old_copycmd} | 
|---|
| 466 |  | 
|---|
| 467 | chmod -R +w ${tempcopydir}/${tempcmtbase}/cmt | 
|---|
| 468 | (cd ${tempcopydir}/${tempcmtbase}/cmt; | 
|---|
| 469 | eval "/bin/rm -f setup.* cleanup.* *make* Makefile") | 
|---|
| 470 |  | 
|---|
| 471 | if test ! "${patch_requirements}" = ""; then | 
|---|
| 472 | echo "create_kit> Patching requirements file with ${patch_requirements}" | 
|---|
| 473 | cat requirements ${patch_requirements} >|${tempcopydir}/${tempcmtbase}/cmt/requirements | 
|---|
| 474 | fi | 
|---|
| 475 | } | 
|---|
| 476 |  | 
|---|
| 477 | acquire_lcg_modules () | 
|---|
| 478 | { | 
|---|
| 479 | echo ' -s=$(CMTINSTALLAREA)/${CMTCONFIG}/lib/modules $('"${package}"'_modules) ' >>${tempfile1} | 
|---|
| 480 |  | 
|---|
| 481 | transfer_files "LCG module files" ${tempfile1} ${project_install_area}/${CMTCONFIG}/lib/modules | 
|---|
| 482 | } | 
|---|
| 483 |  | 
|---|
| 484 | acquire_export_installed_files () | 
|---|
| 485 | { | 
|---|
| 486 | echo ' -s=$(CMTINSTALLAREA) $('"${package}"'_export_installed_files) ' >>${tempfile1} | 
|---|
| 487 |  | 
|---|
| 488 | transfer_files "exported installed files" ${tempfile1} ${project_install_area} | 
|---|
| 489 | } | 
|---|
| 490 |  | 
|---|
| 491 | make_tar_filename () | 
|---|
| 492 | { | 
|---|
| 493 | if test "${project_id}" = ""; then | 
|---|
| 494 | if test "${native_version}" = ""; then | 
|---|
| 495 | echo ${package}-${version}${platform_suffix} | sed -e 's#'${package}-${package}'#'${package}'#' | 
|---|
| 496 | else | 
|---|
| 497 | echo ${package}-${native_version}${platform_suffix} | 
|---|
| 498 | fi | 
|---|
| 499 | else | 
|---|
| 500 | echo ${project_id}/${package}${platform_suffix} | 
|---|
| 501 | fi | 
|---|
| 502 | } | 
|---|
| 503 |  | 
|---|
| 504 | acquire_export_paths () | 
|---|
| 505 | { | 
|---|
| 506 | # | 
|---|
| 507 | # Algo: | 
|---|
| 508 | # | 
|---|
| 509 | #  For each epi = export_paths[i], epsi = export_paths[i](STANDALONE) : | 
|---|
| 510 | #    epsi = epsi - ${SITEROOT} | 
|---|
| 511 | #   transfer_files | 
|---|
| 512 | # | 
|---|
| 513 |  | 
|---|
| 514 | echo "create_kit> Now Acquiring exported files from $*" | 
|---|
| 515 |  | 
|---|
| 516 | if test -f ${tempcopydir}/external_links.dat; then | 
|---|
| 517 | /bin/rm -f ${tempcopydir}/external_links.dat | 
|---|
| 518 | fi | 
|---|
| 519 |  | 
|---|
| 520 | if test -f ${tempcopydir}/excludes.dat; then | 
|---|
| 521 | /bin/rm -f ${tempcopydir}/excludes.dat | 
|---|
| 522 | fi | 
|---|
| 523 |  | 
|---|
| 524 | export_paths=$* | 
|---|
| 525 |  | 
|---|
| 526 | # | 
|---|
| 527 | # Get the two values of export_paths for default tag and for STANDALONE tag | 
|---|
| 528 | # | 
|---|
| 529 | #   each value is formatted as a : separated list of paths | 
|---|
| 530 | # | 
|---|
| 531 | a1=`eval echo ":${export_paths}:" | sed -e 's#[ ][ ]*#:#g'` | 
|---|
| 532 | a20=`standalone_macro_value ${package}_export_paths` | 
|---|
| 533 | a2=`eval echo ":${a20}:" | sed -e 's#[ ][ ]*#:#g' -e 's#[:][:]*#:#g' -e 's#'${SITEROOT}'/##g'` | 
|---|
| 534 |  | 
|---|
| 535 | echo "create_kit> Source=[${a1}]" | 
|---|
| 536 | echo "create_kit> Dest=[${a2}]" | 
|---|
| 537 |  | 
|---|
| 538 | # | 
|---|
| 539 | # Transform the two lists a1[n] a2[n] into a list of pairs <a1[i], a2[i]> | 
|---|
| 540 | # | 
|---|
| 541 | i=2 | 
|---|
| 542 | for f1 in `echo ${a1} | sed -e 's#:# #g'`; do | 
|---|
| 543 | f2=`echo ${a2} | cut -d':' -f${i}` | 
|---|
| 544 |  | 
|---|
| 545 | ##echo "f1=[$f1] f2=[$f2]" | 
|---|
| 546 |  | 
|---|
| 547 | # Test whether the second item is strictly included in the first one. | 
|---|
| 548 |  | 
|---|
| 549 | a=`echo $f1 | egrep -e "${f2}$"` | 
|---|
| 550 |  | 
|---|
| 551 | if test $? = 0; then | 
|---|
| 552 | ## exported path is included in the source path | 
|---|
| 553 |  | 
|---|
| 554 | off=${f1#${f2}} | 
|---|
| 555 |  | 
|---|
| 556 | a=`dirname ${f2}` | 
|---|
| 557 | mkdir -p ${tempcopydir}/${a} | 
|---|
| 558 |  | 
|---|
| 559 | else | 
|---|
| 560 |  | 
|---|
| 561 | ## exported path is not included in the source path let's find the common part | 
|---|
| 562 |  | 
|---|
| 563 | n1=`echo $f1 | awk -F/ '{print NF}'` | 
|---|
| 564 | n2=`echo $f2 | awk -F/ '{print NF}'` | 
|---|
| 565 |  | 
|---|
| 566 | b="" | 
|---|
| 567 | while test ${n1} -gt 0 -a ${n2} -gt 0 ; do | 
|---|
| 568 | s1=`echo $f1 | cut -d/ -f${n1}` | 
|---|
| 569 | s2=`echo $f2 | cut -d/ -f${n2}` | 
|---|
| 570 |  | 
|---|
| 571 | if test ! "${s1}" = "${s2}"; then | 
|---|
| 572 | break | 
|---|
| 573 | fi | 
|---|
| 574 |  | 
|---|
| 575 | if test "${b}" = ""; then | 
|---|
| 576 | b=${s1} | 
|---|
| 577 | else | 
|---|
| 578 | b="${s1}/${b}" | 
|---|
| 579 | fi | 
|---|
| 580 |  | 
|---|
| 581 | n1=`expr ${n1} - 1` | 
|---|
| 582 | n2=`expr ${n2} - 1` | 
|---|
| 583 | done | 
|---|
| 584 |  | 
|---|
| 585 | a=${f1%${b}} | 
|---|
| 586 | c=${f2%${b}} | 
|---|
| 587 |  | 
|---|
| 588 | if test ! -z "${b}"; then | 
|---|
| 589 | d=`dirname ${b}` | 
|---|
| 590 | else | 
|---|
| 591 | d= | 
|---|
| 592 | fi | 
|---|
| 593 |  | 
|---|
| 594 | mkdir -p ${tempcopydir}/${c}/${d} | 
|---|
| 595 |  | 
|---|
| 596 | fi | 
|---|
| 597 |  | 
|---|
| 598 | # | 
|---|
| 599 | # Instead of creating symlinks to external items we instead | 
|---|
| 600 | # create entries in one text file using : | 
|---|
| 601 | # | 
|---|
| 602 | #   <physical-loc>:<link-location> | 
|---|
| 603 | # | 
|---|
| 604 | # where <link-location> is the offset to be created in the tar | 
|---|
| 605 | # | 
|---|
| 606 | ##ln -s ${f1} ${tempcopydir}/${f2} | 
|---|
| 607 |  | 
|---|
| 608 | ##echo "f1=[${f1}] f2=[${f2}]" | 
|---|
| 609 | echo "${f1}:${f2}" >>${tempcopydir}/external_links.dat | 
|---|
| 610 |  | 
|---|
| 611 | i=`expr ${i} + 1` | 
|---|
| 612 | done | 
|---|
| 613 | } | 
|---|
| 614 |  | 
|---|
| 615 |  | 
|---|
| 616 | create_tar () | 
|---|
| 617 | { | 
|---|
| 618 | #--------------- | 
|---|
| 619 | # Prepare the production of the tar file. | 
|---|
| 620 | # | 
|---|
| 621 | #--------------- | 
|---|
| 622 |  | 
|---|
| 623 | #--------------- | 
|---|
| 624 | # Create (or upgrade) the tar file | 
|---|
| 625 | # | 
|---|
| 626 |  | 
|---|
| 627 | ##echo "create_kit> Now creating tar file" | 
|---|
| 628 |  | 
|---|
| 629 | do_override=$1 | 
|---|
| 630 | shift | 
|---|
| 631 |  | 
|---|
| 632 | tar_file_name=`make_tar_filename` | 
|---|
| 633 | t=${tar_file_name}.tar | 
|---|
| 634 | plain_tar="${kits_dir}/${t}" | 
|---|
| 635 | compressed_tar="${plain_tar}.gz" | 
|---|
| 636 |  | 
|---|
| 637 | if test ! "${do_override}" = "yes"; then | 
|---|
| 638 | if test -f "${compressed_tar}"; then | 
|---|
| 639 | echo "create_kit> The tar file ${compressed_tar} already exists. It won't be overwritten" | 
|---|
| 640 | return | 
|---|
| 641 | fi | 
|---|
| 642 | fi | 
|---|
| 643 |  | 
|---|
| 644 | # | 
|---|
| 645 | # In all cases a remaining plain tar file is a remnant of a previous interrupted build | 
|---|
| 646 | # | 
|---|
| 647 | if test -f "${plain_tar}"; then | 
|---|
| 648 | /bin/rm -f ${plain_tar} | 
|---|
| 649 | fi | 
|---|
| 650 |  | 
|---|
| 651 | zip_command="tar " | 
|---|
| 652 | zip_basic_option="v" | 
|---|
| 653 |  | 
|---|
| 654 | if test ! "${project_id}" = ""; then | 
|---|
| 655 | mkdir -p ${kits_dir}/${project_id} | 
|---|
| 656 | fi | 
|---|
| 657 |  | 
|---|
| 658 | if test ! -d ${tempcopydir}; then | 
|---|
| 659 | # | 
|---|
| 660 | # Nothing has been collected to be sent to the tar. So create a dummy file | 
|---|
| 661 | # to always really generate a tar ball | 
|---|
| 662 | # | 
|---|
| 663 | mkdir -p ${tempcopydir}/dummy | 
|---|
| 664 | echo "${package}" >| ${tempcopydir}/dummy/${tar_file_name}.txt | 
|---|
| 665 | fi | 
|---|
| 666 |  | 
|---|
| 667 | # | 
|---|
| 668 | # The items to export to the tar bal have been collected into ${tempcopydir}: | 
|---|
| 669 | # | 
|---|
| 670 | #  either as direct copies into this directory | 
|---|
| 671 | #  or as a list of external directory specifications stored into the external_links.dat | 
|---|
| 672 | # | 
|---|
| 673 | #  [Those two options are currently mutually exclusive] | 
|---|
| 674 | # | 
|---|
| 675 |  | 
|---|
| 676 | if test -f ${tempcopydir}/external_links.dat; then | 
|---|
| 677 |  | 
|---|
| 678 | for f in `cat ${tempcopydir}/external_links.dat`; do | 
|---|
| 679 |  | 
|---|
| 680 | echo "create_kit> Next entry in external_links.dat : ${f} " | 
|---|
| 681 |  | 
|---|
| 682 | # | 
|---|
| 683 | # Entries in external_links.dat are lines fomratted with | 
|---|
| 684 | #   <physical location>:<offset in tar> | 
|---|
| 685 | # | 
|---|
| 686 | # The tar operation is directly performed from the external location and symlinks are kept | 
|---|
| 687 | # | 
|---|
| 688 |  | 
|---|
| 689 | if test -f ${plain_tar}; then | 
|---|
| 690 | zip_option="${zip_basic_option}u" | 
|---|
| 691 | else | 
|---|
| 692 | zip_option="${zip_basic_option}c" | 
|---|
| 693 | fi | 
|---|
| 694 |  | 
|---|
| 695 | a=`echo $f | cut -d: -f1` | 
|---|
| 696 | b=`echo $f | cut -d: -f2` | 
|---|
| 697 |  | 
|---|
| 698 | has_external_links= | 
|---|
| 699 | excludes_opt= | 
|---|
| 700 | tar_sources_prefix= | 
|---|
| 701 |  | 
|---|
| 702 | d=`dirname ${b}` | 
|---|
| 703 | mkdir -p ${tempcopydir}/${d} | 
|---|
| 704 |  | 
|---|
| 705 | if test -d "${a}"; then | 
|---|
| 706 | # | 
|---|
| 707 | # When the item is a directory, we have to detect symbolic links pointing to a location | 
|---|
| 708 | # external to the tree starting from this item | 
|---|
| 709 | # | 
|---|
| 710 | ##echo "(cd ${a}; find . -type l -exec ${here}/filter_links.sh {} \;)" | 
|---|
| 711 | ##has_external_links=`(cd ${a}; find . -type l -exec ${here}/filter_links.sh {} \;)` | 
|---|
| 712 | echo "create_kit> ${here}/filter_links.sh ${a}" | 
|---|
| 713 | has_external_links=`${here}/filter_links.sh ${a}` | 
|---|
| 714 |  | 
|---|
| 715 | if test ! -z "${has_external_links}"; then | 
|---|
| 716 | # | 
|---|
| 717 | # When this is true, we must follow the symlinks in the tar action | 
|---|
| 718 | # | 
|---|
| 719 | zip_option="${zip_option}h" | 
|---|
| 720 | fi | 
|---|
| 721 |  | 
|---|
| 722 | # | 
|---|
| 723 | # We have to exclude recursive symlinks to "." | 
|---|
| 724 | # | 
|---|
| 725 | (cd ${a}; find . -type l -lname . -o -lname "${a}*" ) >|${tempcopydir}/excludes.dat | 
|---|
| 726 |  | 
|---|
| 727 | if test -f "${tempcopydir}/excludes.dat"; then | 
|---|
| 728 |  | 
|---|
| 729 | if test ! -z `cat ${tempcopydir}/excludes.dat`; then | 
|---|
| 730 | echo "create_kit> Excluding recursive or extern symlinks :" | 
|---|
| 731 | cat ${tempcopydir}/excludes.dat | 
|---|
| 732 | echo "  ----------------------------" | 
|---|
| 733 | excludes_opt="-X ${tempcopydir}/excludes.dat" | 
|---|
| 734 | fi | 
|---|
| 735 | fi | 
|---|
| 736 |  | 
|---|
| 737 | tar_sources="${b}/*" | 
|---|
| 738 |  | 
|---|
| 739 | else | 
|---|
| 740 |  | 
|---|
| 741 | zip_option="${zip_option}h" | 
|---|
| 742 | tar_sources="${b}" | 
|---|
| 743 |  | 
|---|
| 744 | fi | 
|---|
| 745 |  | 
|---|
| 746 | d=`dirname ${tempcopydir}/${b}` | 
|---|
| 747 | mkdir -p ${d} | 
|---|
| 748 |  | 
|---|
| 749 | # | 
|---|
| 750 | # A symlink creates the logical name of the sources as they will be seen | 
|---|
| 751 | # in the tar ball, which may not be identical to the original package. | 
|---|
| 752 | # | 
|---|
| 753 | #  This is the logical mapping obtained for the STANDALONE floavour of the | 
|---|
| 754 | # export_paths macro | 
|---|
| 755 | # | 
|---|
| 756 | echo "ln -s ${a} ${tempcopydir}/${b}" | 
|---|
| 757 | ln -s ${a} ${tempcopydir}/${b} | 
|---|
| 758 |  | 
|---|
| 759 | # | 
|---|
| 760 | # To cope with very long list of source files, we create a text file containing | 
|---|
| 761 | # the expanded list of file names. | 
|---|
| 762 | #  When the source is a dirctory, we list this directory | 
|---|
| 763 | #  otherwise, we list this simple file. | 
|---|
| 764 | # | 
|---|
| 765 | tar_source_list="${tempcopydir}/tar_source_list.txt" | 
|---|
| 766 | /bin/rm -f ${tar_source_list} | 
|---|
| 767 |  | 
|---|
| 768 | if test -d "${a}"; then | 
|---|
| 769 | ls ${tempcopydir}/${b} | sed -e "s#^#${b}/#"> ${tar_source_list} | 
|---|
| 770 | else | 
|---|
| 771 | echo ${b} > ${tar_source_list} | 
|---|
| 772 | fi | 
|---|
| 773 |  | 
|---|
| 774 | echo "(cd ${tempcopydir}; ${zip_command} ${zip_option}f ${plain_tar} ${excludes_opt} -X ${here}/excludes.txt --files-from=${tar_source_list} )" | 
|---|
| 775 | (cd ${tempcopydir}; eval ${zip_command} ${zip_option}f ${plain_tar} ${excludes_opt} -X ${here}/excludes.txt --files-from=${tar_source_list} ) | 
|---|
| 776 |  | 
|---|
| 777 | /bin/rm -rf ${tempcopydir}/${b} | 
|---|
| 778 |  | 
|---|
| 779 | done | 
|---|
| 780 |  | 
|---|
| 781 | else | 
|---|
| 782 |  | 
|---|
| 783 | # | 
|---|
| 784 | # The tar operation is done against ${tempcopydir} where original stuff has been copied | 
|---|
| 785 | # | 
|---|
| 786 | #  Since symlinks may have been copied there, they must be resolved when sent to the tar | 
|---|
| 787 | #  (using the -h option) | 
|---|
| 788 | # | 
|---|
| 789 |  | 
|---|
| 790 | if test -f ${plain_tar}; then | 
|---|
| 791 | zip_option="${zip_basic_option}hu" | 
|---|
| 792 | else | 
|---|
| 793 | zip_option="${zip_basic_option}hc" | 
|---|
| 794 | fi | 
|---|
| 795 |  | 
|---|
| 796 | echo "(cd ${tempcopydir}; ${zip_command} ${zip_option}f ${plain_tar} -X ${here}/excludes.txt * )" | 
|---|
| 797 | (cd ${tempcopydir}; ${zip_command} ${zip_option}f ${plain_tar} -X ${here}/excludes.txt * ) | 
|---|
| 798 |  | 
|---|
| 799 | fi | 
|---|
| 800 |  | 
|---|
| 801 | gzip -f ${plain_tar} | 
|---|
| 802 | } | 
|---|
| 803 |  | 
|---|
| 804 | create_RPM () | 
|---|
| 805 | { | 
|---|
| 806 | if test "${rpm}" = 1; then | 
|---|
| 807 | echo 'create_kit> Now creating RPM files' | 
|---|
| 808 |  | 
|---|
| 809 | purge_variables | 
|---|
| 810 |  | 
|---|
| 811 | (cd ${kits_dir}; ${here}/make_RPM.sh ${package} ${version} "tar.gz") | 
|---|
| 812 | fi | 
|---|
| 813 | } | 
|---|
| 814 |  | 
|---|
| 815 | get_offset () | 
|---|
| 816 | { | 
|---|
| 817 | p=`pwd` | 
|---|
| 818 | for f in `echo ${CMTPATH} | sed -e "s#[:]# #g"`; do | 
|---|
| 819 | a=`echo ${p} | egrep -e "${f}/"` | 
|---|
| 820 | if test $? = 0; then | 
|---|
| 821 | echo ${p} | sed -e "s#${f}##" -e 's#/'${package}'/.*##' -e "s#^/##" -e "s#/^##" | 
|---|
| 822 | fi | 
|---|
| 823 | done | 
|---|
| 824 | } | 
|---|
| 825 |  | 
|---|
| 826 | get_project () | 
|---|
| 827 | { | 
|---|
| 828 | if test ! "${cmtpath}" = ""; then | 
|---|
| 829 | rr=`basename ${cmtpath}` | 
|---|
| 830 | pr=`dirname ${cmtpath}` | 
|---|
| 831 | pr=`basename ${pr}` | 
|---|
| 832 | echo ${pr}/${rr} | 
|---|
| 833 | fi | 
|---|
| 834 | } | 
|---|
| 835 |  | 
|---|
| 836 | #================================================================== | 
|---|
| 837 | #  filter_deps <cyclefile> <p> <p> ... | 
|---|
| 838 | # | 
|---|
| 839 | #  Remove from the list of <p>s all entries found in the cyclefile | 
|---|
| 840 | # | 
|---|
| 841 | function filter_deps () | 
|---|
| 842 | { | 
|---|
| 843 | cyclefile=$1 | 
|---|
| 844 | shift | 
|---|
| 845 |  | 
|---|
| 846 | cycles=`cat ${cyclefile} | awk '{if ($NF == "'${package}'") {print $1}}'` | 
|---|
| 847 |  | 
|---|
| 848 | alldeps=$* | 
|---|
| 849 | for f in ${alldeps}; do | 
|---|
| 850 | found=0 | 
|---|
| 851 | p=`echo ${f} | cut -d: -f1` | 
|---|
| 852 | for c in ${cycles}; do | 
|---|
| 853 | if test "${c}" = "${p}"; then | 
|---|
| 854 | found=1 | 
|---|
| 855 | break | 
|---|
| 856 | fi | 
|---|
| 857 | done | 
|---|
| 858 | if test ${found} = 0; then | 
|---|
| 859 | echo ${f} | 
|---|
| 860 | fi | 
|---|
| 861 | done | 
|---|
| 862 | } | 
|---|
| 863 |  | 
|---|
| 864 | function usage () | 
|---|
| 865 | { | 
|---|
| 866 | echo "Make a distribution kit for a CMT package" | 
|---|
| 867 | echo "Usage: create_kit.sh [ <option> ... ] <pacman-cache>" | 
|---|
| 868 | echo " where option can be:" | 
|---|
| 869 | echo "  -release <release-id>  : specify the release id" | 
|---|
| 870 | echo "  -cycles <cycles-file>  : specify the cycles file" | 
|---|
| 871 | echo "  -patches <patch-dir>   : specify a directory for patches " | 
|---|
| 872 | echo "  -minimal               : only store CMT files into the tar ball" | 
|---|
| 873 | echo "  -pacman_only           : do not generate the tar ball" | 
|---|
| 874 | echo "  -platform <platform>   : specify a platform suffix" | 
|---|
| 875 | echo "  -override              : override the existing tar balls" | 
|---|
| 876 | echo "  -source                : generate the source kit" | 
|---|
| 877 | echo "  -rpm                   : also generate RPM manifest files" | 
|---|
| 878 | echo "Typical/example usage:" | 
|---|
| 879 | echo "  cmt broadcast create_kit.sh -release 6.3.0 -cycles ${DEP}/cycles.txt /tmp " | 
|---|
| 880 | exit | 
|---|
| 881 | } | 
|---|
| 882 |  | 
|---|
| 883 | function get_pacman_file_version () | 
|---|
| 884 | { | 
|---|
| 885 | old_file=$1 | 
|---|
| 886 | shift | 
|---|
| 887 |  | 
|---|
| 888 | pacman_file_version=1 | 
|---|
| 889 | if test -f ${old_file};  then | 
|---|
| 890 | pacman_file_version=`grep description ${old_file} | egrep '[(]v' | sed -e 's#.*(v##' -e 's#).*##'` | 
|---|
| 891 | if test "${pacman_file_version}" = ""; then | 
|---|
| 892 | pacman_file_version=1 | 
|---|
| 893 | else | 
|---|
| 894 | pacman_file_version=`expr ${pacman_file_version} + 1` | 
|---|
| 895 | fi | 
|---|
| 896 | fi | 
|---|
| 897 |  | 
|---|
| 898 | echo "(v${pacman_file_version})" | 
|---|
| 899 | } | 
|---|
| 900 |  | 
|---|
| 901 | function build_pacman () | 
|---|
| 902 | { | 
|---|
| 903 | # Set URL for further info and relative path from pacman file to source files" | 
|---|
| 904 | # Should it be something else, e.g. URL of package in CVS or docs? | 
|---|
| 905 |  | 
|---|
| 906 | source='../kits' | 
|---|
| 907 |  | 
|---|
| 908 | # get package name and version from CMT | 
|---|
| 909 | package=$1 | 
|---|
| 910 | version=$2 | 
|---|
| 911 | cmtpath=$3 | 
|---|
| 912 | project_id=$4 | 
|---|
| 913 | is_internal=$5 | 
|---|
| 914 |  | 
|---|
| 915 | # External packages (those with export_paths) are split into two kits: | 
|---|
| 916 | # o The internal part, which follows the naming convention for internal packages | 
|---|
| 917 | # o The external part, which only refers to the package version (no mention of | 
|---|
| 918 | #   the project) | 
|---|
| 919 |  | 
|---|
| 920 | # Naming cnvention: | 
|---|
| 921 | #  external packages : <package>-<version>-<platform> | 
|---|
| 922 | #  internal packages : <projectid>/<package>-<platform> | 
|---|
| 923 |  | 
|---|
| 924 | if test "${is_internal}" = "no"; then | 
|---|
| 925 | # first build the pacman file for the external stuff | 
|---|
| 926 |  | 
|---|
| 927 | if test "${native_version}" = ""; then | 
|---|
| 928 | vv=`echo ${version} | sed -e 's#'^${package}-'##'` | 
|---|
| 929 | download_filename="${package}-${vv}${platform_suffix}" | 
|---|
| 930 | else | 
|---|
| 931 | vv=${native_version} | 
|---|
| 932 | download_filename="${package}-${vv}${platform_suffix}" | 
|---|
| 933 | fi | 
|---|
| 934 |  | 
|---|
| 935 | pacman_filename=${download_filename}.pacman | 
|---|
| 936 |  | 
|---|
| 937 | echo "build_pacman> Create pacman file for external stuff ${pacman_filename}" | 
|---|
| 938 |  | 
|---|
| 939 | pacman_file_version=`get_pacman_file_version ${cache_dir}/${pacman_filename}` | 
|---|
| 940 |  | 
|---|
| 941 | if test -f ${cache_dir}/${pacman_filename};  then | 
|---|
| 942 | mv ${cache_dir}/${pacman_filename} ${cache_dir}/${pacman_filename}.bak | 
|---|
| 943 | if test ! $? = 0; then | 
|---|
| 944 | echo "create_kit> failed to rename ${cache_dir}/${pacman_filename} to ${cache_dir}/${pacman_filename}.bak" | 
|---|
| 945 | exit 1 | 
|---|
| 946 | fi | 
|---|
| 947 | fi | 
|---|
| 948 |  | 
|---|
| 949 | # write pacman file | 
|---|
| 950 |  | 
|---|
| 951 | cat <<EOF >>${cache_dir}/${pacman_filename} | 
|---|
| 952 |  | 
|---|
| 953 | description ('External Package ${package} ${version} ${platform} ${pacman_file_version}') | 
|---|
| 954 |  | 
|---|
| 955 | source = '${source}' | 
|---|
| 956 | download = { '*':'${download_filename}.tar.gz' } | 
|---|
| 957 |  | 
|---|
| 958 | EOF | 
|---|
| 959 |  | 
|---|
| 960 | fi | 
|---|
| 961 |  | 
|---|
| 962 | # Figure out dependencies from CMT. | 
|---|
| 963 | # Only take directly used packages, not those used indirectly; | 
|---|
| 964 | #   let pacman handle the cascade. | 
|---|
| 965 |  | 
|---|
| 966 | #echo "CMTUSERCONTEXT=${CMTUSERCONTEXT}" | 
|---|
| 967 |  | 
|---|
| 968 | #${cmtexe} show uses | 
|---|
| 969 |  | 
|---|
| 970 | # | 
|---|
| 971 | # Filter the requirements file patch if any to get the direct use statements. | 
|---|
| 972 | # The cmt show uses does NOT show the use statements obtained from the CMTUSERCONTEXT thus | 
|---|
| 973 | # they have to be added manually here. | 
|---|
| 974 | # | 
|---|
| 975 | depsv=`(if test ! "${patch_requirements}" = ""; then grep use ${patch_requirements} | sed -e 's/use /# use /'; fi; ${cmtexe} show uses) | cat | awk -f ${here}/get_depends.awk` | 
|---|
| 976 |  | 
|---|
| 977 | ### echo "depsv=[${depsv}]" | 
|---|
| 978 |  | 
|---|
| 979 | if test -f "${cyclefile}" ; then | 
|---|
| 980 | new_depsv=`filter_deps ${cyclefile} ${depsv}` | 
|---|
| 981 | if test ! "${new_depsv}" = "${depsv}"; then | 
|---|
| 982 | echo "Filtered dependencies: " | 
|---|
| 983 | echo "depsv=[${depsv}]" | 
|---|
| 984 | echo "new_depsv=[${new_depsv}]" | 
|---|
| 985 | depsv=${new_depsv} | 
|---|
| 986 | fi | 
|---|
| 987 | fi | 
|---|
| 988 |  | 
|---|
| 989 | if test "${project_id}" = ""; then | 
|---|
| 990 | release_id=${release} | 
|---|
| 991 | vv=`echo ${version} | sed -e 's#'^${package}-'##'` | 
|---|
| 992 | else | 
|---|
| 993 | release_id=${project_id} | 
|---|
| 994 | vv=${project_id} | 
|---|
| 995 | fi | 
|---|
| 996 |  | 
|---|
| 997 | echo "++++ project_id=${project_id} release_id=${release_id} vv=${vv}" | 
|---|
| 998 |  | 
|---|
| 999 | # Format the depend statement according to Pacman syntax | 
|---|
| 1000 | # | 
|---|
| 1001 | if test "${depsv}" = ""; then | 
|---|
| 1002 | depends="" | 
|---|
| 1003 | else | 
|---|
| 1004 | project_dep=`echo ${project}${platform_suffix} | sed -e 's#/#-#'` | 
|---|
| 1005 | if test "${project_dep}" = "contrib-CMT${platform_suffix}"; then | 
|---|
| 1006 | project_dep="CMTCONFIG-${cmtversion}${platform_suffix}" | 
|---|
| 1007 | fi | 
|---|
| 1008 | depends="package ('${project_dep}')" | 
|---|
| 1009 | first=yes | 
|---|
| 1010 | for f in `echo ${depsv}`; do | 
|---|
| 1011 | p=`echo ${f} | cut -d: -f1` | 
|---|
| 1012 | v=`echo ${f} | cut -d: -f2` | 
|---|
| 1013 | pp=`echo ${f} | cut -d: -f3 | sed -e 's#/$##'` | 
|---|
| 1014 |  | 
|---|
| 1015 | for path_item in `echo ${CMTPATH} | sed -e "s#[:]# #g"`; do | 
|---|
| 1016 | if test "${path_item}" = "${pp}"; then break; fi | 
|---|
| 1017 | if test "${p}" = "CMT"; then break; fi | 
|---|
| 1018 | if test "${pp#${path_item}}" != "${pp}"; then | 
|---|
| 1019 | pp=${path_item} | 
|---|
| 1020 | break; | 
|---|
| 1021 | fi | 
|---|
| 1022 | done | 
|---|
| 1023 |  | 
|---|
| 1024 | proj=`basename ${pp}` | 
|---|
| 1025 |  | 
|---|
| 1026 | if test "${proj}" = "cmtdev"; then | 
|---|
| 1027 | proj="CMT" | 
|---|
| 1028 | fi | 
|---|
| 1029 |  | 
|---|
| 1030 | if test "${proj}" = "contrib"; then | 
|---|
| 1031 | proj="CMT" | 
|---|
| 1032 | fi | 
|---|
| 1033 |  | 
|---|
| 1034 | if test "${p}" = "CMT"; then | 
|---|
| 1035 | g="${v}" | 
|---|
| 1036 | else | 
|---|
| 1037 | g="${proj}/${p}${platform_suffix}" | 
|---|
| 1038 | fi | 
|---|
| 1039 |  | 
|---|
| 1040 | echo "create_kit> Add dependency to ${g}" | 
|---|
| 1041 |  | 
|---|
| 1042 | depends="${depends} | 
|---|
| 1043 | package ('${g}')" | 
|---|
| 1044 | done | 
|---|
| 1045 |  | 
|---|
| 1046 | if test "${is_internal}" = "no"; then | 
|---|
| 1047 |  | 
|---|
| 1048 | if test "${native_version}" = ""; then | 
|---|
| 1049 | g=`echo "${package}-${version}${platform_suffix}" | sed -e 's#'${package}-${package}'#'${package}'#'` | 
|---|
| 1050 | else | 
|---|
| 1051 | g="${package}-${native_version}${platform_suffix}" | 
|---|
| 1052 | fi | 
|---|
| 1053 |  | 
|---|
| 1054 | depends="${depends} | 
|---|
| 1055 | package ('${g}') " | 
|---|
| 1056 | fi | 
|---|
| 1057 |  | 
|---|
| 1058 | fi | 
|---|
| 1059 |  | 
|---|
| 1060 | ##echo "project=${project} project_id=${project_id} vv=${vv} depends=${depends}" | 
|---|
| 1061 |  | 
|---|
| 1062 | download_filename=${vv}/${package}${platform_suffix} | 
|---|
| 1063 | mkdir -p ${cache_dir}/${vv} | 
|---|
| 1064 |  | 
|---|
| 1065 | pacman_filename=${download_filename}.pacman | 
|---|
| 1066 |  | 
|---|
| 1067 | echo "build_pacman> Create pacman file ${pacman_filename}" | 
|---|
| 1068 |  | 
|---|
| 1069 |  | 
|---|
| 1070 | pacman_file_version=`get_pacman_file_version ${cache_dir}/${pacman_filename}` | 
|---|
| 1071 |  | 
|---|
| 1072 | if test -f ${cache_dir}/${pacman_filename};  then | 
|---|
| 1073 | mv ${cache_dir}/${pacman_filename} ${cache_dir}/${pacman_filename}.bak | 
|---|
| 1074 | if test ! $? = 0; then | 
|---|
| 1075 | echo "failed to rename ${cache_dir}/${pacman_filename} to ${cache_dir}/${pacman_filename}.bak" | 
|---|
| 1076 | exit 1 | 
|---|
| 1077 | fi | 
|---|
| 1078 | fi | 
|---|
| 1079 |  | 
|---|
| 1080 | package_pacman_post_install=`macro_value ${package}_pacman_post_install` | 
|---|
| 1081 |  | 
|---|
| 1082 | if test ! -z "${package_pacman_post_install}"; then | 
|---|
| 1083 | package_pacman_post_install="${package_pacman_post_install};" | 
|---|
| 1084 | fi | 
|---|
| 1085 |  | 
|---|
| 1086 | if test -f version.cmt; then | 
|---|
| 1087 | versionpattern="" | 
|---|
| 1088 | else | 
|---|
| 1089 | versionpattern="/*" | 
|---|
| 1090 | fi | 
|---|
| 1091 |  | 
|---|
| 1092 | install="shell ('. "'$'"PACMAN_INSTALLATION/CMT/*/mgr/setup.sh; cd "'$'"PACMAN_INSTALLATION/${project}/${offset}${package}${versionpattern}/cmt; "'$'"CMTROOT/"'$'"CMTBIN/cmt.exe -quiet -no_cleanup config; ${package_pacman_post_install} a=1')" | 
|---|
| 1093 |  | 
|---|
| 1094 | # write pacman file | 
|---|
| 1095 |  | 
|---|
| 1096 | cat <<EOF >>${cache_dir}/${pacman_filename} | 
|---|
| 1097 |  | 
|---|
| 1098 | description ('Package ${package} ${version} ${platform} in project=${project} ${pacman_file_version}') | 
|---|
| 1099 |  | 
|---|
| 1100 | source = '${source}/${vv}' | 
|---|
| 1101 | download = { '*':'${package}${platform_suffix}.tar.gz' } | 
|---|
| 1102 |  | 
|---|
| 1103 | ${default_depends} | 
|---|
| 1104 | ${depends} | 
|---|
| 1105 | ${install} | 
|---|
| 1106 |  | 
|---|
| 1107 | EOF | 
|---|
| 1108 |  | 
|---|
| 1109 | status=$? | 
|---|
| 1110 |  | 
|---|
| 1111 | pacman_default_hints=`macro_value pacman_default_hints` | 
|---|
| 1112 | if test ! "${pacman_default_hints}" = ""; then | 
|---|
| 1113 | n=`basename ${pacman_default_hints}` | 
|---|
| 1114 | cmt -quiet filter ${pacman_default_hints} ${tempcopydir}/${n} | 
|---|
| 1115 | cat ${tempcopydir}/${n} >>${cache_dir}/${pacman_filename} | 
|---|
| 1116 | /bin/rm -f ${tempcopydir}/${n} | 
|---|
| 1117 | fi | 
|---|
| 1118 |  | 
|---|
| 1119 | package_pacman_hints=`macro_value ${package}_pacman_hints` | 
|---|
| 1120 | if test ! "${package_pacman_hints}" = ""; then | 
|---|
| 1121 | n=`basename ${package_pacman_hints}` | 
|---|
| 1122 | cmt -quiet filter ${package_pacman_hints} ${tempcopydir}/${n} | 
|---|
| 1123 | cat ${tempcopydir}/${n} >>${cache_dir}/${pacman_filename} | 
|---|
| 1124 | /bin/rm -f ${tempcopydir}/${n} | 
|---|
| 1125 | fi | 
|---|
| 1126 |  | 
|---|
| 1127 | ##echo ${status} | 
|---|
| 1128 |  | 
|---|
| 1129 | } | 
|---|
| 1130 |  | 
|---|
| 1131 | function acquire_sources () | 
|---|
| 1132 | { | 
|---|
| 1133 | echo "Now acquiring sources" | 
|---|
| 1134 | module=`cat ../CVS/Repository` | 
|---|
| 1135 | cvsroot=`cat ../CVS/Root` | 
|---|
| 1136 | #echo "version=${version}" | 
|---|
| 1137 | #echo "package=${package}" | 
|---|
| 1138 | #echo "offset=${offset}" | 
|---|
| 1139 | #echo "project=${project}" | 
|---|
| 1140 | #echo "kits_dir=${kits_dir}" | 
|---|
| 1141 | #echo "tempcopydir=${tempcopydir}" | 
|---|
| 1142 |  | 
|---|
| 1143 | project_id=`basename ${project}` | 
|---|
| 1144 | project_name=`dirname ${project}` | 
|---|
| 1145 |  | 
|---|
| 1146 | rm -rf ${tempcopydir} | 
|---|
| 1147 |  | 
|---|
| 1148 | mkdir -p ${tempcopydir}/${project}/${offset} | 
|---|
| 1149 |  | 
|---|
| 1150 | cvstag=`cvs status requirements | grep 'Sticky Tag' | awk '{print $3}'` | 
|---|
| 1151 | if test "${cvstag}" = "(none)"; then | 
|---|
| 1152 | cvstag="HEAD" | 
|---|
| 1153 | fi | 
|---|
| 1154 | echo "cvstag=${cvstag}" | 
|---|
| 1155 |  | 
|---|
| 1156 | echo "Now exporting the sources from CVS" | 
|---|
| 1157 | (cd ${tempcopydir}/${project}; cvs -d ${cvsroot} export -r ${cvstag} -d ${offset}${package} ${module}) | 
|---|
| 1158 | ls ${tempcopydir} | 
|---|
| 1159 |  | 
|---|
| 1160 | echo "Now constructing the source tar ball" | 
|---|
| 1161 | mkdir -p ${kits_dir}/${project_id} | 
|---|
| 1162 | (cd ${tempcopydir}; tar czf ${kits_dir}/${project_id}/${package}-src.tar.gz . ) | 
|---|
| 1163 | } | 
|---|
| 1164 |  | 
|---|
| 1165 | #-------------------------------------------- | 
|---|
| 1166 | # main | 
|---|
| 1167 | # | 
|---|
| 1168 | #   First argument is the location where all resulting | 
|---|
| 1169 | #  tar files will be created. | 
|---|
| 1170 | # | 
|---|
| 1171 |  | 
|---|
| 1172 | ##set -x | 
|---|
| 1173 |  | 
|---|
| 1174 | date | 
|---|
| 1175 |  | 
|---|
| 1176 | ##echo "args=[$*]" | 
|---|
| 1177 |  | 
|---|
| 1178 | cmtexe=${CMTROOT}/${CMTBIN}/cmt.exe | 
|---|
| 1179 |  | 
|---|
| 1180 | rpm= | 
|---|
| 1181 | pacman_base= | 
|---|
| 1182 | kits_dir=`pwd`/kits | 
|---|
| 1183 | cache_dir=`pwd`/cache | 
|---|
| 1184 | minimal=no | 
|---|
| 1185 | pacman_only=no | 
|---|
| 1186 | patch_dir= | 
|---|
| 1187 | patch_requirements= | 
|---|
| 1188 | platform= | 
|---|
| 1189 | platform_suffix= | 
|---|
| 1190 | override=no | 
|---|
| 1191 | do_source_kit=no | 
|---|
| 1192 |  | 
|---|
| 1193 | while test ! $# = 0; do | 
|---|
| 1194 |  | 
|---|
| 1195 | if test "$1" = "-rpm"; then | 
|---|
| 1196 | rpm=1 | 
|---|
| 1197 | elif test "$1" = "-release"; then | 
|---|
| 1198 | shift | 
|---|
| 1199 | release=$1; | 
|---|
| 1200 | elif test "$1" = "-cycles"; then | 
|---|
| 1201 | shift | 
|---|
| 1202 | cyclefile=$1 | 
|---|
| 1203 | elif test "$1" = "-patches"; then | 
|---|
| 1204 | shift | 
|---|
| 1205 | patch_dir=$1 | 
|---|
| 1206 | elif test "$1" = "-minimal"; then | 
|---|
| 1207 | minimal=yes | 
|---|
| 1208 | elif test "$1" = "-pacman_only"; then | 
|---|
| 1209 | pacman_only=yes | 
|---|
| 1210 | elif test "$1" = "-platform"; then | 
|---|
| 1211 | shift | 
|---|
| 1212 | platform=$1 | 
|---|
| 1213 | platform_suffix="-${platform}" | 
|---|
| 1214 | elif test "$1" = "-override"; then | 
|---|
| 1215 | override=yes | 
|---|
| 1216 | elif test "$1" = "-source"; then | 
|---|
| 1217 | do_source_kit=yes | 
|---|
| 1218 | platform="src" | 
|---|
| 1219 | platform_suffix="-src" | 
|---|
| 1220 | else | 
|---|
| 1221 | pacman_base=$1 | 
|---|
| 1222 | kits_dir=${pacman_base}/kits | 
|---|
| 1223 | cache_dir=${pacman_base}/cache | 
|---|
| 1224 | fi | 
|---|
| 1225 | shift | 
|---|
| 1226 | done | 
|---|
| 1227 |  | 
|---|
| 1228 | if test "${pacman_base}" = ""; then | 
|---|
| 1229 | usage | 
|---|
| 1230 | exit 0 | 
|---|
| 1231 | fi | 
|---|
| 1232 |  | 
|---|
| 1233 | if test ! -d ${kits_dir}; then | 
|---|
| 1234 | mkdir -p ${kits_dir} | 
|---|
| 1235 | fi | 
|---|
| 1236 |  | 
|---|
| 1237 | if test ! -d ${cache_dir}; then | 
|---|
| 1238 | mkdir -p ${cache_dir} | 
|---|
| 1239 | fi | 
|---|
| 1240 |  | 
|---|
| 1241 | #--------------- | 
|---|
| 1242 | # AWK scripts are expected at the same location as this one. | 
|---|
| 1243 | # | 
|---|
| 1244 | here=`dirname $0` | 
|---|
| 1245 | here=`(cd ${here}; pwd)` | 
|---|
| 1246 | #--------------- | 
|---|
| 1247 |  | 
|---|
| 1248 | #--------------- | 
|---|
| 1249 | # Prepare temporary file management | 
|---|
| 1250 | # | 
|---|
| 1251 | tempprefix=/tmp/CMT$$ | 
|---|
| 1252 | if test ! "${TMP}" = ""; then | 
|---|
| 1253 | tempprefix=${TMP}/CMT$$ | 
|---|
| 1254 | fi | 
|---|
| 1255 |  | 
|---|
| 1256 | tempfile1=${tempprefix}/t$$ | 
|---|
| 1257 | tempfile2=${tempprefix}/u$$ | 
|---|
| 1258 | tempcopydir=${tempprefix}/c$$ | 
|---|
| 1259 | tempmacros=${tempprefix}/macros$$ | 
|---|
| 1260 | tempmacrosstandalone=${tempprefix}/macrosstandalone$$ | 
|---|
| 1261 | tempconstituents=${tempprefix}/constituents$$ | 
|---|
| 1262 | tempcmtusercontext=${tempprefix}/d$$ | 
|---|
| 1263 |  | 
|---|
| 1264 | trap "if test -d ${tempprefix} ; then chmod -R +w ${tempprefix}; fi; /bin/rm -rf ${tempprefix}" 0 1 2 15 | 
|---|
| 1265 |  | 
|---|
| 1266 | if test -d ${tempprefix} ; then chmod -R +w ${tempprefix}; fi | 
|---|
| 1267 | /bin/rm -rf ${tempprefix} | 
|---|
| 1268 | mkdir -p ${tempprefix} | 
|---|
| 1269 | #--------------- | 
|---|
| 1270 |  | 
|---|
| 1271 | #--------------- | 
|---|
| 1272 | # Compute environment | 
|---|
| 1273 | # | 
|---|
| 1274 |  | 
|---|
| 1275 | h=`cmt -quiet show pwd` | 
|---|
| 1276 |  | 
|---|
| 1277 | root=`dirname $h` | 
|---|
| 1278 |  | 
|---|
| 1279 | cmtversion=`cmt version` | 
|---|
| 1280 | version=`cmt -quiet show version` | 
|---|
| 1281 | if test "${version}" = "v*"; then | 
|---|
| 1282 | version=v1 | 
|---|
| 1283 | fi | 
|---|
| 1284 |  | 
|---|
| 1285 | cmt -quiet build tag_makefile > ${tempmacros} | 
|---|
| 1286 | cmt -quiet filter ${tempmacros} ${tempmacros}A; mv ${tempmacros}A ${tempmacros} | 
|---|
| 1287 |  | 
|---|
| 1288 | cmt -quiet -tag=STANDALONE build tag_makefile > ${tempmacrosstandalone} | 
|---|
| 1289 | cmt -quiet -tag=STANDALONE filter ${tempmacrosstandalone} ${tempmacrosstandalone}A; mv ${tempmacrosstandalone}A ${tempmacrosstandalone} | 
|---|
| 1290 |  | 
|---|
| 1291 | cmt -quiet show constituents > ${tempconstituents} | 
|---|
| 1292 | cmt -quiet filter ${tempconstituents} ${tempconstituents}A; mv ${tempconstituents}A ${tempconstituents} | 
|---|
| 1293 |  | 
|---|
| 1294 | package=`macro_value package` | 
|---|
| 1295 |  | 
|---|
| 1296 | #offset=`get_offset` | 
|---|
| 1297 | offset=`macro_value ${package}_offset` | 
|---|
| 1298 |  | 
|---|
| 1299 | if test ! "${offset}" = ""; then | 
|---|
| 1300 | offset="${offset}/" | 
|---|
| 1301 | fi | 
|---|
| 1302 |  | 
|---|
| 1303 | cmtpath=`macro_value ${package}_cmtpath` | 
|---|
| 1304 | if test "${cmtpath}" = ""; then | 
|---|
| 1305 | cmtpath=`macro_value ${package}_root` | 
|---|
| 1306 | cmtpath=`dirname ${cmtpath}` | 
|---|
| 1307 | cmtpath=`dirname ${cmtpath}` | 
|---|
| 1308 | fi | 
|---|
| 1309 |  | 
|---|
| 1310 | if test "${cmtpath}" = "/"; then | 
|---|
| 1311 | cmtpath="${cmtpath}${offset}" | 
|---|
| 1312 | offset= | 
|---|
| 1313 | fi | 
|---|
| 1314 |  | 
|---|
| 1315 | project=`get_project` | 
|---|
| 1316 | if test ! "${project}" = ""; then | 
|---|
| 1317 | project_id=`basename ${project}` | 
|---|
| 1318 | fi | 
|---|
| 1319 |  | 
|---|
| 1320 | echo "# Working on ${package} ${version} ${offset} in ${cmtpath} of project ${project} ${project_id}" | 
|---|
| 1321 |  | 
|---|
| 1322 | #--------------- | 
|---|
| 1323 | # Prepare temporary file management | 
|---|
| 1324 | # | 
|---|
| 1325 | tempprefix=/tmp/CMT$$ | 
|---|
| 1326 | if test ! "${TMP}" = ""; then | 
|---|
| 1327 | tempprefix=${TMP}/CMT$$ | 
|---|
| 1328 | fi | 
|---|
| 1329 |  | 
|---|
| 1330 | tempfile1=${tempprefix}/t$$ | 
|---|
| 1331 | tempfile2=${tempprefix}/u$$ | 
|---|
| 1332 | tempcopydir=${tempprefix}/c$$ | 
|---|
| 1333 | tempcmtusercontext=${tempprefix}/d$$ | 
|---|
| 1334 |  | 
|---|
| 1335 | trap "if test -d ${tempprefix} ; then chmod -R +w ${tempprefix}; fi; /bin/rm -rf ${tempprefix}" 0 1 2 15 | 
|---|
| 1336 |  | 
|---|
| 1337 | if test -d ${tempprefix} ; then chmod -R +w ${tempprefix}; fi | 
|---|
| 1338 | /bin/rm -rf ${tempprefix} | 
|---|
| 1339 | #--------------- | 
|---|
| 1340 |  | 
|---|
| 1341 | #--------------- | 
|---|
| 1342 | # Prepare the patch structure | 
|---|
| 1343 | # | 
|---|
| 1344 | if test ! "${patch_dir}" = ""; then | 
|---|
| 1345 |  | 
|---|
| 1346 | if test -d ${patch_dir}/${project_id}; then | 
|---|
| 1347 |  | 
|---|
| 1348 | echo "create_kit> ${patch_dir}/${project_id}" | 
|---|
| 1349 |  | 
|---|
| 1350 | mkdir -p ${tempcmtusercontext} | 
|---|
| 1351 |  | 
|---|
| 1352 | export CMTUSERCONTEXT=${tempcmtusercontext} | 
|---|
| 1353 | export patch_requirements=${tempcmtusercontext}/requirements | 
|---|
| 1354 |  | 
|---|
| 1355 | echo "" >| ${patch_requirements} | 
|---|
| 1356 |  | 
|---|
| 1357 | if test -f ${patch_dir}/${project_id}/requirements; then | 
|---|
| 1358 | cat ${patch_dir}/${project_id}/requirements >>${patch_requirements} | 
|---|
| 1359 | fi | 
|---|
| 1360 |  | 
|---|
| 1361 | if test -f ${patch_dir}/${project_id}/${package}/requirements; then | 
|---|
| 1362 | cat ${patch_dir}/${project_id}/${package}/requirements >>${patch_requirements} | 
|---|
| 1363 | fi | 
|---|
| 1364 | fi | 
|---|
| 1365 | fi | 
|---|
| 1366 | #--------------- | 
|---|
| 1367 |  | 
|---|
| 1368 | native_version=`macro_value ${package}_native_version` | 
|---|
| 1369 | export_paths=`macro_value ${package}_export_paths` | 
|---|
| 1370 |  | 
|---|
| 1371 | if test "${export_paths}" = ""; then | 
|---|
| 1372 | is_internal="yes" | 
|---|
| 1373 | else | 
|---|
| 1374 | is_internal="no" | 
|---|
| 1375 | fi | 
|---|
| 1376 |  | 
|---|
| 1377 | if test "${do_source_kit}" = "yes"; then | 
|---|
| 1378 | is_internal="yes" | 
|---|
| 1379 | fi | 
|---|
| 1380 | #--------------- | 
|---|
| 1381 |  | 
|---|
| 1382 | #--------------- | 
|---|
| 1383 | #  Prepare the temporary copy directory | 
|---|
| 1384 | # | 
|---|
| 1385 | mkdir -p ${tempcopydir} | 
|---|
| 1386 |  | 
|---|
| 1387 | copycmd="ln -s" | 
|---|
| 1388 |  | 
|---|
| 1389 | build_pacman ${package} ${version} ${cmtpath} ${project_id} ${is_internal} | 
|---|
| 1390 |  | 
|---|
| 1391 | if test "${do_source_kit}" = "yes"; then | 
|---|
| 1392 |  | 
|---|
| 1393 | acquire_sources | 
|---|
| 1394 |  | 
|---|
| 1395 | elif test "${pacman_only}" = "no"; then | 
|---|
| 1396 |  | 
|---|
| 1397 | acquire_CMT_files | 
|---|
| 1398 |  | 
|---|
| 1399 | if test ! "${minimal}" = "yes"; then | 
|---|
| 1400 |  | 
|---|
| 1401 | cmt_project_name=`macro_value project` | 
|---|
| 1402 | installarea_prefix=`macro_value ${cmt_project_name}_installarea_prefix` | 
|---|
| 1403 | project_install_area="${project}/${installarea_prefix}" | 
|---|
| 1404 |  | 
|---|
| 1405 | acquire_libraries | 
|---|
| 1406 | acquire_java | 
|---|
| 1407 | acquire_applications | 
|---|
| 1408 | acquire_runtime_files | 
|---|
| 1409 | acquire_jo_files | 
|---|
| 1410 | acquire_python_modules_files | 
|---|
| 1411 | acquire_xml_files | 
|---|
| 1412 | acquire_headers | 
|---|
| 1413 | acquire_scripts_files | 
|---|
| 1414 | acquire_lcg_modules | 
|---|
| 1415 | acquire_export_installed_files | 
|---|
| 1416 | fi | 
|---|
| 1417 |  | 
|---|
| 1418 | # | 
|---|
| 1419 | # First create the tar ball with internal stuff | 
|---|
| 1420 | # | 
|---|
| 1421 | echo "create_kit> create tar for internal contents" | 
|---|
| 1422 | create_tar yes | 
|---|
| 1423 |  | 
|---|
| 1424 | if test "${is_internal}" = "no"; then | 
|---|
| 1425 |  | 
|---|
| 1426 | /bin/rm -rf ${tempfile1} ${tempfile2} ${tempcopydir} | 
|---|
| 1427 |  | 
|---|
| 1428 | project_id= | 
|---|
| 1429 |  | 
|---|
| 1430 | if test ! "${minimal}" = "yes"; then | 
|---|
| 1431 |  | 
|---|
| 1432 | ##acquire_export_paths ${export_paths} | 
|---|
| 1433 |  | 
|---|
| 1434 | acquire_export_paths ${export_paths} | 
|---|
| 1435 | fi | 
|---|
| 1436 |  | 
|---|
| 1437 | echo "create_kit> create tar for exported files" | 
|---|
| 1438 | create_tar ${override} | 
|---|
| 1439 |  | 
|---|
| 1440 | fi | 
|---|
| 1441 | fi | 
|---|
| 1442 |  | 
|---|
| 1443 | #create_RPM | 
|---|
| 1444 |  | 
|---|
| 1445 | date | 
|---|
| 1446 |  | 
|---|
| 1447 | if test -d ${tempprefix} ; then chmod -R +w ${tempprefix}; fi | 
|---|
| 1448 | /bin/rm -rf ${tempprefix} | 
|---|
| 1449 |  | 
|---|
| 1450 | #--------------- | 
|---|
| 1451 | #  Eventually, all temporary directories are automatically removed by the trap | 
|---|
| 1452 | # | 
|---|
| 1453 | exit 0 | 
|---|