[Reproducible-commits] [sbuild] 02/02: srebuild: do not call cp manually to avoid problems when /tmp/*.buildinfo is the same file

Johannes Schauer josch-guest at moszumanska.debian.org
Sat Jan 3 08:04:41 UTC 2015


This is an automated email from the git hooks/post-receive script.

josch-guest pushed a commit to branch pu/reproducible_builds
in repository sbuild.

commit eb12433c11398cc81a8327e95c03e5675e559084
Author: josch <j.schauer at email.de>
Date:   Sat Jan 3 08:50:43 2015 +0100

    srebuild: do not call cp manually to avoid problems when /tmp/*.buildinfo is the same file
---
 bin/srebuild      |  2 +-
 bin/srebuild-hook | 16 +++++++++++++++-
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/bin/srebuild b/bin/srebuild
index 598093d..b0df544 100755
--- a/bin/srebuild
+++ b/bin/srebuild
@@ -245,7 +245,7 @@ $buildinfo = abs_path($buildinfo);
 print "starting sbuild with timestamp $newest\n";
 
 my $retval = system "sbuild", "--arch=$arch", "--dist=wheezy",
-    "--pre-build-command=cp /usr/share/sbuild/srebuild-hook $buildinfo %SBUILD_CHROOT_DIR/tmp",
+    "--pre-build-command=/usr/share/sbuild/srebuild-hook pre-build-command $buildinfo %SBUILD_CHROOT_DIR\"",
     "--chroot-setup-command=/tmp/srebuild-hook chroot-setup /tmp/$bn_buildinfo $newest",
     "--starting-build-commands=/tmp/srebuild-hook starting-build /tmp/$bn_buildinfo",
     $dsc_fname;
diff --git a/bin/srebuild-hook b/bin/srebuild-hook
index 056e445..d21a9a9 100755
--- a/bin/srebuild-hook
+++ b/bin/srebuild-hook
@@ -18,6 +18,7 @@ use warnings;
 use Dpkg::Control;
 use Dpkg::Compression::FileHandle;
 use Dpkg::Deps;
+use File::Copy;
 
 sub none(&@) {
     my $code = shift;
@@ -134,12 +135,25 @@ sub starting_build {
 }
 
 my $mode = shift @ARGV;
+if (not defined($mode)) {
+    die "need mode argument";
+}
+
 my $buildinfo = shift @ARGV;
 if (not defined($buildinfo)) {
     die "need buildinfo filename";
 }
 
-if ($mode eq "chroot-setup") {
+if ($mode eq "pre-build-command") {
+    my $chroot = shift @ARGV;
+    if (not defined ($chroot)) {
+        die "need chroot path";
+    }
+
+    copy($buildinfo, "$chroot/tmp");
+    copy("/usr/share/sbuild/srebuild-hook", "$chroot/tmp");
+    print "srebuild: copied $buildinfo and srebuild-hook to $chroot/tmp\n";
+} elsif ($mode eq "chroot-setup") {
     my @timestamps = @ARGV;
     if (scalar @timestamps == 0) {
         die "need timestamp";

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/sbuild.git



More information about the Reproducible-commits mailing list