mirror of
https://github.com/sshuttle/sshuttle.git
synced 2025-08-11 16:51:24 +02:00
Import the non-pandoc manpage generator from redo.
This makes it easier (possible?) to generate sshuttle.8 from sshuttle.md on MacOS. We also import the git-enhanced version numbering magic so the generated manpage can have a real version number.
This commit is contained in:
1
version/.gitattributes
vendored
Normal file
1
version/.gitattributes
vendored
Normal file
@ -0,0 +1 @@
|
||||
gitvars.pre export-subst
|
3
version/.gitignore
vendored
Normal file
3
version/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
/vars
|
||||
/gitvars
|
||||
/_version.py
|
1
version/__init__.py
Normal file
1
version/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
from _version import COMMIT, TAG, DATE
|
3
version/_version.py.do
Normal file
3
version/_version.py.do
Normal file
@ -0,0 +1,3 @@
|
||||
redo-ifchange vars
|
||||
cat vars
|
||||
|
2
version/all.do
Normal file
2
version/all.do
Normal file
@ -0,0 +1,2 @@
|
||||
redo-ifchange vars _version.py
|
||||
|
3
version/clean.do
Normal file
3
version/clean.do
Normal file
@ -0,0 +1,3 @@
|
||||
rm -f *~ .*~ *.pyc _version.py vars gitvars
|
||||
|
||||
|
28
version/gitvars.do
Normal file
28
version/gitvars.do
Normal file
@ -0,0 +1,28 @@
|
||||
redo-ifchange gitvars.pre prodname
|
||||
|
||||
read PROD <prodname
|
||||
exec >$3
|
||||
|
||||
# Fix each line from gitvars.pre where git may or may not have already
|
||||
# substituted the variables. If someone generated a tarball with 'git archive',
|
||||
# then the data will have been substituted already. If we're in a checkout of
|
||||
# the git repo, then it won't, but we can just ask git to do the substitutions
|
||||
# right now.
|
||||
while read line; do
|
||||
# Lines *may* be of the form: $Format: ... $
|
||||
x=${line#\$Format:} # remove prefix
|
||||
if [ "$x" != "$line" ]; then
|
||||
# git didn't substitute it
|
||||
redo-always # git this from the git repo
|
||||
x=${x%\$} # remove trailing $
|
||||
if [ "$x" = "%d" ]; then
|
||||
tag=$(git describe --match="$PROD-*")
|
||||
x="(tag: $tag)"
|
||||
else
|
||||
x=$(git log -1 --pretty=format:"$x")
|
||||
fi
|
||||
fi
|
||||
echo "$x"
|
||||
done <gitvars.pre
|
||||
|
||||
redo-stamp <$3
|
3
version/gitvars.pre
Normal file
3
version/gitvars.pre
Normal file
@ -0,0 +1,3 @@
|
||||
$Format:%H$
|
||||
$Format:%d$
|
||||
$Format:%ci$
|
1
version/prodname
Normal file
1
version/prodname
Normal file
@ -0,0 +1 @@
|
||||
sshuttle
|
40
version/vars.do
Normal file
40
version/vars.do
Normal file
@ -0,0 +1,40 @@
|
||||
redo-ifchange gitvars prodname
|
||||
|
||||
read PROD <prodname
|
||||
|
||||
exec <gitvars
|
||||
read COMMIT
|
||||
read NAMES
|
||||
read DATE
|
||||
|
||||
# the list of names is of the form:
|
||||
# (x,y,tag: $PROD-####,tag: $PROD-####,a,b)
|
||||
# The entries we want are the ones starting with "tag: $PROD-" since those
|
||||
# refer to the right actual git tags.
|
||||
names_to_tag()
|
||||
{
|
||||
x=${1#\(}
|
||||
x=${x%\)}
|
||||
cur=
|
||||
while [ "$cur" != "$x" ]; do
|
||||
x=${x# }
|
||||
x=${x#tag: }
|
||||
cur=${x%%,*}
|
||||
tagpost=${cur#$PROD-}
|
||||
if [ "$cur" != "$tagpost" ]; then
|
||||
echo "$tagpost"
|
||||
return 0
|
||||
fi
|
||||
x=${x#*,}
|
||||
done
|
||||
commitpost=${COMMIT#???????}
|
||||
commitpre=${COMMIT%$commitpost}
|
||||
echo "unknown-$commitpre"
|
||||
}
|
||||
|
||||
|
||||
sTAG=$(names_to_tag "$NAMES")
|
||||
|
||||
echo "COMMIT='$COMMIT'"
|
||||
echo "TAG='$sTAG'"
|
||||
echo "DATE='${DATE%% *}'"
|
Reference in New Issue
Block a user