mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-15 12:03:31 +01:00
make, scripts: Replace list-vcs-files.sh by scm.sh ls-files
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
f34c97e96c
commit
e827efadd5
9 changed files with 106 additions and 107 deletions
|
|
@ -6,7 +6,7 @@ DAV_SERVER ?= cvs.jannet.de
|
||||||
DAV_RSYNC_SERVER ?= $(DAV_SERVER)
|
DAV_RSYNC_SERVER ?= $(DAV_SERVER)
|
||||||
DAV_RSYNC_DIR ?= /srv/dav/pub/groups/$(DAV_GROUP)/$(DAV_GROUP_PROJECT)
|
DAV_RSYNC_DIR ?= /srv/dav/pub/groups/$(DAV_GROUP)/$(DAV_GROUP_PROJECT)
|
||||||
DAV_RSYNC_URL = $(DAV_RSYNC_SERVER):$(DAV_RSYNC_DIR)
|
DAV_RSYNC_URL = $(DAV_RSYNC_SERVER):$(DAV_RSYNC_DIR)
|
||||||
DAV_RSYNC_EXCLUDE ?= $(shell bash $(MOD_SCRIPT_DIR)/list-vcs-files.sh)
|
DAV_RSYNC_EXCLUDE ?= $(shell bash $(MOD_SCRIPT_DIR)/scm.sh ls-files)
|
||||||
DAV_RSYNC_EXCLUDE_OPTS = $(addprefix --exclude , $(DAV_RSYNC_EXCLUDE) '*.done')
|
DAV_RSYNC_EXCLUDE_OPTS = $(addprefix --exclude , $(DAV_RSYNC_EXCLUDE) '*.done')
|
||||||
DAV_RSYNC_EXTRA_OPTS ?=
|
DAV_RSYNC_EXTRA_OPTS ?=
|
||||||
DAV_RSYNC ?= rsync $(DAV_RSYNC_EXCLUDE_OPTS)
|
DAV_RSYNC ?= rsync $(DAV_RSYNC_EXCLUDE_OPTS)
|
||||||
|
|
|
||||||
|
|
@ -749,7 +749,7 @@ define install_local_cfg
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define cvs_files
|
define cvs_files
|
||||||
sh $(MOD_SCRIPT_DIR)/list-vcs-files.sh -f
|
sh $(MOD_SCRIPT_DIR)/scm.sh ls-files -f
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define add_flavour_prefix
|
define add_flavour_prefix
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@ PGIT_SH = /bin/bash $(MOD_SCRIPT_DIR)/pgit.sh
|
||||||
PURGE_SH = /bin/bash $(firstword $(wildcard $(MOD_SCRIPT_DIR)/purge-stale-projects.sh /opt/jw-build/bin/purge-stale-projects.sh) purge-not-found)
|
PURGE_SH = /bin/bash $(firstword $(wildcard $(MOD_SCRIPT_DIR)/purge-stale-projects.sh /opt/jw-build/bin/purge-stale-projects.sh) purge-not-found)
|
||||||
PKG_MANAGER_SH ?= /bin/bash $(firstword $(wildcard $(MOD_SCRIPT_DIR)/pkg-manager.sh /opt/jw-build/bin/pkg-manager.sh) pkg-manager-not-found)
|
PKG_MANAGER_SH ?= /bin/bash $(firstword $(wildcard $(MOD_SCRIPT_DIR)/pkg-manager.sh /opt/jw-build/bin/pkg-manager.sh) pkg-manager-not-found)
|
||||||
CREATE_PROJECT_SH ?= /bin/bash $(firstword $(wildcard $(MOD_SCRIPT_DIR)/jw-build-create-project.sh /opt/jw-build/bin/jw-build-create-project.sh) jw-build-create-project-not-found)
|
CREATE_PROJECT_SH ?= /bin/bash $(firstword $(wildcard $(MOD_SCRIPT_DIR)/jw-build-create-project.sh /opt/jw-build/bin/jw-build-create-project.sh) jw-build-create-project-not-found)
|
||||||
LIST_VCS_FILES_SH = /bin/bash $(firstword $(wildcard $(MOD_SCRIPT_DIR)/list-vcs-files.sh /opt/jw-build/bin/list-vcs-files.sh) list-vcs-files-not-found)
|
LIST_VCS_FILES_SH = /bin/bash $(firstword $(wildcard $(MOD_SCRIPT_DIR)/scm.sh ls-files /opt/jw-build/bin/scm.sh ls-files) list-vcs-files-not-found)
|
||||||
JW_PKG = /bin/bash $(firstword $(wildcard $(MOD_SCRIPT_DIR)/jw-pkg /opt/jw-build/bin/jw-pkg) jw-pkg-not-found)
|
JW_PKG = /bin/bash $(firstword $(wildcard $(MOD_SCRIPT_DIR)/jw-pkg /opt/jw-build/bin/jw-pkg) jw-pkg-not-found)
|
||||||
GIT_SRV_ADMIN_SH = JW_BUILD_SSH_EXTRA_OPTS="$(JW_BUILD_SSH_EXTRA_OPTS)" $(GIT_SSH) $(JANWARE_USER)@git.janware.com /opt/jw-build/bin/git-srv-admin.sh
|
GIT_SRV_ADMIN_SH = JW_BUILD_SSH_EXTRA_OPTS="$(JW_BUILD_SSH_EXTRA_OPTS)" $(GIT_SSH) $(JANWARE_USER)@git.janware.com /opt/jw-build/bin/git-srv-admin.sh
|
||||||
CVS_ADMIN_SH = JW_BUILD_SSH_EXTRA_OPTS="$(JW_BUILD_SSH_EXTRA_OPTS)" $(GIT_SSH) $(JANWARE_USER)@git.janware.com /opt/jw-build/bin/cvs-admin.sh
|
CVS_ADMIN_SH = JW_BUILD_SSH_EXTRA_OPTS="$(JW_BUILD_SSH_EXTRA_OPTS)" $(GIT_SSH) $(JANWARE_USER)@git.janware.com /opt/jw-build/bin/cvs-admin.sh
|
||||||
|
|
@ -172,7 +172,7 @@ clean: clean.text-files-cache
|
||||||
clean.text-files-cache:
|
clean.text-files-cache:
|
||||||
rm -f $(TEXT_FILES_CACHE)
|
rm -f $(TEXT_FILES_CACHE)
|
||||||
list-files:
|
list-files:
|
||||||
@echo Makefile
|
@realpath Makefile
|
||||||
@for p in $(PROJECTS); do \
|
@for p in $(PROJECTS); do \
|
||||||
$(LIST_VCS_FILES_SH) -znf $$p | sed -z "s/^/$$p\//" | \
|
$(LIST_VCS_FILES_SH) -znf $$p | sed -z "s/^/$$p\//" | \
|
||||||
xargs -0 realpath ;\
|
xargs -0 realpath ;\
|
||||||
|
|
|
||||||
|
|
@ -276,7 +276,7 @@ define increase_build_number
|
||||||
echo -n "+ increasing build number to " ;\
|
echo -n "+ increasing build number to " ;\
|
||||||
echo $(MAJOR_MINOR_RELEASE)-$(shell expr $(BUILD_NUMBER) + 1)-dev | tee VERSION ;\
|
echo $(MAJOR_MINOR_RELEASE)-$(shell expr $(BUILD_NUMBER) + 1)-dev | tee VERSION ;\
|
||||||
echo $(HASH) > HASH ;\
|
echo $(HASH) > HASH ;\
|
||||||
if ! /bin/bash $(MOD_SCRIPT_DIR)/list-vcs-files.sh | grep -q '^HASH$$'; then \
|
if ! /bin/bash $(MOD_SCRIPT_DIR)/scm.sh ls-files | grep -q '^HASH$$'; then \
|
||||||
$(SCM_ADD) HASH ;\
|
$(SCM_ADD) HASH ;\
|
||||||
fi ;\
|
fi ;\
|
||||||
$(SCM_COMMIT) -m "$(MAJOR_MINOR_RELEASE)-$(shell expr $(BUILD_NUMBER) + 1)-dev" HASH VERSION
|
$(SCM_COMMIT) -m "$(MAJOR_MINOR_RELEASE)-$(shell expr $(BUILD_NUMBER) + 1)-dev" HASH VERSION
|
||||||
|
|
|
||||||
|
|
@ -406,7 +406,7 @@ $(INSTALLED_PROFILE_PATH_SCRIPT): $(TOPDIR)/profiledir.done
|
||||||
$(INSTALL) -p -o $(PROFILEOWNER) -g $(PROFILEGROUP) -m $(PROFILEMODE) path_script.sh $@
|
$(INSTALL) -p -o $(PROFILEOWNER) -g $(PROFILEGROUP) -m $(PROFILEMODE) path_script.sh $@
|
||||||
|
|
||||||
find:
|
find:
|
||||||
@bash $(MOD_SCRIPT_DIR)/list-vcs-files.sh
|
@bash $(MOD_SCRIPT_DIR)/scm.sh ls-files
|
||||||
|
|
||||||
collect:
|
collect:
|
||||||
bash $(MOD_SCRIPT_DIR)/collect-installed-pkg-changes.sh -t $(TOPDIR)
|
bash $(MOD_SCRIPT_DIR)/collect-installed-pkg-changes.sh -t $(TOPDIR)
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ SUBDIRS ?= $(wildcard inst/pre make scripts contrib src libsrc \
|
||||||
images htdocs tmpl doc test inst/post)
|
images htdocs tmpl doc test inst/post)
|
||||||
PROJECT_DESCR = $(TOPDIR)/make/project.conf
|
PROJECT_DESCR = $(TOPDIR)/make/project.conf
|
||||||
GIT_DESCR = $(TOPDIR)/.git/description
|
GIT_DESCR = $(TOPDIR)/.git/description
|
||||||
LIST_VCS_FILES = /bin/bash $(MOD_SCRIPT_DIR)/list-vcs-files.sh
|
LIST_VCS_FILES = /bin/bash $(MOD_SCRIPT_DIR)/scm.sh ls-files
|
||||||
|
|
||||||
OPT_JANWARE_PROJECT ?= -j
|
OPT_JANWARE_PROJECT ?= -j
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,97 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
export LANG=POSIX
|
|
||||||
|
|
||||||
filter_deleted()
|
|
||||||
{
|
|
||||||
local rc_file="$1"
|
|
||||||
shift
|
|
||||||
local cand
|
|
||||||
for cand in "$@"; do
|
|
||||||
grep -q "^R ./$cand/" $rc_file && continue
|
|
||||||
echo $cand
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
output()
|
|
||||||
{
|
|
||||||
if [ "$zero_terminate" = 1 ]; then
|
|
||||||
echo -en "$*\x00"
|
|
||||||
else
|
|
||||||
echo "$*"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
list_dirents_cvs()
|
|
||||||
{
|
|
||||||
local dirs=`sed '/^D\// !d; s%^D/%%; s%/.*%%' $1/CVS/Entries`
|
|
||||||
dirs="`filter_deleted $1/CVS/Entries $dirs`"
|
|
||||||
local cands
|
|
||||||
if [ -f $1/CVS/Entries.Log ]; then
|
|
||||||
cands="`sed '/^A D\// !d; s%^A D/%%; s%/.*%%' $1/CVS/Entries.Log`"
|
|
||||||
dirs="$dirs `filter_deleted $1/CVS/Entries.Log $cands`"
|
|
||||||
fi
|
|
||||||
local files=`sed '/^\// !d; s%/%%; s%/.*%%; s%^%%' $1/CVS/Entries`
|
|
||||||
files="`filter_deleted $1/CVS/Entries $files`"
|
|
||||||
local d f
|
|
||||||
for f in $files; do
|
|
||||||
output "$1/$f"
|
|
||||||
done
|
|
||||||
for d in $dirs; do
|
|
||||||
[ "$opt_only_regular_files" = 1 ] || output $1/$d
|
|
||||||
list_dirents_cvs $1/$d
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
list_dirents_git()
|
|
||||||
{
|
|
||||||
local opts="$git_ls_files_opts"
|
|
||||||
[ "$opt_no_submodules" = 1 ] || opts="$opts --recurse-submodules"
|
|
||||||
git ls-files $opts $1
|
|
||||||
}
|
|
||||||
|
|
||||||
list_dirents()
|
|
||||||
{
|
|
||||||
if [ -d $1/CVS ]; then
|
|
||||||
list_dirents_cvs $1
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
git status >/dev/null 2>&1 || {
|
|
||||||
echo "failed to list versioned files in $1: no VCS" >&2
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
list_dirents_git $1
|
|
||||||
}
|
|
||||||
|
|
||||||
set -- `getopt fnzt "$@"`
|
|
||||||
|
|
||||||
while [ "$1" != -- ]; do
|
|
||||||
case $1 in
|
|
||||||
-f)
|
|
||||||
opt_only_regular_files=1
|
|
||||||
;;
|
|
||||||
-n)
|
|
||||||
opt_no_submodules=1
|
|
||||||
;;
|
|
||||||
-z)
|
|
||||||
zero_terminate=1
|
|
||||||
git_ls_files_opts="$git_ls_files_opts -z"
|
|
||||||
opt_sort="$opt_sort -z"
|
|
||||||
;;
|
|
||||||
-t)
|
|
||||||
text_files=1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
shift
|
|
||||||
done
|
|
||||||
shift
|
|
||||||
|
|
||||||
proj_dir="$1"
|
|
||||||
[ "$proj_dir" ] && cd $proj_dir
|
|
||||||
|
|
||||||
if [ "$text_files" ]; then
|
|
||||||
list_dirents . | sort $opt_sort | xargs file -N | grep ":.*text" | cut -d: -f1
|
|
||||||
else
|
|
||||||
list_dirents . | sort $opt_sort
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
@ -90,7 +90,7 @@ scm_files()
|
||||||
{
|
{
|
||||||
(
|
(
|
||||||
cd $TOPDIR
|
cd $TOPDIR
|
||||||
/bin/bash $MOD_SCRIPT_DIR/list-vcs-files.sh -f $@
|
/bin/bash $MOD_SCRIPT_DIR/scm.sh ls-files -f $@
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
100
scripts/scm.sh
100
scripts/scm.sh
|
|
@ -63,9 +63,106 @@ cmd_clean()
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cmd_ls_files()
|
||||||
|
{
|
||||||
|
filter_deleted()
|
||||||
|
{
|
||||||
|
local rc_file="$1"
|
||||||
|
shift
|
||||||
|
local cand
|
||||||
|
for cand in "$@"; do
|
||||||
|
grep -q "^R ./$cand/" $rc_file && continue
|
||||||
|
echo $cand
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
output()
|
||||||
|
{
|
||||||
|
if [ "$zero_terminate" = 1 ]; then
|
||||||
|
echo -en "$*\x00"
|
||||||
|
else
|
||||||
|
echo "$*"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
list_dirents_cvs()
|
||||||
|
{
|
||||||
|
local dirs=`sed '/^D\// !d; s%^D/%%; s%/.*%%' $1/CVS/Entries`
|
||||||
|
dirs="`filter_deleted $1/CVS/Entries $dirs`"
|
||||||
|
local cands
|
||||||
|
if [ -f $1/CVS/Entries.Log ]; then
|
||||||
|
cands="`sed '/^A D\// !d; s%^A D/%%; s%/.*%%' $1/CVS/Entries.Log`"
|
||||||
|
dirs="$dirs `filter_deleted $1/CVS/Entries.Log $cands`"
|
||||||
|
fi
|
||||||
|
local files=`sed '/^\// !d; s%/%%; s%/.*%%; s%^%%' $1/CVS/Entries`
|
||||||
|
files="`filter_deleted $1/CVS/Entries $files`"
|
||||||
|
local d f
|
||||||
|
for f in $files; do
|
||||||
|
output "$1/$f"
|
||||||
|
done
|
||||||
|
for d in $dirs; do
|
||||||
|
[ "$opt_only_regular_files" = 1 ] || output $1/$d
|
||||||
|
list_dirents_cvs $1/$d
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
list_dirents_git()
|
||||||
|
{
|
||||||
|
local opts="$git_ls_files_opts"
|
||||||
|
[ "$opt_no_submodules" = 1 ] || opts="$opts --recurse-submodules"
|
||||||
|
git ls-files $opts $1
|
||||||
|
}
|
||||||
|
|
||||||
|
list_dirents()
|
||||||
|
{
|
||||||
|
if [ -d $1/CVS ]; then
|
||||||
|
list_dirents_cvs $1
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
git status >/dev/null 2>&1 || {
|
||||||
|
echo "failed to list versioned files in $1: no VCS" >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
list_dirents_git $1
|
||||||
|
}
|
||||||
|
|
||||||
|
set -- `getopt fnzt "$@"`
|
||||||
|
|
||||||
|
while [ "$1" != -- ]; do
|
||||||
|
case $1 in
|
||||||
|
-f)
|
||||||
|
opt_only_regular_files=1
|
||||||
|
;;
|
||||||
|
-n)
|
||||||
|
opt_no_submodules=1
|
||||||
|
;;
|
||||||
|
-z)
|
||||||
|
zero_terminate=1
|
||||||
|
git_ls_files_opts="$git_ls_files_opts -z"
|
||||||
|
opt_sort="$opt_sort -z"
|
||||||
|
;;
|
||||||
|
-t)
|
||||||
|
text_files=1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
shift
|
||||||
|
|
||||||
|
proj_dir="$1"
|
||||||
|
[ "$proj_dir" ] && cd $proj_dir
|
||||||
|
|
||||||
|
if [ "$text_files" ]; then
|
||||||
|
list_dirents . | sort $opt_sort | xargs file -N | grep ":.*text" | cut -d: -f1
|
||||||
|
else
|
||||||
|
list_dirents . | sort $opt_sort
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# ------- here we go
|
# ------- here we go
|
||||||
|
export LANG=POSIX
|
||||||
myname=`basename $0`
|
myname=`basename $0`
|
||||||
cmd=cmd_$1
|
cmd=cmd_${1//-/_}
|
||||||
shift
|
shift
|
||||||
if [ -d "CVS" ]; then
|
if [ -d "CVS" ]; then
|
||||||
scm=cvs
|
scm=cvs
|
||||||
|
|
@ -74,4 +171,3 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
$cmd "$@"
|
$cmd "$@"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue