File inc/user/packages_rpm.inc.php changed (mode: 100644) (index 5600724..7994b28) |
... |
... |
function rg_pkg_prepare_ev_for_dotrepo($db, &$ev) |
126 |
126 |
// TODO: replace $di (used above) with below $d? |
// TODO: replace $di (used above) with below $d? |
127 |
127 |
$di = rg_env_info($ev['env']); |
$di = rg_env_info($ev['env']); |
128 |
128 |
|
|
129 |
|
$r = rg_packages_rpm_dotrepo_files($db, $ev['uid'], |
|
|
129 |
|
$r = rg_packages_rpm_add_dotrepo_files($db, $ev['uid'], |
130 |
130 |
$pkg_subrepo_id, $di['distro']); |
$pkg_subrepo_id, $di['distro']); |
131 |
131 |
if ($r['ok'] != 1) { |
if ($r['ok'] != 1) { |
132 |
132 |
$ret['errmsg'] = $r['errmsg']; |
$ret['errmsg'] = $r['errmsg']; |
|
... |
... |
function rg_packages_rpm_get_link($db, $a) |
424 |
424 |
* Populates the returned array with files and content needed to build a |
* Populates the returned array with files and content needed to build a |
425 |
425 |
* subrepo rpm (.repo & co. files). |
* subrepo rpm (.repo & co. files). |
426 |
426 |
*/ |
*/ |
427 |
|
function rg_packages_rpm_dotrepo_files($db, $uid, $pkg_subrepo_id, $distro) |
|
|
427 |
|
function rg_packages_rpm_add_dotrepo_files($db, $uid, $pkg_subrepo_id, $distro) |
428 |
428 |
{ |
{ |
429 |
429 |
global $spec_template, $make_template, $repo_template; |
global $spec_template, $make_template, $repo_template; |
430 |
430 |
|
|
431 |
|
rg_log_enter('packages_rpm_repo_files'); |
|
|
431 |
|
rg_log_enter('packages_rpm_add_dotrepo_files'); |
432 |
432 |
|
|
433 |
433 |
$ret = array('ok' => 0); |
$ret = array('ok' => 0); |
434 |
434 |
do { |
do { |
File scripts/worker.php changed (mode: 100644) (index 29b7c46..b53662e) |
... |
... |
function start_worker_build_tools($job, &$reason, &$reason2) |
554 |
554 |
. 'function rg_extract_rpm_info()' . "\n" |
. 'function rg_extract_rpm_info()' . "\n" |
555 |
555 |
. '{' . "\n" |
. '{' . "\n" |
556 |
556 |
. ' local dir=${1}; shift' . "\n" |
. ' local dir=${1}; shift' . "\n" |
557 |
|
. "\n" |
|
|
557 |
|
. "\n" |
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 |
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" |
562 |
|
. ' return 1' . "\n" // we not signal this as an error |
|
|
562 |
|
. ' return' . "\n" |
563 |
563 |
. ' fi' . "\n" |
. ' fi' . "\n" |
564 |
|
. "\n" |
|
|
564 |
|
. "\n" |
565 |
565 |
. ' spec_file_base=`basename "${spec_file}"`' . "\n" |
. ' spec_file_base=`basename "${spec_file}"`' . "\n" |
566 |
566 |
. ' xecho " .spec file: ${spec_file} basename=[${spec_file_base}]."' . "\n" |
. ' xecho " .spec file: ${spec_file} basename=[${spec_file_base}]."' . "\n" |
567 |
567 |
. "\n" |
. "\n" |
|
... |
... |
function start_worker_build_tools($job, &$reason, &$reason2) |
580 |
580 |
. "\n" |
. "\n" |
581 |
581 |
. ' rg_log_push "rg_build_dotrepo dir=${dir}"' . "\n" |
. ' rg_log_push "rg_build_dotrepo dir=${dir}"' . "\n" |
582 |
582 |
. ' while [ 1 ]; do' . "\n" |
. ' while [ 1 ]; do' . "\n" |
583 |
|
. ' rg_extract_rpm_info "${dir}" || break' . "\n" |
|
|
583 |
|
. ' rg_extract_rpm_info "${dir}"' . "\n" |
|
584 |
|
. ' if [ "${spec_name}" = "" ]; then' . "\n" |
|
585 |
|
. ' xecho "Malformed .spec file?"' . "\n" |
|
586 |
|
. ' E=1' . "\n" |
|
587 |
|
. ' break' . "\n" |
|
588 |
|
. ' fi' . "\n" |
|
589 |
|
. "\n" |
584 |
590 |
. ' 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" |
585 |
591 |
. ' local dst_spec="/mnt/rpmbuild/SPECS/${spec_file_base}"' . "\n" |
. ' local dst_spec="/mnt/rpmbuild/SPECS/${spec_file_base}"' . "\n" |
586 |
592 |
. ' local xecho "DEBUG: dst_spec=${dst_spec}."' . "\n" |
. ' local xecho "DEBUG: dst_spec=${dst_spec}."' . "\n" |
587 |
|
. "\n" |
|
|
593 |
|
. "\n" |
588 |
594 |
. ' xecho "Creating tar archive [${dst_tar_gz}]"' . "\n" |
. ' xecho "Creating tar archive [${dst_tar_gz}]"' . "\n" |
589 |
595 |
. ' rg_op_s tar czf "${dst_tar_gz}" --transform "s:^:./${spec_name}-${spec_ver}/:g" \\' . "\n" |
. ' rg_op_s tar czf "${dst_tar_gz}" --transform "s:^:./${spec_name}-${spec_ver}/:g" \\' . "\n" |
590 |
596 |
. ' -C "${dir}" . || break' . "\n" |
. ' -C "${dir}" . || break' . "\n" |
591 |
|
. "\n" |
|
|
597 |
|
. "\n" |
592 |
598 |
. ' xecho "Copying spec file [${spec_file}] -> [${dst_spec}]"' . "\n" |
. ' xecho "Copying spec file [${spec_file}] -> [${dst_spec}]"' . "\n" |
593 |
599 |
. ' rg_cp "${spec_file}" "${dst_spec}"' . "\n" |
. ' rg_cp "${spec_file}" "${dst_spec}"' . "\n" |
594 |
|
. "\n" |
|
|
600 |
|
. "\n" |
595 |
601 |
. ' xecho "Making only binary packages"' . "\n" |
. ' xecho "Making only binary packages"' . "\n" |
596 |
602 |
. ' rg_op_s rpmbuild --define "_topdir /mnt/rpmbuild" \\' . "\n" |
. ' rg_op_s rpmbuild --define "_topdir /mnt/rpmbuild" \\' . "\n" |
597 |
603 |
. ' -bb "${dst_spec}" || break' . "\n" |
. ' -bb "${dst_spec}" || break' . "\n" |
|
... |
... |
function start_worker_build_tools($job, &$reason, &$reason2) |
607 |
613 |
. "\n" |
. "\n" |
608 |
614 |
. ' rg_log_push "rg_build_rpm: dir=${dir}"' . "\n" |
. ' rg_log_push "rg_build_rpm: dir=${dir}"' . "\n" |
609 |
615 |
. ' while [ 1 ]; do' . "\n" |
. ' while [ 1 ]; do' . "\n" |
610 |
|
. ' rg_extract_rpm_info "${dir}" || break' . "\n" |
|
|
616 |
|
. ' rg_extract_rpm_info "${dir}"' . "\n" |
|
617 |
|
. ' if [ "${spec_name}" = "" ]; then' . "\n" |
|
618 |
|
. ' xecho "Malformed .spec file?"' . "\n" |
|
619 |
|
. ' E=1' . "\n" |
|
620 |
|
. ' break' . "\n" |
|
621 |
|
. ' fi' . "\n" |
611 |
622 |
. ' 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" |
612 |
623 |
. ' local dst_spec="/mnt/rpmbuild/SPECS/${repo_username}+${spec_file_base}"' . "\n" |
. ' local dst_spec="/mnt/rpmbuild/SPECS/${repo_username}+${spec_file_base}"' . "\n" |
613 |
624 |
. "\n" |
. "\n" |
|
... |
... |
function start_worker_build_repo($job, $conf, &$reason, &$reason2) |
954 |
965 |
. ' rgfs_mounted[${pkg_repo_id}-${pkg_subrepo_id}]=1' . "\n" |
. ' rgfs_mounted[${pkg_repo_id}-${pkg_subrepo_id}]=1' . "\n" |
955 |
966 |
. "\n" |
. "\n" |
956 |
967 |
. ' rgfs_subrepo_root="/mnt/build2/rgfs/${pkg_repo_id}/${pkg_subrepo_id}"' . "\n" |
. ' rgfs_subrepo_root="/mnt/build2/rgfs/${pkg_repo_id}/${pkg_subrepo_id}"' . "\n" |
|
968 |
|
. ' xecho "DEBUG: env_distro=${env_distro}"' . "\n" |
957 |
969 |
. ' case "${env_distro}" in' . "\n" |
. ' case "${env_distro}" in' . "\n" |
958 |
970 |
. ' fedora|centos)' . "\n" |
. ' fedora|centos)' . "\n" |
959 |
971 |
. ' for i in os debug src; do' . "\n" |
. ' for i in os debug src; do' . "\n" |
|
... |
... |
function start_worker_build_repo($job, $conf, &$reason, &$reason2) |
972 |
984 |
. ' rg_cp "${pkg_list_file}" "${pkg_common_list_file}" || break' . "\n" |
. ' rg_cp "${pkg_list_file}" "${pkg_common_list_file}" || break' . "\n" |
973 |
985 |
. ' if [ "${job_uid}" = "0" ]; then' . "\n" |
. ' if [ "${job_uid}" = "0" ]; then' . "\n" |
974 |
986 |
. ' if [ -d "${rgfs}/+pending" ]; then' . "\n" |
. ' if [ -d "${rgfs}/+pending" ]; then' . "\n" |
|
987 |
|
. ' xecho "DEBUG: dir +pending found"' . "\n" |
975 |
988 |
. ' rg_create_list "${rgfs}/+pending" "${pkg_pend_list_file}" || break' . "\n" |
. ' rg_create_list "${rgfs}/+pending" "${pkg_pend_list_file}" || break' . "\n" |
976 |
989 |
. ' rg_op cat "${pkg_pend_list_file}" >> "${pkg_common_list_file}"' . "\n" |
. ' rg_op cat "${pkg_pend_list_file}" >> "${pkg_common_list_file}"' . "\n" |
977 |
990 |
. ' else' . "\n" |
. ' else' . "\n" |
|
... |
... |
function start_worker($job) |
1275 |
1288 |
// Creating build.sh file |
// Creating build.sh file |
1276 |
1289 |
// TODO: document how a user can add labels in configure or make |
// TODO: document how a user can add labels in configure or make |
1277 |
1290 |
$s = '#!/bin/bash' . "\n"; |
$s = '#!/bin/bash' . "\n"; |
1278 |
|
$s .= 'date +%s > /mnt/status/build.sh.start' . "\n\n"; |
|
1279 |
1291 |
$s .= 'export RG_LABELS=/mnt/status/RG_LABELS' . "\n\n"; |
$s .= 'export RG_LABELS=/mnt/status/RG_LABELS' . "\n\n"; |
1280 |
1292 |
$s .= "\n"; |
$s .= "\n"; |
1281 |
1293 |
|
|
|
... |
... |
function start_worker($job) |
1447 |
1459 |
. "\n" |
. "\n" |
1448 |
1460 |
. 'while [ "${ERR}" = "" ]; do' . "\n" |
. 'while [ "${ERR}" = "" ]; do' . "\n" |
1449 |
1461 |
. ' echo; echo "`date`: Running build.sh script"' . "\n" |
. ' echo; echo "`date`: Running build.sh script"' . "\n" |
1450 |
|
. ' date +%s > /mnt/T_BUILD_START' . "\n" // TODO: not read and not exposed |
|
|
1462 |
|
. ' date +%s > /mnt/status/build.sh.start' . "\n\n"; // TODO: not read and not exposed? |
1451 |
1463 |
. ' su - build -c "bash /mnt/build.sh" &>/mnt/status/build.log' . "\n" |
. ' su - build -c "bash /mnt/build.sh" &>/mnt/status/build.log' . "\n" |
1452 |
1464 |
. ' E=${?}' . "\n" |
. ' E=${?}' . "\n" |
1453 |
|
. ' date +%s > /mnt/T_BUILD_END' . "\n" // TODO: this is not read and exposed |
|
|
1465 |
|
. ' date +%s > /mnt/status/build.sh.stop' . "\n\n"; // TODO: not read and not exposed? |
1454 |
1466 |
. ' if [ "${E}" != "0" ]; then' . "\n" |
. ' if [ "${E}" != "0" ]; then' . "\n" |
|
1467 |
|
. ' echo "`date`: DEBUG: build.sh exited with code ${E}"' . "\n" |
1455 |
1468 |
. ' ERR=$(< ~/rg_op.err)' . "\n" |
. ' ERR=$(< ~/rg_op.err)' . "\n" |
1456 |
1469 |
. ' break' . "\n" |
. ' break' . "\n" |
1457 |
1470 |
. ' fi' . "\n" |
. ' fi' . "\n" |
|
... |
... |
function start_worker($job) |
1490 |
1503 |
. ' echo "error building rgfs; trying to continue"' . "\n" |
. ' echo "error building rgfs; trying to continue"' . "\n" |
1491 |
1504 |
. ' fi' . "\n" |
. ' fi' . "\n" |
1492 |
1505 |
. "\n" |
. "\n" |
1493 |
|
. ' if [ -r /mnt/build_repo.sh ]; then' . "\n" |
|
|
1506 |
|
. ' if [ -x /mnt/build_repo.sh ]; then' . "\n" |
1494 |
1507 |
. ' echo; echo "`date`: Running build_repo.sh script"' . "\n" |
. ' echo; echo "`date`: Running build_repo.sh script"' . "\n" |
1495 |
1508 |
. ' date +%s > /mnt/T_REPO_START' . "\n" |
. ' date +%s > /mnt/T_REPO_START' . "\n" |
1496 |
1509 |
. ' su - build2 -c "bash /mnt/build_repo.sh" &>/mnt/status/build_repo.log' . "\n" |
. ' su - build2 -c "bash /mnt/build_repo.sh" &>/mnt/status/build_repo.log' . "\n" |