tests: refactor rpm building and add package foo
We're going to be create many different packages in the future. Let's refactor and generalize the targets so that they can build anything. We also add a package foo, which will be used soon for a basic test of package layering. Closes: #344 Approved by: cgwalters
This commit is contained in:
parent
c0924b8997
commit
5479ed5240
@ -7,36 +7,47 @@ AM_TESTS_ENVIRONMENT = \
|
|||||||
commondir=$(abs_top_srcdir)/tests/common
|
commondir=$(abs_top_srcdir)/tests/common
|
||||||
|
|
||||||
CLEANFILES += \
|
CLEANFILES += \
|
||||||
tests/common/compose/yum/empty \
|
|
||||||
tests/common/compose/yum/repodata/repomd.xml \
|
tests/common/compose/yum/repodata/repomd.xml \
|
||||||
tests/common/compose/test-repo.repo \
|
tests/common/compose/test-repo.repo \
|
||||||
tests/common/compose/yum/repodata/*.bz2 \
|
tests/common/compose/yum/repodata/*.bz2 \
|
||||||
tests/common/compose/yum/repodata/*.gz \
|
tests/common/compose/yum/repodata/*.gz \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
# Needed by the compose test
|
testpackages = \
|
||||||
tests/common/compose/yum/empty: tests/common/compose/yum/empty.c
|
tests/common/compose/yum/x86_64/empty-1.0-1.x86_64.rpm \
|
||||||
$(CC) -nostdlib $< -o $@
|
tests/common/compose/yum/x86_64/foo-1.0-1.x86_64.rpm \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
tests/common/compose/yum/repodata/repomd.xml: tests/common/compose/yum/empty tests/common/compose/yum/empty.spec
|
# Create a rule for each testpkg with their respective spec file as dep.
|
||||||
|
# The static pattern feature is almost a fit for this, but does not allow string
|
||||||
|
# substitutions and wildcards in the patterns to allow rpm-filename -->
|
||||||
|
# spec-filename without also encoding the arch, release, and rev.
|
||||||
|
define testpkgbuild_template =
|
||||||
|
$(1): tests/common/compose/yum/$(2).spec
|
||||||
(cd tests/common/compose/yum && \
|
(cd tests/common/compose/yum && \
|
||||||
rpmbuild \
|
rm -rf .build && \
|
||||||
--define "_sourcedir $(abs_top_srcdir)/tests/common/compose/yum" \
|
rpmbuild -ba $$$$(basename $$<) \
|
||||||
--define "_specdir $(abs_top_srcdir)/tests/common/compose/yum" \
|
--define "_sourcedir $$$$PWD" \
|
||||||
--define "_builddir $(abs_top_srcdir)/tests/common/compose/yum" \
|
--define "_specdir $$$$PWD" \
|
||||||
--define "_srcrpmdir $(abs_top_srcdir)/tests/common/compose/yum" \
|
--define "_builddir $$$$PWD/.build" \
|
||||||
--define "_rpmdir $(abs_top_srcdir)/tests/common/compose/yum" \
|
--define "_srcrpmdir $$$$PWD" \
|
||||||
--define "_buildrootdir $(abs_top_srcdir)/tests/common/compose/yum/.build" \
|
--define "_rpmdir $$$$PWD" \
|
||||||
-ba empty.spec && \
|
--define "_buildrootdir $$$$PWD" && \
|
||||||
rm *.src.rpm && \
|
rm -rf .build && \
|
||||||
createrepo_c --no-database $(abs_top_srcdir)/tests/common/compose/yum/)
|
rm -f *.src.rpm)
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(foreach pkg,$(testpackages),$(eval $(call testpkgbuild_template,$(pkg),$(shell basename $(pkg) | cut -d- -f1))))
|
||||||
|
|
||||||
|
tests/common/compose/yum/repodata/repomd.xml: $(testpackages)
|
||||||
|
(cd tests/common/compose/yum && \
|
||||||
|
createrepo_c --no-database $$PWD)
|
||||||
|
|
||||||
tests/common/compose/test-repo.repo: tests/common/compose/test-repo.repo.in tests/common/compose/yum/repodata/repomd.xml
|
tests/common/compose/test-repo.repo: tests/common/compose/test-repo.repo.in tests/common/compose/yum/repodata/repomd.xml
|
||||||
cat $< | sed -e "s|%WHERE%|$(abs_top_srcdir)|" > $@
|
cat $< | sed -e "s|%WHERE%|$(abs_top_srcdir)|" > $@
|
||||||
|
|
||||||
CLEANFILES += \
|
CLEANFILES += \
|
||||||
tests/common/compose/test-repo-local.repo \
|
tests/common/compose/test-repo-local.repo \
|
||||||
tests/common/compose/yum/empty-1.0-1.src.rpm \
|
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
tests_check_jsonutil_CPPFLAGS = -I $(srcdir)/src/libpriv
|
tests_check_jsonutil_CPPFLAGS = -I $(srcdir)/src/libpriv
|
||||||
|
@ -1,27 +0,0 @@
|
|||||||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
|
|
||||||
*
|
|
||||||
* Copyright (C) 2015 Red Hat Inc.
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Lesser General Public License as published
|
|
||||||
* by the Free Software Foundation; either version 2 of the licence or (at
|
|
||||||
* your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General
|
|
||||||
* Public License along with this library; if not, write to the
|
|
||||||
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
|
||||||
* Boston, MA 02111-1307, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
int
|
|
||||||
_start ()
|
|
||||||
{
|
|
||||||
__asm__ __volatile__ ("mov $1, %eax");
|
|
||||||
__asm__ __volatile__ ("mov $0, %ebx\n");
|
|
||||||
__asm__ __volatile__ ("int $0x80\n");
|
|
||||||
}
|
|
@ -10,7 +10,6 @@ License: GPL+
|
|||||||
Group: Development/Tools
|
Group: Development/Tools
|
||||||
URL: http://foo.bar.com
|
URL: http://foo.bar.com
|
||||||
BuildArch: x86_64
|
BuildArch: x86_64
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
|
|
||||||
|
|
||||||
%description
|
%description
|
||||||
%{summary}
|
%{summary}
|
||||||
@ -18,6 +17,16 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
|
|||||||
%prep
|
%prep
|
||||||
|
|
||||||
%build
|
%build
|
||||||
|
cat > empty.c << EOF
|
||||||
|
int
|
||||||
|
_start ()
|
||||||
|
{
|
||||||
|
__asm__ __volatile__ ("mov \$1, %eax");
|
||||||
|
__asm__ __volatile__ ("mov \$0, %ebx\n");
|
||||||
|
__asm__ __volatile__ ("int \$0x80\n");
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
cc -nostdlib empty.c -o empty
|
||||||
|
|
||||||
%install
|
%install
|
||||||
mkdir -p %{buildroot}/boot
|
mkdir -p %{buildroot}/boot
|
||||||
@ -58,5 +67,3 @@ rm -rf %{buildroot}
|
|||||||
%changelog
|
%changelog
|
||||||
* Tue Mar 17 2015 Giuseppe Scrivano <gscrivan@redhat.com> 1.0-1
|
* Tue Mar 17 2015 Giuseppe Scrivano <gscrivan@redhat.com> 1.0-1
|
||||||
- First Build
|
- First Build
|
||||||
|
|
||||||
EOF
|
|
||||||
|
34
tests/common/compose/yum/foo.spec
Normal file
34
tests/common/compose/yum/foo.spec
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
Summary: Awesome utility that allows convenient foobing
|
||||||
|
Name: foo
|
||||||
|
Version: 1.0
|
||||||
|
Release: 1
|
||||||
|
License: GPL+
|
||||||
|
Group: Development/Tools
|
||||||
|
URL: http://foo.bar.com
|
||||||
|
BuildArch: x86_64
|
||||||
|
|
||||||
|
%description
|
||||||
|
%{summary}
|
||||||
|
|
||||||
|
%prep
|
||||||
|
|
||||||
|
%build
|
||||||
|
cat > foo << EOF
|
||||||
|
#!/bin/sh
|
||||||
|
echo "Happy foobing!"
|
||||||
|
EOF
|
||||||
|
chmod a+x foo
|
||||||
|
|
||||||
|
%install
|
||||||
|
mkdir -p %{buildroot}/usr/bin
|
||||||
|
install foo %{buildroot}/usr/bin
|
||||||
|
|
||||||
|
%clean
|
||||||
|
rm -rf %{buildroot}
|
||||||
|
|
||||||
|
%files
|
||||||
|
/usr/bin/foo
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* Tue Jun 21 2016 Jonathan Lebon <jlebon@redhat.com> 1.0-1
|
||||||
|
- First Build
|
Loading…
Reference in New Issue
Block a user