This patch fixes problems I had when attempting rh-srpm with
KVERSION:=2.6.31
MARKER:=v2.6.31
The problem is that "cut -f2 -d-" in this case returns the whole
string, not the empty string. Fixed by switching to sed.
There were also a couple of missing question marks in the spec.
---
redhat/Makefile.common | 5 +++--
redhat/create-patches.sh | 9 +++++++--
redhat/kernel.spec.template | 4 ++--
3 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/redhat/Makefile.common b/redhat/Makefile.common
index b91748a..b926bf5 100644
--- a/redhat/Makefile.common
+++ b/redhat/Makefile.common
@@ -16,8 +16,9 @@ TARBALL:=$(REDHAT)/$(TARFILE)
TESTPATCH:=$(REDHAT)/linux-kernel-test.patch
SUBLEVEL := $(shell echo $(MARKER) | cut -f 3 -d '.' | cut -f 1 -d '-')
-RCREV := $(shell echo $(MARKER) | cut -f 2 -d '-' | sed -e "s/rc//")
-GITREV := $(shell echo $(MARKER) | cut -f 3 -d '-' | sed -e "s/git//")
+RCREV := $(shell echo $(MARKER) | sed -ne "s/^[^-]*-rc//p")
+GITREV := $(shell echo $(MARKER) | sed -ne "s/^[^-]*-[^-]*-git//p")
+
ifneq ($(RCREV),)
RELEASED_KERNEL := 0
else
diff --git a/redhat/create-patches.sh b/redhat/create-patches.sh
index d6835ba..2c9cf62 100755
--- a/redhat/create-patches.sh
+++ b/redhat/create-patches.sh
@@ -10,13 +10,18 @@ SERIESF="$SOURCES/series"
clogf="$SOURCES/changelog"
SUBLEVEL="$(echo $MARKER | cut -f 3 -d '.' | cut -f 1 -d
'-')";
#SUBLEVEL="$(echo $MARKER | cut -f 3 -d '.')";
-RCREV=$(echo $MARKER | cut -f 2 -d '-' | sed -e "s/rc//")
-GITREV=$(echo $MARKER | cut -f 3 -d '-' | sed -e "s/git//")
+RCREV=$(echo $MARKER | sed -ne "s/^[^-]*-rc//p")
+GITREV=$(echo $MARKER | sed -ne "s/^[^-]*-[^-]*-git//p")
+
if [ -n "$RCREV" ]; then
RELEASED_KERNEL="0";
SUBLEVEL=$(($SUBLEVEL - 1));
else
RELEASED_KERNEL="1";
+ RCREV="0";
+fi
+if [ -z "$GITREV" ]; then
+ GITREV="0";
fi
touch $PATCHF $patchf
diff --git a/redhat/kernel.spec.template b/redhat/kernel.spec.template
index d7f1666..cbe88e4 100644
--- a/redhat/kernel.spec.template
+++ b/redhat/kernel.spec.template
@@ -518,9 +518,9 @@ Source0:
ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-%{kversion}.tar.bz2
Source1: Makefile.common
-%if 0%{rcrev}
+%if 0%{?rcrev}
Source2:
ftp://ftp.kernel.org/pub/linux/kernel/v2.6/testing/incr/patch-2.6.%{upstr...
-%if 0%{gitrev}
+%if 0%{?gitrev}
Source3:
ftp://ftp.kernel.org/pub/linux/kernel/v2.6/testing/incr/patch-2.6.%{upstr...
%endif
%endif
--
1.6.2.5