This is the mail archive of the cygwin-apps mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

genini patch


Thanks for submitting my previous patches. I have further modified 
genini so that it generates output that is parsed without errors by 
setup.exe. I also fixed the sorting problem for file versions (ref: 
http://sourceware.org/ml/cygwin-apps/2006-09/msg00020.html).

A few issues remain, but setup.exe seems to accept them:
* genini generates one line for the non-existing db package ("@ db")
* genini doesn't include some -src files that do exist in the official
  setup.ini. This seems to be related to external-source values in 
  setup.hint. Maybe the error is in the .hint file? (e.g. gcc)
* for postgresql genini includes a [prev] version with no files (install
  or source). These files don't exist: the error is in the setup.hint.

Here's the changelog:

* genini (parsedir): Use correct sorting order based on file versions
(get): Fix quotes in sdesc and ldesc values
(parse): # in the middle of a line does not start a comment
Don't output keys with empty values
Fix minor typo in warning
New categories: KDE, Perl, Python

Please excuse me for any clumsy perl constructs: perl is new for me.

Greetings,
Servaas.
--
--- genini-1.4	2007-02-21 16:59:27.000000000 +0100
+++ genini	2007-02-23 07:25:37.000000000 +0100
@@ -55,7 +55,7 @@
 	} else {
 	    if ($key eq 'requires') {
 		for my $p1 (split(' ', $val)) {
-		    mywarn "package $p requires on unknown package
'$p1'"
+		    mywarn "package $p requires an unknown package
'$p1'"
 		      unless $pkg{$p};
 		}
 	    } elsif ($key eq 'category') {
@@ -64,7 +64,8 @@
 		      unless $main::categories{lc $c};
 		}
 	    }
-	    print "$key: ", $val, "\n";
+	    print "$key: ", $val, "\n" 
+	        unless !$val;
 	}
     }
     for my $what ('', "[prev]\n", "[test]\n") {
@@ -91,6 +92,14 @@
 	    $val .= "\n" . $_;
 	}
     } 
+    # fix syntax of ldesc and sdesc values
+    if ($key =~ /^(?:ldesc|sdesc)/) {
+      # ensure the text begins and ends with a double quote
+      $val =~ s/^([^"])/"$1/;
+      $val =~ s/([^"])$/$1"/;
+      # replace double quotes inside the text by single quotes
+      $val =~ s/(.)"(.)/$1'$2/g;
+    }
     return $val;
 }
 
@@ -103,7 +112,7 @@
     open(F, '<', $f) or die "$0: couldn't open $f - $!\n";
     while (<F>) {
 	chomp;
-	s/#.*$//o;
+	s/^#.*$//o;
 	s/^\s+//o;
 	s/(\S)\s+$/$1/o;
 	length or next;
@@ -165,13 +174,27 @@
     }
 
     return if $explicit;
-    my @files = sort grep{!/-src\.tar.bz2/} glob("$d/*.tar.bz2");
-    if (!@files) {
+
+    my @filesortingkeys;
+    my %files;
+    # Create files list keyed on the sorting key, which is based on the
version
+    foreach my $file (glob("$d/*[0-9].tar.bz2")) {
+      my $version = '.' . getver($file) . '.';
+      # let all numbers consist of at least 4 digits
+      $version =~ s/([\D])(\d{1})(?=[\D])/${1}000$2/g;
+      $version =~ s/([\D])(\d{2})(?=[\D])/${1}00$2/g;
+      $version =~ s/([\D])(\d{3})(?=[\D])/${1}0$2/g;
+      push(@filesortingkeys, $version);
+      $files{$version} = $file;
+    }
+    if (!%files) {
 	myerror "not enough package files in $d";
 	return;
     }
+    @filesortingkeys = sort(@filesortingkeys);
     for my $what ('', "[prev]\n") {
-	my $f = pop @files or last;
+	my $fs = pop @filesortingkeys or last;
+	my $f = $files{$fs};
 	$pkg{$pname}{$what}{-unused} = 1;
 	my $x = $pkg{$pname}{$what};
 	my $p;
@@ -259,8 +282,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 Sound System Text Utils Web X11
      _obsolete _PostInstallLast
      ';
     @main::categories{map {lc $_} @cats} = @cats;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]