From 749ab5273bbb43342e1cc183b58ad3f56bf79eae Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Fri, 7 Sep 2018 12:00:28 +0000 Subject: [PATCH] projects-dir.mk: Add git-echo-link-% and friends git-echo-link- returns a string functioning as hyperlink to the file in git if embedded into a janware wiki or ticket. Signed-off-by: Jan Lindemann --- make/projects-dir.mk | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/make/projects-dir.mk b/make/projects-dir.mk index 1ea94bf4..5db17409 100644 --- a/make/projects-dir.mk +++ b/make/projects-dir.mk @@ -52,6 +52,7 @@ SSH_WRAPPER_SH := $(CWD)/ssh-wrapper.sh EXCLUDES_FILE ?= exclude.txt EXCLUDES_FILES = exclude-$(shell $(GET_OS_SH) name).txt exclude-$(shell $(GET_OS_SH)).txt $(EXCLUDES_FILE) +TEXT_FILES_CACHE ?= text-files.txt ifneq ($(wildcard $(EXCLUDES_FILES)),) EXCLUDE_FROM_BUILD += $(shell sed 's/\#.*//g' $(wildcard $(EXCLUDES_FILES))) @@ -258,6 +259,11 @@ git-show-non-master-branches: fi ;\ done +# git-echo-link- returns a string functioning as hyperlink to +# matching files in git, if embedded into a janware wiki or ticket. +git-echo-link-%: | $(TEXT_FILES_CACHE) + sed "/$*$$/!d; s%$(CWD)%%; s|^|\n \[\[jgit>/proj/$(JANWARE_USER)/|; s/$$/|$*\]\]\n/" $(TEXT_FILES_CACHE) + pull-%: $(SSH_WRAPPER_SH) PGIT_CLONE_FROM_USER=$* $(PGIT) clone @@ -341,8 +347,16 @@ list-files: xargs -0 realpath ;\ done -list-text-files: - @make --no-print-directory list-files | xargs file -N | grep ":.*text" | cut -d: -f1 +clean: clean.text-files-cache +clean.text-files-cache: + rm -f $(TEXT_FILES_CACHE) +$(TEXT_FILES_CACHE): + @make text-files-update +text-files-update: + @make --no-print-directory list-files | xargs file -N | grep ":.*text" | cut -d: -f1 | tee $(TEXT_FILES_CACHE).tmp + mv $(TEXT_FILES_CACHE).tmp $(TEXT_FILES_CACHE) +text-files-list list-text-files: | $(TEXT_FILES_CACHE) + @cat $< loc-all: @make --no-print-directory list-text-files | \