From 0ccb397a6c52894c8756b3611121b4e1bbe11e5e Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 20 Apr 2009 14:51:14 -0400 Subject: factor out a buildsystems_list --- Debian/Debhelper/Dh_Buildsystems.pm | 58 ++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 26 deletions(-) diff --git a/Debian/Debhelper/Dh_Buildsystems.pm b/Debian/Debhelper/Dh_Buildsystems.pm index e3c78052..5a3e45f4 100644 --- a/Debian/Debhelper/Dh_Buildsystems.pm +++ b/Debian/Debhelper/Dh_Buildsystems.pm @@ -91,6 +91,37 @@ sub buildsystems_init { Debian::Debhelper::Dh_Lib::init(%args); } +sub buildsystems_list { + my $action=shift; + + # List buildsystems (including auto and specified status) + my $auto_found; + my $specified_found; + print "STATUS (* auto, + specified) NAME - DESCRIPTION", "\n"; + for my $system (@BUILDSYSTEMS) { + my $inst = create_buildsystem_instance($system, build_action => undef); + my $is_specified = defined $opt_buildsys && $opt_buildsys eq $inst->NAME(); + my $status; + if ($is_specified) { + $status = "+"; + $specified_found = 1; + } + elsif (!$auto_found && $inst->check_auto_buildable($action)) { + $status = "*"; + $auto_found = 1; + } + else { + $status = " "; + } + printf("%s %s - %s.\n", $status, $inst->NAME(), $inst->DESCRIPTION()); + } + # List a 3rd party buildsystem too. + if (!$specified_found && defined $opt_buildsys) { + my $inst = create_buildsystem_instance($opt_buildsys, build_action => undef); + printf("+ %s - %s.\n", $inst->NAME(), $inst->DESCRIPTION()); + } +} + sub buildsystems_do { my $action=shift; @@ -104,32 +135,7 @@ sub buildsystems_do { } if ($opt_list) { - # List buildsystems (including auto and specified status) - my $auto_found; - my $specified_found; - print "STATUS (* auto, + specified) NAME - DESCRIPTION", "\n"; - for my $system (@BUILDSYSTEMS) { - my $inst = create_buildsystem_instance($system, build_action => undef); - my $is_specified = defined $opt_buildsys && $opt_buildsys eq $inst->NAME(); - my $status; - if ($is_specified) { - $status = "+"; - $specified_found = 1; - } - elsif (!$auto_found && $inst->check_auto_buildable($action)) { - $status = "*"; - $auto_found = 1; - } - else { - $status = " "; - } - printf("%s %s - %s.\n", $status, $inst->NAME(), $inst->DESCRIPTION()); - } - # List a 3rd party buildsystem too. - if (!$specified_found && defined $opt_buildsys) { - my $inst = create_buildsystem_instance($opt_buildsys, build_action => undef); - printf("+ %s - %s.\n", $inst->NAME(), $inst->DESCRIPTION()); - } + buildsystems_list($action); exit 0; } -- cgit v1.2.3