From 6be63283f31cb36eb8ee2bc5b39db3f6ac33e584 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 3 Dec 2020 13:40:12 +0000 Subject: [PATCH] Unify Fedora and RHEL spec files. --- copy-patches.sh | 55 +++++++++++++++++++++++++++++++++++++++++++++ gating.yaml | 6 +++++ libnbd.spec | 10 ++++++--- tests/basic-test.sh | 15 +++++++++++++ tests/tests.yml | 12 ++++++++++ 5 files changed, 95 insertions(+), 3 deletions(-) create mode 100755 copy-patches.sh create mode 100755 gating.yaml create mode 100755 tests/basic-test.sh create mode 100755 tests/tests.yml diff --git a/copy-patches.sh b/copy-patches.sh new file mode 100755 index 0000000..00041ac --- /dev/null +++ b/copy-patches.sh @@ -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" diff --git a/gating.yaml b/gating.yaml new file mode 100755 index 0000000..6985029 --- /dev/null +++ b/gating.yaml @@ -0,0 +1,6 @@ +--- !Policy +product_versions: + - rhel-8 +decision_context: osci_compose_gate +rules: + - !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional} diff --git a/libnbd.spec b/libnbd.spec index 3eb43b4..b7c5133 100644 --- a/libnbd.spec +++ b/libnbd.spec @@ -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 - 1.5.7-2 +- Unify Fedora and RHEL spec files. + * Wed Nov 25 2020 Richard W.M. Jones - 1.5.7-1 - New upstream development version 1.5.7. - Add some more test suite buildrequires lines. diff --git a/tests/basic-test.sh b/tests/basic-test.sh new file mode 100755 index 0000000..f514ef0 --- /dev/null +++ b/tests/basic-test.sh @@ -0,0 +1,15 @@ +#!/bin/bash - +set -e +set -x + +# Enable libnbd debugging. +export LIBNBD_DEBUG=1 + +# Connect to nbdkit. +nbdsh -c - <