pub / stagit-scripts

Building src.jayvii.de with stagit
git clone https://src.jayvii.de/pub/stagit-scripts.git
Home | Log | Files | Exports | Refs | README | RSS

commit e326edbae9c6e6b02a2f591be757130b221b7072
parent 0f512520490402a6ed74f2d688123eb54a711ca7
Author: JayVii <jayvii[AT]posteo[DOT]de>
Date:   Sun, 28 Apr 2024 22:19:18 +0200

Add REUSE linting example

Diffstat:
MREADME | 3++-
Aexamples/hooks/post-update.sample2 | 26++++++++++++++++++++++++++
2 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/README b/README @@ -89,7 +89,8 @@ You'll find a post-update hook example in the "examples/hooks/" directory. examples/ | '- hooks/ - '- post-update.sample1 Automatic packaging and deployment + |- post-update.sample1 Automatic packaging and deployment + '- post-update.sample2 REUSE linting on push License ======= diff --git a/examples/hooks/post-update.sample2 b/examples/hooks/post-update.sample2 @@ -0,0 +1,26 @@ +#!/usr/bin/env sh +# SPDX-License-Identifier: AGPL-3.0-or-later +# SPDX-FileCopyrightText: 2021-2024 JayVii <jayvii[AT]posteo[DOT]de> + +# REUSE linting on push from bare git repository: +# https://reuse.software + +# Define temporary file and directory +TMP_ARC=`mktemp` +TMP_DIR=`mktemp --directory` + +# get current branch +BRANCH=`git branch --show-current || echo "HEAD"` + +# Create archive from bare git repository +git archive $BRANCH . --format=tar.gz -o "${TMP_ARC}" + +# Extract archive to temporary directory +tar xfz "${TMP_ARC}" -- directory "${TMP_DIR}/" + +# Lint via reuse tool +reuse --root "${TMP_DIR}/" lint + +# Cleanup +rm -r "${TMP_DIR}" "${TMP_ARC}" +