[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: any clear description of sources.list format and apt interpretation?



On Sun, Feb 20, 2000 at 01:57:53PM -0500, Daniel Barclay wrote:
> 
> Where can I get a clear and consistent specification of how apt-get 
> interprets a sources.list file?  

Read the source? ... Actually, i don't think it's explicitly stated
anywhere else.

> What is unclear is exactly how apt-get maps to full directory names or URIs 
> from the various pieces (initial URI or directory, distribution name, and 
> component names given in sources.list, and "Filename:" entries in Packages 
> files).

I'll try to explain. Hopefully i have everything right ;)

> Specifically:
> - Does apt-get assume or require directory "dists" somewhere in the 
>   directory hierarchy?
>
>   I can't tell whether apt-get is hard-coded to add "dists" at some level,
>   apt-get defaults to that but can be overridden, or "dists" comes from the 
>   "Filename:" entries in some Packages.gz files.

See below. I'll be using variables to make discussion easier. As you
know, there's two line formats:
  deb $base $distribution $component $component ...
  deb $base $distribution/

In the Packages file, there's a field formatted like this:
  Filename: $field_Filename

$arch is your archetecture, e.g. i386. "dpkg --print-architecture" will
tell you.

> - How _exactly_ does apt-get assemble the URI, the distribution name, and
>   any component names to find Packages.gz files?  

There's two formats for a sources.list entry. With components, it plugs
it into a format something like this for finding the Package file
  $(base)/dists/$(distribution)/$(component)/binary-$(arch)/Packages[.gz]

Without components, it just puts things together like this, no 'dists':
  $(base)/$(distribution)/Packages[.gz]
 
> - How _exactly_ does apt-get combine the URI, distribution, and component 
>   names with the pathnames in "Filename:" entries in Packages files to find
>   *.deb files?

For finding files to download, it adds the Filename entry to $(base):
  $(base)/$(field_Filename)

> That is, how can I figure out exactly how I must name and organize local 
> directories for local mirrors of Debian, KDE, or GNOME releases, and how 
> can I figure out exactly how to construct source.list entries to point to 
> those local mirrors?

Put together, $base and $field_Filename should completely specify the
URI to the file. Put together by the rules above, $base, $distribution,
and components should lead to the Packages[.gz] file.

You can use dpkg-scanpackages, from the dpkg-dev package, to rebuild
the Packages file if necessary.

> The manual page for sources.list (at least version 0.3.10slink11) is
> quite ambiguous and also contradicts itself, leaving several things 
> unclear:
> 
> * The sources.list manual page says that the URI field "must specify the 
>   base of the Debian distribution."  
> 
>   Which directory is the "base"?  
>   
>   For "ftp://ftp.debian.org/pub/debian/dists/slink/main/...";, which level is
>   the base of the distribution?  Is it:
>   - "ftp://ftp.debian.org/pub/debian/dists/slink";, 
>   - "ftp://ftp.debian.org/pub/debian/dists";, or
>   - "ftp://ftp.debian.org/pub/debian"; ?
>   That is, is the base URI the directory that contains "dists"? the one
>   that contains the directory named by the "distribution" field in the
>   source.list line?

$base is "ftp://ftp.debian.org/pub/debian";
$distribution is "slink"
$component is "main"
Packages.gz is in
  ftp://ftp.debian.org/pub/debian/dists/slink/main/binary-$(arch)/
In Packages.gz, $field_Filename is such that the deb is at
  ftp://ftp.debian.org/pub/debian/$field_Filename

>   (Also, does it matter whether the base URI ends with a slash?)

i believe $base shouldn't end with a slash. i don't know if it matters,
i've never tested it.

> * Soon after, the manual page says:
>     distribution can specify an exact path, in which case the components 
>     must be omitted and distribution must end with a slash (/). ... If 
>     distribution does not specify an exact path, at least one component 
>     must be present.
> 
>   However, about four paragraphs down, it says:
>   
>     Some examples:
> 
>     deb http://http.us.debian.org/debian stable  main  contrib non-free
> 
>     deb http://http.us.debian.org/debian dists/stable-updates
> 
>   In the second example, the distribution field does not end with a slash,
>   but the components are omitted.  That directly contradicts what was
>   specified above.  

Looks like a bug in the manpage to me... Still present in the latest
unstable apt, too.

Putting that line into my sources.list makes apt give an error.

> So, is there any complete (and correct) description of how apt-get 
> manipulates all these pieces of file pathnames?

I hope this came close ;)


-- 
  finger for GPG public key.

Attachment: pgpyEHHp6L_Rx.pgp
Description: PGP signature


Reply to: