Re: [patch] add -p option to cygcheck to query website package search

2005-11-22 Thread Christopher Faylor
On Mon, Jun 20, 2005 at 01:04:45PM -0700, Brian Dessent wrote:
>Here is a patch that implements the -p option to cygcheck that was
>mentioned on the list previously.  It uses the WinInet API to hit the
>package-grep.cgi URL on cygwin.com with the search regexp supplied by
>the user.

Five+ months later, I've checked in (most of) this patch to cygcheck.cc
and the documentation.

It seems like the bug fix that was in the patch was no longer needed
since it didn't apply and the code around the fix had changed.

One reason for the delay was that I wanted to do things a little
differently in package-grep.cgi.  I think I've done that, with the help
of HTML::TreeBuilder.  So, there is now a "text" option to this script,
similar to your patch, which will just dump raw text.

Another reason for the delay was that I didn't want to add another way
to overload the old sourceware.org.  However, the new system is
perfectly capable of handling anything we can throw at it for the
foreseeable future, so this seemed like a good time to implement this
functionality.

Other than that, your patch just went in as-is.  I'm going to make a
snapshot with this change in it soon, Brian, so if you have some new
insights after five months, please let me know so that I can incorporate
them.

I apologize for the very long lag time in getting this patch in. I do
appreciate your addition of this functionality to cygcheck.exe.  I hope
that it will be a useful addition to our bag of tech support tricks.

Thanks again.

cgf


Re: [patch] add -p option to cygcheck to query website package search

2005-07-02 Thread Christopher Faylor
On Tue, Jun 21, 2005 at 08:49:24PM -0400, Christopher Faylor wrote:
>On Mon, Jun 20, 2005 at 01:04:45PM -0700, Brian Dessent wrote:
>>Here is a patch that implements the -p option to cygcheck that was
>>mentioned on the list previously.  It uses the WinInet API to hit the
>>package-grep.cgi URL on cygwin.com with the search regexp supplied by
>>the user.
>
>I appreciate your doing this Brian.  I won't be able to really
>investigate this and comment on it until Saturday but I wanted to
>respond to your email, at least so you would know the status.  I think
>that, on a quick inspection, the cygcheck stuff is fine (and I like the
>rewording of the help) but I have a different idea for how to handle
>the package_grep.cgi part but I need to do some more research.

As is probably obvious, I didn't do this last Saturday.

I am going to hold off putting this in 1.5.18 but it will be in 1.5.19,
as soon as I modify the perl script on sourceware.org.

cgf


Re: [patch] add -p option to cygcheck to query website package search

2005-06-21 Thread Christopher Faylor
On Mon, Jun 20, 2005 at 01:04:45PM -0700, Brian Dessent wrote:
>
>Here is a patch that implements the -p option to cygcheck that was mentioned on
>the list previously.  It uses the WinInet API to hit the package-grep.cgi URL 
>on
>cygwin.com with the search regexp supplied by the user.

I appreciate your doing this Brian.  I won't be able to really investigate this
and comment on it until Saturday but I wanted to respond to your email, at least
so you would know the status.  I think that, on a quick inspection, the cygcheck
stuff is fine (and I like the rewording of the help) but I have a different idea
for how to handle the package_grep.cgi part but I need to do some more research.

cgf


[patch] add -p option to cygcheck to query website package search

2005-06-20 Thread Brian Dessent

Here is a patch that implements the -p option to cygcheck that was mentioned on
the list previously.  It uses the WinInet API to hit the package-grep.cgi URL on
cygwin.com with the search regexp supplied by the user.

Rather than trying to parse the html output or requiring cygcheck to depend on
awk or something, I instead modified the cgi script to recognise an additional
parameter named 'plain'.  If present in the request, the script replies with a
text/plain version of the results that cygcheck just copies to stdout.

Included in the patch is an update of the utils.sgml documentation for the new
parameter.  As I understand it the man pages are created from this part of the
user's guide, so that should kill two birds with one stone.

I also document the new switch in the --help output.  I took the liberty of
rewording it considerably, because the way that it described the options seemed
rather unintuitive -- there are certain combinations of allowed and unallowed
parameters, and rather than trying to explain for each switch which others it is
incompatible with, instead it gives a list of the acceptible forms of calling
the program.  Here is the output after this patch:

$ cygcheck -h  
Usage: cygcheck PROGRAM [ -v ] [ -h ]
   cygcheck -c [ PACKAGE ] [ -d ]
   cygcheck -s [ -r ] [ -v ] [ -h ]
   cygcheck -k
   cygcheck -f FILE [ FILE ... ]
   cygcheck -l [ PACKAGE ] [ PACKAGE ... ]
   cygcheck -p REGEXP
List system information, check installed packages, or query package database.

At least one command option or a PROGRAM is required, as shown above.

  PROGRAM  list library (DLL) dependencies of PROGRAM
  -c, --check-setupshow installed version of PACKAGE and verify integrity
   (or for all installed packages if none specified)
  -d, --dump-only  just list packages, do not verify (with -c)
  -s, --sysinfoproduce diagnostic system information (implies -c -d)
  -r, --registry   also scan registry for Cygwin settings (with -s)
  -k, --keycheck   perform a keyboard check session (must be run from a
   plain console only, not from a pty/rxvt/xterm)
  -f, --find-package   find the package that FILE belongs to
  -l, --list-package   list contents of PACKAGE (or all packages if none given)
  -p, --package-query  search for REGEXP in the entire cygwin.com package
   repository (requies internet connectivity)
  -v, --verboseproduce more verbose output
  -h, --help   annotate output with explanatory comments when given
   with another command, otherwise print this help
  -V, --versionprint the version of cygcheck and exit

Note: -c, -f, and -l only report on packages that are currently installed. To
  search all official Cygwin packages use -p instead.  The -p REGEXP matches
  package names, descriptions, and names of files/paths within all packages.

The new --package-query command works more or less as you would expect. 
Whatever you supply after -p is passed along to the CGI as if you'd entered it
in the web form.  The only thing I changed was I omitted the directory name that
the package is in, so save a little bit of screen width.  Here is a sample:

$ cygcheck -p 'cygintl-2\.dll'
Found 1 matches for 'cygintl-2\.dll'.

libintl2-0.12.1-3 GNU Internationalization runtime library

$ cygcheck -p 'libexpat.*\.a'
Found 2 matches for 'libexpat.*\.a'.

expat-1.95.7-1XML parser library written in C
expat-1.95.8-1XML parser library written in C

$ cygcheck -p '/ls\.exe'
Found 2 matches for '/ls\.exe'.

coreutils-5.2.1-5 GNU core utilities (includes fileutils, sh-utils and
textutils)
coreutils-5.3.0-6 GNU core utilities (includes fileutils, sh-utils and
textutils)


There is an additional unrelated bugfix that I included with this patch.  The
bug was introduced with my patch to cygcheck that calls cygrunsrv.  It did not
properly null-terminate the buffer that was read from popen(), which would
result in the strtok() loop erroniously calling "cygrunsrv --query "
after the last service.  This resulted in an occasional spurious cygrunsrv error
to stdout if you ran "cygcheck -s" without -v.  If the package-grep part of the
patch is not yet ready for primetime, I will resubmit just this fix by itself
since it's a pretty dumb bug.

I have tested the WinInet stuff on WinXP and Win98 and it seemed ok on both. 
MSDN claims that this API exists as far back as Win95 and only requires IE 3.0. 
I have tested the package-grep.cgi script locally.

In terms of error reporting cygcheck will emit an error if the HTTP response
code was not 200.  It will also emit an error (and call FormatMessage to get a
textual version) if there is a problem connecting or resolving the domain.

Brian

winsup/utils:
2005-06-20  Brian Dessent  <[EMAIL PROTECTED]>

* Makefile.in: Link cygcheck with libwininet.a.
* cygcheck.cc: Add