~ubuntu-branches/ubuntu/lucid/sbuild/lucid

« back to all changes in this revision

Viewing changes to bin/sbuild-upgrade

  • Committer: Bazaar Package Importer
  • Author(s): Kees Cook
  • Date: 2009-05-09 16:06:44 UTC
  • mfrom: (8.1.6 upstream) (3.1.3 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090509160644-9k0fgp6c2ajcu54h
Tags: 0.58.2-1ubuntu1
* Merge from debian unstable, remaining changes:
  - bin/sbuild, lib/Sbuild/{Base,Conf,Options}.pm: add --setup-hook
    to allow pre-build modifications to underlying chroots (needed
    to adjust pockets and components in sources.list).  (debian bug
    500746).

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
use Getopt::Long;
25
25
use Sbuild qw(help_text version_text usage_error);
 
26
use Sbuild::Conf;
26
27
use Sbuild::Utility qw(setup cleanup);
27
28
 
28
29
package main;
29
30
 
 
31
my $conf = Sbuild::Conf->new();
 
32
 
30
33
GetOptions (
31
34
    "h|help" => sub { help_text("1", "sbuild-upgrade"); },
32
35
    "V|version" => sub {version_text("sbuild-upgrade"); })
34
37
 
35
38
usage_error("sbuild-upgrade", "Incorrect number of options") if (@ARGV < 1);
36
39
 
37
 
$Sbuild::Conf::cwd = "/";
38
 
 
39
40
foreach (@ARGV) {
40
41
 
41
42
    my $chroot = Sbuild::Utility::get_dist($_);
42
43
 
43
 
    my $session = setup($_) or die "Chroot setup failed for $chroot chroot";
 
44
    my $session = setup($_, $conf) or die "Chroot setup failed for $chroot chroot";
44
45
 
45
46
    print STDOUT "Upgrading $chroot chroot...\n";
46
47
    $ENV{'DEBIAN_FRONTEND'} = "noninteractive";
47
 
    my $status = $session->run_apt_command($Sbuild::Conf::apt_get,
48
 
                                           "-uy upgrade",
49
 
                                           "root", 1);
 
48
    $session->run_apt_command(
 
49
        { COMMAND => [$conf->get('APT_GET'), '-uy', 'upgrade'],
 
50
          ENV => {'DEBIAN_FRONTEND' => 'noninteractive'},
 
51
          USER => 'root',
 
52
          PRIORITY => 1,
 
53
          DIR => '/' });
 
54
    my $status = $? >> 8;
50
55
 
51
 
    cleanup();
 
56
    cleanup($conf);
52
57
 
53
58
    exit $status if ($status);
54
59
}