Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/3111

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/11/3111/1

Make autogen.sh prefer to read an autogen.input file

An autogen.lastrun file will still be used if it exists (and autogen.input
does not exist). The recommended workflow is now to keep the configuration
parametets in autogen.input which is never written by autogen.sh.

Most (?) developers used to treat autogen.lastrun as a valuable parameter file
to be edited manually anyway, and not as an ad-hoc backup copy of command-line
parameters last used. The name autogen.input better reflects this usage.

Change-Id: I7e3c747fa95e9f2f0bc44036419aaab8f4ad01e7
---
M autogen.sh
1 file changed, 22 insertions(+), 18 deletions(-)



diff --git a/autogen.sh b/autogen.sh
index fa77b73..f5960e3 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -21,7 +21,7 @@
 {
     system ("rm -Rf autom4te.cache");
     system ("rm -f missing install-sh mkinstalldirs libtool ltmain.sh");
-    print "cleaned the build tree\n";
+    print "Cleaned the build tree\n";
 }
 
 my $aclocal;
@@ -108,9 +108,18 @@
 }
 
 my @cmdline_args = ();
-if (!@ARGV) {
-    my $lastrun = "autogen.lastrun";
-    @cmdline_args = read_args ($lastrun) if (-f $lastrun);
+
+my $input = "autogen.input";
+my $lastrun = "autogen.lastrun";
+
+if (-f $input) {
+    warn "Ignoring command-line arguments, using $input.\n" if (@ARGV);
+    warn "Ignoring $lastrun, using $input.\n" if (-f $lastrun);
+    @cmdline_args = read_args ($input);
+} elsif (-f $lastrun) {
+    warn "Ignoring command-line arguments, using $lastrun.\n" if (@ARGV);
+    print STDERR "Reading $lastrun. Please rename it to $input to avoid this message.\n";
+    @cmdline_args = read_args ($lastrun);
 } else {
     @cmdline_args = @ARGV;
 }
@@ -118,7 +127,7 @@
 my @args;
 my $default_config = "$src_path/distro-configs/default.conf";
 if (-f $default_config) {
-    print STDERR "Reading default config file: $default_config\n";
+    print STDERR "Reading default config file: $default_config.\n";
     push @args, read_args ($default_config);
 }
 for my $arg (@cmdline_args) {
@@ -164,40 +173,35 @@
 system ("$aclocal $aclocal_flags") && die "Failed to run aclocal";
 unlink ("configure");
 system ("autoconf -I ${src_path}") && die "Failed to run autoconf";
-die "failed to generate configure" if (! -f "configure");
+die "Failed to generate the configure script" if (! -f "configure");
 
 if (defined $ENV{NOCONFIGURE}) {
     print "Skipping configure process.";
 } else {
     # Save autogen.lastrun only if we did get some arguments on the command-line
-    if (@ARGV) {
+    if (! -f $input && @ARGV) {
         if (scalar(@cmdline_args) > 0) {
             # if there's already an autogen.lastrun, make a backup first
-            if (-e "autogen.lastrun") {
-                open (my $fh, "autogen.lastrun") || warn "can't open autogen.lastrun. \n";
-                open (BAK, ">autogen.lastrun.bak") || warn "can't create backup file. \n";
+            if (-e $lastrun) {
+                open (my $fh, $lastrun) || warn "Can't open $lastrun.\n";
+                open (BAK, ">$lastrun.bak") || warn "Can't create backup file $lastrun.bak.\n";
                 while (<$fh>) {
                     print BAK;
                 }
                 close (BAK) && close ($fh);
             }
-            # print "writing args to autogen.lastrun\n";
+            # print "Saving command-line args to $lastrun\n";
             my $fh;
-            open ($fh, ">autogen.lastrun") || die "can't open autogen.lastrun: $!";
+            open ($fh, ">autogen.lastrun") || die "Can't open autogen.lastrun: $!";
             for my $arg (@cmdline_args) {
                 print $fh "$arg\n";
             }
             close ($fh);
         }
     }
-    elsif ( ! -e "autogen.lastrun")
-    {
-        open (my $fh, ">autogen.lastrun") || die "can't create autogen.lastrun";
-        close ($fh);
-    }
     push @args, "--srcdir=$src_path";
 
-    print "running ./configure with '" . join ("' '", @args), "'\n";
+    print "Running ./configure with '" . join ("' '", @args), "'\n";
     system ("./configure", @args) && die "Error running configure";
 }
 

-- 
To view, visit https://gerrit.libreoffice.org/3111
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7e3c747fa95e9f2f0bc44036419aaab8f4ad01e7
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Tor Lillqvist <tml@iki.fi>


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.