mirror of
https://github.com/opnsense/plugins.git
synced 2026-02-03 20:40:37 -05:00
make: migrate git glue
This commit is contained in:
parent
fa2d3e97da
commit
752d5a940f
4 changed files with 44 additions and 89 deletions
12
Makefile
12
Makefile
|
|
@ -23,10 +23,7 @@
|
|||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
|
||||
all:
|
||||
@cat ${.CURDIR}/README.md | ${PAGER}
|
||||
|
||||
.include "Mk/defaults.mk"
|
||||
PLUGINSDIR?= ${.CURDIR}
|
||||
|
||||
CATEGORIES!= ls -1d [a-z0-9]*
|
||||
|
||||
|
|
@ -35,6 +32,13 @@ _${CATEGORY}!= ls -1d ${CATEGORY}/*
|
|||
PLUGIN_DIRS+= ${_${CATEGORY}}
|
||||
.endfor
|
||||
|
||||
all:
|
||||
@cat ${.CURDIR}/README.md | ${PAGER}
|
||||
|
||||
.include "Mk/defaults.mk"
|
||||
.include "Mk/common.mk"
|
||||
.include "Mk/git.mk"
|
||||
|
||||
list:
|
||||
.for PLUGIN_DIR in ${PLUGIN_DIRS}
|
||||
@echo ${PLUGIN_DIR} -- $$(${MAKE} -C ${PLUGIN_DIR} -v PLUGIN_COMMENT) \
|
||||
|
|
|
|||
|
|
@ -34,6 +34,9 @@ PKG= true
|
|||
.endif
|
||||
GIT!= which git || echo true
|
||||
|
||||
SCRIPTSDIR= ${PLUGINSDIR}/Scripts
|
||||
TEMPLATESDIR= ${PLUGINSDIR}/Templates
|
||||
|
||||
GITVERSION= ${SCRIPTSDIR}/version.sh
|
||||
|
||||
_PLUGIN_ARCH!= uname -p
|
||||
|
|
@ -89,84 +92,3 @@ SED_REPLACE= # empty
|
|||
.for REPLACEMENT in ${REPLACEMENTS}
|
||||
SED_REPLACE+= -e "s=%%${REPLACEMENT}%%=${${REPLACEMENT}}=g"
|
||||
.endfor
|
||||
|
||||
ARGS= diff feed mfc
|
||||
|
||||
# handle argument expansion for required targets
|
||||
.for TARGET in ${.TARGETS}
|
||||
_TARGET= ${TARGET:C/\-.*//}
|
||||
.if ${_TARGET} != ${TARGET}
|
||||
.for ARGUMENT in ${ARGS}
|
||||
.if ${_TARGET} == ${ARGUMENT}
|
||||
${_TARGET}_ARGS+= ${TARGET:C/^[^\-]*(\-|\$)//:S/,/ /g}
|
||||
${TARGET}: ${_TARGET}
|
||||
.endif
|
||||
.endfor
|
||||
${_TARGET}_ARG= ${${_TARGET}_ARGS:[0]}
|
||||
.endif
|
||||
.endfor
|
||||
|
||||
ensure-stable:
|
||||
@if ! git show-ref --verify --quiet refs/heads/${PLUGIN_STABLE}; then \
|
||||
git update-ref refs/heads/${PLUGIN_STABLE} refs/remotes/origin/${PLUGIN_STABLE}; \
|
||||
git config branch.${PLUGIN_STABLE}.merge refs/heads/${PLUGIN_STABLE}; \
|
||||
git config branch.${PLUGIN_STABLE}.remote origin; \
|
||||
fi
|
||||
|
||||
diff_ARGS?= .
|
||||
|
||||
diff: ensure-stable
|
||||
@git diff --stat -p ${PLUGIN_STABLE} ${.CURDIR}/${diff_ARGS:[1]}
|
||||
|
||||
feed: ensure-stable
|
||||
@git log --stat -p --reverse ${PLUGIN_STABLE}...${feed_ARGS:[1]}~1
|
||||
|
||||
mfc_ARGS?= .
|
||||
|
||||
mfc: ensure-stable
|
||||
.for MFC in ${mfc_ARGS}
|
||||
.if exists(${MFC})
|
||||
@git diff --stat -p ${PLUGIN_STABLE} ${.CURDIR}/${MFC} > /tmp/mfc.diff
|
||||
@git checkout ${PLUGIN_STABLE}
|
||||
@git apply /tmp/mfc.diff
|
||||
@git add ${.CURDIR}/${MFC}
|
||||
@if ! git diff --quiet HEAD; then \
|
||||
git commit -m "${MFC:S/^.$/${PLUGIN_DIR}/}: sync with ${PLUGIN_MAIN}"; \
|
||||
fi
|
||||
.else
|
||||
@git checkout ${PLUGIN_STABLE}
|
||||
@if ! git cherry-pick -x ${MFC}; then \
|
||||
git cherry-pick --abort; \
|
||||
fi
|
||||
.endif
|
||||
@git checkout ${PLUGIN_MAIN}
|
||||
.endfor
|
||||
|
||||
stable:
|
||||
@git checkout ${PLUGIN_STABLE}
|
||||
|
||||
${PLUGIN_MAINS}:
|
||||
@git checkout ${PLUGIN_MAIN}
|
||||
|
||||
rebase:
|
||||
@git checkout ${PLUGIN_STABLE}
|
||||
@git rebase -i
|
||||
@git checkout ${PLUGIN_MAIN}
|
||||
|
||||
log:
|
||||
@git log --stat -p ${PLUGIN_STABLE}
|
||||
|
||||
pull:
|
||||
@git checkout ${PLUGIN_STABLE}
|
||||
@git pull
|
||||
@git checkout ${PLUGIN_MAIN}
|
||||
|
||||
push:
|
||||
@git checkout ${PLUGIN_STABLE}
|
||||
@git push
|
||||
@git checkout ${PLUGIN_MAIN}
|
||||
|
||||
reset:
|
||||
@git checkout ${PLUGIN_STABLE}
|
||||
@git reset --hard HEAD~1
|
||||
@git checkout ${PLUGIN_MAIN}
|
||||
|
|
|
|||
30
Mk/git.mk
Normal file
30
Mk/git.mk
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# Copyright (c) 2025 Franco Fichtner <franco@opnsense.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
|
||||
CORE_MAIN= ${PLUGIN_MAIN}
|
||||
CORE_MAINS= ${PLUGIN_MAINS}
|
||||
CORE_STABLE= ${PLUGIN_STABLE}
|
||||
|
||||
.-include "${PLUGINSDIR}/../core/Mk/git.mk"
|
||||
|
|
@ -23,15 +23,13 @@
|
|||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
|
||||
PLUGINSDIR?= ${.CURDIR}/../..
|
||||
|
||||
all: check
|
||||
@cat ${.CURDIR}/${PLUGIN_DESC} | ${PAGER}
|
||||
|
||||
.include "defaults.mk"
|
||||
|
||||
PLUGINSDIR?= ${.CURDIR}/../..
|
||||
SCRIPTSDIR= ${PLUGINSDIR}/Scripts
|
||||
TEMPLATESDIR= ${PLUGINSDIR}/Templates
|
||||
|
||||
.if exists(${GIT}) && exists(${GITVERSION})
|
||||
PLUGIN_COMMIT!= ${GITVERSION}
|
||||
.else
|
||||
|
|
@ -53,6 +51,7 @@ PLUGIN_REQUIRES= PLUGIN_NAME PLUGIN_VERSION PLUGIN_COMMENT \
|
|||
PLUGIN_MAINTAINER
|
||||
|
||||
.include "common.mk"
|
||||
.include "git.mk"
|
||||
.include "lint.mk"
|
||||
.include "style.mk"
|
||||
.include "sweep.mk"
|
||||
|
|
|
|||
Loading…
Reference in a new issue