<title>APT Method Interface </title>
<author>Jason Gunthorpe <email>jgg@debian.org</email></author>
-<version>$Id: method.sgml,v 1.1 1998/10/04 04:49:17 jgg Exp $</version>
+<version>$Id: method.sgml,v 1.6 1998/12/14 04:00:34 jgg Exp $</version>
<abstract>
This document describes the interface that APT uses to the archive
<sect>General
<p>
-The APT method interface allows APT to aquire archive files (.deb), index
-files (Packages, Revision, Mirrors) and source files (.tar.gz, .diff). It
+The APT method interface allows APT to acquire archive files (.deb), index
+files (Packages, Release, Mirrors) and source files (.tar.gz, .diff). It
is a general, extensible system designed to satisfy all of these
requirements:
syntax used by web browsers. It consists of an access specification
followed by a specific location in that access space. The form is
<access>:<location>. Network addresses are given with the form
-<access>://[<user>:<pas>>@]hostname[:port]/<location>.
+<access>://[<user>[:<pas>]@]hostname[:port]/<location>.
Some examples:
<example>
file:/var/mirrors/debian/
where xxx are digits forming the status code and TAG is an informational
string
-<tag>aquire<item>
+<tag>acquire<item>
The act of bring a URI into the local pathname space. This may simply
-be verifiying the existance of the URI or actually downloading it from
+be verifiying the existence of the URI or actually downloading it from
a remote site.
</taglist>
emergency error reporting. The FD's corrispond to the well known unix FD's,
stdin, stdout and stderr.
-<p>
-The basic startup sequence depends on how the method is invoked. If any
-command line arguments are passed then the method should start in
-automatic mode. This facility is provided soley to make the methods
-easier to test and perhaps use outside of APT. Upon startup the method
-will print out a header describing its capabilities and requirements.
-After that it either begins processing the command line arugments and
-exits when done or waits for commands to be fed to it.
-
<p>
Throught operation of the method communication is done via http
style plain text. Specifically RFC-822 (like the Package file) fields
<item>100 Capabilities - Method capabilities
<item>101 Log - General Logging
<item>102 Status - Inter-URI status reporting (login progress)
-<item>200 URI Start - URI is starting aquire
-<item>201 URI Done - URI is finished aquire
-<item>400 URI Failure - URI has failed to aquire
+<item>200 URI Start - URI is starting acquire
+<item>201 URI Done - URI is finished acquire
+<item>400 URI Failure - URI has failed to acquire
<item>401 General Failure - Method did not like something sent to it
<item>402 Authorization Required - Method requires authorization
to access the URI. Authorization is User/Pass
<item>403 Media Failure - Method requires a media change
-<item>600 URI Aquire - Request a URI be aquired
+<item>600 URI Acquire - Request a URI be acquired
<item>601 Configuration - Sends the configuration space
<item>602 Authorization Credentials - Response to the 402 message
<item>603 Media Changed - Response to the 403 message
-<item>605 Shutdown - Exit
</list>
Only the 6xx series of status codes is sent TO the method. Furthermore
<p>
The flow of messages starts with the method sending out a
<em>100 Capabilities</> and APT sending out a <em>601 Configuration</>.
-After that APT begins sending <em>600 URI Aquire</> and the method
+After that APT begins sending <em>600 URI Acquire</> and the method
sends out <em>200 URI Start</>, <em>201 URI Done</> or
<em>400 URI Failure</>. No syncronization is performed, it is expected
-that APT will send <em>600 URI Aquire</> messages at -any- time and
+that APT will send <em>600 URI Acquire</> messages at -any- time and
that the method should queue the messages. This allows methods like http
to pipeline requests to the remote server. It should be noted however
that APT will buffer messages so it is not neccessary for the method
<tag>URI<item>URI being described by the message
<tag>Filename<item>Location in the filesystem
<tag>Last-Modified<item>A time stamp in RFC1123 notation for use by IMS checks
+<tag>IMS-Hit<item>The already existing item is valid
<tag>Size<item>Size of the file in bytes
<tag>Resume-Point<item>Location that transfer was started
<tag>MD5-Hash<item>Computed MD5 hash for the file
<tag>Site<item>String indicating the site authorization is required for
<tag>User<item>Username for authorization
<tag>Password<item>Password for authorization
+<tag>Fail<item>Operation failed
+<tag>Drive<item>Drive the media should be placed in
<tag>Config-Item<item>
A string of the form <var>item</>=<var>value</> derived from the APT
configuration space. These may include method specific values and general
the ones it wants.
<tag>Single-Instance<item>Requires that only one instance of the method be run
This is a yes/no value.
-<tag>Pre-Scan<item>Method can detect if archives are already available.
- This is a yes/no value.
+<tag>Pipeline<item>The method is capable of pipelining.
+<tag>Local<item>The method only returns Filename: feilds.
+<tag>Send-Config<item>Send configuration to the method.
<tag>Version<item>Version string for the method
</taglist>
<taglist>
<tag>100 Capabilities<item>
-Displays the capabilities of the method.
-Fields: Version, Single-Interface, Pre-Scan
+Displays the capabilities of the method. Methods should set the
+pipeline bit if their underlying protocol supports pipeling. The
+only known method that does support pipelining is http.
+Fields: Version, Single-Instance, Pre-Scan, Pipeline, Send-Config
<tag>101 Log<item>
A log message may be printed to the screen if debugging is enabled. This
mean no data was transfered but the file is now available. A Filename
field is specified when the URI is directly available in the local
pathname space. APT will either directly use that file or copy it into
-another location.
+another location. It is possible to return Alt-* feilds to indicate that
+another possibility for the URI has been found in the local pathname space.
+This is done if a decompressed version of a .gz file is found.
Fields: URI, Size, Last-Modified, Filename, MD5-Hash
<tag>400 URI Failure<item>
<tag>403 Media Failure<item>
A method that deals with multiple media requires that a new media be inserted.
The Media field contains the name of the media to be inserted.
-Fields: Media
+Fields: Media, Drive
-<tag>600 URI Aquire<item>
-APT is requesting that a new URI be added to the aquire list. Last-Modified
+<tag>600 URI Acquire<item>
+APT is requesting that a new URI be added to the acquire list. Last-Modified
has the time stamp of the currently cache file if applicable. Filename
-is the name of the file that the aquired URI should be written to.
+is the name of the file that the acquired URI should be written to.
Fields: URI, Filename Last-Modified
<tag>601 Configuration<item>
<tag>603 Media Changed<item>
This is sent in response to a <em>403 Media Failure</> message. It
indicates that the user has changed media and it is safe to proceed.
-Fields: Media
-
-<tag>605 Shutdown<item>
-APT sends this to signal the shutdown of the method. The method should
-terminate immidiately.
-Fields: None
+Fields: Media, Fail
</taglist>
</sect>
<!-- }}} -->
-<!-- Examples {{{ -->
+<!-- Method Notes {{{ -->
<!-- ===================================================================== -->
-<sect>Examples
+<sect>Notes
+
+<p>
+The methods supplied by the stock apt are:
+<enumlist>
+<item>cdrom - For Multi-Disc CDROMs
+<item>copy - (internal) For copying files around the filesystem
+<item>file - For local files
+<item>gzip - (internal) For decompression
+<item>http - For HTTP servers
+</enumlist>
+
+<p>
+The two internal methods, copy and gzip, are used by the acquire code to
+parallize and simplify the automatic decompression of package files as well
+as copying package files around the file system. Both methods can be seen to
+act the same except that one decompresses on the fly. APT uses them by
+generating a copy URI that is formed identically to a file URI. The destination
+file is send as normal. The method then takes the file specified by the
+URI and writes it to the destination file. A typical set of operations may
+be:
+<example>
+http://foo.com/Packages.gz -> /bar/Packages.gz
+gzip:/bar/Packages.gz -> /bar/Packages.decomp
+rename Packages.decomp to /final/Packages
+</example>
+
+<p>
+The http method implements a fully featured HTTP/1.1 client that supports
+deep pipelining and reget. It works best when coupled with an apache 1.3
+server. The file method simply generates failures or success responses with
+the filename field set to the proper location. The cdrom method acts the same
+except that it checks that the mount point has a valid cdrom in it. It does
+this by (effectively) computing a md5 hash of 'ls -l' on the mountpoint.
</sect>
<!-- }}} -->