Harald Hoyer 9336ee
From 0344c2be134fbdf1019052eb314b76b7e3251d52 Mon Sep 17 00:00:00 2001
Harald Hoyer 9336ee
From: Harald Hoyer <harald@redhat.com>
Harald Hoyer 9336ee
Date: Fri, 11 Aug 2017 14:11:32 +0200
Harald Hoyer 9336ee
Subject: [PATCH] dracut.spec: add support for builds without dist-tag
Harald Hoyer 9336ee
Harald Hoyer 9336ee
In the module-build-service, we have pieces of dracut provided by different
Harald Hoyer 9336ee
modules ("base-runtime" provides most functionality, but we need
Harald Hoyer 9336ee
dracut-network in "installer". Since these two modules build with separate
Harald Hoyer 9336ee
dist-tags, we need to reduce this strict requirement to ignore the dist-tag.
Harald Hoyer 9336ee
---
Harald Hoyer 9336ee
 dracut.spec | 17 ++++++++++++++++-
Harald Hoyer 9336ee
 git2spec.pl |  4 ++--
Harald Hoyer 9336ee
 2 files changed, 18 insertions(+), 3 deletions(-)
Harald Hoyer 9336ee
Harald Hoyer 9336ee
diff --git a/dracut.spec b/dracut.spec
Harald Hoyer 9336ee
index f6502c65..855adba6 100644
Harald Hoyer 9336ee
--- a/dracut.spec
Harald Hoyer 9336ee
+++ b/dracut.spec
Harald Hoyer 9336ee
@@ -14,9 +14,11 @@
Harald Hoyer 9336ee
 %define with_nbd 0
Harald Hoyer 9336ee
 %endif
Harald Hoyer 9336ee
 
Harald Hoyer 9336ee
+%define dist_free_release xxx
Harald Hoyer 9336ee
+
Harald Hoyer 9336ee
 Name: dracut
Harald Hoyer 9336ee
 Version: xxx
Harald Hoyer 9336ee
-Release: xxx
Harald Hoyer 9336ee
+Release: %{dist_free_release}%{?dist}
Harald Hoyer 9336ee
 
Harald Hoyer 9336ee
 Summary: Initramfs generator using udev
Harald Hoyer 9336ee
 %if 0%{?fedora} || 0%{?rhel}
Harald Hoyer 9336ee
@@ -136,7 +138,15 @@ NFS, iSCSI, NBD, FCoE with the dracut-network package.
Harald Hoyer 9336ee
 
Harald Hoyer 9336ee
 %package network
Harald Hoyer 9336ee
 Summary: dracut modules to build a dracut initramfs with network support
Harald Hoyer 9336ee
+%if 0%{?_module_build}
Harald Hoyer 9336ee
+# In the module-build-service, we have pieces of dracut provided by different
Harald Hoyer 9336ee
+# modules ("base-runtime" provides most functionality, but we need
Harald Hoyer 9336ee
+# dracut-network in "installer". Since these two modules build with separate
Harald Hoyer 9336ee
+# dist-tags, we need to reduce this strict requirement to ignore the dist-tag.
Harald Hoyer 9336ee
+Requires: %{name} >= %{version}-%{dist_free_release}
Harald Hoyer 9336ee
+%else
Harald Hoyer 9336ee
 Requires: %{name} = %{version}-%{release}
Harald Hoyer 9336ee
+%endif
Harald Hoyer 9336ee
 Requires: iputils
Harald Hoyer 9336ee
 Requires: iproute
Harald Hoyer 9336ee
 Requires: dhclient
Harald Hoyer 9336ee
@@ -184,7 +194,12 @@ initramfs with dracut, which drops capabilities.
Harald Hoyer 9336ee
 
Harald Hoyer 9336ee
 %package live
Harald Hoyer 9336ee
 Summary: dracut modules to build a dracut initramfs with live image capabilities
Harald Hoyer 9336ee
+%if 0%{?_module_build}
Harald Hoyer 9336ee
+# See the network subpackage comment.
Harald Hoyer 9336ee
+Requires: %{name} >= %{version}-%{dist_free_release}
Harald Hoyer 9336ee
+%else
Harald Hoyer 9336ee
 Requires: %{name} = %{version}-%{release}
Harald Hoyer 9336ee
+%endif
Harald Hoyer 9336ee
 Requires: %{name}-network = %{version}-%{release}
Harald Hoyer 9336ee
 Requires: tar gzip coreutils bash device-mapper curl
Harald Hoyer 9336ee
 
Harald Hoyer 9336ee
diff --git a/git2spec.pl b/git2spec.pl
Harald Hoyer 9336ee
index 4b03a95c..0c5f3b9e 100755
Harald Hoyer 9336ee
--- a/git2spec.pl
Harald Hoyer 9336ee
+++ b/git2spec.pl
Harald Hoyer 9336ee
@@ -39,8 +39,8 @@ while(<>) {
Harald Hoyer 9336ee
     if (/^Version:/) {
Harald Hoyer 9336ee
 	print "Version: $tag\n";
Harald Hoyer 9336ee
     }
Harald Hoyer 9336ee
-    elsif (/^Release:/) {
Harald Hoyer 9336ee
-	print "Release: $release%{?dist}\n";
Harald Hoyer 9336ee
+    elsif (/^%define dist_free_release/) {
Harald Hoyer 9336ee
+	print "%define dist_free_release $release\n";
Harald Hoyer 9336ee
     }
Harald Hoyer 9336ee
     elsif ((/^Source0:/) || (/^Source:/)) {
Harald Hoyer 9336ee
 	print $_;