public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Check if a package is installed
@ 2012-10-01 11:03 Vincent Rivière
  2012-10-01 11:25 ` marco atzeri
  0 siblings, 1 reply; 7+ messages in thread
From: Vincent Rivière @ 2012-10-01 11:03 UTC (permalink / raw)
  To: cygwin

Hello.

I would like to know how to reliably test if a Cygwin package is already 
installed (just like setup.exe does).

Currently, I test the existence of /etc/setup/<package>.lst.gz. It works 
perfectly for me, but a user reported to me that that file was missing 
sometimes.

I see there is also package information listed in 
/etc/setup/installed.db. Maybe this information should be considered as 
more reliable?

-- 
Vincent Rivière

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Check if a package is installed
  2012-10-01 11:03 Check if a package is installed Vincent Rivière
@ 2012-10-01 11:25 ` marco atzeri
  2012-10-01 11:38   ` Vincent Rivière
  2012-10-03 22:02   ` Vincent Rivière
  0 siblings, 2 replies; 7+ messages in thread
From: marco atzeri @ 2012-10-01 11:25 UTC (permalink / raw)
  To: cygwin

On 10/1/2012 1:03 PM, Vincent Rivière wrote:
> Hello.
>
> I would like to know how to reliably test if a Cygwin package is already
> installed (just like setup.exe does).
>
> Currently, I test the existence of /etc/setup/<package>.lst.gz. It works
> perfectly for me, but a user reported to me that that file was missing
> sometimes.
>
> I see there is also package information listed in
> /etc/setup/installed.db. Maybe this information should be considered as
> more reliable?
>

cygcheck -c <package>

It uses the the two information left by setup.exe
  /etc/setup/installed.db
  /etc/setup/<package>.lst.gz

to provide a status.

Regards
Marco


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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Check if a package is installed
  2012-10-01 11:25 ` marco atzeri
@ 2012-10-01 11:38   ` Vincent Rivière
  2012-10-01 12:34     ` marco atzeri
  2012-10-03 22:02   ` Vincent Rivière
  1 sibling, 1 reply; 7+ messages in thread
From: Vincent Rivière @ 2012-10-01 11:38 UTC (permalink / raw)
  To: cygwin

On 01/10/2012 13:24, marco atzeri wrote:
> cygcheck -c <package>

Thanks, this is what I looked for.

However, I notice that:

1) If the .lst.gz file is missing, "cygcheck -c <package>" still reports OK.

2) When testing a missing package, "cygcheck -c <package>" does not 
output any status line, but its return code is still 0. This is not easy 
to use from scripts.

-- 
Vincent Rivière

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Check if a package is installed
  2012-10-01 11:38   ` Vincent Rivière
@ 2012-10-01 12:34     ` marco atzeri
  0 siblings, 0 replies; 7+ messages in thread
From: marco atzeri @ 2012-10-01 12:34 UTC (permalink / raw)
  To: cygwin

On 10/1/2012 1:38 PM, Vincent Rivière wrote:
> On 01/10/2012 13:24, marco atzeri wrote:
>> cygcheck -c <package>
>
> Thanks, this is what I looked for.
>
> However, I notice that:
>
> 1) If the .lst.gz file is missing, "cygcheck -c <package>" still reports
> OK.

a package with a missing .lst.gz , should be a obsolete and empty.
Usually are package labels left to pull in the alternative package.

>
> 2) When testing a missing package, "cygcheck -c <package>" does not
> output any status line, but its return code is still 0. This is not easy
> to use from scripts.
>

try using grep.

I damaged the xv package as following:

$ cygcheck -c  -v xz
Cygwin Package Information
Last downloaded files to: e:\downloads\cygwin_cache
Last downloaded files from: http://mirrors.dotsrc.org/cygwin/

Package              Version              Status
Missing file: /usr/bin/xz.exe from package xz
xz                   5.0.2_20110517-1     Incomplete


using grep I can find the failing package

$ cygcheck -c xz |grep OK ; echo $?
1

while usually I have

$ cygcheck -c xz |grep OK ; echo $?
xz                   5.0.2_20110517-1     OK
0

Regards
Marco


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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Check if a package is installed
  2012-10-01 11:25 ` marco atzeri
  2012-10-01 11:38   ` Vincent Rivière
@ 2012-10-03 22:02   ` Vincent Rivière
  2012-10-03 23:05     ` Larry Hall (Cygwin)
  1 sibling, 1 reply; 7+ messages in thread
From: Vincent Rivière @ 2012-10-03 22:02 UTC (permalink / raw)
  To: cygwin

On 01/10/2012 13:24, marco atzeri wrote:
> cygcheck -c <package>

I wonder how much "cygcheck -c" is reliable.

For example, the libmpfr4 package.
I delete /bin/cygmpfr-4.dll and /etc/setup/libmpfr4.lst.gz

As a result, I can't compile sources with gcc anymore due to the missing 
cygmpfr-4.dll.

But "cygcheck -c libmpfr4" still indicates OK...

-- 
Vincent Rivière

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Check if a package is installed
  2012-10-03 22:02   ` Vincent Rivière
@ 2012-10-03 23:05     ` Larry Hall (Cygwin)
  2012-10-04  8:54       ` Vincent Rivière
  0 siblings, 1 reply; 7+ messages in thread
From: Larry Hall (Cygwin) @ 2012-10-03 23:05 UTC (permalink / raw)
  To: cygwin

On 10/3/2012 6:02 PM, Vincent Rivière wrote:
> On 01/10/2012 13:24, marco atzeri wrote:
>> cygcheck -c <package>
>
> I wonder how much "cygcheck -c" is reliable.
>
> For example, the libmpfr4 package.
> I delete /bin/cygmpfr-4.dll and /etc/setup/libmpfr4.lst.gz
>
> As a result, I can't compile sources with gcc anymore due to the missing
> cygmpfr-4.dll.
>
> But "cygcheck -c libmpfr4" still indicates OK...
>

Well it has to use something to validate the package.  The data it
uses is the list of files in the .lst.gz file you deleted.  So it
can't do allot of validating without that metadata.  But I suppose
it would make sense to not return "OK" if the list of files is
missing.

-- 
Larry

_____________________________________________________________________

A: Yes.
 > Q: Are you sure?
 >> A: Because it reverses the logical flow of conversation.
 >>> Q: Why is top posting annoying in email?

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Check if a package is installed
  2012-10-03 23:05     ` Larry Hall (Cygwin)
@ 2012-10-04  8:54       ` Vincent Rivière
  0 siblings, 0 replies; 7+ messages in thread
From: Vincent Rivière @ 2012-10-04  8:54 UTC (permalink / raw)
  To: cygwin

On 04/10/2012 01:05, Larry Hall (Cygwin) wrote:
> Well it has to use something to validate the package. The data it
> uses is the list of files in the .lst.gz file you deleted. So it
> can't do allot of validating without that metadata.

Indeed.

> But I suppose it would make sense to not return "OK" if the list of
> files is missing.

Sure.

So I will continue to just test the presence of the .lst.gz to check if 
a package is installed:
- missing: not correctly installed
- present: installed (correctly or corrupted)

-- 
Vincent Rivière

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-10-04  8:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-01 11:03 Check if a package is installed Vincent Rivière
2012-10-01 11:25 ` marco atzeri
2012-10-01 11:38   ` Vincent Rivière
2012-10-01 12:34     ` marco atzeri
2012-10-03 22:02   ` Vincent Rivière
2012-10-03 23:05     ` Larry Hall (Cygwin)
2012-10-04  8:54       ` Vincent Rivière

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).