kbuild: Fix make rpm
authorMichal Marek <mmarek@suse.cz>
Thu, 15 Jul 2010 08:36:37 +0000 (10:36 +0200)
committerMichal Marek <mmarek@suse.cz>
Wed, 21 Jul 2010 14:06:05 +0000 (16:06 +0200)
make rpm was broken by commit 0915512:
make clean
set -e; cd ..; ln -sf /usr/src/iwlwifi-2.6 kernel-2.6.35rc4wl
/bin/sh /usr/src/iwlwifi-2.6/scripts/setlocalversion --scm-only >
/usr/src/iwlwifi-2.6/.scmversion
cat: .scmversion: input file is output file
make[1]: *** [rpm] Error 1

Reported-and-tested-by: "Zheng, Jiajia" <jiajia.zheng@intel.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
scripts/package/Makefile
scripts/setlocalversion

index 3a681ef25306ba0a98cfaedf7412c24c9af11adb..d2c29b63addaa04dbd3df94d1adbfa9bc3ff8518 100644 (file)
@@ -44,7 +44,7 @@ rpm-pkg rpm: $(objtree)/kernel.spec FORCE
        fi
        $(MAKE) clean
        $(PREV) ln -sf $(srctree) $(KERNELPATH)
-       $(CONFIG_SHELL) $(srctree)/scripts/setlocalversion --scm-only > $(objtree)/.scmversion
+       $(CONFIG_SHELL) $(srctree)/scripts/setlocalversion --save-scmversion
        $(PREV) tar -cz $(RCS_TAR_IGNORE) -f $(KERNELPATH).tar.gz $(KERNELPATH)/.
        $(PREV) rm $(KERNELPATH)
        rm -f $(objtree)/.scmversion
index a7b9f7607e133a54fe0210ec349ace403d16d0bd..64a9cb5556cd0f90dab503c6b8cd96e2fa7bff1d 100755 (executable)
 #
 
 usage() {
-       echo "Usage: $0 [--scm-only] [srctree]" >&2
+       echo "Usage: $0 [--save-scmversion] [srctree]" >&2
        exit 1
 }
 
 scm_only=false
 srctree=.
-if test "$1" = "--scm-only"; then
+if test "$1" = "--save-scmversion"; then
        scm_only=true
        shift
 fi
@@ -132,7 +132,10 @@ collect_files()
 }
 
 if $scm_only; then
-       scm_version
+       if test ! -e .scmversion; then
+               res=$(scm_version)
+               echo "$res" >.scmversion
+       fi
        exit
 fi