What is createrepo(8)
?
createrepo(8)
is a python(1)
script which reads the RPM metadata and creates XML files that yum(8)
can use to determine what a RPM package provides, requires and may conflict with. To find out more details visit the createrepo(8)
web site.
Why put a Linux RPM utility on a FreeBSD system?
I recently decided to convert my home web/VMware server over to FreeBSD from CentOS. I just purchased a Mac mini (more about that in a future posting) to become my new VMware server, using VMware Fusion, so I had no reason to stick with a CentOS/Linux system. I am a FreeBSD contributor and really want to work more with it more than just in VMs (i.e. using zfs/zpools on real spinning disks, etc).
My home webserver supports a few applications, including a yum(1)
repository for my VMs. I use createrepo(8)
on the old CentOS system to keep the metadata up to date.
Packages Needed
This is the list of packages I installed via pkg_add(8)
- createrepo
- rpm5
- python26
- py26-yum-metadata-parser
- py26-urlgrabber
- py26-sqlite3
- sqlite3
- py26-libxml2
- libxml2
- yum
Bugs and Issues
The first problem I had with the createrepo(8)
package was keeping the correct version of python and its require modules in sync. I decided on staying with the python 2.6 version as most of the modules were already prebuilt. I just had to remember to stick the ‘py26-‘ prefix on everything.
rpm vs rpm5
Once I had the python modules all worked out the second problem I had was with the python rpm module. Usually this comes with the rpm package itself but when do you a
pkg_add -r rpm
you only get rpm-3.x version. Even if you do the
pkg_add -r rpm4
this does not have the python module. You need to use rpm5.
yum
The one last python module you need is the yum(8)
module. This come with a new, and yet unreleased, port of yum(8)
. See ports/150541 to create the yum entry in your ports tree.
The last problem I found was with the createrepo(8)
package itself. It was mis-identifying the python(1)
interpreter in the /usr/local/share/createrepo directory. It had:
#!/usr/local/bin/python2.6python -t
I wound up editing all 3 files in the directory to have this:
#!/usr/local/bin/python2.6 -t
But the error message you will see is quite cryptic:
# createrepo
exec: /usr/local/share/createrepo/genpkgmetadata.py: not found
These errors also have been reported in ports/160397