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 5af0359..5bb263d 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