build: fiddle with git and improve skim
This commit is contained in:
parent
31bedd1d58
commit
5119ed798a
3
Makefile
3
Makefile
|
@ -19,6 +19,7 @@ NAME?= OPNsense
|
|||
FLAVOUR?= OpenSSL
|
||||
_VERSION!= date '+%Y%m%d%H%M'
|
||||
VERSION?= ${_VERSION}
|
||||
PORTSREFDIR?= /usr/freebsd-ports
|
||||
TOOLSDIR?= /usr/tools
|
||||
PORTSDIR?= /usr/ports
|
||||
COREDIR?= /usr/core
|
||||
|
@ -50,5 +51,5 @@ ${STEP}:
|
|||
@cd build && sh ./${.TARGET}.sh \
|
||||
-f ${FLAVOUR} -n ${NAME} -v ${VERSION} \
|
||||
-S ${SRCDIR} -P ${PORTSDIR} -T ${TOOLSDIR} \
|
||||
-C ${COREDIR} ${${STEP}_ARGS}
|
||||
-C ${COREDIR} -R ${PORTSREFDIR} ${${STEP}_ARGS}
|
||||
.endfor
|
||||
|
|
|
@ -30,7 +30,6 @@ set -e
|
|||
. ./common.sh && $(${SCRUB_ARGS})
|
||||
|
||||
for GITDIR in ${SRCDIR} ${PORTSDIR} ${COREDIR}; do
|
||||
echo ">>> Checking out ${GITDIR}:"
|
||||
git -C ${GITDIR} fetch --all --prune
|
||||
git_checkout ${GITDIR} ${1}
|
||||
echo ">>> Updating ${GITDIR}:"
|
||||
git_update ${GITDIR} ${1}
|
||||
done
|
||||
|
|
|
@ -29,23 +29,14 @@ set -e
|
|||
|
||||
SCRUB_ARGS=:
|
||||
|
||||
# clear these to make sure they are passed by the caller
|
||||
PRODUCT_FLAVOUR=
|
||||
PRODUCT_VERSION=
|
||||
PRODUCT_NAME=
|
||||
TOOLSDIR=
|
||||
PORTSDIR=
|
||||
COREDIR=
|
||||
SRCDIR=
|
||||
|
||||
usage()
|
||||
{
|
||||
echo "Usage: ${0} -f flavour -n name -v version" >&2
|
||||
echo "Usage: ${0} -f flavour -n name -v version -R freebsd-ports.git" >&2
|
||||
echo " -C core.git -P ports.git -S src.git -T tools.git" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
while getopts C:f:n:P:S:T:v: OPT; do
|
||||
while getopts C:f:n:P:R:S:T:v: OPT; do
|
||||
case ${OPT} in
|
||||
C)
|
||||
export COREDIR=${OPTARG}
|
||||
|
@ -63,6 +54,10 @@ while getopts C:f:n:P:S:T:v: OPT; do
|
|||
export PORTSDIR=${OPTARG}
|
||||
SCRUB_ARGS=${SCRUB_ARGS};shift;shift
|
||||
;;
|
||||
R)
|
||||
export PORTSREFDIR=${OPTARG}
|
||||
SCRUB_ARGS=${SCRUB_ARGS};shift;shift
|
||||
;;
|
||||
S)
|
||||
export SRCDIR=${OPTARG}
|
||||
SCRUB_ARGS=${SCRUB_ARGS};shift;shift
|
||||
|
@ -86,6 +81,7 @@ if [ -z "${PRODUCT_NAME}" -o \
|
|||
-z "${PRODUCT_VERSION}" -o \
|
||||
-z "${TOOLSDIR}" -o \
|
||||
-z "${PORTSDIR}" -o \
|
||||
-z "${PORTSREFDIR}" -o \
|
||||
-z "${COREDIR}" -o \
|
||||
-z "${SRCDIR}" ]; then
|
||||
usage
|
||||
|
@ -131,6 +127,14 @@ git_checkout()
|
|||
git -C ${1} reset --hard ${REPO_TAG}
|
||||
}
|
||||
|
||||
git_update()
|
||||
{
|
||||
git -C ${1} fetch --all --prune
|
||||
if [ -n "${2}" ]; then
|
||||
git_checkout ${1} ${2}
|
||||
fi
|
||||
}
|
||||
|
||||
git_describe()
|
||||
{
|
||||
VERSION=$(git -C ${1} describe --abbrev=0 --always)
|
||||
|
|
|
@ -30,9 +30,8 @@ set -e
|
|||
. ./common.sh && $(${SCRUB_ARGS})
|
||||
|
||||
export __MAKE_CONF=${PRODUCT_CONFIG}/make.conf
|
||||
PORT_LIST=${PRODUCT_CONFIG}/ports.conf
|
||||
FREEBSD=/usr/freebsd-ports
|
||||
OPNSENSE=${PORTSDIR}
|
||||
|
||||
git_update ${PORTSREFDIR} origin/master
|
||||
|
||||
UNUSED=1
|
||||
USED=1
|
||||
|
@ -61,9 +60,9 @@ while read PORT_NAME PORT_CAT PORT_OPT; do
|
|||
|
||||
PORT=${PORT_CAT}/${PORT_NAME}
|
||||
|
||||
SOURCE=${OPNSENSE}
|
||||
if [ ! -d ${OPNSENSE}/${PORT} ]; then
|
||||
SOURCE=${FREEBSD}
|
||||
SOURCE=${PORTSDIR}
|
||||
if [ ! -d ${PORTSDIR}/${PORT} ]; then
|
||||
SOURCE=${PORTSREFDIR}
|
||||
fi
|
||||
|
||||
if [ "${PORT_OPT}" != "sync" ]; then
|
||||
|
@ -85,11 +84,11 @@ while read PORT_NAME PORT_CAT PORT_OPT; do
|
|||
PORT_MODS="${PORT_MODS} ${PORT_DEPS}"
|
||||
|
||||
for PORT in ${PORT_DEPS}; do
|
||||
if [ ! -d ${FREEBSD}/${PORT} ]; then
|
||||
if [ ! -d ${PORTSREFDIR}/${PORT} ]; then
|
||||
continue;
|
||||
fi
|
||||
|
||||
diff -rq ${OPNSENSE}/${PORT} ${FREEBSD}/${PORT} \
|
||||
diff -rq ${PORTSDIR}/${PORT} ${PORTSREFDIR}/${PORT} \
|
||||
> /dev/null && continue
|
||||
|
||||
NEW=1
|
||||
|
@ -103,13 +102,13 @@ while read PORT_NAME PORT_CAT PORT_OPT; do
|
|||
PORTS_CHANGED="${PORTS_CHANGED} ${PORT}"
|
||||
fi
|
||||
done
|
||||
done < ${PORT_LIST}
|
||||
done < ${PRODUCT_CONFIG}/ports.conf
|
||||
|
||||
echo "done"
|
||||
|
||||
if [ -n "${UNUSED}" ]; then
|
||||
for ENTRY in ${OPNSENSE}/*; do
|
||||
ENTRY=${ENTRY##"${OPNSENSE}/"}
|
||||
for ENTRY in ${PORTSDIR}/*; do
|
||||
ENTRY=${ENTRY##"${PORTSDIR}/"}
|
||||
|
||||
case "$(echo ${ENTRY} | colrm 2)" in
|
||||
[[:upper:]])
|
||||
|
@ -119,26 +118,26 @@ if [ -n "${UNUSED}" ]; then
|
|||
;;
|
||||
esac
|
||||
|
||||
if [ ! -d ${FREEBSD}/${ENTRY} ]; then
|
||||
if [ ! -d ${PORTSREFDIR}/${ENTRY} ]; then
|
||||
continue;
|
||||
fi
|
||||
|
||||
for PORT in ${OPNSENSE}/${ENTRY}/*; do
|
||||
PORT=${PORT##"${OPNSENSE}/"}
|
||||
for PORT in ${PORTSDIR}/${ENTRY}/*; do
|
||||
PORT=${PORT##"${PORTSDIR}/"}
|
||||
|
||||
if [ -e ${FREEBSD}/${PORT} ]; then
|
||||
if [ -e ${PORTSREFDIR}/${PORT} ]; then
|
||||
continue;
|
||||
fi
|
||||
|
||||
echo ">>> Removing ${PORT}"
|
||||
|
||||
rm -fr ${OPNSENSE}/${PORT}
|
||||
rm -fr ${PORTSDIR}/${PORT}
|
||||
done
|
||||
|
||||
PORT_MODS=$(echo ${PORT_MODS} | tr ' ' '\n' | sort -u)
|
||||
|
||||
for PORT in ${FREEBSD}/${ENTRY}/*; do
|
||||
PORT=${PORT##"${FREEBSD}/"}
|
||||
for PORT in ${PORTSREFDIR}/${ENTRY}/*; do
|
||||
PORT=${PORT##"${PORTSREFDIR}/"}
|
||||
|
||||
UNUSED=1
|
||||
for PORT_MOD in ${PORT_MODS}; do
|
||||
|
@ -154,29 +153,29 @@ if [ -n "${UNUSED}" ]; then
|
|||
|
||||
echo ">>> Refreshing ${PORT}"
|
||||
|
||||
rm -fr ${OPNSENSE}/${PORT}
|
||||
cp -r ${FREEBSD}/${PORT} ${OPNSENSE}/${PORT}
|
||||
rm -fr ${PORTSDIR}/${PORT}
|
||||
cp -r ${PORTSREFDIR}/${PORT} ${PORTSDIR}/${PORT}
|
||||
done
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -n "${USED}" ]; then
|
||||
for PORT in ${PORTS_CHANGED}; do
|
||||
(clear && diff -ru ${OPNSENSE}/${PORT} ${FREEBSD}/${PORT} \
|
||||
(clear && diff -ru ${PORTSDIR}/${PORT} ${PORTSREFDIR}/${PORT} \
|
||||
2>/dev/null || true;) | less -r
|
||||
|
||||
echo -n "replace ${PORT} [y/N]: "
|
||||
read YN
|
||||
case ${YN} in
|
||||
[yY])
|
||||
rm -fr ${OPNSENSE}/${PORT}
|
||||
cp -a ${FREEBSD}/${PORT} ${OPNSENSE}/${PORT}
|
||||
rm -fr ${PORTSDIR}/${PORT}
|
||||
cp -a ${PORTSREFDIR}/${PORT} ${PORTSDIR}/${PORT}
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
for ENTRY in ${FREEBSD}/*; do
|
||||
ENTRY=${ENTRY##"${FREEBSD}/"}
|
||||
for ENTRY in ${PORTSREFDIR}/*; do
|
||||
ENTRY=${ENTRY##"${PORTSREFDIR}/"}
|
||||
|
||||
case "$(echo ${ENTRY} | colrm 2)" in
|
||||
[[:upper:]])
|
||||
|
@ -186,13 +185,13 @@ if [ -n "${USED}" ]; then
|
|||
;;
|
||||
esac
|
||||
|
||||
diff -rq ${OPNSENSE}/${ENTRY} ${FREEBSD}/${ENTRY} \
|
||||
diff -rq ${PORTSDIR}/${ENTRY} ${PORTSREFDIR}/${ENTRY} \
|
||||
> /dev/null || ENTRIES="${ENTRIES} ${ENTRY}"
|
||||
done
|
||||
|
||||
if [ -n "${ENTRIES}" ]; then
|
||||
(clear && for ENTRY in ${ENTRIES}; do
|
||||
diff -ru ${OPNSENSE}/${ENTRY} ${FREEBSD}/${ENTRY} \
|
||||
diff -ru ${PORTSDIR}/${ENTRY} ${PORTSREFDIR}/${ENTRY} \
|
||||
2>/dev/null || true;
|
||||
done) | less -r
|
||||
|
||||
|
@ -201,8 +200,8 @@ if [ -n "${USED}" ]; then
|
|||
case ${YN} in
|
||||
[yY])
|
||||
for ENTRY in ${ENTRIES}; do
|
||||
rm -r ${OPNSENSE}/${ENTRY}
|
||||
cp -a ${FREEBSD}/${ENTRY} ${OPNSENSE}/
|
||||
rm -r ${PORTSDIR}/${ENTRY}
|
||||
cp -a ${PORTSREFDIR}/${ENTRY} ${PORTSDIR}/
|
||||
done
|
||||
;;
|
||||
esac
|
||||
|
|
Loading…
Reference in New Issue