From 809a9458943300b7e98b0e793a6645724b33b23d Mon Sep 17 00:00:00 2001 From: yuanhao Date: Tue, 17 Sep 2013 02:31:20 -0400 Subject: [PATCH] Check the real RPMs/SRPMs dir in chroot, instead of hardcode For root user, the output dir of RPMs in chroot is /usr/src/packages/RPMS, not /home/abuild/rpmbuild. Get the output dir of RPMs/SRPMs using the following command RPMs: sudo chroot $BUILD_ROOT rpm --eval "%{_rpmdir}" SRPMs: sudo chroot $BUILD_ROOT rpm --eval "%{_srcrpmdir}" Fixes: #1326 Change-Id: I8fd79e2b67d9bb2e04274d8d563ed49038e820fa --- data/gbs | 2 ++ depanneur | 13 +++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/data/gbs b/data/gbs index 121bdbe..42be93c 100644 --- a/data/gbs +++ b/data/gbs @@ -6,6 +6,8 @@ ALL ALL=(ALL) NOPASSWD: /usr/bin/build ALL ALL=(ALL) NOPASSWD: /bin/cp *.conf */scratch.*/*.conf ALL ALL=(ALL) NOPASSWD: /bin/rm -f */.build.log ALL ALL=(ALL) NOPASSWD: /bin/echo -n +ALL ALL=(ALL) NOPASSWD: /usr/sbin/chroot */scratch.* +ALL ALL=(ALL) NOPASSWD: /usr/bin/chroot */scratch.* Defaults env_keep += "http_proxy" Defaults env_keep += "no_proxy" diff --git a/depanneur b/depanneur index eb6ecd2..d329273 100755 --- a/depanneur +++ b/depanneur @@ -1381,11 +1381,16 @@ sub build_package { my_system("sudo /bin/cp $dist_configs/$dist.conf $scratch/$dist.conf") if ($noinit == 0); if ($ret == 0) { - if (bsd_glob "$scratch/home/abuild/rpmbuild/SRPMS/*.rpm") { - my_system ("cp $scratch/home/abuild/rpmbuild/SRPMS/*.rpm $srpm_repo_path"); + # Set the real path of RPMS and SRPMS + my $rpmdirpath = `sudo chroot $scratch su -c "rpm --eval %{_rpmdir} 2>/dev/null" - abuild`; + my $srcrpmdirpath = `sudo chroot $scratch su -c "rpm --eval %{_srcrpmdir} 2>/dev/null" - abuild`; + chomp($rpmdirpath); + chomp($srcrpmdirpath); + if (bsd_glob "$scratch/$srcrpmdirpath/*.rpm") { + my_system ("cp $scratch/$srcrpmdirpath/*.rpm $srpm_repo_path"); } - if (bsd_glob "$scratch/home/abuild/rpmbuild/RPMS/*/*.rpm") { - my_system ("cp $scratch/home/abuild/rpmbuild/RPMS/*/*.rpm $rpm_repo_path"); + if (bsd_glob "$scratch/$rpmdirpath/*/*.rpm") { + my_system ("cp $scratch/$rpmdirpath/*/*.rpm $rpm_repo_path"); } mkdir_p "$success_logs_path/$name-$version-$release"; if (-e "$scratch/.build.log") { -- 2.7.4