Subject: how do I uninstall a cygwin snapshot?
From: Yitzchak Scott-Thoennes <[email-masked]>
To: [email-masked]
Date: Sun, 19 Dec 2004 10:55:19 -0800

(Subject phrased as a question for the archives.)

If you just installed a cygwin1-ccyymmdd.dll.bz2 snapshot, stop all cygwin
services and reinstall the cygwin package (or reinstall the cygwin package
and then reboot).

If you installed a cygwin-inst-ccyymmdd.tar.bz2 snapshot, do the same,
but in addition to the cygwin package, you may occasionally need to
reinstall additional packages or delete files that do not have a
package, depending on what all was changed in the snapshot.

This perl script, given a tarball name, will identify which files from
which packages are present in a snapshot.  For correct identification,
you need to have previously installed the relevant packages via setup.

#!/usr/bin/perl
use warnings;
use strict;
my @files = `tar tjf $ARGV[0]`
   or die "error getting file list from $ARGV[0]\n";
@files = map { s!(.*?)\r?\n!/$1!; m!/\z! ? () : $_ } @files;
my %files;
my %pkgs;
@files{@files}=@files;
while (keys %files) {
   my $file = each %files;
   my $pkg = `cygcheck -f $file`;
   if ($pkg) {
      $pkg =~ s/-[-\d.]+\r?\n//;
      my @pkgfiles = map { s/\r?\n//; $_} `cygcheck -l $pkg`;
      my @found = grep defined, delete @files{@pkgfiles}
         or die "cygcheck inconsistent for $file/$pkg\n";
      push @{$pkgs{$pkg}}, (@found == @pkgfiles) ? "all" : @found;
   } else {
      push @{$pkgs{"no package"}}, delete $files{$file};
   }
}
for my $pkg (sort keys %pkgs) {
   print "$pkg:\n";
   print "   $_\n" for @{$pkgs{$pkg}};
}

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