File scripts/worker.php changed (mode: 100644) (index 57a5af0..2da01a5) |
... |
... |
function start_worker_build_tools($job, &$reason, &$reason2) |
558 |
558 |
. ' xecho "rg_extract_rpm_info: dir=${dir} [`date`]"' . "\n" |
. ' xecho "rg_extract_rpm_info: dir=${dir} [`date`]"' . "\n" |
559 |
559 |
. ' spec_file=`find "${dir}" -type f -iname \'*.spec\' | head -n1`' . "\n" |
. ' spec_file=`find "${dir}" -type f -iname \'*.spec\' | head -n1`' . "\n" |
560 |
560 |
. ' if [ "${spec_file}" = "" ]; then' . "\n" |
. ' if [ "${spec_file}" = "" ]; then' . "\n" |
561 |
|
. ' E=1' . "\n" |
|
562 |
561 |
. ' xecho " Cannot find any .spec file in ${dir}!" > ~/rg_op.err' . "\n" |
. ' xecho " Cannot find any .spec file in ${dir}!" > ~/rg_op.err' . "\n" |
563 |
|
. ' return ${E}' . "\n" |
|
|
562 |
|
. ' return 1' . "\n" // we not signal this as an error |
564 |
563 |
. ' fi' . "\n" |
. ' fi' . "\n" |
565 |
564 |
. "\n" |
. "\n" |
566 |
565 |
. ' spec_file_base=`basename "${spec_file}"`' . "\n" |
. ' spec_file_base=`basename "${spec_file}"`' . "\n" |
|
... |
... |
function start_worker_build_tools($job, &$reason, &$reason2) |
571 |
570 |
. ' spec_ver=`grep ^Version: "${spec_file}" | cut -d: -f2 | tr -d " \t\r\n"`' . "\n" |
. ' spec_ver=`grep ^Version: "${spec_file}" | cut -d: -f2 | tr -d " \t\r\n"`' . "\n" |
572 |
571 |
. ' spec_rel=`grep ^Release: "${spec_file}" | cut -d: -f2 | tr -d " \t\r\n"`' . "\n" |
. ' spec_rel=`grep ^Release: "${spec_file}" | cut -d: -f2 | tr -d " \t\r\n"`' . "\n" |
573 |
572 |
. ' spec_deps=`rpmspec --parse "${spec_file}" | grep ^BuildRequires | cut -d: -f2 | tr ",\t\r\n" " "`' . "\n" |
. ' spec_deps=`rpmspec --parse "${spec_file}" | grep ^BuildRequires | cut -d: -f2 | tr ",\t\r\n" " "`' . "\n" |
574 |
|
. ' xecho " DEBUG: name=${spec_name}, ver=${spec_ver}, rel=${spec_rel}, deps=[${spec_deps}]"' . "\n" |
|
|
573 |
|
. ' xecho " DEBUG: name=${spec_name}, ver=${spec_ver}, rel=${spec_rel}"' . "\n" |
575 |
574 |
. ' if [ "${spec_deps}" != "" ]; then' . "\n" |
. ' if [ "${spec_deps}" != "" ]; then' . "\n" |
576 |
575 |
. ' xecho " Storing deps [${spec_deps}] into /mnt/tmp/_deps"' . "\n" |
. ' xecho " Storing deps [${spec_deps}] into /mnt/tmp/_deps"' . "\n" |
577 |
|
. ' echo "${spec_deps}" > /mnt/tmp/_deps' . "\n" |
|
|
576 |
|
. ' echo ${spec_deps} > /mnt/tmp/_deps' . "\n" |
578 |
577 |
. ' fi' . "\n" |
. ' fi' . "\n" |
579 |
578 |
. ' echo' . "\n" |
. ' echo' . "\n" |
580 |
579 |
. '}' . "\n" |
. '}' . "\n" |
|
... |
... |
function start_worker_build_tools($job, &$reason, &$reason2) |
585 |
584 |
. "\n" |
. "\n" |
586 |
585 |
. ' rg_log_push "rg_build_dotrepo dir=${dir}"' . "\n" |
. ' rg_log_push "rg_build_dotrepo dir=${dir}"' . "\n" |
587 |
586 |
. ' while [ 1 ]; do' . "\n" |
. ' while [ 1 ]; do' . "\n" |
588 |
|
. ' rg_extract_rpm_info "${dir}" || break' . "\n" |
|
589 |
587 |
. ' local dst_tar_gz="/mnt/rpmbuild/SOURCES/${spec_name}-${spec_ver}.tar.gz"' . "\n" |
. ' local dst_tar_gz="/mnt/rpmbuild/SOURCES/${spec_name}-${spec_ver}.tar.gz"' . "\n" |
590 |
588 |
. ' local dst_spec="/mnt/rpmbuild/SPECS/${spec_file_base}"' . "\n" |
. ' local dst_spec="/mnt/rpmbuild/SPECS/${spec_file_base}"' . "\n" |
591 |
589 |
. ' local xecho "DEBUG: dst_spec=${dst_spec}."' . "\n" |
. ' local xecho "DEBUG: dst_spec=${dst_spec}."' . "\n" |
|
... |
... |
function start_worker_build_tools($job, &$reason, &$reason2) |
612 |
610 |
. "\n" |
. "\n" |
613 |
611 |
. ' rg_log_push "rg_build_rpm: dir=${dir}"' . "\n" |
. ' rg_log_push "rg_build_rpm: dir=${dir}"' . "\n" |
614 |
612 |
. ' while [ 1 ]; do' . "\n" |
. ' while [ 1 ]; do' . "\n" |
615 |
|
. ' rg_extract_rpm_info "${dir}" || break' . "\n" |
|
616 |
613 |
. ' local dst_tar_gz="/mnt/rpmbuild/SOURCES/${repo_username}+${spec_name}-${spec_ver}.tar.gz"' . "\n" |
. ' local dst_tar_gz="/mnt/rpmbuild/SOURCES/${repo_username}+${spec_name}-${spec_ver}.tar.gz"' . "\n" |
617 |
614 |
. ' local dst_spec="/mnt/rpmbuild/SPECS/${repo_username}+${spec_file_base}"' . "\n" |
. ' local dst_spec="/mnt/rpmbuild/SPECS/${repo_username}+${spec_file_base}"' . "\n" |
618 |
615 |
. "\n" |
. "\n" |
|
... |
... |
function start_worker($job) |
1449 |
1446 |
. 'fi' . "\n" |
. 'fi' . "\n" |
1450 |
1447 |
. "\n" |
. "\n" |
1451 |
1448 |
. 'while [ "${ERR}" = "" ]; do' . "\n" |
. 'while [ "${ERR}" = "" ]; do' . "\n" |
|
1449 |
|
. ' date +%s > /mnt/T_BUILD_START' . "\n" // TODO: not read and not exposed |
1452 |
1450 |
. ' su - build -c "bash /mnt/build.sh" &>/mnt/status/build.log' . "\n" |
. ' su - build -c "bash /mnt/build.sh" &>/mnt/status/build.log' . "\n" |
|
1451 |
|
. ' E=${?}' . "\n" |
|
1452 |
|
. ' date +%s > /mnt/T_BUILD_END' . "\n" // TODO: this is not read and exposed |
|
1453 |
|
. ' if [ "${E}" != "0" ]; then' . "\n" |
|
1454 |
|
. ' ERR=$(< ~/rg_op.err)' . "\n" |
|
1455 |
|
. ' break' . "\n" |
|
1456 |
|
. ' fi' . "\n" |
1453 |
1457 |
. "\n" |
. "\n" |
1454 |
1458 |
. ' # Now we may have the .spec file, we can try to extract info' . "\n" |
. ' # Now we may have the .spec file, we can try to extract info' . "\n" |
1455 |
|
. ' _deps=`cat /mnt/tmp/_deps 2>/dev/null`' . "\n" |
|
|
1459 |
|
. ' rg_extract_rpm_info /mnt/target || break' . "\n" |
|
1460 |
|
. ' _deps=`cat /mnt/tmp/_deps`' . "\n" |
1456 |
1461 |
. ' if [ "${_deps}" != "" ]; then' . "\n" |
. ' if [ "${_deps}" != "" ]; then' . "\n" |
1457 |
1462 |
. ' echo; echo "`date`: Installing dependencies [${_deps}]"' . "\n" |
. ' echo; echo "`date`: Installing dependencies [${_deps}]"' . "\n" |
1458 |
1463 |
. ' export DEBIAN_FRONTEND=noninteractive' . "\n" |
. ' export DEBIAN_FRONTEND=noninteractive' . "\n" |