diff mbox

0011-Dirty-commit-to-hook-cross-dependency-resolver.patch

Message ID 20111214181003.GY28260@dream.aleph1.co.uk
State Accepted
Headers show

Commit Message

Wookey Dec. 14, 2011, 6:10 p.m. UTC
From 0a8de71ba8ca4422c77b46c4ce8f0485e5d43ce6 Mon Sep 17 00:00:00 2001
From: Hector Oron <hector.oron@toby-churchill.com>
Date: Mon, 12 Dec 2011 19:21:29 +0000
Subject: [PATCH 11/17] Dirty commit to hook cross dependency resolver

  $ sbuild -d sid-amd64-sbuild --host=armel --build=amd64 --build-dep-resolver=xapt mc_4.7.0.9-1.dsc

  This is a work-in-progress... trying to get it working:
	1. xapt -a $host_arch $pkg_list
	2. cd $source_dir && embuilddeps -a $host_arch

   xapt is probably best way to go, but we need a list of packages

Signed-off-by: Hector Oron <hector.oron@toby-churchill.com>
---
 lib/Sbuild/Conf.pm         |    4 ++++
 lib/Sbuild/ResolverBase.pm |   27 +++++++++++++++++++++++----
 lib/Sbuild/XaptResolver.pm |   11 +++++++----
 3 files changed, 34 insertions(+), 8 deletions(-)
diff mbox

Patch

diff --git a/lib/Sbuild/Conf.pm b/lib/Sbuild/Conf.pm
index b5b962a..c1100c5 100644
--- a/lib/Sbuild/Conf.pm
+++ b/lib/Sbuild/Conf.pm
@@ -257,6 +257,10 @@  sub setup ($) {
 	    CHECK => $validate_program,
 	    DEFAULT => 'xapt'
 	},
+	'EMBUILDDEPS'				=> {
+	    CHECK => $validate_program,
+	    DEFAULT => 'embuilddeps'
+	},
 	'DPKG_BUILDPACKAGE_USER_OPTIONS'	=> {
 	    TYPE => 'ARRAY:STRING',
 	    GROUP => '__INTERNAL',
diff --git a/lib/Sbuild/ResolverBase.pm b/lib/Sbuild/ResolverBase.pm
index d2362bd..8917cb8 100644
--- a/lib/Sbuild/ResolverBase.pm
+++ b/lib/Sbuild/ResolverBase.pm
@@ -448,10 +448,12 @@  sub run_xapt {
     # dpkg since 1.4.1.18 issues an error on the conffile question if
     # it reads EOF -- hardwire the new --force-confold option to avoid
     # the questions.
-    my @xapt_command = ($self->get_conf('XAPT'),
-	'-a', $self->get_conf('HOST_ARCH'));
-    # FIXME?:push @xapt_command, "$mode", $action, @packages;
-    push @xapt_command, @packages;
+    use Data::Dumper;
+    debug("Source Dir = " . $self->get('Source Dir') . "\n");
+    print "Dump Source Dir\n";
+    print Dumper ($self->get('Source Dir'));
+    # chdir ($dir);
+    my @xapt_command = ($self->get_conf('EMBUILDDEPS'));
     my $pipe =
 	$self->pipe_xapt_command(
 	    { COMMAND => \@xapt_command,
@@ -1056,6 +1058,23 @@  sub pipe_apt_command {
     }
 }
 
+sub pipe_xapt_command {
+    my $self = shift;
+    my $options = shift;
+
+    my $session = $self->get('Session');
+    my $host = $self->get('Host');
+
+    # Set modfied command
+    $self->get_apt_command_internal($options);
+
+    if ($self->get('Split')) {
+	return $host->pipe_command_internal($options);
+    } else {
+	return $session->pipe_command_internal($options);
+    }
+}
+
 sub get_aptitude_command_internal {
     my $self = shift;
     my $options = shift;
diff --git a/lib/Sbuild/XaptResolver.pm b/lib/Sbuild/XaptResolver.pm
index 6bc9309..ea795a1 100644
--- a/lib/Sbuild/XaptResolver.pm
+++ b/lib/Sbuild/XaptResolver.pm
@@ -56,11 +56,11 @@  sub install_deps {
 
     my $status = 0;
     my $session = $self->get('Session');
-    my $dummy_pkg_name = 'sbuild-build-depends-' . $name. '-dummy';
+#    my $dummy_pkg_name = 'sbuild-build-depends-' . $name. '-dummy';
 
     # Call functions to setup an archive to install dummy package.
-    return 0 unless ($self->setup_apt_archive($dummy_pkg_name, @pkgs));
-    return 0 unless (!$self->update_archive());
+#    return 0 unless ($self->setup_apt_archive($dummy_pkg_name, @pkgs));
+#    return 0 unless (!$self->update_archive());
 
 
     $self->log_subsection("Install $name cross-build dependencies (xapt-based resolver)");
@@ -68,7 +68,10 @@  sub install_deps {
     # Install the dummy package
     my (@instd, @rmvd);
     $self->log("Installing cross-build dependencies\n");
-    if (!$self->run_apt("-yf", \@instd, \@rmvd, 'install', $dummy_pkg_name)) {
+#    if (!$self->run_apt("-yf", \@instd, \@rmvd, 'install', $dummy_pkg_name)) {
+    print "checking pwd\n";
+    system("pwd");
+    if (!$self->run_xapt("-a", $self->get_conf('HOST_ARCH'))) {
 	$self->log("Package installation failed\n");
 	if (defined ($self->get('Session')->get('Session Purged')) &&
 	    $self->get('Session')->get('Session Purged') == 1) {