Difference between revisions of "Creating an Eprints RPM"
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{Installation}} | {{Installation}} | ||
− | + | Most of this page assumes you are running as the root user, which is because we run our package building on virtual machines. You probably want to use a non-root user if you are on a shared machine. | |
Install rpm-build (depending on your package manager): | Install rpm-build (depending on your package manager): | ||
up2date rpm-build | up2date rpm-build | ||
− | yum install | + | yum install rpm-build |
Download the Eprints source file (eprints-x.x.x.tar.gz, version 3.0.1 and above). | Download the Eprints source file (eprints-x.x.x.tar.gz, version 3.0.1 and above). | ||
Line 15: | Line 15: | ||
The RPMs should be written to /usr/src/redhat/RPMS/ and /usr/src/redhat/SRPMS/. | The RPMs should be written to /usr/src/redhat/RPMS/ and /usr/src/redhat/SRPMS/. | ||
+ | |||
+ | ==.rpmmacros== | ||
+ | |||
+ | %_signature gpg | ||
+ | %_gpg_path /root/.gnupg | ||
+ | %_gpg_name rpm.eprints.org | ||
+ | |||
+ | %_rpmdir /root/rpm.eprints.org/repo/base | ||
+ | %_srcrpmdir /root/rpm.eprints.org/repo/base/SRPMS | ||
+ | |||
+ | ==Signing RPMs== | ||
+ | |||
+ | Install GPG if not already: | ||
+ | |||
+ | yum install gnupg | ||
+ | |||
+ | Create a personal key: | ||
+ | |||
+ | gpg --gen-key | ||
+ | |||
+ | Add the key name to .rpmmacros. | ||
+ | |||
+ | Sign one or more RPM packages: | ||
+ | |||
+ | rpm --resign xxx.rpm | ||
+ | |||
+ | See http://fedoranews.org/tchung/gpg/ for how to create a GPG key pair and signing an RPM. To avoid key warnings when using up2date or Yum all RPMs need to be signed, and the public key imported into the local system. | ||
+ | |||
+ | ===Exporting the GPG key(s)=== | ||
+ | |||
+ | Exporting the public key (publish this somewhere): | ||
+ | |||
+ | gpg --export -a my-key-name > RPM-GPG-KEY-my-key-name | ||
+ | |||
+ | Exporting the private key (keep this somewhere safe): | ||
+ | |||
+ | gpg --export-secret-key -a my-key-name > my-key-name.key | ||
==Building a Yum repository== | ==Building a Yum repository== | ||
− | Install createrepo from http://linux.duke.edu/projects/metadata/ | + | Install createrepo from http://linux.duke.edu/projects/metadata/: |
− | |||
− | |||
− | + | yum install createrepo | |
− | |||
− | |||
− | To create the repository | + | To create the repository structure: |
createrepo . | createrepo . | ||
− | + | Copy RPMs below /base/ | |
− | + | Re-run createrepo to update the metadata. | |
− | + | ==Create a yum configuration RPM== | |
− | yum- | + | Name: rpm-eprints-org |
+ | Version: 5 | ||
+ | Release: 1 | ||
+ | Summary: rpm.eprints.org Repository Configuration | ||
+ | Group: System Environment/Base | ||
+ | License: MIT | ||
+ | URL: http://www.eprints.org/software | ||
+ | Source0: RPM-GPG-KEY-rpm-eprints-org | ||
+ | Source1: rpm-eprints-org.repo | ||
+ | BuildRoot: %{_builddir}/%{name}-%{version}-rpmroot | ||
+ | BuildArch: noarch | ||
+ | Requires: redhat-release >= %{version} | ||
+ | |||
+ | %description | ||
+ | This package installs the repository GPG and repo files for the EPrints software repository. | ||
+ | |||
+ | %prep | ||
+ | %setup -c -T | ||
+ | |||
+ | %build | ||
+ | |||
+ | %install | ||
+ | rm -rf $RPM_BUILD_ROOT | ||
+ | |||
+ | # gpg | ||
+ | install -Dpm 644 %{SOURCE0} $RPM_BUILD_ROOT%{_sysconfdir}/pki/rpm-gpg/RPM-GPG-KEY-rpm-eprints-org | ||
+ | |||
+ | # yum | ||
+ | install -dm 755 $RPM_BUILD_ROOT%{_sysconfdir}/yum.repos.d | ||
+ | install -pm 644 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/yum.repos.d | ||
+ | |||
+ | %clean | ||
+ | rm -rf $RPM_BUILD_ROOT | ||
+ | |||
+ | %files | ||
+ | %defattr(-,root,root,-) | ||
+ | %{_sysconfdir}/pki/rpm-gpg/* | ||
+ | %config %{_sysconfdir}/yum.repos.d/* | ||
+ | |||
+ | %changelog | ||
+ | * Thu Apr 29 2010 Tim Brody <tdb2@ecs.soton.ac.uk> | ||
+ | - Spec file for installing rpm.eprints.org repository |
Latest revision as of 15:36, 29 April 2010
Download an appropriate EPrints Release
Most of this page assumes you are running as the root user, which is because we run our package building on virtual machines. You probably want to use a non-root user if you are on a shared machine.
Install rpm-build (depending on your package manager):
up2date rpm-build yum install rpm-build
Download the Eprints source file (eprints-x.x.x.tar.gz, version 3.0.1 and above).
Create the RPM and source RPMs (will error if there are any missing dependencies):
rpmbuild -ta eprints-x.x.x.tar.gz
The RPMs should be written to /usr/src/redhat/RPMS/ and /usr/src/redhat/SRPMS/.
Contents
.rpmmacros
%_signature gpg %_gpg_path /root/.gnupg %_gpg_name rpm.eprints.org %_rpmdir /root/rpm.eprints.org/repo/base %_srcrpmdir /root/rpm.eprints.org/repo/base/SRPMS
Signing RPMs
Install GPG if not already:
yum install gnupg
Create a personal key:
gpg --gen-key
Add the key name to .rpmmacros.
Sign one or more RPM packages:
rpm --resign xxx.rpm
See http://fedoranews.org/tchung/gpg/ for how to create a GPG key pair and signing an RPM. To avoid key warnings when using up2date or Yum all RPMs need to be signed, and the public key imported into the local system.
Exporting the GPG key(s)
Exporting the public key (publish this somewhere):
gpg --export -a my-key-name > RPM-GPG-KEY-my-key-name
Exporting the private key (keep this somewhere safe):
gpg --export-secret-key -a my-key-name > my-key-name.key
Building a Yum repository
Install createrepo from http://linux.duke.edu/projects/metadata/:
yum install createrepo
To create the repository structure:
createrepo .
Copy RPMs below /base/
Re-run createrepo to update the metadata.
Create a yum configuration RPM
Name: rpm-eprints-org Version: 5 Release: 1 Summary: rpm.eprints.org Repository Configuration Group: System Environment/Base License: MIT URL: http://www.eprints.org/software Source0: RPM-GPG-KEY-rpm-eprints-org Source1: rpm-eprints-org.repo BuildRoot: %{_builddir}/%{name}-%{version}-rpmroot BuildArch: noarch Requires: redhat-release >= %{version} %description This package installs the repository GPG and repo files for the EPrints software repository. %prep %setup -c -T %build %install rm -rf $RPM_BUILD_ROOT # gpg install -Dpm 644 %{SOURCE0} $RPM_BUILD_ROOT%{_sysconfdir}/pki/rpm-gpg/RPM-GPG-KEY-rpm-eprints-org # yum install -dm 755 $RPM_BUILD_ROOT%{_sysconfdir}/yum.repos.d install -pm 644 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/yum.repos.d %clean rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root,-) %{_sysconfdir}/pki/rpm-gpg/* %config %{_sysconfdir}/yum.repos.d/* %changelog * Thu Apr 29 2010 Tim Brody <tdb2@ecs.soton.ac.uk> - Spec file for installing rpm.eprints.org repository