X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:content-type:message-id:mime-version :subject:date:references:to:in-reply-to; q=dns; s=default; b=UvP boqP+Qy08uZ/QCCoczLqPOyToUeRvyYAr6vShYvxp/qHyT06z5hbw82+j6SBLXs2 JERYOMXJ+QKqgkqfcAsz+1uNvXOPHxGLp57nsOOjUf8xf10OkdI2ezcT0edGwcv6 3TJYPo9hHKPYUt1hCOwH3nJIHWH7NS0GNyqTfatU= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:content-type:message-id:mime-version :subject:date:references:to:in-reply-to; s=default; bh=B1gSchwW9 HvYWpGeRIcvR2GTFmk=; b=GDDQyNRsTU2aoSwd3VID8A9X4soTfsljgaefWO6w1 kIdVrerEDubxyfnvoPva/SFdj2Z5VxdZWYIZukCipyOwKXtWa1AqhKV5kmEGQkE7 APyz7cWA/CDof8DQWg5NsPli6EW5tI5QHuBgTd+4KQYe6Wr8Q2WzaoqpgUJlNW31 Fk= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.2 required=5.0 tests=AWL,BAYES_40,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=fifth, Attached, H*c:MHil, indirectly X-HELO: etr-usa.com From: Warren Young Content-Type: multipart/mixed; boundary="Apple-Mail=_F1491F0D-7E12-430C-B8AB-7307A2C432F0" Message-Id: <98C319EE-D0EF-48CD-85D7-3384DA5051A9@etr-usa.com> Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: Anecdotal: Rebase and Visual Studio 2015 and /etc Date: Fri, 1 Jul 2016 16:40:24 -0600 References: <693uFCmXF1392S07 DOT 1467203045 AT web07 DOT cms DOT usa DOT net> <3334CBDB-BF42-4CDA-83B5-CCA5B251A746 AT etr-usa DOT com> To: The Cygwin Mailing List In-Reply-To: <3334CBDB-BF42-4CDA-83B5-CCA5B251A746@etr-usa.com> X-IsSubscribed: yes --Apple-Mail=_F1491F0D-7E12-430C-B8AB-7307A2C432F0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 On Jul 1, 2016, at 1:35 PM, Warren Young wrote: >=20 > To clone an existing install using setup.exe: >=20 > $ /path/to/setup-x86_64 -R 'c:\cygwin-clone' -q -L \ > -P $(tail -n+2 installed.db | cut -f1 -d' ' | tr '\n' ,) [snip] > ...you can prune the long list produced by that $() construct way down I=E2=80=99ve written a script to do that automatically. (Attached.) It takes the raw list parsed from installed.db using the scheme above and a= copy of the setup.ini file downloaded by setup.exe and removes all =E2=80= =9Cnon-root=E2=80=9D packages, being those that will be installed indirectl= y by some other package on that list. It cut my largest local Cygwin installation=E2=80=99s package list down to = about a fifth the size spewed out by the command above. Enjoy! --Apple-Mail=_F1491F0D-7E12-430C-B8AB-7307A2C432F0 Content-Disposition: attachment; filename=find-cyg-roots Content-Type: application/octet-stream; name="find-cyg-roots" Content-Transfer-Encoding: 7bit #!/usr/bin/perl use strict; use warnings; my $prgname = $0; #### parse_command_line ################################################ # Return a digested form of the command line arguments sub parse_command_line { my ($pn, $inifile) = @_; usage() unless defined($inifile); my @pkgnames = split ',', $pn; usage("no packages given") if @pkgnames == 0; usage("cannot read INI file") unless -r $inifile; return ($inifile, \@pkgnames); } #### parse_cygwin_setup_ini_file ####################################### # Extract dependency info from the Cygwin setup.ini file. sub parse_cygwin_setup_ini_file { my ($inifile, $piref) = @_; open my $ini, '<', $inifile or die "Cannot read INI file $inifile: $!\n"; # Skip to first package entry while (<$ini>) { last if /^@/; } # Parse package entries my %deps; while (defined $_) { chomp; my $p = substr $_, 2; my $obs = 0; while (<$ini>) { if (/^@/) { # Found next package entry; restart outer loop last; } elsif (/^category: Base$/) { # Mark this one as a special sort of root package: one # we're going to install regardless of user selection, # so we need not list it in our output. $piref->{$p} = 2; } elsif (/^category: _obsolete$/) { # Select this package's replacement instead below. $piref->{$p} = 0; $obs = 1; } elsif (/^requires:/) { # Save this package's requirements as its dependents list. my ($junk, @deps) = split; $deps{$p} = \@deps; # If this package was marked obsolete above, select its # replacement as provisionally to-be-installed. That # package still might end up removed from our output list # if it in turn is a dependent of one of the packages we # consider a "root" package at the end. $piref->{$deps[0]} = 1 if $obs; } } } close $ini; return \%deps; } #### usage ############################################################# # Print usage message plus optional error string, then exit sub usage { my ($error) = @_; print "ERROR: $error\n\n" if length($error); print <<"USAGE"; usage: $prgname packages ini-path packages is a comma-separated list of Cygwin package names, as produced by: \$ tail -n+2 /etc/setup/installed.db | cut -f1 -d' ' | tr '\\n' , ini-path is the path to a Cygwin setup.ini file. USAGE exit ($error ? 1 : 0); } #### main ############################################################## my ($inifile, $pkgnames) = parse_command_line(@ARGV); # Convert package list to a hash so we can mark them non-root by name my %packages = map { $_ => 1 } @$pkgnames; my $deps = parse_cygwin_setup_ini_file($inifile, \%packages); # For each given package name, mark any of its dependencies also found # on the command line as as non-root. for my $p (@$pkgnames) { my $pdref = $deps->{$p}; for my $d (@$pdref) { $packages{$d} = 0; } } # Collect list of root packages and print it out print join ',', sort(grep { $packages{$_} == 1 } @$pkgnames); --Apple-Mail=_F1491F0D-7E12-430C-B8AB-7307A2C432F0 Content-Type: text/plain; charset=us-ascii -- 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 --Apple-Mail=_F1491F0D-7E12-430C-B8AB-7307A2C432F0--