File scripts/worker.php changed (mode: 100644) (index 6732642..9839920) |
... |
... |
function start_worker_build_tools($job, &$reason, &$reason2) |
583 |
583 |
. '{' . "\n" |
. '{' . "\n" |
584 |
584 |
. ' local dir=${1}; shift' . "\n" |
. ' local dir=${1}; shift' . "\n" |
585 |
585 |
. "\n" |
. "\n" |
586 |
|
. ' rg_log_push "rg_build_dotrepo dir=${dir} [`date`]"' . "\n" |
|
|
586 |
|
. ' rg_log_push "rg_build_dotrepo dir=${dir}"' . "\n" |
587 |
587 |
. ' while [ 1 ]; do' . "\n" |
. ' while [ 1 ]; do' . "\n" |
588 |
588 |
. ' rg_extract_rpm_info "${dir}" || break' . "\n" |
. ' rg_extract_rpm_info "${dir}" || break' . "\n" |
589 |
589 |
. ' 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" |
|
... |
... |
function start_worker_build_tools($job, &$reason, &$reason2) |
610 |
610 |
. '{' . "\n" |
. '{' . "\n" |
611 |
611 |
. ' local dir=${1}; shift' . "\n" |
. ' local dir=${1}; shift' . "\n" |
612 |
612 |
. "\n" |
. "\n" |
613 |
|
. ' rg_log_push "rg_build_rpm: dir=${dir} [`date`]"' . "\n" |
|
|
613 |
|
. ' rg_log_push "rg_build_rpm: dir=${dir}"' . "\n" |
614 |
614 |
. ' while [ 1 ]; do' . "\n" |
. ' while [ 1 ]; do' . "\n" |
615 |
615 |
. ' rg_extract_rpm_info "${dir}" || break' . "\n" |
. ' rg_extract_rpm_info "${dir}" || break' . "\n" |
616 |
616 |
. ' 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" |
|
... |
... |
function start_worker($job) |
1444 |
1444 |
. 'else' . "\n" |
. 'else' . "\n" |
1445 |
1445 |
. ' iptables -I OUTPUT -m owner --uid-owner build -j REJECT' . "\n" |
. ' iptables -I OUTPUT -m owner --uid-owner build -j REJECT' . "\n" |
1446 |
1446 |
. ' if [ "${?}" != "0" ]; then' . "\n" |
. ' if [ "${?}" != "0" ]; then' . "\n" |
1447 |
|
. ' ERR="Cannot disable network access"' . "\n" |
|
|
1447 |
|
. ' ERR="Cannot disable network access for build user"' . "\n" |
|
1448 |
|
. ' fi' . "\n" |
|
1449 |
|
. ' iptables -I OUTPUT -m owner --uid-owner build2 -j REJECT' . "\n" |
|
1450 |
|
. ' if [ "${?}" != "0" ]; then' . "\n" |
|
1451 |
|
. ' ERR="Cannot disable network access for build2 user"' . "\n" |
1448 |
1452 |
. ' fi' . "\n" |
. ' fi' . "\n" |
1449 |
1453 |
. 'fi' . "\n" |
. 'fi' . "\n" |
1450 |
1454 |
. "\n" |
. "\n" |
1451 |
1455 |
. 'while [ "${ERR}" = "" ]; do' . "\n" |
. 'while [ "${ERR}" = "" ]; do' . "\n" |
1452 |
1456 |
. ' su - build -c "bash /mnt/build.sh" &>/mnt/status/build.log' . "\n" |
. ' su - build -c "bash /mnt/build.sh" &>/mnt/status/build.log' . "\n" |
1453 |
|
. ' date +%s > /mnt/T_RPMS_START' . "\n" |
|
1454 |
|
. ' su - build -c "bash /mnt/build_rpms.sh" &>/mnt/status/build_rpms.log' . "\n" |
|
1455 |
|
. ' E=${?}' . "\n" |
|
1456 |
|
. ' date +%s > /mnt/T_RPMS_END' . "\n" |
|
1457 |
|
. ' if [ "${E}" != "0" ]; then' . "\n" |
|
1458 |
|
. ' ERR=$(< ~/rg_op.err)' . "\n" |
|
1459 |
|
. ' break' . "\n" |
|
1460 |
|
. ' fi' . "\n" |
|
1461 |
|
. "\n" |
|
|
1457 |
|
. "\n" |
|
1458 |
|
. ' # Now we may have the .spec file, we can try to extract info' . "\n" |
1462 |
1459 |
. ' _deps=`cat /mnt/tmp/_deps 2>/dev/null`' . "\n" |
. ' _deps=`cat /mnt/tmp/_deps 2>/dev/null`' . "\n" |
1463 |
1460 |
. ' if [ "${_deps}" != "" ]; then' . "\n" |
. ' if [ "${_deps}" != "" ]; then' . "\n" |
1464 |
1461 |
. ' echo; echo "`date`: Installing dependencies [${_deps}]"' . "\n" |
. ' echo; echo "`date`: Installing dependencies [${_deps}]"' . "\n" |
|
... |
... |
function start_worker($job) |
1470 |
1467 |
. ' break' . "\n" |
. ' break' . "\n" |
1471 |
1468 |
. ' fi' . "\n" |
. ' fi' . "\n" |
1472 |
1469 |
. ' fi' . "\n" |
. ' fi' . "\n" |
1473 |
|
. "\n" |
|
|
1470 |
|
. "\n" |
|
1471 |
|
. ' date +%s > /mnt/T_RPMS_START' . "\n" |
|
1472 |
|
. ' su - build -c "bash /mnt/build_rpms.sh" &>/mnt/status/build_rpms.log' . "\n" |
|
1473 |
|
. ' E=${?}' . "\n" |
|
1474 |
|
. ' date +%s > /mnt/T_RPMS_END' . "\n" |
|
1475 |
|
. ' if [ "${E}" != "0" ]; then' . "\n" |
|
1476 |
|
. ' ERR=$(< ~/rg_op.err)' . "\n" |
|
1477 |
|
. ' break' . "\n" |
|
1478 |
|
. ' fi' . "\n" |
|
1479 |
|
. "\n" |
1474 |
1480 |
. ' rm -f ~/rg_op.err # it was owned by build user till now' . "\n" |
. ' rm -f ~/rg_op.err # it was owned by build user till now' . "\n" |
1475 |
1481 |
. ' # Moving everything to build2 dir. TODO: Why?' . "\n" |
. ' # Moving everything to build2 dir. TODO: Why?' . "\n" |
1476 |
|
. ' mv /mnt/target/rocketgit /mnt/build2' . "\n" |
|
|
1482 |
|
. ' mv -f /mnt/target/rocketgit /mnt/build2' . "\n" |
1477 |
1483 |
. ' chown -R build2:build2 /mnt/build2 /mnt/rpmbuild' . "\n" |
. ' chown -R build2:build2 /mnt/build2 /mnt/rpmbuild' . "\n" |
1478 |
1484 |
. "\n" |
. "\n" |
1479 |
1485 |
. ' echo; echo "`date`: Running build_rgfs.sh script"' . "\n" |
. ' echo; echo "`date`: Running build_rgfs.sh script"' . "\n" |
|
... |
... |
function start_worker($job) |
1481 |
1487 |
. ' if [ "${?}" != "0" ]; then' . "\n" |
. ' if [ "${?}" != "0" ]; then' . "\n" |
1482 |
1488 |
. ' echo "error building rgfs; trying to continue"' . "\n" |
. ' echo "error building rgfs; trying to continue"' . "\n" |
1483 |
1489 |
. ' fi' . "\n" |
. ' fi' . "\n" |
1484 |
|
. "\n" |
|
|
1490 |
|
. "\n" |
1485 |
1491 |
. ' if [ -r /mnt/build_repo.sh ]; then' . "\n" |
. ' if [ -r /mnt/build_repo.sh ]; then' . "\n" |
1486 |
1492 |
. ' echo; echo "`date`: Running build_repo.sh script"' . "\n" |
. ' echo; echo "`date`: Running build_repo.sh script"' . "\n" |
1487 |
1493 |
. ' date +%s > /mnt/T_REPO_START' . "\n" |
. ' date +%s > /mnt/T_REPO_START' . "\n" |
|
... |
... |
function start_worker($job) |
1493 |
1499 |
. ' break' . "\n" |
. ' break' . "\n" |
1494 |
1500 |
. ' fi' . "\n" |
. ' fi' . "\n" |
1495 |
1501 |
. ' fi' . "\n" |
. ' fi' . "\n" |
1496 |
|
. "\n" |
|
|
1502 |
|
. "\n" |
1497 |
1503 |
. ' break' . "\n" |
. ' break' . "\n" |
1498 |
1504 |
. 'done' . "\n" |
. 'done' . "\n" |
1499 |
1505 |
. 'if [ "${ERR}" != "" ]; then' . "\n" |
. 'if [ "${ERR}" != "" ]; then' . "\n" |