tags 574721 + patch
thanks

On Sun, Mar 21, 2010 at 02:27:50PM +0100, Ralf Treinen wrote:
> > I would rather prefer installing a proper configuration file that will
> > then be parsed by add-sources.py (that would also permit easy editing by
> > the buildd admins). I can work on that but, as you know, not this
> > week-end. Nevertheless, if you want to work on that this week-end, I
> > suggest hereby a configuration file syntax which is really easy to
> > parse:
> > 
> >   [section]
> >   key=value
> > 
> > In our case we can use for instance one section for each architecture
> > and a single key "build-essential".
> > 
> > What do you think of this proposal?
> 
> I agree, that would be a better solution. In that case it should also be
> made possible to overwrite the system-wide setting: We should add an
> option that allows to specify an additional configuration files that
> overwrites system-wide setting.
> 
> That would also solve #574721.

So, here is a patch implementing this (actually 2, read on). The
configuration file is expected to be /etc/edos-builddebcheck.conf and
can be generated using your get-buildessentials after it is patched with
the attached patch. In the end, I've chosen the following as sample
format (heading spaces to be removed):

  [build-essentials]
  amd64: foo, bar, baz
  armel: quux, clan, toto

Note: the patch is only for get-buildessentials: I did not change
package building to actually install the configuration file under /etc.

The other attached patch fixes add-sources.py to actually read the
configuration files if it exists and to use the build-essentials defined
therein. I've left around the previous static list, which is used as a
fallback if no conffile is found or if it is found but does not contain
the needed architecture. The patch should be orthogonal to the other I
sent.

Cheers.

PS I've tested add-sources.py with a hand-written
   /etc/edos-builddebcheck.conf, but not get-buildessentials (still on a
   train, sorry)

-- 
Stefano Zacchiroli -o- PhD in Computer Science \ PostDoc @ Univ. Paris 7
z...@{upsilon.cc,pps.jussieu.fr,debian.org} -<>- http://upsilon.cc/zack/
Dietro un grande uomo c'è ..|  .  |. Et ne m'en veux pas si je te tutoie
sempre uno zaino ...........| ..: |.... Je dis tu à tous ceux que j'aime
--- add-sources.py.bak	2010-03-24 21:06:55.000000000 +0100
+++ add-sources.py	2010-03-24 21:37:04.000000000 +0100
@@ -12,19 +12,21 @@
 
 # $Id: add-sources.py 5957 2008-08-16 18:32:17Z zack $
 
-# build-essential packages. All build-dependencies and build-conflicts
-# to one of these packages is simply ignored.
-# TODO: this list should be obtained from the binary package file,
-# by grep-dctrl -F Build-Essential --pattern=yes -s Package -n
-# but then we have to change the way this command is called.
+# build-essential packages: all (unversioned) build-dependencies will be
+# ignored. This list is just the default fallback for when
+# /etc/edos-builddebcheck.conf is not available; when it is, per-arch
+# build-essential packages will be read from it
 buildessentials = ['apt', 'binutils', 'cpio', 'cpp', 'dpkg-dev',
                    'g++', 'gcc', 'libc6-dev', 'make', 'patch',
                    'perl', 'perl-modules']
+CONFFILE = "/etc/edos-builddebcheck.conf"
 
 
+import os
 import string
 import sys
 
+from ConfigParser import ConfigParser
 from optparse import OptionParser
 from debian_bundle import deb822
 
@@ -39,6 +41,14 @@
     sys.exit(2)
 sources_file = args[0]
 architecture = args[1]
+if os.path.isfile(CONFFILE):
+    conf = ConfigParser()
+    conf.read(CONFFILE)
+    if conf.has_option('build-essentials', architecture):
+        # overrire default with configured per-arch build-essentials
+        raw_b_e = conf.get('build-essentials', architecture)
+        buildessentials = map(lambda s: s.strip(), raw_b_e.split(','))
+
 
 def pkg_of_src(src):
     global architecture, options
diff --git a/debian/contrib/get-buildessentials b/debian/contrib/get-buildessentials
index 201fa56..57e8863 100755
--- a/debian/contrib/get-buildessentials
+++ b/debian/contrib/get-buildessentials
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-$output = "buildessentials.py";
+$output = "edos-builddebcheck.conf";
 $mirror="ftp://ftp.fr.debian.org/debian";;
 @arches=("alpha", "amd64", "armel", "hppa", "hurd-i386", "i386", "ia64",
     "kfreebsd-amd64", "kfreebsd-i386", "mips", "mipsel", "powerpc",
@@ -8,17 +8,18 @@ $mirror="ftp://ftp.fr.debian.org/debian";;
 
 open(OUT,">$output");
 select OUT;
+print "[build-essentials]\n";
 foreach $arch (@arches) {
     my($isfirst)=1;
-    print "buildessentials[\'$arch\']=[";
+    print "$arch: ";
     open(ESS,"wget -O - $mirror/dists/sid/main/binary-$arch/Packages.bz2 | bzcat | grep-dctrl -FBuild-Essential -ni yes -sPackage |");
     while ($p=<ESS>) {
 	chop $p;
 	print ", " unless $isfirst;
-	print "'$p\'";
+	print $p;
 	$isfirst=0;
     }
-    print "]\n";
+    print "\n";
     close ESS;
 }
 close OUT;

Reply via email to