summaryrefslogtreecommitdiff
path: root/hooks
diff options
context:
space:
mode:
authorVivien Kraus <vivien@planete-kraus.eu>2021-07-01 16:41:20 +0200
committerVivien Kraus <vivien@planete-kraus.eu>2021-07-02 14:49:13 +0200
commitd05a8836f29d41ec4a423d4f44dcbb93a8bdd759 (patch)
treeb41b0f76b9ee4b9a9e7a415fcde3b967b89db7a2 /hooks
parente0e3bbbe6d78fc7a7f54325471af5d0e5c498471 (diff)
Switch to AGPL
Diffstat (limited to 'hooks')
-rwxr-xr-xhooks/update56
1 files changed, 31 insertions, 25 deletions
diff --git a/hooks/update b/hooks/update
index 1fc463d..325adfd 100755
--- a/hooks/update
+++ b/hooks/update
@@ -1,5 +1,21 @@
#!/bin/sh
+# webid-oidc, implementation of the Solid specification
+# Copyright (C) 2020, 2021 Vivien Kraus
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+
refname="$1"
oldrev="$2"
newrev="$3"
@@ -17,42 +33,32 @@ then
exit 0
fi
-if test "x$refname" = "xrefs/notes/dist"
-then
- >&2 echo "Error: the server does not accept dist notes."
- exit 1
-fi
-
>&2 echo "Checking all refs in range $span."
-for ref in $(guix environment --ad-hoc git -- git rev-list $span)
+CHANNEL=$(mktemp -d 2>/dev/null || mktemp -d -t "channel")
+>&2 echo "The channel is in $CHANNEL."
+
+for ref in $(guix environment --ad-hoc git -- git rev-list --reverse $span)
do
# If there is not already a note on the refs/notes/dist ref, then we
# should run the CI.
>&2 echo "Checking new commit $ref."
- if git notes --ref="refs/notes/dist" list "$ref"
+ if test "x$ref" = "x0e29ddc3c41870e14da87770a429a94f80dd4110"
then
- >&2 echo "CI already ran for $ref, skipping."
+ >&2 echo "This is the root, skipping."
else
- >&2 echo "This commit has not seen CI yet."
- CLONEREPO=$(mktemp -d 2>/dev/null || mktemp -d -t "clone")
- REPO=$(pwd)
- cd "$CLONEREPO"
- guix environment --ad-hoc --pure git -- git clone "$REPO" .
- guix environment --ad-hoc --container git -- git checkout "$ref"
- guix environment --ad-hoc --container git -- git checkout-index -a -f --prefix=source/
- if OUTCOME=$(guix build -c 4 -L guix -f ci.scm)
+ >&2 echo "Running CI for $ref..."
+ guix environment --ad-hoc git -- git archive "-o" "$CHANNEL/source.tar.gz" "$ref" guix ci.scm || exit 1
+ (cd "$CHANNEL" ; rm -rf "source" ; mkdir "source" ; cd "source" ; guix environment --ad-hoc tar -- tar xf ../source.tar.gz)
+ export CI_REF="$ref"
+ if OUTCOME=$(guix build -c 4 -L "$CHANNEL/source/guix" -f "$CHANNEL/source/ci.scm")
then
- cd $REPO
- export BLOB="$(git hash-object -w $OUTCOME/*.tar.gz)"
- >&2 echo "Adding blob $BLOB as the results of the CI."
- guix environment --ad-hoc --container git -- git notes --ref=refs/notes/dist add \
- --allow-empty -f -C "$BLOB" "$ref"
- rm -rf $CLONEREPO
+ >&2 echo "CI ran: $OUTCOME."
else
- cd $REPO
- rm -rf $CLONEREPO
+ rm -rf $CHANNEL
exit 1
fi
fi
done
+
+rm -rf $CHANNEL