Update documentation

- Update readme
- Split “list” into “list” and “listall”
- Kill short option names
- Kill --file option
- Kill --help option
This commit is contained in:
Steven Penny 2015-04-17 22:47:28 -05:00
parent 27570bae67
commit 3ca57e88d3
2 changed files with 145 additions and 131 deletions

115
README.md
View File

@ -4,70 +4,57 @@ apt-cyg
apt-cyg is a Cygwin package manager. It includes a command-line installer for apt-cyg is a Cygwin package manager. It includes a command-line installer for
Cygwin which cooperates with Cygwin Setup and uses the same repository. Cygwin which cooperates with Cygwin Setup and uses the same repository.
<table> Operations
<thead> ----------
<tr>
<th>Command</th> ~~~
<th>Description</th> install
<th>Analog</th> Install package(s).
</tr>
</thead> remove
<tbody> Remove package(s) from the system.
<tr>
<td>install</td> update
<td>Install packages</td> Download a fresh copy of the master package list (setup.ini) from the
<td>apt-get install</td> server defined in setup.rc.
</tr>
<tr> download
<td>remove</td> Retrieve package(s) from the server, but do not install/upgrade anything.
<td>Remove packages</td>
<td>apt-get&nbsp;remove</td> show
</tr> Display information on given package(s).
<tr>
<td>update</td> depends
<td>Update setup.ini</td> Produce a dependency tree for a package.
<td>apt-get&nbsp;update</td>
</tr> rdepends
<tr> Produce a tree of packages that depend on the named package.
<td>show</td>
<td>Displays the package records for the named packages</td> list
<td>apt-cache&nbsp;show</td> Search each locally-installed package for names that match regexp. If no
</tr> package names are provided in the command line, all installed packages will
<tr> be queried.
<td>list</td>
<td> listall
List packages matching given pattern. If no pattern is given, list all installed This will search each package in the master package list (setup.ini) for
packages. names that match regexp.
</td>
<td>dpkg --list</td> category
</tr> Display all packages that are members of a named category.
<tr>
<td>search</td> listfiles
<td>Search for a filename from installed packages</td> List all files owned by a given package. Multiple packages can be specified
<td>dpkg --search</td> on the command line.
</tr>
<tr> search
<td>download</td> Search for downloaded packages that own the specified file(s). The path can
<td>Download only - do NOT install or unpack archives</td> be relative or absolute, and one or more files can be specified.
<td>apt-get&nbsp;install&nbsp;--download-only</td>
</tr> searchall
<tr> Search cygwin.com to retrieve file information about packages. The provided
<td>depends</td> target is considered to be a filename and searchall will return the
<td>Performs recursive dependency listings</td> package(s) which contain this file.
<td>apt-cache depends</td> ~~~
</tr>
<tr>
<td>listfiles</td>
<td>List files owned by packages</td>
<td>dpkg --listfiles</td>
</tr>
<tr>
<td>searchall</td>
<td>Search for a filename from all available packages</td>
<td>apt-file search</td>
</tr>
</tbody>
</table>
Quick start Quick start
----------- -----------

161
apt-cyg
View File

@ -24,30 +24,83 @@
# THE SOFTWARE. # THE SOFTWARE.
mapfile usage <<+ mapfile usage <<+
usage: apt-cyg [command] [options] [packages] NAME
apt-cyg - package manager utility
Commands: SYNOPSIS
install Install packages apt-cyg [operation] [options] [targets]
remove Remove packages
update Update setup.ini
download Download only - do NOT install or unpack archives
show Displays the package records for the named packages
depends Performs recursive dependency listings
rdepends Display packages which require X to be installed,
AKA show reverse dependencies
list List packages matching given pattern. If no pattern is given,
list all installed packages.
category List packages matching given category
listfiles List files owned by packages
search Search for a filename from installed packages
searchall Search for a filename from all available packages
Options: DESCRIPTION
-c, --cache <dir> set cache apt-cyg is a package management utility that tracks installed packages on a
-f, --file <file> read package names from file Cygwin system. Invoking apt-cyg involves specifiying an operation with any
-m, --mirror <url> set mirror potential options and targets to operate on. A target is usually a package
--help name, file name, or a search string. Targets can be provided as command line
--version arguments.
OPERATIONS
install
Install package(s).
remove
Remove package(s) from the system.
update
Download a fresh copy of the master package list (setup.ini) from the
server defined in setup.rc.
download
Retrieve package(s) from the server, but do not install/upgrade anything.
show
Display information on given package(s).
depends
Produce a dependency tree for a package.
rdepends
Produce a tree of packages that depend on the named package.
list
Search each locally-installed package for names that match regexp. If no
package names are provided in the command line, all installed packages will
be queried.
listall
This will search each package in the master package list (setup.ini) for
names that match regexp.
category
Display all packages that are members of a named category.
listfiles
List all files owned by a given package. Multiple packages can be specified
on the command line.
search
Search for downloaded packages that own the specified file(s). The path can
be relative or absolute, and one or more files can be specified.
searchall
Search cygwin.com to retrieve file information about packages. The provided
target is considered to be a filename and searchall will return the
package(s) which contain this file.
OPTIONS
--nodeps
Specify this option to skip all dependency checks.
--mirror <url>
A full URL to a location where the database, packages, and signatures for
this repository can be found.
--cache <dir>
Overrides the default location of the package cache directory. A typical
default is C:\Users\John\Downloads. If a file is not found in the cache
directory, it will be downloaded. NOTE: this is an absolute path, the root
path is not automatically prepended.
--version
Display version and exit.
+ +
mapfile version <<+ mapfile version <<+
@ -124,7 +177,7 @@ function check-packages {
then then
return 0 return 0
else else
echo No packages found echo No packages found.
return 1 return 1
fi fi
} }
@ -161,20 +214,25 @@ function apt-category {
} }
function apt-list { function apt-list {
local sbq
for pkg in "${pks[@]}"
do
let sbq++ && echo
awk 'NR>1 && $1~pkg && $0=$1' pkg="$pkg" /etc/setup/installed.db
done
let sbq && return
awk 'NR>1 && $0=$1' /etc/setup/installed.db
}
function apt-listall {
check-packages
find-workspace find-workspace
local sbq local sbq
for pkg in "${pks[@]}" for pkg in "${pks[@]}"
do do
(( sbq++ )) && echo let sbq++ && echo
info Searching for installed packages matching "$pkg": awk '$1~pkg && $0=$1' RS='\n\n@ ' FS='\n' pkg="$pkg" setup.ini
awk 'NR>1 && $1~ENVIRON["pkg"] && $0=$1' /etc/setup/installed.db
echo
info Searching for installable packages matching "$pkg":
awk '$1 ~ ENVIRON["pkg"] && $0 = $1' RS='\n\n@ ' FS='\n' setup.ini
done done
(( sbq )) && return
info The following packages are installed:
awk 'NR>1 && $0=$1' /etc/setup/installed.db
} }
function apt-listfiles { function apt-listfiles {
@ -521,7 +579,7 @@ while (( $# ))
do do
case "$1" in case "$1" in
--mirror | -m) --mirror)
awk -i inplace ' awk -i inplace '
1 1
/last-mirror/ { /last-mirror/ {
@ -532,7 +590,7 @@ do
shift 2 shift 2
;; ;;
--cache | -c) --cache)
rpc=$(cygpath -aw "$2" | sed 's \\ \\\\ g') rpc=$(cygpath -aw "$2" | sed 's \\ \\\\ g')
awk -i inplace ' awk -i inplace '
1 1
@ -549,49 +607,18 @@ do
shift shift
;; ;;
--help)
printf %s "${usage[@]}"
exit 0
;;
--version) --version)
printf %s "${version[@]}" printf %s "${version[@]}"
exit 0 exit 0
;; ;;
--file | -f)
if [[ $2 ]]
then
mf=$2
if [ -f "$mf" ]
then
mapfile -t pks < "$mf"
else
echo File "$mf" not found, skipping
fi
shift
else
info No file name provided, ignoring $1
fi
shift
;;
update) update)
command=$1 command=$1
shift shift
;; ;;
install \ list | remove | depends | listall | download | listfiles |\
| remove \ show | search | install | category | rdepends | searchall )
| download \
| show \
| depends \
| rdepends \
| list \
| category \
| listfiles \
| search \
| searchall)
if [[ $command ]] if [[ $command ]]
then then
pks+=("$1") pks+=("$1")