build: leaving behind incomplete metadata files on cancelled builds
authorFelix Fietkau <nbd@nbd.name>
Sun, 2 Oct 2016 09:40:06 +0000 (11:40 +0200)
committerFelix Fietkau <nbd@nbd.name>
Tue, 4 Oct 2016 14:01:41 +0000 (16:01 +0200)
Signed-off-by: Felix Fietkau <nbd@nbd.name>
include/scan.mk

index 5af035972f6822e445817fe8abad35d4fc4458c7..5bb263d713c03487e6e5c45ea50f222ca6b3f985 100644 (file)
@@ -40,7 +40,8 @@ define PackageDir
                        rm -f $$@; \
                }; \
                echo; \
-       } > $$@ || true
+       } > $$@.tmp
+       mv $$@.tmp $$@
 endef
 
 $(OVERRIDELIST):
@@ -76,7 +77,8 @@ $(TMP_DIR)/info/.files-$(SCAN_TARGET).mk: $(FILELIST)
                        print "$$(eval $$(call PackageDir," info "," dir "," pkg "))"; \
                } ' < $<; \
                true; \
-       ) > $@
+       ) > $@.tmp
+       mv $@.tmp $@
 
 -include $(TMP_DIR)/info/.files-$(SCAN_TARGET).mk