[PATCH] - setup.exe --text-mode and --current-user-only options
Hello, Please consider the following patch to setup. (I tried to follow the patch submission guidelines, please correct me if I missed something). Note that the new commandline options do *not* override the settings of a currently existing installation. I chose this behaviour because I'm unsure what the effect would be. It would be easy to change this, though. The output of setup.exe -h (to the logfile) becomes: Command Line Options: -D --download Download from internet -L --local-install Install from local directory -s --site Download site -R --root Root installation directory + -t --text-mode Use text mode mount for root directory + -c --current-user-only Make cygwin available to the current +user only -p --proxy HTTP/FTP proxy (host:port) -q --quiet-modeUnattended setup mode -h --help print help -l --local-package-dir Local package directory -r --no-replaceonrebootDisable replacing in-use files on next reboot. -n --no-shortcuts Disable creation of desktop and start menu shortcuts -N --no-startmenu Disable creation of start menu shortcut -d --no-desktopDisable creation of desktop shortcut -A --disable-buggy-antivirus Disable known or suspected buggy anti virus software packages during execution. Thanks, Servaas. -- Index: ChangeLog === RCS file: /cvs/cygwin-apps/setup/ChangeLog,v retrieving revision 2.592 diff -u -p -r2.592 ChangeLog --- ChangeLog 16 Apr 2008 10:07:25 - 2.592 +++ ChangeLog 28 May 2008 08:38:13 - @@ -1,3 +1,11 @@ +2008-05-28 Servaas Goossens sgoossens-AT-ortec.nl + + * root.cc (OnInit): Two new BoolOptions (TextModeOption, + CurrentUserOption). These new options (-t and -c) allow the use + of text-mode mounts and user mounts for unattended setups. + 2008-04-16 Brian Dessent [EMAIL PROTECTED] * mount.cc: Include malloc.h. Index: root.cc === RCS file: /cvs/cygwin-apps/setup/root.cc,v retrieving revision 2.21 diff -u -p -r2.21 root.cc --- root.cc 6 Apr 2006 16:45:19 - 2.21 +++ root.cc 28 May 2008 08:38:13 - @@ -39,10 +39,13 @@ static const char *cvsid = #include mount.h #include getopt++/StringOption.h +#include getopt++/BoolOption.h using namespace std; -StringOption RootOption (, 'R', root, Root installation directory, false); +static StringOption RootOption (, 'R', root, Root installation directory, false); +static BoolOption TextModeOption (false, 't', text-mode, Use text mode mount for root directory); +static BoolOption CurrentUserOption (false, 'c', current-user-only, Make cygwin available to the current user only); static ControlAdjuster::ControlInfo RootControlsInfo[] = { { IDC_ROOTDIR_GRP, CP_STRETCH, CP_TOP }, @@ -196,8 +199,14 @@ RootPage::OnInit () { makeClickable (IDC_FILEMODES_LINK, http://cygwin.com/cygwin-ug-net/using-textbinary.html;); + if (((string)RootOption).size()) set_root_dir((string)RootOption); + if (TextModeOption) +root_text = IDC_ROOT_TEXT; + if (CurrentUserOption) +root_scope = IDC_ROOT_USER; + if (!get_root_dir ().size()) read_mounts (); load_dialog (GetHWND ());
RE: [PATCH] - setup.exe --text-mode and --current-user-only options
Sorry, I wasn't aware of these changes for 1.7. Does this mean that the 1.5 version of setup is not modified anymore? If so, I'll just keep using my own patched setup.exe. Servaas. -Original Message- From: Brian Dessent [mailto:[EMAIL PROTECTED] Sent: woensdag 28 mei 2008 12:06 To: Servaas Goossens Cc: cygwin-apps@cygwin.com Subject: Re: [PATCH] - setup.exe --text-mode and --current-user-only options Servaas Goossens wrote: Please consider the following patch to setup. (I tried to follow the patch submission guidelines, please correct me if I missed something). This definitely conflicts with the direction that setup is moving in. In the 1.7 patches that I've been (slowly!) working on, the text/bin choice is completely removed from setup because it's no longer stored in the registry. To get textmode with 1.7 you edit fstab. Brian
RE: runtime unpleasantness with setup.exe [please try 2.569]
Looks good. I tested with an up-to-date release tree and the original setup.ini (no errors of course). With a freshly generated setup.ini, containing a syntax error, setup now shows a list of error messages. Unfortunately, the line unrecognized line 8519 (do you have the lastest setup?) is repeated 10 times, but that's a minor issue to me. Servaas. -Original Message- From: Brian Dessent [mailto:[EMAIL PROTECTED] Sent: woensdag 30 mei 2007 06:03 To: cygwin-apps@cygwin.com Subject: Re: runtime unpleasantness with setup.exe [please try 2.569] Servaas Goossens wrote: Part of the unpleasantness is caused by the fact that the message box doesn't contain any details on why the parse error occured. I had the same problem a few month ago while testing my own generated setup.ini. I changed one line in ini.cc and got a message box with the error message. This diff is based on ini.cc rev. 2.42, which I used, but rev 2.44 is similar: I've just reworked a lot of the ini-parsing error handling code. It should give you a useful error message containing filename/URL, line number, and reason now. Also, as a side effect the progress meter works during the parsing step, and I've added some code to be more robust with falling back to setup.ini if the setup.bz2 download fails or the file was truncated/corrupt. If you were having any issues along the lines of crashes/uninformative errors related to parsing, please test 2.569. Thank you. Brian
RE: genini patch
Christopher Faylor wrote: Again, sorry but I am not really supporting genini. I provided it as a proof of concept when people thought they had a right to have some sort of way to handle the awful complexity of setup.hint files. Since there is nothing important relying on it, I'm comfortable leaving it as is until somebody does it the right way. Ok. (I just wonder how the setup.ini for the official release is created.) Anyway, I now have a genini that works for me, and I'm happy that some of my patches were useful to you. Greetings, Servaas.
RE: genini patch
Christopher Faylor wrote: * genini (parsedir): Use correct sorting order based on file versions It's a lot more complicated than this if you want to get the sorting right. Maybe the setup.cc code could be of some use. You're right, it was a simplistic approach. Do you mean version_compare.cc? I don't feel like re-implementing that in perl. Instead I found Sort::Versions (apt-get install libsort-versions-perl). The output looks good given the current release tree. If you don't mind adding the dependency, it would keep the genini code small and simple. See the patch below. (get): Fix quotes in sdesc and ldesc values It took me a couple of tries but I think I've implemented this in a slightly cleaner manner than your patch. Ok, great. As I said, I'm not a perl coder: this is in fact the first time I work on a perl script. (parse): # in the middle of a line does not start a comment Actually, yes it does. It just doesn't start a comment in a quoted string. I haven't committed this since more work is needed. According to http://sourceware.org/cygwin-apps/setup-head.ini.html: Any line beginning with # is ignored by setup and can be used to add commentary to the file. All current setup.hint/ini files follow this rule. If you also want to support end-of-line-comments, that's great. Please consider committing my patch as a temporary measure until the final solution is ready. Don't output keys with empty values Committed Fix minor typo in warning Committed New categories: KDE, Perl, Python Committed Thank you, Servaas. -- --- genini-1.7 2007-02-25 10:33:14.0 +0100 +++ genini 2007-02-25 11:14:23.0 +0100 @@ -8,6 +8,7 @@ use File::Basename; use Digest::MD5; use Getopt::Long; +use Sort::Versions; use strict; @@ -108,7 +109,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; @@ -170,17 +171,27 @@ } return if $explicit; -my @files = sort grep{!/-src\.tar.bz2/} glob($d/*.tar.bz2); -if ([EMAIL PROTECTED]) { + +# Create list of files and versions +my @versions; +my %files; +foreach my $file (glob($d/*[0-9].tar.bz2)) { + my $version = getver($file); + push(@versions, $version); + $files{$version} = $file; +} +if (!%files) { myerror not enough package files in $d; return; } +@versions = sort { versioncmp($a, $b) } @versions; for my $what ('', [prev]\n) { - my $f = pop @files or last; + my $version = pop @versions or last; + my $f = $files{$version}; $pkg{$pname}{$what}{-unused} = 1; my $x = $pkg{$pname}{$what}; my $p; - ($p, $x-{'version'}) = getver($f); + ($p, $x-{'version'}) = $version; addfiles($p, $x, $d); } }
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.0 +0100 +++ genini 2007-02-23 07:25:37.0 +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 ([EMAIL PROTECTED]) { + +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;
Another genini patch
Hi Christopher, I fetched genini 1.3 from CVS. Tried out --recursive, seems to work quite well. I noticed that it generated the following output for directory db, which contains only subdirectories. This could have to do with --recursive (didn't verify): @ db @ db2 sdesc: The Sleepycat Berkeley DB Library v2 ldesc: High performance database library supporting B+trees, Hash [etc...] I have a patch for two other issues: * For ldesc lines that end with a space, the last (non-space) character was consistently removed. Fixed in the get function. * To prevent warnings I added KDE, Perl and Python to the list of accepted categories (I suppose this would be okay). Greetings, Servaas. -- --- genini-1.3 2007-02-15 18:18:19.0 +0100 +++ genini 2007-02-15 18:36:29.0 +0100 @@ -87,7 +87,7 @@ $_ = $FH; length or last; chomp; - s/(\S)\s+$//; + s/(\S)\s+$/$1/; $val .= \n . $_; } } @@ -259,7 +259,7 @@ BEGIN { my @cats = qw' Admin Archive Audio Base Comm Database Devel Doc Editors Games - Gnome Graphics Interpreters Libs Mail Math Mingw Net Publishing + Gnome Graphics Interpreters KDE Libs Mail Math Mingw Net Perl Publishing Python Science Shells Sound System Text Utils Web X11 _obsolete _PostInstallLast ';
two small patches for genini
Hi, I am trying to create a local setup server with a custom package for selection of locally required packages. I stumbled upon an error produced by genini: ./genini: unrecognized input at line file ./release/_update-info-dir, line 4. In the end, I found the offending line in ./release/_obsolete/XFree86-xwinclip/setup.ini. Indeed line 4, which reads: requires: I'd like to suggest a small patch to genini, which would produce a more accurate error message in this case: --- genini-cvs/genini 2007-02-13 17:41:27.0 +0100 +++ ./genini2007-02-13 03:43:24.0 +0100 @@ -139,7 +139,7 @@ $what = $_ . \n; next; }; - die $0: unrecognized input at line file $ARGV[0], line $.\n; + die $0: unrecognized input at file $f, line $.\n; } } Because there are 3 more setup.hint files that have a requires: line with no packages after the colon, I also applied the following patch to make that syntax acceptable: --- genini-cvs/genini 2007-02-13 17:41:27.0 +0100 +++ genini 2007-02-13 04:14:58.0 +0100 @@ -120,7 +120,7 @@ $what = ''; next; }; - /^([^:]+):\s+(.*)$/ and do { + /^([^:]+):\s*(.*)$/ and do { my $key = $1; my $val = $2; if ($key !~ /^(?:prev|curr|test)/) { Cheers, Servaas.