Unify Fedora and RHEL spec files.

This commit is contained in:
Richard W.M. Jones 2020-12-03 13:40:12 +00:00
parent 7e1b1a1eed
commit 6be63283f3
5 changed files with 95 additions and 3 deletions

55
copy-patches.sh Executable file
View File

@ -0,0 +1,55 @@
#!/bin/bash -
set -e
# Maintainer script to copy patches from the git repo to the current
# directory. Use it like this:
# ./copy-patches.sh
rhel_version=8.3
# Check we're in the right directory.
if [ ! -f libnbd.spec ]; then
echo "$0: run this from the directory containing 'libnbd.spec'"
exit 1
fi
git_checkout=$HOME/d/libnbd-rhel-$rhel_version
if [ ! -d $git_checkout ]; then
echo "$0: $git_checkout does not exist"
echo "This script is only for use by the maintainer when preparing a"
echo "libnbd release on RHEL."
exit 1
fi
# Get the base version of libnbd.
version=`grep '^Version:' libnbd.spec | awk '{print $2}'`
tag="v$version"
# Remove any existing patches.
git rm -f [0-9]*.patch ||:
rm -f [0-9]*.patch
# Get the patches.
(cd $git_checkout; rm -f [0-9]*.patch; git format-patch -N $tag)
mv $git_checkout/[0-9]*.patch .
# Remove any not to be applied.
rm -f *NOT-FOR-RPM*.patch
# Add the patches.
git add [0-9]*.patch
# Print out the patch lines.
echo
echo "--- Copy the following text into libnbd.spec file"
echo
echo "# Patches."
for f in [0-9]*.patch; do
n=`echo $f | awk -F- '{print $1}'`
echo "Patch$n: $f"
done
echo
echo "--- End of text"

6
gating.yaml Executable file
View File

@ -0,0 +1,6 @@
--- !Policy
product_versions:
- rhel-8
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}

View File

@ -9,7 +9,7 @@
Name: libnbd
Version: 1.5.7
Release: 1%{?dist}
Release: 2%{?dist}
Summary: NBD client library in userspace
License: LGPLv2+
@ -22,6 +22,9 @@ Source1: http://libguestfs.org/download/libnbd/%{source_directory}/%{name
# https://pgp.key-server.io/pks/lookup?search=rjones%40redhat.com&fingerprint=on&op=vindex
Source2: libguestfs.keyring
# Maintainer script which helps with handling patches.
Source3: copy-patches.sh
%if 0%{patches_touch_autotools}
BuildRequires: autoconf, automake, libtool
%endif
@ -58,7 +61,6 @@ BuildRequires: coreutils
BuildRequires: gcc-c++
BuildRequires: gnutls-utils
BuildRequires: jq
%if 0%{?fedora} >= 31
BuildRequires: nbdkit
BuildRequires: nbdkit-data-plugin
BuildRequires: nbdkit-eval-plugin
@ -66,7 +68,6 @@ BuildRequires: nbdkit-memory-plugin
BuildRequires: nbdkit-null-plugin
BuildRequires: nbdkit-pattern-plugin
BuildRequires: nbdkit-sh-plugin
%endif
BuildRequires: nbd
BuildRequires: qemu-img
BuildRequires: util-linux
@ -289,6 +290,9 @@ make %{?_smp_mflags} check || {
%changelog
* Thu Dec 03 2020 Richard W.M. Jones <rjones@redhat.com> - 1.5.7-2
- Unify Fedora and RHEL spec files.
* Wed Nov 25 2020 Richard W.M. Jones <rjones@redhat.com> - 1.5.7-1
- New upstream development version 1.5.7.
- Add some more test suite buildrequires lines.

15
tests/basic-test.sh Executable file
View File

@ -0,0 +1,15 @@
#!/bin/bash -
set -e
set -x
# Enable libnbd debugging.
export LIBNBD_DEBUG=1
# Connect to nbdkit.
nbdsh -c - <<EOF
h.connect_command (["nbdkit", "-s", "--exit-with-parent",
"memory", "size=1G"])
size = h.get_size ()
print ("size = %s" % size)
assert size == 1073741824
EOF

12
tests/tests.yml Executable file
View File

@ -0,0 +1,12 @@
- hosts: localhost
roles:
- role: standard-test-basic
tags:
- classic
required_packages:
- python3-libnbd
- nbdkit
tests:
- simple:
dir: .
run: ./basic-test.sh