rev 10334 - scripts

Modestas Vainius modax-guest at alioth.debian.org
Mon Apr 28 15:42:30 UTC 2008


Author: modax-guest
Date: 2008-04-28 15:42:27 +0000 (Mon, 28 Apr 2008)
New Revision: 10334

Modified:
   scripts/autofixtll
Log:
v0.4.1 - enhanced --invoke-edit.


Modified: scripts/autofixtll
===================================================================
--- scripts/autofixtll	2008-04-28 12:03:29 UTC (rev 10333)
+++ scripts/autofixtll	2008-04-28 15:42:27 UTC (rev 10334)
@@ -174,9 +174,6 @@
             $count++;
         }
         close(IN);
-#        while(<OUT>) {
-#            chomp;
-#        }
         close(OUT);
         print(STDERR "Lost a few C++ symbols (", (scalar(@cpp_symbols) - $count), 
                      ") while demangling ", $self->to_string(), "\n") unless ($count == scalar(@cpp_symbols));
@@ -355,7 +352,8 @@
         }
 
         if (!$found) {
-            die "$MSG_PREFIX $cmakelists could not be corrected (needed '$strlibs' for target '$target'). Respective target_link_libraries() was not found $MSG_PREFIX";
+            print "$MSG_PREFIX $cmakelists could not be corrected (needed '$strlibs' for target '$target'). Respective target_link_libraries() was not found $MSG_PREFIX\n";
+            return 0;
         } else {
             # Write
             system("$QUILT add '$cmakelists'");
@@ -371,12 +369,28 @@
             File::Copy::move("$cmakelists.tmp", "$cmakelists") 
                 or die "Could not rename file '$cmakelists.tmp' -> '$cmakelists'";
             print "$MSG_PREFIX $cmakelists edited. Added libraries '$strlibs' for target $target\n";
+            return 1;
         }
     } else {
         die "$cmakelists for target $target could not be found. Something is wrong";
     }
 }
 
+sub invoke_edit {
+    my ($cmakelists, $do_invoke) = @_;
+    my $quilt_cmd = "$QUILT edit '$cmakelists'";
+
+    if ($do_invoke) {
+        print "$MSG_PREFIX Press ENTER to edit '$cmakelists' or ^C to cancel ...";
+        <>;
+        return (system($quilt_cmd) == 0) ? 0 : 2;
+    } else {
+        print "$MSG_PREFIX You probably want to run the command to correct the problem yourself: \n",
+              "$MSG_PREFIX     \$ $quilt_cmd\n";
+        return 2;
+    }
+}
+
 sub build_and_fix {
     my ($sourcedir, $builddir, $buildcmd, $exec_in_build_dir, $do_backups, $invoke_edit) = @_;
 
@@ -434,22 +448,16 @@
     if ($islderror && $bdir && $btarget && @undefrefs) {
         my $libs = determine_needed_libs(\@LIBS, \@undefrefs);
         if (@$libs) {
-            write_target_link_libs($bdir, $btarget, $libs, $do_backups);
-            return 0; # again
+            if (write_target_link_libs($bdir, $btarget, $libs, $do_backups)) {
+                return 0; # again
+            } else {
+                return invoke_edit("$bdir/CMakeLists.txt", $invoke_edit);
+            }
         } else {
             my $cmakelists = "$bdir/CMakeLists.txt";
             print "$MSG_PREFIX Could not resolve linkage problem automatically. Undefined symbols have not been recognized\n";
             print "$MSG_PREFIX Target: $btarget; CMakeLists.txt: $cmakelists", "\n";
-            my $quilt_cmd = "$QUILT edit $cmakelists";
-            if ($invoke_edit) {
-                print "$MSG_PREFIX Press ENTER to edit '$cmakelists' or ^C to cancel ...";
-                <>;
-                system($quilt_cmd);
-            } else {
-                print "$MSG_PREFIX You probably want to run the command to correct the problem yourself: \n",
-                      "$MSG_PREFIX     \$ $quilt_cmd\n";
-                return 2;
-            }
+            return invoke_edit($cmakelists, $invoke_edit);
         }
     } else {
         #print $islderror, ", ", $bdir, ", ", $btarget, ", ", @undefrefs, "\n";
@@ -499,7 +507,7 @@
 
 ############## Main loop ##############################
 
-$main::VERSION = "0.4";
+$main::VERSION = "0.4.1";
 
 my $sourcedir = Cwd::getcwd();
 my $builddir = "obj-" . get_gnu_build_type();




More information about the pkg-kde-commits mailing list