[Buildd-tools-devel] Bug#495560: sbuild: Please detect that personality=… is needed.

Cyril Brulebois cyril.brulebois at kerlabs.com
Mon Aug 18 16:07:10 UTC 2008


Package: sbuild
Version: 0.57.6-1
Severity: wishlist
Tags: patch

Hi,

I encountered some troubles while cross-compiling (i386 on amd64) due to
the build system using uname output to determine the architecture.
Currently, sbuild-createchroot doesn't do any kind of detection, but
using the attached patches, it could:
 1. warn the user that a personality= option in schroot configuration
    file might be needed when the architectures don't match;
 2. add this option automatically when the case is known (currently,
    only i386 on amd64 is supported, resulting in a linux32 pers.);
 3. suggest the user to report bugs to the developers for the other
    cases.

Thanks for considering.

(BTW, I'm now subscribed to the -devel list.)

Cheers,

-- 
Cyril Brulebois
-------------- next part --------------
>From 6fbbf357f4133c0d8a2b12cf90ed2d80988c9900 Mon Sep 17 00:00:00 2001
From: Cyril Brulebois <cyril.brulebois at kerlabs.com>
Date: Mon, 18 Aug 2008 17:03:06 +0200
Subject: [PATCH] [sbuild-createchroot] Detect whether a personality option might be needed.

---
 bin/sbuild-createchroot |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/bin/sbuild-createchroot b/bin/sbuild-createchroot
index 5720100..2ab3a4a 100755
--- a/bin/sbuild-createchroot
+++ b/bin/sbuild-createchroot
@@ -186,4 +186,11 @@ print "I: Please rename and modify this file as required.\n";
 print "I: Successfully set up $suite chroot.\n";
 print "I: Run sbuild-adduser to add new sbuild users.\n";
 
+# Detect whether personality might be needed.
+if ($bootstrap_arch ne $main::arch) {
+    print "W: You probably need to add a personality option (see schroot(1))\n";
+    print "   since the selected architecture and the current architecture\n";
+    print "   don't match ($bootstrap_arch versus $main::arch).\n";
+}
+
 exit 0;
-- 
1.5.6.3

-------------- next part --------------
>From 67db09af6724a3bacd7d4295f15c6a59aee11225 Mon Sep 17 00:00:00 2001
From: Cyril Brulebois <cyril.brulebois at kerlabs.com>
Date: Mon, 18 Aug 2008 16:32:03 +0200
Subject: [PATCH] [sbuild-createchroot] Add personality option automatically for some known cases.

---
 bin/sbuild-createchroot |   33 ++++++++++++++++++++++++---------
 1 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/bin/sbuild-createchroot b/bin/sbuild-createchroot
index 2ab3a4a..ed71d4a 100755
--- a/bin/sbuild-createchroot
+++ b/bin/sbuild-createchroot
@@ -165,6 +165,23 @@ my $SCHROOT_CONF =
 		    UNLINK => 0)
     or die "Can't open schroot configuration file: $!\n";
 
+my ($personality, $personality_message);
+# Detect whether personality might be needed.
+if ($bootstrap_arch ne $main::arch) {
+    # Take care of the known case(s).
+    if ($bootstrap_arch eq 'i386' && $main::arch eq 'amd64') {
+	$personality='linux32';
+	$personality_message =
+	    "I: Added personality=$personality automatically (i386 on amd64).\n";
+    }
+    else {
+	$personality_message =
+	    "W: You probably need to add a personality option (see schroot(1))\n"
+	  . "   since the selected architecture and the current architecture\n"
+	  . "   don't match ($bootstrap_arch versus $main::arch).\n";
+    }
+}
+
 print $SCHROOT_CONF <<"EOF";
 [$chrootname]
 type=directory
@@ -176,21 +193,19 @@ root-groups=root,sbuild
 run-setup-scripts=true
 run-exec-scripts=true
 EOF
-    # Needed to display file below.
-    $SCHROOT_CONF->flush();
+
+# Add personality if detected.
+print $SCHROOT_CONF "personality=$personality\n" if $personality;
+
+# Needed to display file below.
+$SCHROOT_CONF->flush();
 
 # Display schroot configuration.
 print "I: schroot chroot configuration written to $SCHROOT_CONF.\n";
 dump_file("$SCHROOT_CONF");
+print $personality_message if $personality_message;
 print "I: Please rename and modify this file as required.\n";
 print "I: Successfully set up $suite chroot.\n";
 print "I: Run sbuild-adduser to add new sbuild users.\n";
 
-# Detect whether personality might be needed.
-if ($bootstrap_arch ne $main::arch) {
-    print "W: You probably need to add a personality option (see schroot(1))\n";
-    print "   since the selected architecture and the current architecture\n";
-    print "   don't match ($bootstrap_arch versus $main::arch).\n";
-}
-
 exit 0;
-- 
1.5.6.3

-------------- next part --------------
>From dfa410f88c4133c98133850cd1a5bb3fc38c92dd Mon Sep 17 00:00:00 2001
From: Cyril Brulebois <cyril.brulebois at kerlabs.com>
Date: Mon, 18 Aug 2008 18:00:59 +0200
Subject: [PATCH] [sbuild-createchroot] Suggest reporting usecases to sbuild developers.

---
 bin/sbuild-createchroot |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/bin/sbuild-createchroot b/bin/sbuild-createchroot
index ed71d4a..6110add 100755
--- a/bin/sbuild-createchroot
+++ b/bin/sbuild-createchroot
@@ -178,7 +178,9 @@ if ($bootstrap_arch ne $main::arch) {
 	$personality_message =
 	    "W: You probably need to add a personality option (see schroot(1))\n"
 	  . "   since the selected architecture and the current architecture\n"
-	  . "   don't match ($bootstrap_arch versus $main::arch).\n";
+	  . "   don't match ($bootstrap_arch versus $main::arch).\n"
+	  . "   You may want to report your usecase to sbuild developers so that\n"
+	  . "   the appropriate option gets automatically added in the future.\n";
     }
 }
 
-- 
1.5.6.3



More information about the Buildd-tools-devel mailing list