How does yum work ??
Michael Schwendt
mschwendt at gmail.com
Wed Jan 16 17:17:16 UTC 2008
On 16/01/2008, William Case <billlinux at rogers.com> wrote:
>
> In this case, what is metadata?
A high-level file format created to be used by various package resolver tools:
http://linux.duke.edu/projects/metadata/
> Where is it on a file (package)
It is stored in multiple files in a directory with the name "repodata"
in the same place where the RPM packages are stored. To create it you
would run createrepo in the top-level package directory to make it
fill the repodata directory with metadata for all found packages.
createrepo traverses the given directory and its sub-directories
recursively.
> and how does Yum read it?
Yum is pointed to repositories via config files in /etc/yum.repos.d/
and uses URLs to access the "repodata" directories and the files
within. Nowadays there's a metadata parser for these files:
http://linux.duke.edu/projects/yum/download/yum-metadata-parser/
> Does it use its own specialized instructions to access data or does it
> use some version of 'wget'?
From the top of my head, it uses networking methods from Python
Standard Library, e.g. urllib, instead of an external tool.
> > that contain RPM packages plus the
> > corresponding metadata archives generated by the createrepo tool.
>
> How does the creatrepotool create an archive? What is needed etc?
Put some RPM packages into a directory, run "createrepo" in or above
that directory. See "man createrepo". Notice the "repodata" directory
and the files within it which are created.
$ rpm -qf $(which createrepo)
createrepo-0.4.11-1.fc8
> I suppose analyzing how createreptool creates an archive answers most of
> the metadata questions? Where would I find an *explanation* of how to
> go about creating a repo or a package for a repo?
You can put any RPM package into such a repository. And yes, reading
the source would help here.
$ rpm -ql createrepo | grep .py$
/usr/share/createrepo/dumpMetadata.py
/usr/share/createrepo/genpkgmetadata.py
/usr/share/createrepo/modifyrepo.py
/usr/share/createrepo/readMetadata.py
> Where, and more importantly what is the info regarding each package
> stored in the local RPM database?
It's similar to all the package details you can query with rpm, e.g.
$ rpm --query --requires glibc
glibc-common = 2.7-2
basesystem
libgcc
/usr/sbin/glibc_post_upgrade.i686
/sbin/ldconfig
rpmlib(PartialHardlinkSets) <= 4.0.4-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rpmlib(CompressedFileNames) <= 3.0.4-1
and the many other queries that are covered by "man rpm".
Yum/createrepo do it via the RPM Python API, however, instead of
low-level C/C++.
> How does yum find it and read it?
I've answered that in the previous reply. Yum parses repository
metadata files and also queries the local RPM database via RPM's API.
> * What precisely is a package?
http://rpm.org/ answers that one the first page.
> * What and Where is this temp directory?
That's implementation-dependent and a low-level question.
> * What checks are it running (you have alluded to them above)?
> * What exactly is a *transaction*?
Transaction is a database related term here and covers the full set of
changes to be applied to the local installation *and* in the RPM
database:
http://en.wikipedia.org/wiki/Database_transaction
> * What does cleaning up (cleanall etc.) mean? Is something being
> removed or just changed?
Roughly, there's stuff to do *after* replacing an old version of a
package installed on your system with a newer version.
More information about the fedora-list
mailing list