Simple RPM repo in Gentoo


So I’ve started creating a RPM repo so I can easily update my rabbitmq consumers. Here’s how I did it !

The code

echo '=app-arch/createrepo-0.10.4 ~amd64
=dev-python/pyliblzma-0.5.3-r1 ~amd64
=app-arch/deltarpm-3.6_pre20110223-r1 ~amd64
=sys-apps/yum-3.4.3_p20130218-r1 ~amd64
=dev-util/rpmdevtools-8.5 ~amd64
=dev-util/checkbashisms-2.15.10 ~amd64' >> /etc/portage/package.keywords
echo 'app-arch/deltarpm python
app-arch/rpm python' >> /etc/portage/package.use
emerge createrepo rpmdevtools

mkdir -p /usr/src/rpm
cd /usr/src/rpm
cd /usr/src/rpm/SPECS
rpmdev-newspec serverstuff
echo '[serverstuff]
name=ServerStuff Repo
gpgcheck=0' > /usr/src/rpm/SOURCES/serverstuff.repo

echo 'Name: serverstuff-repo
Version: 1
Release: 1%{?dist}
Summary: ServerStuff Repository
BuildArch: noarch

License: GPL
Source0: serverstuff.repo

ServerStuff Repository

mkdir -p $RPM_BUILD_ROOT/etc/yum.repos.d
cp %SOURCE0 $RPM_BUILD_ROOT/etc/yum.repos.d


* Sat Feb 6 2016 root
- Initial Creation' >/usr/src/rpm/SPECS/serverstuff-repo.spec

rpmbuild -bb serverstuff-repo.spec --define "_topdir /usr/src/rpm"
# I have my apache serve from the htdocs dir
mkdir -p /var/www/
cp /usr/src/rpm/RPMS/noarch/serverstuff-repo-1-1.noarch.rpm /var/www/
createrepo /var/www/

Other issues

Now the same applies if you want to create another package. Just put it in the repo dir and run

createrepo --update /var/www/

If you’re doing this too fast, yum caches the repo and might have to do a clean metadata

yum --enablerepo=serverstuff clean metadata

Leave a Reply

Your email address will not be published. Required fields are marked *