commit 69462269edebde269ae224a26690e8d505d54116
parent 0387cb8200ba4c6a44ec7fb9a2760c2dea0c1881
Author: Andreas Gruhler <andreas.gruhler@adfinis.com>
Date: Sun, 20 Oct 2024 17:12:59 +0200
feat(docker-git): add archive link
Diffstat:
5 files changed, 86 insertions(+), 58 deletions(-)
diff --git a/docker/docker-git/Dockerfile b/docker/docker-git/Dockerfile
@@ -15,12 +15,12 @@ COPY docker/favicon.png /opt/stagit/
COPY docker/logo.png /opt/stagit/
COPY docker/create.sh /opt/stagit/
COPY docker/example_post-receive.sh /opt/stagit/
-COPY docker/header-patch.diff /opt/stagit/
+COPY docker/*.patch /opt/stagit/
# Patch header
RUN git config --global user.email "docker@in0rdr.ch"
RUN git config --global user.name "Docker build"
-RUN cd /opt/stagit && git am header-patch.diff
+RUN cd /opt/stagit && git am *.patch
# Build stagit
RUN cd /opt/stagit && make && make install
diff --git a/docker/docker-git/docker/0001-feat-add-pr-link.patch b/docker/docker-git/docker/0001-feat-add-pr-link.patch
@@ -0,0 +1,49 @@
+From d1184e7a64723df5830f8c9c17ee3f82ef1441df Mon Sep 17 00:00:00 2001
+From: Andreas Gruhler <andreas.gruhler@adfinis.com>
+Date: Thu, 29 Aug 2024 09:22:24 +0200
+Subject: [PATCH 1/2] feat: add pr link
+
+---
+ stagit-index.c | 4 +++-
+ stagit.c | 3 ++-
+ 2 files changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/stagit-index.c b/stagit-index.c
+index 6402296..d128b36 100644
+--- a/stagit-index.c
++++ b/stagit-index.c
+@@ -12,7 +12,8 @@ static git_repository *repo;
+
+ static const char *relpath = "";
+
+-static char description[255] = "Repositories";
++static char description[255] = "Repos";
++static char prlink[255] = " | Pull requests at <a href=\"https://pr.in0rdr.ch\">pr.in0rdr.ch</a>";
+ static char *name = "";
+ static char owner[255];
+
+@@ -107,6 +108,7 @@ writeheader(FILE *fp)
+ fprintf(fp, "<table>\n<tr><td><img src=\"%slogo.png\" alt=\"\" width=\"32\" height=\"32\" /></td>\n"
+ "<td><span class=\"desc\">", relpath);
+ xmlencode(fp, description, strlen(description));
++ fputs(prlink, fp);
+ fputs("</span></td></tr><tr><td></td><td>\n"
+ "</td></tr>\n</table>\n<hr/>\n<div id=\"content\">\n"
+ "<table id=\"index\"><thead>\n"
+diff --git a/stagit.c b/stagit.c
+index 03f0c09..5d492f6 100644
+--- a/stagit.c
++++ b/stagit.c
+@@ -537,7 +537,8 @@ writeheader(FILE *fp, const char *title)
+ fputs("<tr><td></td><td>\n", fp);
+ fprintf(fp, "<a href=\"%slog.html\">Log</a> | ", relpath);
+ fprintf(fp, "<a href=\"%sfiles.html\">Files</a> | ", relpath);
+- fprintf(fp, "<a href=\"%srefs.html\">Refs</a>", relpath);
++ fprintf(fp, "<a href=\"%srefs.html\">Refs</a> | ", relpath);
++ fprintf(fp, "<a href=\"https://pr.in0rdr.ch/repos/%s\">Pull requests</a>", strippedname);
+ if (submodules)
+ fprintf(fp, " | <a href=\"%sfile/%s.html\">Submodules</a>",
+ relpath, submodules);
+--
+2.44.1
+
diff --git a/docker/docker-git/docker/0002-feat-add-archive-link.patch b/docker/docker-git/docker/0002-feat-add-archive-link.patch
@@ -0,0 +1,26 @@
+From a8e717da1ab580d428db53c25d59fdfe729e9d5d Mon Sep 17 00:00:00 2001
+From: Andreas Gruhler <andreas.gruhler@adfinis.com>
+Date: Sun, 20 Oct 2024 17:09:59 +0200
+Subject: [PATCH 2/2] feat: add archive link
+
+---
+ stagit.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/stagit.c b/stagit.c
+index 5d492f6..e93df45 100644
+--- a/stagit.c
++++ b/stagit.c
+@@ -538,7 +538,8 @@ writeheader(FILE *fp, const char *title)
+ fprintf(fp, "<a href=\"%slog.html\">Log</a> | ", relpath);
+ fprintf(fp, "<a href=\"%sfiles.html\">Files</a> | ", relpath);
+ fprintf(fp, "<a href=\"%srefs.html\">Refs</a> | ", relpath);
+- fprintf(fp, "<a href=\"https://pr.in0rdr.ch/repos/%s\">Pull requests</a>", strippedname);
++ fprintf(fp, "<a href=\"https://pr.in0rdr.ch/repos/%s\">Pull requests</a> |", strippedname);
++ fprintf(fp, "<a href=\"%sarchive\">Archive</a>", relpath);
+ if (submodules)
+ fprintf(fp, " | <a href=\"%sfile/%s.html\">Submodules</a>",
+ relpath, submodules);
+--
+2.44.1
+
diff --git a/docker/docker-git/docker/example_post-receive.sh b/docker/docker-git/docker/example_post-receive.sh
@@ -70,15 +70,11 @@ ln -sf log.html index.html
ln -sf ../style.css style.css
ln -sf ../logo.png logo.png
-# trigger jenkins, create a token first
-# https://plugins.jenkins.io/git/#plugin-content-push-notification-from-repository
-TOKEN=""
-curl --max-time 5 -s \
- "https://jenkins.in0rdr.ch/git/notifyCommit?token=$TOKEN&url=https://git.in0rdr.ch/$r"
-
# Create .tar.gz archives by tag
-archivedir="${destdir}${d}"
+echo "Archiving tags.."
+archivedir="${destdir}${d}/archive"
mkdir -p "${archivedir}"
+cd "${reposdir}/${r}"
git tag -l | while read -r t; do
f="${archivedir}/${d}-$(echo "${t}" | tr '/' '_').tar.gz"
test -f "${f}" && continue
@@ -99,4 +95,10 @@ git archive \
-- \
"master"
+# trigger jenkins, create a token first
+# https://plugins.jenkins.io/git/#plugin-content-push-notification-from-repository
+TOKEN=""
+curl --max-time 5 -s \
+ "https://jenkins.in0rdr.ch/git/notifyCommit?token=$TOKEN&url=https://git.in0rdr.ch/$r"
+
echo "done"
diff --git a/docker/docker-git/docker/header-patch.diff b/docker/docker-git/docker/header-patch.diff
@@ -1,49 +0,0 @@
-From c7b208722e7e4b52731be3b86f2927a85817d113 Mon Sep 17 00:00:00 2001
-From: Andreas Gruhler <andreas.gruhler@adfinis.com>
-Date: Thu, 29 Aug 2024 09:22:24 +0200
-Subject: [PATCH] feat: add pr link
-
----
- stagit-index.c | 4 +++-
- stagit.c | 3 ++-
- 2 files changed, 5 insertions(+), 2 deletions(-)
-
-diff --git a/stagit-index.c b/stagit-index.c
-index 6402296..d128b36 100644
---- a/stagit-index.c
-+++ b/stagit-index.c
-@@ -12,7 +12,8 @@ static git_repository *repo;
-
- static const char *relpath = "";
-
--static char description[255] = "Repositories";
-+static char description[255] = "Repos";
-+static char prlink[255] = " | Pull requests at <a href=\"https://pr.in0rdr.ch\">pr.in0rdr.ch</a>";
- static char *name = "";
- static char owner[255];
-
-@@ -107,6 +108,7 @@ writeheader(FILE *fp)
- fprintf(fp, "<table>\n<tr><td><img src=\"%slogo.png\" alt=\"\" width=\"32\" height=\"32\" /></td>\n"
- "<td><span class=\"desc\">", relpath);
- xmlencode(fp, description, strlen(description));
-+ fputs(prlink, fp);
- fputs("</span></td></tr><tr><td></td><td>\n"
- "</td></tr>\n</table>\n<hr/>\n<div id=\"content\">\n"
- "<table id=\"index\"><thead>\n"
-diff --git a/stagit.c b/stagit.c
-index 03f0c09..5d492f6 100644
---- a/stagit.c
-+++ b/stagit.c
-@@ -537,7 +537,8 @@ writeheader(FILE *fp, const char *title)
- fputs("<tr><td></td><td>\n", fp);
- fprintf(fp, "<a href=\"%slog.html\">Log</a> | ", relpath);
- fprintf(fp, "<a href=\"%sfiles.html\">Files</a> | ", relpath);
-- fprintf(fp, "<a href=\"%srefs.html\">Refs</a>", relpath);
-+ fprintf(fp, "<a href=\"%srefs.html\">Refs</a> | ", relpath);
-+ fprintf(fp, "<a href=\"https://pr.in0rdr.ch/repos/%s\">Pull requests</a>", strippedname);
- if (submodules)
- fprintf(fp, " | <a href=\"%sfile/%s.html\">Submodules</a>",
- relpath, submodules);
---
-2.44.1
-