From da562cb7507c7001b5cf3f8b2a0a80c865877ab7 Mon Sep 17 00:00:00 2001 From: Patrick McCarty Date: Tue, 31 Jul 2018 12:45:28 -0700 Subject: [PATCH] Always clean rpms and logs from previous builds I often find myself running "make clean proper", when by default, I think the old build artifacts should be removed so that the results directory is pristine at the start of a new build. As a result, if users wish to keep all build artifacts from a previous "make build" or "make autospec", they must keep manual backups, as the tooling no longer keeps them around. Signed-off-by: Patrick McCarty --- Makefile.common | 5 ++--- Makefile.shared | 11 +++++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Makefile.common b/Makefile.common index a4efc9c..a202304 100644 --- a/Makefile.common +++ b/Makefile.common @@ -115,7 +115,7 @@ shell: # Always rebuild the source rpm .PHONY: $(SRPMFILE) -$(SRPMFILE): $(SPECFILE) $(__allsources) localreponotice +$(SRPMFILE): $(SPECFILE) $(__allsources) localreponotice clean-old-content @$(MAKE) spdxcheck $(MOCK) --buildsrpm --source=./ --spec=$(SPECFILE) --result=results/ --no-cleanup-after --uniqueext=$(PKG_NAME) mv results/root.log results/srpm-root.log @@ -156,8 +156,7 @@ pullrebase: #help Use MOCK_OPTS environment varible to pass down arbitrary mock options #help to autospec. #help For more information, see the project at https://github.com/clearlinux/autospec -autospec: pullrebase localreponotice - rm -f results/*src.rpm +autospec: pullrebase localreponotice clean-old-content @if [ -e $(SPECFILE) ] && ! grep -q "# Generated by: autospec.py" $(SPECFILE) ; then \ echo "Specfile already exists and was not created by autospec.py! Aborting."; \ exit 1; \ diff --git a/Makefile.shared b/Makefile.shared index f784235..8215774 100644 --- a/Makefile.shared +++ b/Makefile.shared @@ -138,6 +138,17 @@ localreponotice: [ -f $(TOPLVL)/repo/opt-in-build ] || sleep 3; \ fi >&2 +.PHONY: clean-old-rpms clean-old-logs clean-old-content +clean-old-rpms: + rm -rf ./rpms + rm -f ./results/*.rpm + +clean-old-logs: + rm -f ./results/*.log + +clean-old-content: clean-old-rpms clean-old-logs + + .PHONY: help ##### Code # Make sure that HELPSPACE has exactly HELPLEN spaces in it