X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/dd80ca3ca82976b94244a6d05092da5029fa0107..bb1293d975294884a95b9cb298432c9cf9ecc995:/doc/method.sgml diff --git a/doc/method.sgml b/doc/method.sgml index 756dce87f..d71ef02ea 100644 --- a/doc/method.sgml +++ b/doc/method.sgml @@ -1,10 +1,10 @@ - + APT Method Interface Jason Gunthorpe jgg@debian.org -$Id: method.sgml,v 1.1 1998/10/04 04:49:17 jgg Exp $ +$Id: method.sgml,v 1.10 2003/02/12 15:05:46 doogie Exp $ This document describes the interface that APT uses to the archive @@ -21,7 +21,7 @@ option) any later version.

For more details, on Debian GNU/Linux systems, see the file -/usr/doc/copyright/GPL for the full license. +/usr/share/common-licenses/GPL for the full license. @@ -32,8 +32,8 @@ For more details, on Debian GNU/Linux systems, see the file General

-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: @@ -82,7 +82,7 @@ Universal Resource Identifier (URI) is a super-set of the familiar URL 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: file:/var/mirrors/debian/ @@ -108,9 +108,9 @@ communication lines. The first line should have the form xxx TAG where xxx are digits forming the status code and TAG is an informational string -aquire +acquire 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 verifying the existence of the URI or actually downloading it from a remote site. @@ -125,20 +125,11 @@ a remote site.

All methods operate as a sub process of a main controlling parent. 3 FD's are opened for use by the method allowing two way communication and -emergency error reporting. The FD's corrispond to the well known unix FD's, +emergency error reporting. The FD's correspond to the well known unix FD's, stdin, stdout and stderr.

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

-Throught operation of the method communication is done via http +Through operation of the method communication is done via http style plain text. Specifically RFC-822 (like the Package file) fields are used to describe items and a numeric-like header is used to indicate what is happening. Each of these distinct communication messages should be @@ -156,7 +147,7 @@ URI's to determine how many files are available locally.

The first line of each message is called the message header. The first 3 digits (called the Status Code) have the usual meaning found in the -http protocol. 1xx is informational, 2xx is successfull and 4xx is failure. +http protocol. 1xx is informational, 2xx is successful and 4xx is failure. The 6xx series is used to specify things sent to the method. After the status code is an informational string provided for visual debugging. @@ -164,37 +155,36 @@ status code is an informational string provided for visual debugging. 100 Capabilities - Method capabilities 101 Log - General Logging 102 Status - Inter-URI status reporting (login progress) -200 URI Start - URI is starting aquire -201 URI Done - URI is finished aquire -400 URI Failure - URI has failed to aquire +200 URI Start - URI is starting acquire +201 URI Done - URI is finished acquire +400 URI Failure - URI has failed to acquire 401 General Failure - Method did not like something sent to it 402 Authorization Required - Method requires authorization to access the URI. Authorization is User/Pass 403 Media Failure - Method requires a media change -600 URI Aquire - Request a URI be aquired +600 URI Acquire - Request a URI be acquired 601 Configuration - Sends the configuration space 602 Authorization Credentials - Response to the 402 message 603 Media Changed - Response to the 403 message -605 Shutdown - Exit Only the 6xx series of status codes is sent TO the method. Furthermore the method may not emit status codes in the 6xx range. The Codes 402 and 403 require that the method continue reading all other 6xx codes -until the proper 602/603 code is recieved. This means the method must be +until the proper 602/603 code is received. This means the method must be capable of handling an unlimited number of 600 messages.

The flow of messages starts with the method sending out a 100 Capabilities and APT sending out a 601 Configuration. -After that APT begins sending 600 URI Aquire and the method +After that APT begins sending 600 URI Acquire and the method sends out 200 URI Start, 201 URI Done or -400 URI Failure. No syncronization is performed, it is expected -that APT will send 600 URI Aquire messages at -any- time and +400 URI Failure. No synchronization is performed, it is expected +that APT will send 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 -to be constantly ready to recieve them. +that APT will buffer messages so it is not necessary for the method +to be constantly ready to receive them. @@ -208,6 +198,7 @@ The following is a short index of the header fields that are supported URIURI being described by the message FilenameLocation in the filesystem Last-ModifiedA time stamp in RFC1123 notation for use by IMS checks +IMS-HitThe already existing item is valid SizeSize of the file in bytes Resume-PointLocation that transfer was started MD5-HashComputed MD5 hash for the file @@ -216,6 +207,8 @@ The following is a short index of the header fields that are supported SiteString indicating the site authorization is required for UserUsername for authorization PasswordPassword for authorization +FailOperation failed +DriveDrive the media should be placed in Config-Item A string of the form item=value derived from the APT configuration space. These may include method specific values and general @@ -223,8 +216,12 @@ values not related to the method. It is up to the method to filter out the ones it wants. Single-InstanceRequires that only one instance of the method be run This is a yes/no value. -Pre-ScanMethod can detect if archives are already available. - This is a yes/no value. +PipelineThe method is capable of pipelining. +LocalThe method only returns Filename: fields. +Send-ConfigSend configuration to the method. +Needs-CleanupThe process is kept around while the files it returned +are being used. This is primarily intended for CDROM and File URIs that need +to unmount filesystems. VersionVersion string for the method @@ -232,8 +229,11 @@ This is a list of which headers each status code can use 100 Capabilities -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 pipelining. The +only known method that does support pipelining is http. +Fields: Version, Single-Instance, Pre-Scan, Pipeline, Send-Config, +Needs-Cleanup 101 Log A log message may be printed to the screen if debugging is enabled. This @@ -242,7 +242,7 @@ Fields: Message 102 Status Message gives a progress indication for the method. It can be used to show -pre-transfer status for internet type methods. +pre-transfer status for Internet type methods. Fields: Message 200 URI Start @@ -256,17 +256,19 @@ to specify a 201 URI Done without a URI Start which would 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-* fields 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 400 URI Failure Indicates a fatal URI failure. The URI is not retrievable from this source. -As with 201 URI Done 200 URI Start is not required to preceed +As with 201 URI Done 200 URI Start is not required to precede this message Fields: URI, Message 401 General Failure -Indicates that some unspecific failure has occured and the method is unable +Indicates that some unspecific failure has occurred and the method is unable to continue. The method should terminate after sending this message. It is intended to check for invalid configuration options or other severe conditions. @@ -282,12 +284,12 @@ Fields: Site 403 Media Failure 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 -600 URI Aquire -APT is requesting that a new URI be added to the aquire list. Last-Modified +600 URI Acquire +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 601 Configuration @@ -304,19 +306,47 @@ Fields: Site, User, Password 603 Media Changed This is sent in response to a 403 Media Failure message. It indicates that the user has changed media and it is safe to proceed. -Fields: Media - -605 Shutdown -APT sends this to signal the shutdown of the method. The method should -terminate immidiately. -Fields: None +Fields: Media, Fail - + -Examples +Notes + +

+The methods supplied by the stock apt are: + +cdrom - For Multi-Disc CDROMs +copy - (internal) For copying files around the filesystem +file - For local files +gzip - (internal) For decompression +http - For HTTP servers + + +

+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: + +http://foo.com/Packages.gz -> /bar/Packages.gz +gzip:/bar/Packages.gz -> /bar/Packages.decomp +rename Packages.decomp to /final/Packages + + +

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