Skip to content

Commit

Permalink
Add release tool
Browse files Browse the repository at this point in the history
  • Loading branch information
herrhotzenplotz committed Jul 18, 2022
1 parent 5bce3a6 commit 6d9d54a
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -155,3 +155,4 @@
/include/gcli/gitea/repos.h~
/src/gitea/repos.c~
/src/gitea/repos.o
/tools/gentarball.sh~
79 changes: 79 additions & 0 deletions tools/gentarball.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#!/opt/schily/bin/bosh

die() {
printf -- "error: %s\n" "$*" 1>&2
exit 1
}

info() {
printf -- "info: %s\n" "$*" 1>&2
}

findversion() {
grep '^GCLI_VERSION' Makefile \
| head -1 \
| awk -F\= '{print $2}' \
| sed -E 's/[[:space:]]*([^[:space:]]*)[[:space:]]*$/\1/g'
}

stage() {
info "Creating staging directory..."
mkdir -p ${STAGEDIR}

find . -type f \
! -path \./\.git/\* \
! -name \.gitignore \
! -name \*.o \
! -name \*.d \
! -name \*~ \
! -name gcli \
! -name \*.a \
! -name todo.org \
! -name config.mk \
! -name TAGS \
! -name \*.gz \
! -path \./tools/\* \
! -name y.tab.h \
-exec cp {} ${STAGEDIR} \;
}



NAMEBASE="gcli-`findversion`"
TARFBASE="${NAMEBASE}.tar"
STAGEDIR="/tmp/${NAMEBASE}/"

if [ ! -f Makefile ]; then
die "Please change to the source top"
fi

pushd .. > /dev/null 2>&1

info "Staging into ${STAGEDIR} ..."
pushd gcli > /dev/null 2>&1
stage
popd > /dev/null 2>&1

info "Creating base tarball ${TARFBASE} ..."
pushd /tmp > /dev/null 2>&1

star -c -f "${TARFBASE}" "${NAMEBASE}"

info "Compressing tarballs..."
xz < "${TARFBASE}" > "${TARFBASE}".xz
gzip < "${TARFBASE}" > "${TARFBASE}".gz
bzip2 < "${TARFBASE}" > "${TARFBASE}".bz2

info "Shuffling around output files..."

rm "${TARFBASE}"
rm -rf "${STAGEDIR}"
mkdir -p "${STAGEDIR}"

mv "${TARFBASE}".* "${STAGEDIR}"

popd > /dev/null 2>&1

info "Tarballs are at ${STAGEDIR}"

popd > /dev/null 2>&1

0 comments on commit 6d9d54a

Please sign in to comment.