]> git.donarmstrong.com Git - debhelper.git/commitdiff
factor out a buildsystems_list
authorJoey Hess <joey@gnu.kitenet.net>
Mon, 20 Apr 2009 18:51:14 +0000 (14:51 -0400)
committerJoey Hess <joey@gnu.kitenet.net>
Mon, 20 Apr 2009 18:51:14 +0000 (14:51 -0400)
Debian/Debhelper/Dh_Buildsystems.pm

index e3c78052150cfa5a49e06a85c130a93b781510d8..5a3e45f41f913b60c9b5c2f8f17ada63e1121954 100644 (file)
@@ -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;
        }