mirror of
ssh://git.janware.com/janware/proj/jw-pkg
synced 2026-04-24 09:13:37 +02:00
pgit.sh: Rename command "clone" to "get"
"clone" in the Git sense means to copy a remote project over from scratch. pgit.sh clone has come from that, but has since evolved into something different, a mixture of clone, pull and fetch, so find a different name. "get" seems generic enough and doesn't clash with a Git meaning. Adapt variable names accordingly across the project. Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
82b41ffce2
commit
f86634a1d1
4 changed files with 38 additions and 43 deletions
|
|
@ -25,13 +25,13 @@ JWBDIR_NAME ?= jw-pkg
|
|||
JWBDIR_SEARCH_PATH ?= $(DEV_PROJECTS_DIR) $(BUILD_TOOLS_PREFIX)/opt/$(FLAVOUR_PATH_PREFIX)
|
||||
JWBDIR ?= $(firstword $(wildcard $(addsuffix /$(JWBDIR_NAME),$(JWBDIR_SEARCH_PATH))))
|
||||
|
||||
JW_PKG_BINDIR = $(JWBDIR)/bin
|
||||
JW_PKG_BINDIR = $(JWBDIR)/bin
|
||||
JWB_SCRIPT_DIR = $(firstword $(wildcard ./$(JWBDIR_NAME)/scripts $(JW_PKG_BINDIR)) jwb-script-dir-not-found)
|
||||
JW_PKG_REMOTE_BINDIR = /opt/jw-pkg/bin
|
||||
JW_PKG_REMOTE_BINDIR = /opt/jw-pkg/bin
|
||||
|
||||
SHELL = /bin/bash -o pipefail +H
|
||||
PROJECTS_TXT ?= projects.txt
|
||||
JW_PKG_VERBOSE ?= false
|
||||
JW_PKG_VERBOSE ?= false
|
||||
BASE_PKGS = git make sudo time xdg-utils python3
|
||||
PREREQ_RELEASE ?= pull
|
||||
ifneq ($(JANWARE_USER),)
|
||||
|
|
@ -77,7 +77,7 @@ OFFLINE_PROJECTS ?= $(EXCLUDE_FROM_BUILD)
|
|||
TEXT_FILES_CACHE ?= text-files.txt
|
||||
|
||||
ifeq ($(OFFLINE),true)
|
||||
UNAVAILABLE_TARGETS ?= pull.done update.done clone.done
|
||||
UNAVAILABLE_TARGETS ?= pull.done update.done get.done
|
||||
else
|
||||
UNAVAILABLE_TARGETS ?=
|
||||
endif
|
||||
|
|
@ -121,19 +121,19 @@ PKG_MANAGER ?= $(JW_PKG_PY) distro --interactive=$(INTERACTIVE)
|
|||
ifneq ($(origin PROJECTS_DIR_REMOTE_BASE),undefined)
|
||||
PGIT_SH += --remote-base $(PROJECTS_DIR_REMOTE_BASE)
|
||||
endif
|
||||
PGIT_SH_CLONE := $(PGIT_SH) clone
|
||||
PGIT_SH_CLONE_DEFAULT = $(PGIT_SH_CLONE) $(PGIT_SH_OPTS_NETWORK)
|
||||
PGIT_SH_GET := $(PGIT_SH) get
|
||||
PGIT_SH_GET_DEFAULT = $(PGIT_SH_GET) $(PGIT_SH_OPTS_NETWORK)
|
||||
ifneq ($(JANWARE_USER),)
|
||||
PGIT_SH_OPTS_NETWORK += --login $(JANWARE_USER)
|
||||
endif
|
||||
ifneq ($(CLONE_FROM_USER),)
|
||||
PGIT_SH_CLONE_DEFAULT += --refspec $(CLONE_FROM_USER):current-branch:current-branch
|
||||
PGIT_SH_GET_DEFAULT += --refspec $(CLONE_FROM_USER):current-branch:current-branch
|
||||
endif
|
||||
ifneq ($(OFFLINE_PROJECTS),)
|
||||
export PGIT_IGNORE = $(OFFLINE_PROJECTS)
|
||||
endif
|
||||
ifneq ($(JANWARE_USER),)
|
||||
PGIT_SH_CLONE_DEFAULT += --create-remote-user-repos
|
||||
PGIT_SH_GET_DEFAULT += --create-remote-user-repos
|
||||
endif
|
||||
|
||||
PURGE_SH = /bin/bash $(firstword $(wildcard $(JWB_SCRIPT_DIR)/purge-stale-projects.sh $(JW_PKG_BINDIR)/purge-stale-projects.sh) purge-not-found)
|
||||
|
|
@ -291,7 +291,7 @@ done.clean:
|
|||
list-maintainers: $(SSH_WRAPPER_SH)
|
||||
$(GIT_SRV_ADMIN_SH) $@
|
||||
|
||||
update pull: purge git-clone
|
||||
update pull: purge git-get
|
||||
touch pull.done
|
||||
|
||||
sync: pull push
|
||||
|
|
@ -301,13 +301,15 @@ sync-all: pull-all push-all
|
|||
sync-%:
|
||||
ssh $* make -C $(shell pwd) sync
|
||||
|
||||
pull-all: purge git-clone git-pull-all
|
||||
touch clone.done
|
||||
pull-all: purge git-get git-pull-all
|
||||
touch get.done
|
||||
touch pull.done
|
||||
|
||||
diff-all diff: $(SSH_WRAPPER_SH)
|
||||
$(PGIT_SH) diff
|
||||
|
||||
# --- git targets
|
||||
|
||||
git-push push: $(SSH_WRAPPER_SH)
|
||||
$(PGIT_SH) push $(PGIT_SH_OPTS_NETWORK)
|
||||
|
||||
|
|
@ -323,22 +325,18 @@ git-short-diff: $(SSH_WRAPPER_SH)
|
|||
git-status:
|
||||
$(PGIT_SH) status -uno
|
||||
|
||||
git-get: $(SSH_WRAPPER_SH)
|
||||
$(PGIT_SH_GET_DEFAULT)
|
||||
touch get.done
|
||||
|
||||
git-pull: $(SSH_WRAPPER_SH)
|
||||
$(PGIT_SH_CLONE_DEFAULT)
|
||||
|
||||
git-pull-mini: $(SSH_WRAPPER_SH)
|
||||
PGIT_CLONE_PROJECTS="$(patsubst %/.git,%,$(wildcard $(addsuffix /.git,$(shell make -s build-order))))" $(PGIT_SH_CLONE_DEFAULT)
|
||||
git-get-mini: $(SSH_WRAPPER_SH)
|
||||
PGIT_SH_PROJECTS="$(patsubst %/.git,%,$(wildcard $(addsuffix /.git,$(shell make -s build-order))))" $(PGIT_SH_GET_DEFAULT)
|
||||
|
||||
git-pull-all: $(SSH_WRAPPER_SH)
|
||||
$(PGIT_SH) pull $(PGIT_SH_OPTS_NETWORK) --all
|
||||
|
||||
git-clone: $(SSH_WRAPPER_SH)
|
||||
$(PGIT_SH_CLONE_DEFAULT)
|
||||
touch clone.done
|
||||
|
||||
git-clone-%: $(SSH_WRAPPER_SH)
|
||||
$(PGIT_SH_CLONE_DEFAULT)
|
||||
git-get-%: $(SSH_WRAPPER_SH)
|
||||
$(PGIT_SH_GET) $(PGIT_SH_OPTS_NETWORK) --refspec "$*:master:master"
|
||||
|
||||
git-show-non-master-branches:
|
||||
$(Q)$(PGIT_SH) branch 2>&1 | \
|
||||
|
|
@ -366,9 +364,6 @@ git-echo-links-%: | $(TEXT_FILES_CACHE)
|
|||
git-update-project-descriptions: $(SSH_WRAPPER_SH)
|
||||
$(GIT_SRV_ADMIN_SH) -j update-descriptions all
|
||||
|
||||
git-pull-%: $(SSH_WRAPPER_SH)
|
||||
$(PGIT_SH_CLONE) $(PGIT_SH_OPTS_NETWORK) --refspec "$*:master:master"
|
||||
|
||||
git-commit:
|
||||
$(PGIT_SH) commit
|
||||
|
||||
|
|
@ -383,9 +378,9 @@ clean.ssh-wrapper:
|
|||
rm -f $(SSH_WRAPPER_SH)
|
||||
distclean: clean.ssh-wrapper
|
||||
|
||||
pull.done: $(filter-out $(UNAVAILABLE_TARGETS), clone.done)
|
||||
pull.done: $(filter-out $(UNAVAILABLE_TARGETS),get.done)
|
||||
touch $@
|
||||
|
||||
clone.done: $(filter-out $(UNAVAILABLE_TARGETS),$(SSH_WRAPPER_SH))
|
||||
$(PGIT_SH_CLONE_DEFAULT)
|
||||
get.done: $(filter-out $(UNAVAILABLE_TARGETS),$(SSH_WRAPPER_SH))
|
||||
$(PGIT_SH_GET_DEFAULT)
|
||||
touch $@
|
||||
|
|
|
|||
|
|
@ -239,7 +239,7 @@ SCM_ADD = cvs add
|
|||
SCM_PUSH =
|
||||
SCM_PULL = cvs update -dP
|
||||
|
||||
pull-maintainer:
|
||||
get-maintainer:
|
||||
$(SCM_PULL)
|
||||
|
||||
define check_scm_sync
|
||||
|
|
@ -266,9 +266,9 @@ else
|
|||
SCM_COMMIT = git commit
|
||||
SCM_ADD = git add
|
||||
SCM_PUSH = git push
|
||||
SCM_PULL = make git-pull-maintainer
|
||||
SCM_PULL = make git-get-maintainer
|
||||
|
||||
pull-maintainer: git-pull-maintainer
|
||||
get-maintainer: git-get-maintainer
|
||||
|
||||
define check_scm_sync
|
||||
echo + checking git ;\
|
||||
|
|
@ -344,7 +344,7 @@ pkg-rebuild-reinstall: pkg-clean pkg-build pkg-reinstall
|
|||
# doesn't work
|
||||
# pkg-release-update: pkg-release pkg-update
|
||||
|
||||
pkg-release-reinstall: pull-maintainer
|
||||
pkg-release-reinstall: get-maintainer
|
||||
$(PKG_SH) release $(PKG_SH_BUILD_OPTS)
|
||||
ifneq ($(TARGET_HOST),)
|
||||
pkg-remote-install:
|
||||
|
|
|
|||
|
|
@ -197,14 +197,14 @@ git-ssh-%:
|
|||
bash -c "`git remote get-url --push $* | sed 's|ssh://||; s|\([^/]\+\)/\(.*\)|LC_CDPATH=/\2 ssh -o SendEnv=LC_CDPATH \1|'`"
|
||||
git-ssh: git-ssh-origin
|
||||
|
||||
git-pull-official:
|
||||
make git-pull-devops
|
||||
git-get-official:
|
||||
make git-get-devops
|
||||
|
||||
git-pull-maintainer:
|
||||
make git-pull-$(call proj_query,getval global jw-maintainer)
|
||||
git-get-maintainer:
|
||||
make git-get-$(call proj_query,getval global jw-maintainer)
|
||||
|
||||
git-pull-%:
|
||||
PGIT_CLONE_PROJECTS=. $(PGIT_SH) clone --refspec $*:$(GIT_MAIN_BRANCH):$(GIT_MAIN_BRANCH)
|
||||
git-get-%:
|
||||
PGIT_SH_PROJECTS=. $(PGIT_SH) get --refspec $*:$(GIT_MAIN_BRANCH):$(GIT_MAIN_BRANCH)
|
||||
|
||||
pkg-manager-refresh:
|
||||
$(PKG_MANAGER) refresh
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ cmd_commit()
|
|||
done
|
||||
)
|
||||
|
||||
cmd_clone()
|
||||
cmd_get()
|
||||
(
|
||||
run_clone() {
|
||||
local url="$1"
|
||||
|
|
@ -128,7 +128,7 @@ cmd_clone()
|
|||
local whoami="$(id -un)"
|
||||
set_global_variables
|
||||
cd $projects_dir
|
||||
local projects="$PGIT_CLONE_PROJECTS"
|
||||
local projects="$PGIT_SH_PROJECTS"
|
||||
local ignore="$PGIT_IGNORE"
|
||||
local this_dir="${0%/*}"
|
||||
local jw_projects="/usr/bin/python3 $this_dir/jw-pkg.py"
|
||||
|
|
@ -138,7 +138,7 @@ cmd_clone()
|
|||
long_opts="$long_opts,refspec:"
|
||||
|
||||
local opts
|
||||
opts=$(getopt -o C --long "$long_opts" -n clone -- "$@") || fatal "Failed to parse options $@"
|
||||
opts=$(getopt -o C --long "$long_opts" -n get -- "$@") || fatal "Failed to parse options $@"
|
||||
eval set -- "$opts"
|
||||
while [ "$1" != -- ]; do
|
||||
case "$1" in
|
||||
|
|
@ -189,7 +189,7 @@ cmd_clone()
|
|||
[ "$to_ref" = "current-branch" ] && to_ref=$cur_ref
|
||||
[ "$from_ref" = "current-branch" ] && from_ref=$cur_ref
|
||||
[ "$refspec_arg" != "$from_user:$from_ref:$to_ref" ] && log "Fetching $from_user:$from_ref:$to_ref ($refspec_arg)"
|
||||
fat_marker "Fetching project $project_name from user $from_user"
|
||||
fat_marker "Getting project $project_name from user $from_user"
|
||||
if [ -d $project_dir ]; then
|
||||
run_git -C $project_dir remote | grep -q "^$remote_name$" || {
|
||||
run_git -C $project_dir remote add $remote_name $pull_url
|
||||
|
|
@ -272,7 +272,7 @@ while [ "${1:0:1}" = - ]; do
|
|||
done
|
||||
|
||||
case $cmd in
|
||||
clone|diff|commit)
|
||||
get|diff|commit)
|
||||
cmd_${cmd//-/_} "$@"
|
||||
;;
|
||||
*)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue