DRY up test harness to use spec file for build deps

Ensure build deps are consistent across the spec file and test harness.

Note: http://fedoraproject.org/wiki/HOWTOFindMissingBuildRequires
says that some packages should not be BuildRequires because
"they would occur too often" and "are considered the minimum build
environment." However, Docker changes the scope of that assumption
to keep docker images small.
This commit is contained in:
Paul Morgan 2014-05-26 19:40:03 +00:00
parent b3e0827d2c
commit ea7404d6a5
6 changed files with 63 additions and 16 deletions

1
.gitignore vendored
View file

@ -24,3 +24,4 @@ bin
include
lib
local
hacking/*/tito.spec

View file

@ -86,8 +86,15 @@ header() {
build_image() {
name=$1
header $name
# Use hard link + gitignore as workaround for
# https://github.com/dotcloud/docker/issues/1676
# Do not use...
# symlink: not available when building image
# cp: invalidates docker build cache
ln -f tito.spec hacking/$name/
pushd hacking/$name && echo $PWD && docker build --rm -t $name .
popd
rm -f hacking/$name/tito.spec
}
run_inside_image() {

View file

@ -5,6 +5,8 @@ FROM tianon/centos:5.9
MAINTAINER Paul Morgan <jumanjiman@gmail.com>
# Install dependencies.
# It would be nice to use yum-builddep, but
# el5 yum-builddep only works against rpm, not spec file.
RUN rpm -Uvh http://mirror.es.its.nyu.edu/epel/5/x86_64/epel-release-5-4.noarch.rpm
RUN yum -y install git rpm-build \
python-devel python-nose python-setuptools python-pep8 \

View file

@ -4,14 +4,28 @@ FROM centos:6.4
# http://jumanjiman.github.io/
MAINTAINER Paul Morgan <jumanjiman@gmail.com>
# Install dependencies.
RUN yum -y install git rpm-build python-devel python-nose \
libxslt asciidoc python-setuptools tar createrepo which
RUN rpm -Uvh http://ftp.linux.ncsu.edu/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
RUN yum -y install python-pep8 git-annex python-mock python-bugzilla
# NOTE: runtests.sh hard-links tito.spec into this directory on-the-fly
# to work around https://github.com/dotcloud/docker/issues/1676
ADD tito.spec /tmp/tito.spec
# Remove yum metadata.
RUN yum clean all
# Install build dependencies.
RUN yum -y install yum-utils \
; yum-builddep -y /tmp/tito.spec \
; yum clean all
# Install test dependencies. It would be nice to add these as
# build deps and add %check to tito.spec in accordance with
# https://fedoraproject.org/wiki/QA/Testing_in_check
# but some of the packages come from EPEL.
RUN rpm -Uvh http://ftp.linux.ncsu.edu/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
RUN yum -y install \
git \
git-annex \
python-bugzilla \
python-mock \
python-nose \
python-pep8 \
; yum clean all
RUN useradd sandbox
RUN git config --global user.email "sandbox@example.com"

View file

@ -7,16 +7,14 @@ MAINTAINER Paul Morgan <jumanjiman@gmail.com>
# F20 needs updates to resolve conflict with asciidoc.
RUN yum -y update; yum clean all
# Install dependencies.
RUN yum -y install git rpm-build libxslt tar \
asciidoc \
python-devel python-nose python-setuptools python-pep8 \
python-mock \
python3-devel python3-nose python3-setuptools python3-pep8 rpm-python3 python3-mock \
createrepo git-annex which python-bugzilla python3-bugzilla
# NOTE: runtests.sh hard-links tito.spec into this directory on-the-fly
# to work around https://github.com/dotcloud/docker/issues/1676
ADD tito.spec /tmp/tito.spec
# Remove yum metadata.
RUN yum clean all
# Install build dependencies.
RUN yum -y install yum-utils \
; yum-builddep -y /tmp/tito.spec \
; yum clean all
RUN useradd sandbox
RUN git config --global user.email "sandbox@example.com"

View file

@ -18,6 +18,31 @@ BuildRequires: asciidoc
BuildRequires: docbook-style-xsl
BuildRequires: libxslt
BuildRequires: rpmdevtools
BuildRequires: rpm-build
BuildRequires: createrepo
BuildRequires: tar
BuildRequires: which
%if 0%{?fedora} >= 20
# todo: add %check to spec file in accordance with
# https://fedoraproject.org/wiki/QA/Testing_in_check
BuildRequires: git
BuildRequires: git-annex
BuildRequires: python-bugzilla
BuildRequires: python-mock
BuildRequires: python-nose
BuildRequires: python-pep8
%endif
%if 0%{?fedora} >= 20
BuildRequires: python3-mock
BuildRequires: python3-nose
BuildRequires: python3-pep8
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-bugzilla
BuildRequires: rpm-python3
%endif
Requires: python-setuptools
Requires: python-bugzilla