new_build.git - avoid failing on 'rm' of nonexistent file

Message ID AANLkTinUVpHdJRZ_EHw8B4nv=X2yNoOwdNqtH_+wiV=r@mail.gmail.com (mailing list archive)
State Not Applicable, archived
Headers

Commit Message

Vincent McIntyre Jan. 7, 2011, 11:53 a.m. UTC
  While attempting to build recently I have found the 'make distclean'
target fails if 'rm' tries to remove a file that is not there. The
attached patch fixes the issue for me (by using rm -f).
I converted all the other 'rm' calls to 'rm -f' along the way.

Please consider applying this.

Cheers
Vince
  

Comments

Jarod Wilson Jan. 7, 2011, 4:23 p.m. UTC | #1
On Jan 7, 2011, at 6:53 AM, Vincent McIntyre wrote:

> While attempting to build recently I have found the 'make distclean'
> target fails if 'rm' tries to remove a file that is not there. The
> attached patch fixes the issue for me (by using rm -f).
> I converted all the other 'rm' calls to 'rm -f' along the way.
> 
> Please consider applying this.

Yeah, I did the same earlier for another target, I'll go ahead and get
it applied and pushed.
  
Peter D. Jan. 10, 2011, 1:48 a.m. UTC | #2
on Sat, 8 Jan 2011 03:23
in the Usenet newsgroup gmane.linux.drivers.video-input-infrastructure
Jarod Wilson wrote:

> On Jan 7, 2011, at 6:53 AM, Vincent McIntyre wrote:
> 
>> While attempting to build recently I have found the 'make distclean'
>> target fails if 'rm' tries to remove a file that is not there. The
>> attached patch fixes the issue for me (by using rm -f).
>> I converted all the other 'rm' calls to 'rm -f' along the way.
>> 
>> Please consider applying this.
> 
> Yeah, I did the same earlier for another target, I'll go ahead and 
get
> it applied and pushed.

Third attempt to post to this news group...  

The --force option stops complaints about non existent files 
AND removes read only files.  If that is what you want, then fine.  
If you are only trying to stop existence problems, test for 
existence before removing.
  

Patch

diff --git a/linux/Makefile b/linux/Makefile
index 695dcf2..8bbeee8 100644
--- a/linux/Makefile
+++ b/linux/Makefile
@@ -53,7 +52,7 @@  help:
 
 todaytar:
 	@if [ "$(DIR)" = "" ]; then echo "make $@ DIR=<version>"; exit -1; fi
-	-rm $(PWD)/$(TODAY_TAR).bz2
+	-rm -f $(PWD)/$(TODAY_TAR).bz2
 	tar cf $(PWD)/$(TODAY_TAR) -C $(DIR) $(TARFILES)
 	-git --git-dir $(DIR)/.git log --pretty=oneline HEAD^1^1^1^1^1^1^1^1..HEAD >git_log
 	tar rvf $(PWD)/linux-media.tar git_log
@@ -70,7 +69,7 @@  todaytar:
 
 tar:
 	@if [ "$(DIR)" = "" ]; then echo "make $@ DIR=<version>"; exit -1; fi
-	-rm $(PWD)/linux-media.tar.bz2
+	-rm -f $(PWD)/linux-media.tar.bz2
 	tar cf $(PWD)/linux-media.tar -C $(DIR) $(TARFILES)
 	-git --git-dir $(DIR)/.git log --pretty=oneline HEAD^1^1^1^1^1^1^1^1..HEAD >git_log
 	tar rvf $(PWD)/linux-media.tar git_log
@@ -97,7 +96,7 @@  dir: clean
 	./use_dir.pl $(DIR)
 
 distclean: clean
-	-rm linux-media.tar.bz2 linux-media.tar.bz2.md5
+	-rm -f linux-media.tar.bz2 linux-media.tar.bz2.md5
 
 apply_patches apply-patches:
 	@if [ -e .linked_dir ]; then ./use_dir.pl --recheck --silent; fi
@@ -131,7 +130,7 @@  apply_patches apply-patches:
 	mv .patches_applied .patches_applied.old; \
 	echo "#$$dir" > .patches_applied; \
 	cat .patches_applied.old >> .patches_applied; \
-	rm .patches_applied.old; \
+	rm -f .patches_applied.old; \
 	if [ -e .linked_dir ]; then ./use_dir.pl --get_patched; fi
 
 unapply_patches unapply-patches:
@@ -141,7 +140,7 @@  unapply_patches unapply-patches:
 		echo patch -s -f -R -p1 -i ../backports/$$i; \
 		patch -s -f -R -p1 -i ../backports/$$i || break; \
 	done; \
-	rm .patches_applied; fi
+	rm -f .patches_applied; fi
 
 download:
 	wget $(LATEST_TAR_MD5) -O linux-media.tar.bz2.md5.tmp