delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2015/01/02/20:56:47

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:message-id:date:subject:from:to:mime-version
:content-type:content-transfer-encoding; q=dns; s=default; b=vXj
FEdti0vlsmQFXdsQUWPrx8m901k001uEun9H7DXasRwBSc8souGIaF3EHaTbn/Cp
tLzKvDB9gt0qQiaZGG1cpd9MalDYVV2Cx9+J7NSK5dCOWW+s0yLwaqN8C8X7jJA6
w+ei5tdNmAPLBrVSVq517vjxJpCkro/PAlolB278=
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:message-id:date:subject:from:to:mime-version
:content-type:content-transfer-encoding; s=default; bh=00iYIo/9j
3WYPqGMrKj+zu8YtK4=; b=bxcLMZsFZiXyUc2U5UGNfPxJXElWX/KM73zoFDvze
uA4maJqvGOwHQzvHeB5KogxO6yX6qes2e8po1xLrvO+nnd8YyCpds1sfM2Kz0sGd
GMWv6jMVRYFwOkTyebhidpeV9X5dldJ0XzD2ZeN+UBHKIcVqz+Abm6HM5LHYe+/p
Rc=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
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=-1.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2
X-HELO: lb2-smtp-cloud6.xs4all.net
Message-ID: <946e28a6f38de35f8ff3a2be5155d857.squirrel@webmail.xs4all.nl>
Date: Sat, 3 Jan 2015 02:56:23 +0100
Subject: Re: A list of installed packages (no dependencies) -- this may help
From: "Houder" <houder AT xs4all DOT nl>
To: cygwin AT cygwin DOT com
User-Agent: SquirrelMail/1.4.18
MIME-Version: 1.0
X-IsSubscribed: yes

> Is there in Cygwin a command to recover a list of installed packages chosen by
> the user without the dependencies?
>
> For example, the archlinux package manager with
>
> pacman -Qqe > pkglist

> can save the list of package chosen by the user only and this is useful in case
> one wants/needs to reinstall all the packages.

Hi Angelo,

I replied to your entry in an earlier attempt, but my reply got stuck in the machinery
at sourceware.org (my message had a shell script and a .bat file attached).

Below (I hope) you will find a script, that may be of help to you ...

It computes the "top vertices" of the forest (i.e. the dependency graph), i.e. the pkgs
that no other pkg depends on (within the context of a specific installation of Cygwin).

In my case, it reduced a list of 161 pkgs to one of only (about) 15 pkgs.

(using a .bat file - quiet-install.bat - which I will attempt to include as well, I
 installed Cygwin afresh and verified the result)

Of course your situation may be different from mine ... then somebody else may find good
use of the script.

Henri

top-sters-sh:

#!/bin/bash

# compute the top vertices of the forest (the dependency graph), i.e. the packages that no other package depends on.

case $(uname -s) in
*WOW64)
setup_ini='/drv/e/_cygwin_repository/http%3a%2f%2fftp.snt.utwente.nl%2fpub%2fsoftware%2fcygwin%2f/x86/setup.ini' ;;
*)     
setup_ini='/drv/e/_cygwin64_repository/http%3a%2f%2fftp.snt.utwente.nl%2fpub%2fsoftware%2fcygwin%2f/x86_64/setup.ini'
;;
esac

( awk '
NR == 1 { next }
        {
          if ($1 ~ /-debuginfo/) next # skip -debuginfo packages
          printf "%s\n", $1
        }' /etc/setup/installed.db
# each 'requires: line' WILL be preceeded by a corresponding '@ <package>' line
awk '
/^@ /   { left = $2; next }
/^requires: / \
        {
          if (left ~ /-debuginfo$/) next # skip the -debuginfo pkgs (irrelevant pkgs for regular users)
          printf "%s", left
          for (i = 2; i <= NF; ++i) {
            if ($i ~ /-debuginfo$/) continue # skip any -debuginfo pkg (never reached)
            printf " %s", $i

          }
          printf "\n"
        } ' $setup_ini ) | sort | \
awk '
# pkg1 <==== must be printed (even in case the following line is missing)
# pkg1 pkg2 ...
BEGIN   { pkg = "" }
NF == 1 {
          if (pkg != "") { # pkg wo dependencies
            printf "%s\n", pkg
          }
          pkg = $1
          next
        }
NF > 1  {
          if (pkg == "") next
          if ($1 == pkg) {
            printf "%s\n", $0
          } else { # pkg wo dependencies
            printf "%s\n", pkg
          }
          pkg = ""
        } ' | \
awk '
# pkg1 [ pkg2 ... ]
        {
          for (j = 1; j <= NF; j++) {
            # keep count of number of pkgs that depend on a pkg (for each pkg)
            if ($j in ary) {
              ary[$j]++
            } else {
              ary[$j] = 0
            }
          }
        }
END     {
          for (elm in ary) {
           if (ary[elm] == 0) {
            printf "%s\n", elm
           }
          }
        } ' | sort # sort, as arrays are indexed by string values in awk

exit # <==== !!!!!

# each 'requires: line' WILL be preceeded by a corresponding '@ <package>' line
awk '
/^@ /   { left = $2; next }
/^requires: / \
        {
          if (left ~ /-debuginfo$/) next # skip the -debuginfo pkgs (irrelevant pkgs for regular users)
          if ($0 ~ /-debuginfo/) { # test: none of the regular packages should depend on a -debuginfo pkg
            printf "%s %s\n", left, $0
          }
        } ' $setup_ini

#=====

quiet-install.bat:

@echo off

e:/_cygwin64_repository/setup-x86_64 -q -L -n -N -d -M -A -a x86_64 -R e:/Cygwin64 -l e:/_cygwin64_repository -P ^
base-files,^
<pkg>,^
...
<last-pkg>

::=====


--
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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019