Compare commits

...

10 commits

Author SHA1 Message Date
aaecf00394 Replace sourcezap/utils/gitexec with sourcezap/utils/git
Some checks are pending
sourcezap / shellcheck (push) Waiting to run
2024-07-02 09:14:33 -03:00
1c344e0c60 Add gitdiff 2024-07-02 08:39:59 -03:00
d54f37d3b6 Drop set -x for chown -Rv 2024-07-02 06:06:40 -03:00
03c858a73f Fix typo in man page 2024-06-22 20:21:54 -03:00
137afd371d v0.1.1 2024-06-22 19:43:38 -03:00
6092eff441 set +x before we call perform_(update|install) 2024-06-22 19:40:13 -03:00
a9f8daac78 Update git-* utils
Default to a localbase path that is relative to the current
file, and call git via utils/gitexec
2024-06-07 13:07:11 -03:00
1218164c9a Fix typo (in sourcezap-clone) 2024-06-05 18:34:17 -03:00
436e47f5e2 v0.1.0 2024-06-05 17:34:44 -03:00
1943b94da4 Fix typo 2024-06-01 05:34:48 -03:00
11 changed files with 45 additions and 43 deletions

View file

@ -10,9 +10,9 @@ branch=$2
##
# functions
gitexec()
git()
{
"${libexec}"/utils/gitexec "${1}"
"${libexec}"/utils/git "${@}"
}
printok()
@ -44,8 +44,7 @@ fi
set -x
cd "${gitdir}"
gitexec "fetch origin"
gitexec "checkout ${branch}" ||
gitexec "checkout -t origin/${branch}"
git fetch origin
git checkout "${branch}" || git checkout -t origin/"${branch}"
set +x
printok "${branch} checked out"

View file

@ -11,9 +11,9 @@ branch=$3
##
# functions
gitexec()
git()
{
"${libexec}"/util/gitexec "${1}"
"${libexec}"/utils/git "${@}"
}
printok()
@ -33,7 +33,7 @@ if [ "$(id -u)" = "0" ]; then
exit 1
fi
if ! "${libexec}"/utils/issourcezap-member > /dev/null >2&1; then
if ! "${libexec}"/utils/issourcezap-member > /dev/null 2>&1; then
printerr "$(id -un) is not a member of _sourcezap"
exit 1
fi
@ -44,9 +44,9 @@ if [ -e "${gitdir}/.git" ]; then
fi
set -x
gitexec "clone ${giturl} ${gitdir}"
git clone "${giturl}" "${gitdir}"
cd "${gitdir}"
gitexec "config core.filemode off"
gitexec "checkout -t origin/${branch}"
git config core.filemode off
git checkout -t origin/"${branch}"
set +x
printok "clone complete"

View file

@ -55,8 +55,7 @@ perform_install()
! -name ".arclint" \
! -name ".arcconfig" \
-exec cp -Rpv {} "${installdir}" \;
set -x
chown -R root "${installdir}"
chown -Rv root "${installdir}"
}
run_install()
@ -86,11 +85,11 @@ umask ${mode}
cd "${gitdir}"
run_install "-d" "${installdir}"
chmod ${mode} "${installdir}"
set +x
if [ -e "${revfile}" ]; then
perform_update
else
perform_install
fi
"${libexec}"/utils/git-rev "${gitdir}" > "${revfile}"
set +x
printok "install complete"

View file

@ -9,9 +9,9 @@ gitdir=$1
##
# functions
gitexec()
git()
{
"${libexec}"/utils/gitexec "${1}"
"${libexec}"/utils/git "${@}"
}
printok()
@ -44,7 +44,7 @@ fi
set -x
cd "${gitdir}"
branch=$(gitexec "branch --show-current")
gitexec "pull --rebase origin ${branch}"
branch=$(git "branch --show-current")
git pull --rebase origin "${branch}"
set +x
printok "pull complete"

View file

@ -3,24 +3,20 @@ set -e
##
# variables
localbase=${LOCALBASE:-/usr/local}
git="${localbase}"/bin/git
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)}
libexec="${localbase}"/libexec/sourcezap
gitdir=$1
commit=$2
mode=u=rwX,g=rX,o=
##
# functions
gitexec()
diff()
{
doas -n -u _sourcezap \
/bin/sh -c "umask ${mode}; ${git} ${1}"
"${libexec}"/utils/gitdiff ${@}
}
##
# main
cd "${gitdir}"
add=$(gitexec "diff --name-only --diff-filter=A ${commit} HEAD")
mod=$(gitexec "diff --name-only --diff-filter=M ${commit} HEAD")
echo "${add}"
echo "${mod}"
diff "--name-only" "--diff-filter=A" "${commit}" "HEAD"
diff "--name-only" "--diff-filter=M" "${commit}" "HEAD"

View file

@ -3,21 +3,19 @@ set -e
##
# variables
localbase=${LOCALBASE:-/usr/local}
git="${localbase}"/bin/git
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)}
libexec="${localbase}"/libexec/sourcezap
gitdir=$1
commit=$2
mode=u=rwX,g=rX,o=
##
# functions
gitexec()
diff()
{
doas -n -u _sourcezap \
/bin/sh -c "umask ${mode}; ${git} ${1}"
"${libexec}"/utils/gitdiff ${@}
}
##
# main
cd "${gitdir}"
gitexec "diff --name-only --diff-filter=D ${commit} HEAD"
diff "--name-only" "--diff-filter=D" "${commit}" "HEAD"

View file

@ -3,19 +3,18 @@ set -e
##
# variables
git=/usr/local/bin/git
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)}
libexec="${localbase}"/libexec/sourcezap
gitdir=$1
mode=u=rwX,g=rX,o=
##
# functions
gitexec()
git()
{
doas -n -u _sourcezap \
/bin/sh -c "umask ${mode}; ${git} ${1}"
"${libexec}"/utils/git "${1}"
}
##
# main
cd "${gitdir}"
gitexec "rev-parse HEAD"
git rev-parse HEAD

11
libexec/sourcezap/utils/gitdiff Executable file
View file

@ -0,0 +1,11 @@
#!/bin/sh
set -e
##
# variables
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)}
libexec="${localbase}"/libexec/sourcezap
##
# main
"${libexec}"/utils/git diff -l0 ${@}

View file

@ -61,7 +61,7 @@ Default: https://git.HardenedBSD.org/HardenedBSD/HardenedBSD.git/
.sp
.Nm SOURCEZAP_INSTALLDIR
.br
The directory where the ports collection will be installed
The directory where the source tree will be installed
.br
Default: /usr/src/
.sp

View file

@ -1 +1 @@
v0.1.0-dev
v0.1.1