[buildd-tools-devel] Bug#826847: Bug#826847: sbuild: override default debootstap's /etc/apt/sources.list

Luca Capello luca.capello at infomaniak.com
Fri Jun 10 11:10:42 UTC 2016


reopen 826847
severity 826847 minor
tags 826847 + patch
thanks

Hi Raphael,

On Thu, 09 Jun 2016 22:37:39 +0200, Raphael Hertzog wrote:
> On Thu, 09 Jun 2016, Luca Capello wrote:
> > Thank you, I missed that "apt-get build-dep" requires deb-src.
> > 
> > And for "apt-get source" I forgot that by default sbuild builds binary
> > packages, which means that the sources could already be in the archive.
> > 
> > Tagging the bug as wontfix (not really a bug) and closing it, thank you
> > for the explanation.  I have just added the sources to our internal APT
> > mirror ;-)
> 
> Note that sbuild works fine without "deb-src" lines if you feed it a .dsc.
> It grabs build dependencies directly from the extracted source package.
> 
> So your initial request might still make some sense.

Finally, very easy to implement, off by default:

--8<---------------cut here---------------start------------->8---
From a286347700c10f3a681db06a732cf09afa40d91f Mon Sep 17 00:00:00 2001
From: Luca Capello <luca.capello at infomaniak.com>
Date: Fri, 10 Jun 2016 13:05:51 +0200
Subject: [PATCH] bin/sbuild-createchroot: (#826847) add --no-deb-src

---
 bin/sbuild-createchroot      | 25 +++++++++++++++----------
 man/sbuild-createchroot.8.in |  5 +++++
 2 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/bin/sbuild-createchroot b/bin/sbuild-createchroot
index efcfe04..7244773 100755
--- a/bin/sbuild-createchroot
+++ b/bin/sbuild-createchroot
@@ -72,6 +72,9 @@ sub setup {
 	'KEEP_SBUILD_CHROOT_DIR'			=> {
 	    DEFAULT => 0
 	},
+	'DEB_SRC'				=> {
+	    DEFAULT => 1
+	},
     );
 
     $conf->set_allowed_keys(\%createchroot_keys);
@@ -136,6 +139,9 @@ sub set_options {
 	},
 	"keep-sbuild-chroot-dir" => sub {
 	    $self->set_conf('KEEP_SBUILD_CHROOT_DIR', 1);
+	},
+	"no-deb-src" => sub {
+	    $self->set_conf('DEB_SRC', 0);
 	});
 }
 
@@ -266,16 +272,15 @@ chmod(0775, $policy_rc_d) == 1
 print "I: Configured /usr/sbin/policy-rc.d:\n";
 dump_file("$policy_rc_d");
 
-
-
-# Set up minimal /etc/apt/sources.list
-my $sources = "${target}/etc/apt/sources.list";
-my $comps = join(' ',split(/,/,$conf->get('COMPONENTS')));
-open(SOURCES, ">$sources")
-    or die "Can't open $sources for writing";
-print SOURCES "deb $mirror $suite $comps\n";
-print SOURCES "deb-src $mirror $suite $comps\n";
-close SOURCES or die "Can't close $sources";
+# Add deb-src to /etc/apt/sources.list.
+if ($conf->get('NO_DEB_SRC')) {
+    my $sources = "${target}/etc/apt/sources.list";
+    my $comps = join(' ',split(/,/,$conf->get('COMPONENTS')));
+    open(SOURCES, ">>$sources")
+        or die "E: Can't open $sources for writing";
+    print SOURCES "deb-src $mirror $suite $comps\n";
+    close SOURCES or die "E: Can't close $sources";
+}
 
 # Display /etc/apt/sources.list.
 print "I: Configured APT /etc/apt/sources.list:\n";
diff --git a/man/sbuild-createchroot.8.in b/man/sbuild-createchroot.8.in
index 25e4996..80a8f4c 100644
--- a/man/sbuild-createchroot.8.in
+++ b/man/sbuild-createchroot.8.in
@@ -34,6 +34,7 @@ sbuild\-createchroot \- create sbuild chroot
 .RB [ "\-\-setup\-only" ]
 .RB [ "\-\-make\-sbuild\-tarball=\fIfile\fP" ]
 .RB [ "\-\-keep\-sbuild\-chroot\-dir" ]
+.RB [ "\-\-no\-deb\-src" ]
 .B SUITE TARGET-DIRECTORY DEBIAN-MIRROR-URI
 .RB [ SCRIPT ]
 .PP
@@ -162,6 +163,10 @@ details.
 .BR \-\-keep\-sbuild\-chroot\-dir
 Don't delete the directory used for creating a file type chroot. This option
 does nothing if not creating a file type chroot.
+.TP
+.BR \-\-no\-deb\-src
+Don't add a deb-src line to the \fI/etc/apt/sources.list\fP file in the
+\fITARGET-DIRECTORY\fP after the debootstrap process.
 .SH TARBALL FILE
 When creating an sbuild tarball \fIfile\fP, the compression format used to
 generate the tarball depends on the entension used in \fIfile\fP. Here is a
-- 
2.1.4

--8<---------------cut here---------------end--------------->8---

Tested successfully backporting it to a jessie-backports sbuild.

Thx, bye,
Gismo / Luca

-- 
Luca Capello
Administrateur GNU/Linux

Infomaniak Network SA
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/buildd-tools-devel/attachments/20160610/41afad52/attachment.sig>


More information about the Buildd-tools-devel mailing list