From 514a04d64363f0b678074c19cc528227942eede1 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Mon, 14 Sep 2020 23:28:53 -0700 Subject: [PATCH] doc: Before fetching, drop all old to cleanup deleted pages/images Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- doc/Makefile | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/doc/Makefile b/doc/Makefile index 94c0ee0e6..4e63015cb 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -60,13 +60,21 @@ install: all # require further reviews. fetch-main-list:=$(foreach lang,$(MANUAL_LANGUAGES),fetch-main-$(lang)) fetch-pages-list:=$(foreach lang,$(MANUAL_LANGUAGES),fetch-pages-$(lang)) +fetch-cleanup-list:=$(foreach lang,$(MANUAL_LANGUAGES),fetch-cleanup-$(lang)) -.PHONY: fetch $(fetch-main-list) $(fetch-pages-list) +.PHONY: fetch $(fetch-main-list) $(fetch-pages-list) $(fetch-cleanup-list) fetch: $(fetch-main-list) $(fetch-pages-list) +# Remove raw wiki pages and images before fetching to drop items deleted +# upstream. +featch-cleanup-%: lang = $* +$(fetch-cleanup-list): fetch-cleanup-%: + rm -f manual/$(lang)/*.raw.wiki + rm -f manual/$(lang)/images/*.png manual/$(lang)/images/*.jpg + fetch-main-%: lang = $* fetch-main-%: lang-fragment = $(subst en/,,$*/) -$(fetch-main-list): fetch-main-%: +$(fetch-main-list): fetch-main-%: fetch-cleanup-% MANUAL_URL_RAW_LANG=$(subst {lang-fragment},$(lang-fragment),$(MANUAL_URL_RAW)) ; \ wget --quiet --user-agent=Firefox \ -O manual/$(lang)/freedombox-manual.raw.wiki $${MANUAL_URL_RAW_LANG} @@ -82,7 +90,7 @@ $(fetch-main-list): fetch-main-%: fetch-pages-%: lang = $* fetch-pages-%: lang-fragment = $(subst en/,,$*/) -$(fetch-pages-list): fetch-pages-%: +$(fetch-pages-list): fetch-pages-%: fetch-cleanup-% MANUAL_URL_LANG=$(subst {lang-fragment},$(lang-fragment),$(MANUAL_URL_RAW)) ; \ PAGES=$$(wget --quiet --user-agent=Firefox -O - $${MANUAL_URL_LANG} | \ sed -n -e "s|.*<