Product SiteDocumentation Site

Chapter 8. Advanced YUM repository management

8.1. Repository creation with createrepo
8.2. Query repositories with repoquery
8.3. Groups management with yum-groups-manager
8.4. Creating YUM mirrors with reposync
8.5. Web browsable repositories with repoview
8.6. Unresolved dependencies with repoclosure
8.7. Package tracking with repotrack
We eill examin all the native tools available in Fedora for the YUM repository management.

8.1. Repository creation with createrepo

In this section we will create an example yum repository from a set of rpm packages. But first it is necessary to install the createrepo tool.
# yum install createrepo
# createrepo -h
Usage: genpkgmetadata.py [options]

Options:
  --version             show program's version number and exit
  -h, --help            show this help message and exit
  -q, --quiet           output nothing except for serious errors
  -v, --verbose         output more debugging info.
  --profile             output timing/profile info.
  -x EXCLUDES, --excludes=EXCLUDES
                        files to exclude
  --basedir=BASEDIR     basedir for path to directories
  -u BASEURL, --baseurl=BASEURL
                        baseurl to append on all files
  -g GROUPFILE, --groupfile=GROUPFILE
                        path to groupfile to include in metadata
  -s SUMTYPE, --checksum=SUMTYPE
                        specify the checksum type to use (default: sha256)
  -p, --pretty          make sure all xml generated is formatted
  -c CACHEDIR, --cachedir=CACHEDIR
                        set path to cache dir
  -C, --checkts         check timestamps on files vs the metadata to seeif we
                        need to update
  -d, --database        create sqlite database files
  --update              use the existing repodata to speed up creation of new
  --update-md-path=UPDATE_MD_PATH
                        use the existing repodata  for --update from this path
  --skip-stat           skip the stat() call on a --update, assumes if the
                        filename is the same then the file is still the
                        same(only use this if you're fairly trusting or
                        gullible)
  --split               generate split media
  -i PKGLIST, --pkglist=PKGLIST
                        use only the files listed in this file from
                        thedirectory specified
  -n INCLUDEPKG, --includepkg=INCLUDEPKG
                        add this pkg to the list - can be specified multiple
                        times
  -o OUTPUTDIR, --outputdir=OUTPUTDIR
                        <dir> = optional directory to output to
  -S, --skip-symlinks   ignore symlinks of packages
  --changelog-limit=CHANGELOG_LIMIT
                        only import the last N changelog entries
  --unique-md-filenames
                        include the file's checksum in the filename,helps with
                        proxies
  --distro=DISTRO       distro tag and optional cpeid:
                        --distro'cpeid,textname'
  --content=CONTENT_TAGS
                        tags for the content in the repository
  --revision=REVISION   user-specified revision for this repository
  --deltas              create delta rpms and metadata
  --oldpackagedirs=OLDPACKAGE_PATHS
                        paths to look for older pkgs to delta against
  --num-deltas=NUM_DELTAS
                        the number of older versions to make deltas against

The procedure is simple, we have to create a directory to hold the repository, put the rpms provided by developers and packagers there, and then execute createrepo specifying the directory where the rpms reside.
# mkdir /var/www/html/x86_64/
# cp -ar /home/makerpm/rpmbuild/RPMS/x86_64/*rpm /var/www/html/x86_64/
# createrepo --verbose /var/www/html/x86_64/
1/14 - dhcp_probe-1.3.0-2.fc13.x86_64.rpm
2/14 - dhcp_probe-debuginfo-1.3.0-2.fc13.x86_64.rpm
3/14 - rubygem-pg-0.9.0-1.fc13.x86_64.rpm
4/14 - dhcp_probe-1.3.0-4.fc13.x86_64.rpm
5/14 - iptables-debuginfo-1.4.5-1.fc12.x86_64.rpm
6/14 - passenger-debuginfo-2.2.15-1.fc13.x86_64.rpm
7/14 - iptables-ipv6-1.4.5-1.fc12.x86_64.rpm
8/14 - dhcp_probe-debuginfo-1.3.0-4.fc13.x86_64.rpm
9/14 - iptables-devel-1.4.5-1.fc12.x86_64.rpm
10/14 - dhcp_probe-debuginfo-1.3.0-3.fc13.x86_64.rpm
11/14 - dhcp_probe-1.3.0-3.fc13.x86_64.rpm
12/14 - dhcp_probe-debuginfo-1.3.0-1.fc13.x86_64.rpm
13/14 - passenger-2.2.15-1.fc13.x86_64.rpm
14/14 - iptables-1.4.5-1.fc12.x86_64.rpm

Saving Primary metadata
Saving file lists metadata
Saving other metadata
It can be easily checked that the previous process has created a repodata directory with the metadata representing and conforming the new repository.
# ls /var/www/html/x86_64/repodata/
filelists.xml.gz  other.xml.gz  primary.xml.gz  repomd.xml
Once the metadata for the YUM repository is created, it is time to make it available. In this example we will create a local configuration using the file:/// access method that will allow us to access the recently created repository.
/etc/yum.repos.d/rubyera.repo
[rubyera]
name=Rubyera repo
baseurl=file:///var/www/html/x86_64
enabled=1
gpgcheck=0
To verify the availability of the new repository the repoquery tool can be used.
# repoquery -q --repoid=rubyera -a
dhcp_probe-0:1.3.0-4.fc13.x86_64
dhcp_probe-debuginfo-0:1.3.0-4.fc13.x86_64
iptables-0:1.4.5-1.fc12.x86_64
iptables-debuginfo-0:1.4.5-1.fc12.x86_64
iptables-devel-0:1.4.5-1.fc12.x86_64
iptables-ipv6-0:1.4.5-1.fc12.x86_64
passenger-0:2.2.15-1.fc13.x86_64
passenger-debuginfo-0:2.2.15-1.fc13.x86_64
rubygem-pg-0:0.9.0-1.fc13.x86_64