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

2016-06-10 Thread Luca Capello
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 
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


signature.asc
Description: Digital signature


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

2016-06-09 Thread Raphael Hertzog
Hi,

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.

Cheers,
-- 
Raphaël Hertzog ◈ Debian Developer

Support Debian LTS: http://www.freexian.com/services/debian-lts.html
Learn to master Debian: http://debian-handbook.info/get/



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

2016-06-09 Thread Raphael Hertzog
On Thu, 09 Jun 2016, Luca Capello wrote:
> 2) why adding by default deb-src for a *building* environment?  This
>seems quite strange to me, but I am sure I am missing something...

This could be explained by the desire to have "apt-get source" and
"apt-get build-dep" working. In particular since sbuild allows "sbuild
foo" with foo just a package name...

Cheers,
-- 
Raphaël Hertzog ◈ Debian Developer

Support Debian LTS: http://www.freexian.com/services/debian-lts.html
Learn to master Debian: http://debian-handbook.info/get/



Bug#826847: sbuild: override default debootstap's /etc/apt/sources.list

2016-06-09 Thread Luca Capello
Package: sbuild
Version: 0.65.2-1
Severity: normal
User: luca.cape...@infomaniak.com
Usertags: infomaniak.com-packaging

Hi there,

I am setting up an internal buildd (with no wanna-build) following:

  
  

As we plan to recompile official Debian packages from internal Git
repositories, we do not mirror the source architecture, no need to waste
bandwidth and disk space:

  

I do not understand why sbuild-createchroot completely replaces the
${target}/etc/apt/sources.list generated by debootstrap with its own,
since the following commit:

  commit 7eaa13539e6542f553efbf81c2514cbfad2cbac8
  Author: Roger Leigh 
  Date:   Sun Jul 27 13:54:19 2008 +0100

[sbuild-createchroot] Set up sources.list with --components values

So, my questions are:

1) what is the rationale for the current behavior, i.e. why not leaving
   all the *default* APT sources to debootstrap?

2) why adding by default deb-src for a *building* environment?  This
   seems quite strange to me, but I am sure I am missing something...

Thx, bye,
Gismo / Luca

-- System Information:
Debian Release: 8.5
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.18.30-imu (SMP w/4 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/dash
Init: unable to detect

Versions of packages sbuild depends on:
ii  adduser 3.113+nmu3
ii  apt-utils   1.0.9.8.3
ii  libsbuild-perl  0.65.2-1
ii  perl5.20.2-3+deb8u5

Versions of packages sbuild recommends:
ii  debootstrap  1.0.67
ii  fakeroot 1.20.2-1

Versions of packages sbuild suggests:
pn  deborphan  
ii  wget   1.16-1

-- no debconf information

-- 
Luca Capello
Administrateur GNU/Linux

Infomaniak Network SA


signature.asc
Description: Digital signature