Blob Blame History Raw
From 0344c2be134fbdf1019052eb314b76b7e3251d52 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Fri, 11 Aug 2017 14:11:32 +0200
Subject: [PATCH] dracut.spec: add support for builds without dist-tag

In the module-build-service, we have pieces of dracut provided by different
modules ("base-runtime" provides most functionality, but we need
dracut-network in "installer". Since these two modules build with separate
dist-tags, we need to reduce this strict requirement to ignore the dist-tag.
---
 dracut.spec | 17 ++++++++++++++++-
 git2spec.pl |  4 ++--
 2 files changed, 18 insertions(+), 3 deletions(-)

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