mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-15 12:03:31 +01:00
projects-dir-minimal.mk: Default PROJECTS_DIR_REMOTE_BASE to jw-build's remote
If jw-build is already cloned, infect all other repositories with its remote via PROJECTS_DIR_REMOTE_BASE. Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
561905bab7
commit
fc02dad92c
2 changed files with 12 additions and 3 deletions
|
|
@ -2,7 +2,6 @@
|
||||||
# SPDX-License-Identifier: LGPL-2.0-only
|
# SPDX-License-Identifier: LGPL-2.0-only
|
||||||
#
|
#
|
||||||
# Makefile for managing multiple software repositories in one tree
|
# Makefile for managing multiple software repositories in one tree
|
||||||
#
|
|
||||||
# (C) Copyright 2001-2025, Jan Lindemann <jan@janware.com>
|
# (C) Copyright 2001-2025, Jan Lindemann <jan@janware.com>
|
||||||
#
|
#
|
||||||
# This is the top-level Makefile for a software build tree organized by
|
# This is the top-level Makefile for a software build tree organized by
|
||||||
|
|
@ -21,7 +20,12 @@ PROJECTS_MAKEFILE_NAME := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)
|
||||||
JWBDIR ?= jw-build
|
JWBDIR ?= jw-build
|
||||||
|
|
||||||
ifeq ($(origin PROJECTS_DIR_REMOTE_BASE),undefined)
|
ifeq ($(origin PROJECTS_DIR_REMOTE_BASE),undefined)
|
||||||
PROJECTS_DIR_REMOTE_BASE ?= https://janware.com/code
|
ifneq ($(wildcard $(JWBDIR)),)
|
||||||
|
PROJECTS_DIR_REMOTE_BASE := $(shell /usr/bin/python3 $(JWBDIR)/scripts/jw-projects.py -p . get-auth-info --remote-base --only-values)
|
||||||
|
endif
|
||||||
|
ifeq ($(PROJECTS_DIR_REMOTE_BASE),)
|
||||||
|
PROJECTS_DIR_REMOTE_BASE := https://janware.com/code
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ($(findstring ssh://git.janware.com/srv/git,$(PROJECTS_DIR_REMOTE_BASE)),)
|
ifneq ($(findstring ssh://git.janware.com/srv/git,$(PROJECTS_DIR_REMOTE_BASE)),)
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ class CmdGetAuthInfo(Cmd): # export
|
||||||
parser.add_argument('--only-values', help='Don\'t prefix values by "<field-name>="', action='store_true', default=False)
|
parser.add_argument('--only-values', help='Don\'t prefix values by "<field-name>="', action='store_true', default=False)
|
||||||
parser.add_argument('--username', help='Show user name', action='store_true', default=False)
|
parser.add_argument('--username', help='Show user name', action='store_true', default=False)
|
||||||
parser.add_argument('--password', help='Show password', action='store_true', default=False)
|
parser.add_argument('--password', help='Show password', action='store_true', default=False)
|
||||||
|
parser.add_argument('--remote-base', help='Show remote base URL', action='store_true', default=False)
|
||||||
|
|
||||||
def _run(self, args: Namespace) -> None:
|
def _run(self, args: Namespace) -> None:
|
||||||
keys = ['username', 'password']
|
keys = ['username', 'password']
|
||||||
|
|
@ -32,10 +33,14 @@ class CmdGetAuthInfo(Cmd): # export
|
||||||
if re.match(r'^\s*$', line):
|
if re.match(r'^\s*$', line):
|
||||||
continue
|
continue
|
||||||
name, url, typ = re.split(r'\s+', line)
|
name, url, typ = re.split(r'\s+', line)
|
||||||
if name == 'origin' and typ == '(push)':
|
if name == 'origin' and typ == '(pull)': # TODO: Use other remotes, too?
|
||||||
parsed = urlparse(url)
|
parsed = urlparse(url)
|
||||||
for key in keys:
|
for key in keys:
|
||||||
result[key] = getattr(parsed, key)
|
result[key] = getattr(parsed, key)
|
||||||
|
base = parsed.geturl()
|
||||||
|
base = re.sub(r'/jw-build', '', base)
|
||||||
|
base = re.sub(r'/proj$', '', base)
|
||||||
|
url['remote-base'] = base
|
||||||
break
|
break
|
||||||
|
|
||||||
# --- Print results
|
# --- Print results
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue