[PATCH] Package content search and listing functionality for cygcheck
Igor Pechtchanski
pechtcha@cs.nyu.edu
Sat Aug 16 02:29:00 GMT 2003
On Fri, 15 Aug 2003, David Rothenberger wrote:
> Corinna Vinschen wrote:
> > Thanks for the patch, it's really cool,
>
> I agree, very cool, Igor.
>
> Any chance the return in package_find() could be changed to
> continue? I went to try it out for /bin/ssh and found it didn't
> work because diffutils is missing the package list. I didn't think
> to even try verbose until I read the code.
>
> Here's the ridiculously small patch if you agree.
>
> Dave
> ==============================
> 2003-08-15 David Rothenberger <daveroth@acm.org>
>
> * dump_setup.cc (package_find): Don't stop searching on missing
> file list.
Dave,
Thanks for catching this -- this was a genuine bug. Thanks also for the
patch, but I have another one in the pipeline that'll conflict with yours
(<http://cygwin.com/ml/cygwin-patches/2003-q3/msg00105.html>). How about
I just resubmit that patch with your changes included?
Attached is a new patch, with an updated ChangeLog entry (well, two
entries).
Igor
==============================================================================
ChangeLog:
2003-08-15 David Rothenberger <daveroth@acm.org>
* dump_setup.cc (package_find): Don't stop searching on missing
file list.
(package_list): Ditto.
2003-08-15 Igor Pechtchanski <pechtcha@cs.nyu.edu>
* dump_setup.cc: (package_list): Make output terse unless
verbose requested. Fix formatting.
(package_find): Ditto.
--
http://cs.nyu.edu/~pechtcha/
|\ _,,,---,,_ pechtcha@cs.nyu.edu
ZZZzz /,`.-'`' -. ;-;;,_ igor@watson.ibm.com
|,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski, Ph.D.
'---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow!
"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster." -- Patrick Naughton
-------------- next part --------------
Index: dump_setup.cc
===================================================================
RCS file: /cvs/src/src/winsup/utils/dump_setup.cc,v
retrieving revision 1.10
diff -u -p -r1.10 dump_setup.cc
--- dump_setup.cc 15 Aug 2003 20:26:11 -0000 1.10
+++ dump_setup.cc 16 Aug 2003 02:22:58 -0000
@@ -411,21 +411,22 @@ package_list (int verbose, char **argv)
{
FILE *fp = open_package_list (packages[i].name);
if (!fp)
- {
- if (verbose)
- printf ("Can't open file list /etc/setup/%s.lst.gz for package %s\n",
- packages[i].name, packages[i].name);
- return;
- }
+ {
+ if (verbose)
+ printf ("Can't open file list /etc/setup/%s.lst.gz for package %s\n",
+ packages[i].name, packages[i].name);
+ continue;
+ }
- printf ("Package: %s-%s\n", packages[i].name, packages[i].ver);
+ if (verbose)
+ printf ("Package: %s-%s\n", packages[i].name, packages[i].ver);
char buf[MAX_PATH + 1];
while (fgets (buf, MAX_PATH, fp))
{
char *lastchar = strchr(buf, '\n');
if (lastchar[-1] != '/')
- printf (" /%s", buf);
+ printf ("%s/%s", (verbose?" ":""), buf);
}
fclose (fp);
@@ -450,12 +451,7 @@ package_find (int verbose, char **argv)
{
FILE *fp = open_package_list (packages[i].name);
if (!fp)
- {
- if (verbose)
- printf ("Can't open file list /etc/setup/%s.lst.gz for package %s\n",
- packages[i].name, packages[i].name);
- return;
- }
+ continue;
char buf[MAX_PATH + 2];
buf[0] = '/';
@@ -479,7 +475,11 @@ package_find (int verbose, char **argv)
if (!a && is_alias)
a = match_argv (argv, filename + 4);
if (a > 0)
- printf ("%s-%s\n", packages[i].name, packages[i].ver);
+ {
+ if (verbose)
+ printf ("%s: found in package ", filename);
+ printf ("%s-%s\n", packages[i].name, packages[i].ver);
+ }
}
}
More information about the Cygwin-patches
mailing list