delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/07/19/18:00:53

X-Spam-Check-By: sourceware.org
Subject: Additions to genini
To: cygwin AT cygwin DOT com
X-Mailer: Lotus Notes Release 6.5.4 CCH5 September 12, 2005
Message-ID: <OF5CF1EF86.3A651CEA-ON872571B0.0077314D-872571B0.0077CC55@seagate.com>
From: Gordon DOT Schumacher AT seagate DOT com
Date: Wed, 19 Jul 2006 15:50:05 -0600
MIME-Version: 1.0
X-Proofpoint-FWRule: outbound2
X-Proofpoint-Virus-Version: vendor=fsecure engine=4.64.4171:2.3.9,1.2.33,4.0.164 definitions=2006-07-19_05:2006-07-19,2006-07-18,2006-07-19 signatures=0
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

I've added a few things to the genini.pl script, as I downloaded it from
the CVS archive.  Mostly this was to make it not choke on the setup.hint
files that come with CygWin.

I've added an --append switch, so that one can build a setup.ini file
incrementally, because (at least on my system) I was unable to find a
way to pass the entire huge list of directories to it all at once without
it returning an error that I couldn't figure out the source of.

The two main changes I made were:
1) Check for and fix "internal" quote marks in the "value" fields (this
   particularly shows up in the ldescs in certain packages).  A warning
   will be issued.
2) Check for and fix keys that do not have a space between the colon
   and the value.  A warning will be issued here as well.
3) Check for keys without values, and simply skip them.

Let me know what you think...


--- genini.pl.orig      2006-07-19 13:17:18.000000000 -0600
+++ genini.pl     2006-07-19 15:28:42.000000000 -0600
@@ -15,13 +15,19 @@

 my @okmissing;
 my ($outfile, $help);
-GetOptions('okmissing=s'=>\@okmissing, 'output=s'=>\$outfile,
'help'=>\$help) or usage;
+GetOptions('okmissing=s'=>\@okmissing, 'output=s'=>\$outfile,
'append'=>\$appendfile, 'help'=>\$help) or usage;
 $help and usage;

 @main::okmissing{@okmissing} = @okmissing;

 if (defined($outfile)) {
-    open(STDOUT, '>', $outfile) or die "$0: can't open $outfile - $!\n";
+    my $fmode;
+    if (defined($appendfile)) {
+        $fmode = '>>';
+    } else {
+        $fmode = '>';
+    }
+    open(STDOUT, $fmode, $outfile) or die "$0: can't open $outfile -
$!\n";
 }

 local %pkg;
@@ -34,15 +40,17 @@
     }
 }

-print <<'EOF';
+if (!defined($appendfile)) {
+    print <<'EOF';
 # This file is automatically generated.  If you edit it, your
 # edits will be discarded next time the file is generated.
 # See http://cygwin.com/setup.html for details.
 #
 EOF

-print "$main::setup_timestamp\n" if $main::setup_timestamp;
-print "$main::setup_version\n" if $main::setup_version;
+    print "$main::setup_timestamp\n" if $main::setup_timestamp;
+    print "$main::setup_version\n" if $main::setup_version;
+}

 undef $main::curfile;
 for my $p (sort keys %pkg) {
@@ -88,6 +96,11 @@
          length or last;
          chomp;
          s/(\S)\s+$//;
+            # eliminate internal quote marks, replace with single quotes
+            if ($ ~= /."./) {
+                mywarn "internal quotes in '$key'";
+                s/(.)"(.)/\1'\2/g;
+            }
          $val .= "\n" . $_;
      }
     }
@@ -139,6 +152,16 @@
          $what = $_ . "\n";
          next;
      };
+        # Check for key without a value
+        /^([^:]+):$/ and do {
+            next;
+        };
+     # Check for missing space after the colon
+     /^([^:]+):(.*)$/ and do {
+            mywarn "missing space after colon in '$1'";
+            s/^([^:]+):(.*)$/\1: \2/;
+            redo;
+        };
      die "$0: unrecognized input at line file $ARGV[0], line $.\n";
     }
 }
@@ -241,6 +264,7 @@

     --okmissing=key    don't warn if key is missing from setup.ini or
setup.hint
     --output=file      output setup.ini info to file
+    --append           append to existing file (don't overwrite)
     --help             display this message

 Report bugs to cygwin mailing list.
@@ -251,8 +275,8 @@
 BEGIN {
     my @cats = qw'
      Admin Archive Audio Base Comm Database Devel Doc Editors Games
-     Gnome Graphics Interpreters Libs Mail Math Mingw Net Publishing
-     Science Shells Sound System Text Utils Web X11
+     Gnome Graphics Interpreters KDE Libs Mail Math Mingw Net Perl
+     Publishing Python Science Shells System Text Utils Web X11
      _obsolete _PostInstallLast
      ';
     @main::categories{map {lc $_} @cats} = @cats;


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019