From 13afee30910f02a7cc56df4fe4bacf7b73239449 Mon Sep 17 00:00:00 2001
From: Wouter Wijsman
Date: Thu, 20 Jun 2024 16:53:44 +0200
Subject: [PATCH 01/15] Initial content
---
index.html | 14 ++++++++++++++
make-repo-html.sh | 16 ++++++++++++++++
2 files changed, 30 insertions(+)
create mode 100644 index.html
create mode 100755 make-repo-html.sh
diff --git a/index.html b/index.html
new file mode 100644
index 0000000..aad43d7
--- /dev/null
+++ b/index.html
@@ -0,0 +1,14 @@
+
+
+
+ ${GITHUB_REPOSITORY_OWNER}'s package index
+
+
+
${GITHUB_REPOSITORY_OWNER}'s package index
+
+ Name Version Description Last Updated
+ ${INDEX_TABLE_CONTENT}
+
+ Source on GitHub
+
+
diff --git a/make-repo-html.sh b/make-repo-html.sh
new file mode 100755
index 0000000..94402d6
--- /dev/null
+++ b/make-repo-html.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+mkdir -p repo
+export GITHUB_REPOSITORY_OWNER="${GITHUB_REPOSITORY_OWNER:-pspdev}"
+export GITHUB_REPOSITORY="${GITHUB_REPOSITORY:-pspdev/pspdev}"
+
+declare -a INDEX_TABLE_CONTENT
+for PSPBUILD in $(find . -name "PSPBUILD" | sort); do
+ source "${PSPBUILD}"
+ UPDATED=$(git log -1 --format=%cd --date=short -- "${PSPBUILD}")
+ URL="${pkgname}-${pkgver}-${pkgrel}-${arch}.pkg.tar.gz"
+ INDEX_TABLE_CONTENT+=("${pkgname} ${pkgver}-${pkgrel} ${pkgdesc} ${UPDATED} ")
+done
+
+ensubst < index.html > repo/index.html
+
From fe30534c17138236e06ebb8b2089456d6004c395 Mon Sep 17 00:00:00 2001
From: Wouter Wijsman
Date: Thu, 20 Jun 2024 17:49:20 +0200
Subject: [PATCH 02/15] Make make-repo-html.sh able to generate full repo pages
---
index.html | 1 +
make-repo-html.sh | 60 ++++++++++++++++++++++++++++++++++++++++-------
package.html | 31 ++++++++++++++++++++++++
style.css | 0
4 files changed, 84 insertions(+), 8 deletions(-)
create mode 100644 package.html
create mode 100644 style.css
diff --git a/index.html b/index.html
index aad43d7..65cdb02 100644
--- a/index.html
+++ b/index.html
@@ -2,6 +2,7 @@
${GITHUB_REPOSITORY_OWNER}'s package index
+
${GITHUB_REPOSITORY_OWNER}'s package index
diff --git a/make-repo-html.sh b/make-repo-html.sh
index 94402d6..ec2bc42 100755
--- a/make-repo-html.sh
+++ b/make-repo-html.sh
@@ -1,16 +1,60 @@
#!/bin/bash
-mkdir -p repo
-export GITHUB_REPOSITORY_OWNER="${GITHUB_REPOSITORY_OWNER:-pspdev}"
-export GITHUB_REPOSITORY="${GITHUB_REPOSITORY:-pspdev/pspdev}"
+#Change directory to the directory of this script
+cd "$(dirname "$0")"
-declare -a INDEX_TABLE_CONTENT
+# Export all variables
+set -a
+
+# Set global variables
+GITHUB_REPOSITORY_OWNER="${GITHUB_REPOSITORY_OWNER:-pspdev}"
+GITHUB_REPOSITORY="${GITHUB_REPOSITORY:-pspdev/pspdev}"
+INDEX_TABLE_CONTENT=""
+
+# Build the html pages
for PSPBUILD in $(find . -name "PSPBUILD" | sort); do
source "${PSPBUILD}"
UPDATED=$(git log -1 --format=%cd --date=short -- "${PSPBUILD}")
- URL="${pkgname}-${pkgver}-${pkgrel}-${arch}.pkg.tar.gz"
- INDEX_TABLE_CONTENT+=("${pkgname} ${pkgver}-${pkgrel} ${pkgdesc} ${UPDATED} ")
-done
+ DOWNLOAD_URL="${pkgname}-${pkgver}-${pkgrel}-${arch}.pkg.tar.gz"
+
+ # Convert lists to strings
+ ARCH="${arch[*]}"
+ LICENSE="${license[*]}"
+
+ # Get file size info
+ FILENAME="repo/${DOWNLOAD_URL}"
+ if [ -f "${FILENAME}" ]; then
+ GZSTATS="$(gzip -l $FILENAME | tail -n 1 | tr -s ' ')"
+ PKGSIZE=$(echo $GZSTATS | cut -d ' ' -f 1 | numfmt --to=iec --suffix=B --format="%.2f")
+ INSTSIZE=$(echo $GZSTATS | cut -d ' ' -f 2 | numfmt --to=iec --suffix=B --format="%.2f")
+ fi
-ensubst < index.html > repo/index.html
+ # List dependencies
+ if [ ! -n "${depends[*]}" ]; then
+ DEPS="No dependencies"
+ else
+ DEPS=""
+ for dep in "${depends[@]}"; do
+ DEPS="${DEPS}${dep} "
+ done
+ DEPS="${DEPS} "
+ fi
+
+ # List content of files
+ if [ -f "${FILENAME}" ]; then
+ CONTENT=""
+ for item in =$(tar tzf $FILENAME | grep -v '\.BUILDINFO\|\.MTREE\|\.PKGINFO'); do
+ CONTENT="${CONTENT}${item} "
+ done
+ CONTENT="${CONTENT} "
+ else
+ CONTENT="Not known"
+ fi
+
+ envsubst < package.html > "repo/${pkgname}.html"
+
+ INDEX_TABLE_CONTENT="${INDEX_TABLE_CONTENT}${pkgname} ${pkgver}-${pkgrel} ${pkgdesc} ${UPDATED} "
+done
+envsubst < index.html > repo/index.html
+cp style.css repo/
\ No newline at end of file
diff --git a/package.html b/package.html
new file mode 100644
index 0000000..28268ca
--- /dev/null
+++ b/package.html
@@ -0,0 +1,31 @@
+
+
+
+ ${pkgname} - ${GITHUB_REPOSITORY_OWNER}'s package index
+
+
+
+
${GITHUB_REPOSITORY_OWNER}'s package index
+
${pkgname} ${pkgver}-${pkgrel}
+
+
+ Architecture: ${ARCH}
+ Description: ${pkgdesc}
+ Upstream URL: ${url}
+ License: ${LICENSE}
+ Package Size: ${PKGSIZE}
+ Installed Size: ${INSTSIZE}
+ Download: ${DOWNLOAD_URL}
+
+
+
Dependencies
+ ${DEPS}
+
+
Contents
+ ${CONTENT}
+
+ Back to index
+
+ Source on GitHub
+
+
diff --git a/style.css b/style.css
new file mode 100644
index 0000000..e69de29
From 18430bec58e4f5c5fbaa4e16b660edc862bcbda2 Mon Sep 17 00:00:00 2001
From: Wouter Wijsman
Date: Thu, 20 Jun 2024 17:51:30 +0200
Subject: [PATCH 03/15] Add repo index page generation to build
---
.github/workflows/build.yml | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 001b609..186a99e 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -76,6 +76,10 @@ jobs:
mv pspdev.db.tar.gz pspdev.db
mv pspdev.files.tar.gz pspdev.files
tar -cvf ../repo.tar ./*
+ cd ..
+ - name: Create repo index pages
+ run: |
+ ./make-repo-html.sh
- name: Upload repo artifact
uses: actions/upload-artifact@v4
with:
From 9f4d62e83e086ebf9e6061bdb7be2736363c6874 Mon Sep 17 00:00:00 2001
From: Wouter Wijsman
Date: Thu, 20 Jun 2024 18:09:55 +0200
Subject: [PATCH 04/15] Make sure commands in script can execute
---
.github/workflows/build.yml | 2 ++
make-repo-html.sh | 9 ++++++---
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 186a99e..0e427e0 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -79,6 +79,8 @@ jobs:
cd ..
- name: Create repo index pages
run: |
+ chown -R $(id -nu):$(id -ng) .
+ apk add --no-cache bash
./make-repo-html.sh
- name: Upload repo artifact
uses: actions/upload-artifact@v4
diff --git a/make-repo-html.sh b/make-repo-html.sh
index ec2bc42..36b412b 100755
--- a/make-repo-html.sh
+++ b/make-repo-html.sh
@@ -6,6 +6,9 @@ cd "$(dirname "$0")"
# Export all variables
set -a
+# Fail on error
+set -e
+
# Set global variables
GITHUB_REPOSITORY_OWNER="${GITHUB_REPOSITORY_OWNER:-pspdev}"
GITHUB_REPOSITORY="${GITHUB_REPOSITORY:-pspdev/pspdev}"
@@ -24,9 +27,9 @@ for PSPBUILD in $(find . -name "PSPBUILD" | sort); do
# Get file size info
FILENAME="repo/${DOWNLOAD_URL}"
if [ -f "${FILENAME}" ]; then
- GZSTATS="$(gzip -l $FILENAME | tail -n 1 | tr -s ' ')"
- PKGSIZE=$(echo $GZSTATS | cut -d ' ' -f 1 | numfmt --to=iec --suffix=B --format="%.2f")
- INSTSIZE=$(echo $GZSTATS | cut -d ' ' -f 2 | numfmt --to=iec --suffix=B --format="%.2f")
+ //GZSTATS="$(gzip -l $FILENAME | tail -n 1 | tr -s ' ')"
+ //PKGSIZE=$(echo $GZSTATS | cut -d ' ' -f 1 | numfmt --to=iec --suffix=B --format="%.2f")
+ //INSTSIZE=$(echo $GZSTATS | cut -d ' ' -f 2 | numfmt --to=iec --suffix=B --format="%.2f")
fi
# List dependencies
From 3b1ea4775492608ca2006e691ea7948731a1e2b0 Mon Sep 17 00:00:00 2001
From: Wouter Wijsman
Date: Thu, 20 Jun 2024 18:17:50 +0200
Subject: [PATCH 05/15] Comment out gzip command for now
---
make-repo-html.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/make-repo-html.sh b/make-repo-html.sh
index 36b412b..18dfa81 100755
--- a/make-repo-html.sh
+++ b/make-repo-html.sh
@@ -27,9 +27,9 @@ for PSPBUILD in $(find . -name "PSPBUILD" | sort); do
# Get file size info
FILENAME="repo/${DOWNLOAD_URL}"
if [ -f "${FILENAME}" ]; then
- //GZSTATS="$(gzip -l $FILENAME | tail -n 1 | tr -s ' ')"
- //PKGSIZE=$(echo $GZSTATS | cut -d ' ' -f 1 | numfmt --to=iec --suffix=B --format="%.2f")
- //INSTSIZE=$(echo $GZSTATS | cut -d ' ' -f 2 | numfmt --to=iec --suffix=B --format="%.2f")
+ # GZSTATS="$(gzip -l $FILENAME | tail -n 1 | tr -s ' ')"
+ # PKGSIZE=$(echo $GZSTATS | cut -d ' ' -f 1 | numfmt --to=iec --suffix=B --format="%.2f")
+ # INSTSIZE=$(echo $GZSTATS | cut -d ' ' -f 2 | numfmt --to=iec --suffix=B --format="%.2f")
fi
# List dependencies
From 91637d6e60fa34bdb336d716988388cb02641123 Mon Sep 17 00:00:00 2001
From: Wouter Wijsman
Date: Thu, 20 Jun 2024 18:45:18 +0200
Subject: [PATCH 06/15] Fix getting package size
---
.github/workflows/build.yml | 2 +-
make-repo-html.sh | 5 ++---
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 0e427e0..f73fb20 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -80,7 +80,7 @@ jobs:
- name: Create repo index pages
run: |
chown -R $(id -nu):$(id -ng) .
- apk add --no-cache bash
+ apk add --no-cache bash coreutils
./make-repo-html.sh
- name: Upload repo artifact
uses: actions/upload-artifact@v4
diff --git a/make-repo-html.sh b/make-repo-html.sh
index 18dfa81..4cfbef0 100755
--- a/make-repo-html.sh
+++ b/make-repo-html.sh
@@ -27,9 +27,8 @@ for PSPBUILD in $(find . -name "PSPBUILD" | sort); do
# Get file size info
FILENAME="repo/${DOWNLOAD_URL}"
if [ -f "${FILENAME}" ]; then
- # GZSTATS="$(gzip -l $FILENAME | tail -n 1 | tr -s ' ')"
- # PKGSIZE=$(echo $GZSTATS | cut -d ' ' -f 1 | numfmt --to=iec --suffix=B --format="%.2f")
- # INSTSIZE=$(echo $GZSTATS | cut -d ' ' -f 2 | numfmt --to=iec --suffix=B --format="%.2f")
+ INSTSIZE=$(du "${FILENAME}" | cut -d ' ' -f 1 | numfmt --to=iec --suffix=B --format="%.2f")
+ PKGSIZE="$(gunzip -c "${FILENAME}"|grep -a '^size = '|cut -d' ' -f3|numfmt --to iec --suffix=B --format "%.1f")"
fi
# List dependencies
From fb8a153f67f2f800527dc9dfbbafef4f2c2e470b Mon Sep 17 00:00:00 2001
From: Wouter Wijsman
Date: Thu, 20 Jun 2024 19:17:11 +0200
Subject: [PATCH 07/15] Make pages before packaging github pages artifact
---
.github/workflows/build.yml | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index f73fb20..74434d4 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -69,19 +69,16 @@ jobs:
uses: actions/download-artifact@v4
- name: Create repo files
run: |
+ chown -R $(id -nu):$(id -ng) .
+ apk add --no-cache bash coreutils
mkdir repo
cp artifact-*/*.pkg.tar.gz repo/
+ ./make-repo-html.sh
cd repo
${PSPDEV}/share/pacman/bin/repo-add pspdev.db.tar.gz *.pkg.tar.gz
mv pspdev.db.tar.gz pspdev.db
mv pspdev.files.tar.gz pspdev.files
- tar -cvf ../repo.tar ./*
- cd ..
- - name: Create repo index pages
- run: |
- chown -R $(id -nu):$(id -ng) .
- apk add --no-cache bash coreutils
- ./make-repo-html.sh
+ tar -cvf ../repo.tar ./*
- name: Upload repo artifact
uses: actions/upload-artifact@v4
with:
From cf498f196fea43a6fdb4bebdaf9e6391e5edaecb Mon Sep 17 00:00:00 2001
From: Wouter Wijsman
Date: Thu, 20 Jun 2024 19:25:51 +0200
Subject: [PATCH 08/15] Remove = in first file in contents
---
make-repo-html.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/make-repo-html.sh b/make-repo-html.sh
index 4cfbef0..3f5c9a4 100755
--- a/make-repo-html.sh
+++ b/make-repo-html.sh
@@ -45,7 +45,7 @@ for PSPBUILD in $(find . -name "PSPBUILD" | sort); do
# List content of files
if [ -f "${FILENAME}" ]; then
CONTENT=""
- for item in =$(tar tzf $FILENAME | grep -v '\.BUILDINFO\|\.MTREE\|\.PKGINFO'); do
+ for item in $(tar tzf $FILENAME | grep -v '\.BUILDINFO\|\.MTREE\|\.PKGINFO'); do
CONTENT="${CONTENT}${item} "
done
CONTENT="${CONTENT} "
From dbc44eadd892201b4f1b1d7c8ddbab870193507b Mon Sep 17 00:00:00 2001
From: Wouter Wijsman
Date: Thu, 20 Jun 2024 19:28:25 +0200
Subject: [PATCH 09/15] Fix file sizes
---
make-repo-html.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/make-repo-html.sh b/make-repo-html.sh
index 3f5c9a4..dffebad 100755
--- a/make-repo-html.sh
+++ b/make-repo-html.sh
@@ -27,8 +27,8 @@ for PSPBUILD in $(find . -name "PSPBUILD" | sort); do
# Get file size info
FILENAME="repo/${DOWNLOAD_URL}"
if [ -f "${FILENAME}" ]; then
- INSTSIZE=$(du "${FILENAME}" | cut -d ' ' -f 1 | numfmt --to=iec --suffix=B --format="%.2f")
- PKGSIZE="$(gunzip -c "${FILENAME}"|grep -a '^size = '|cut -d' ' -f3|numfmt --to iec --suffix=B --format "%.1f")"
+ PKGSIZE=$(du "${FILENAME}" | cut -f 1 | numfmt --to=iec --suffix=B --format="%.2f")
+ INSTSIZE="$(gunzip -c "${FILENAME}"|grep -a '^size = '|cut -d' ' -f3|numfmt --to iec --suffix=B --format "%.1f")"
fi
# List dependencies
From a0f0fb19b36b76821b551f5ba911a7fd276ab170 Mon Sep 17 00:00:00 2001
From: Wouter Wijsman
Date: Thu, 20 Jun 2024 19:45:52 +0200
Subject: [PATCH 10/15] Use same format for the different sizes
---
make-repo-html.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/make-repo-html.sh b/make-repo-html.sh
index dffebad..edbab64 100755
--- a/make-repo-html.sh
+++ b/make-repo-html.sh
@@ -27,7 +27,7 @@ for PSPBUILD in $(find . -name "PSPBUILD" | sort); do
# Get file size info
FILENAME="repo/${DOWNLOAD_URL}"
if [ -f "${FILENAME}" ]; then
- PKGSIZE=$(du "${FILENAME}" | cut -f 1 | numfmt --to=iec --suffix=B --format="%.2f")
+ PKGSIZE="$(ls -l "${FILENAME}"|cut -d' ' -f5|numfmt --to iec --suffix=B --format "%.1f")"
INSTSIZE="$(gunzip -c "${FILENAME}"|grep -a '^size = '|cut -d' ' -f3|numfmt --to iec --suffix=B --format "%.1f")"
fi
From 0ec24663a2bce98285b402186bd01ab3fce27b7a Mon Sep 17 00:00:00 2001
From: Wouter Wijsman
Date: Thu, 20 Jun 2024 19:54:26 +0200
Subject: [PATCH 11/15] Clone deeper for better update dates
---
.github/workflows/build.yml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 74434d4..705a02d 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -65,6 +65,8 @@ jobs:
steps:
- uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
- name: Download artifacts
uses: actions/download-artifact@v4
- name: Create repo files
From dfe3d5eef74ea6007d3eef12c733be7d7b8fab30 Mon Sep 17 00:00:00 2001
From: Wouter Wijsman
Date: Thu, 20 Jun 2024 20:00:02 +0200
Subject: [PATCH 12/15] Exclude directories from contents
---
make-repo-html.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/make-repo-html.sh b/make-repo-html.sh
index edbab64..3b816c2 100755
--- a/make-repo-html.sh
+++ b/make-repo-html.sh
@@ -45,7 +45,7 @@ for PSPBUILD in $(find . -name "PSPBUILD" | sort); do
# List content of files
if [ -f "${FILENAME}" ]; then
CONTENT=""
- for item in $(tar tzf $FILENAME | grep -v '\.BUILDINFO\|\.MTREE\|\.PKGINFO'); do
+ for item in $(tar -tzf $FILENAME | grep -v '\.BUILDINFO\|\.MTREE\|\.PKGINFO\|/$'); do
CONTENT="${CONTENT}${item} "
done
CONTENT="${CONTENT} "
From 6eecd4f5433b58d2e4771b99cc56f9d4b40c5de4 Mon Sep 17 00:00:00 2001
From: Wouter Wijsman
Date: Thu, 20 Jun 2024 20:05:29 +0200
Subject: [PATCH 13/15] Add last updated to package page
---
package.html | 1 +
1 file changed, 1 insertion(+)
diff --git a/package.html b/package.html
index 28268ca..1728cda 100644
--- a/package.html
+++ b/package.html
@@ -13,6 +13,7 @@
Description: ${pkgdesc}
Upstream URL: ${url}
License: ${LICENSE}
+ Last Updated: ${UPDATED}
Package Size: ${PKGSIZE}
Installed Size: ${INSTSIZE}
Download: ${DOWNLOAD_URL}
From c6ab27d49bc44fac8fd760aec8a7d064e9df7efb Mon Sep 17 00:00:00 2001
From: Wouter Wijsman
Date: Fri, 21 Jun 2024 07:16:48 +0200
Subject: [PATCH 14/15] Remove tab at end of line
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Co-authored-by: Damián Parrino
---
.github/workflows/build.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 705a02d..3c38c84 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -80,7 +80,7 @@ jobs:
${PSPDEV}/share/pacman/bin/repo-add pspdev.db.tar.gz *.pkg.tar.gz
mv pspdev.db.tar.gz pspdev.db
mv pspdev.files.tar.gz pspdev.files
- tar -cvf ../repo.tar ./*
+ tar -cvf ../repo.tar ./*
- name: Upload repo artifact
uses: actions/upload-artifact@v4
with:
From 81734c260e6ba738ecb94175b253cf330a9824fc Mon Sep 17 00:00:00 2001
From: Wouter Wijsman
Date: Fri, 21 Jun 2024 10:58:09 +0200
Subject: [PATCH 15/15] Add some basic css
Thanks @bucanero!
---
style.css | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/style.css b/style.css
index e69de29..535bd80 100644
--- a/style.css
+++ b/style.css
@@ -0,0 +1,24 @@
+body {
+ font-family: sans-serif;
+}
+
+table {
+ border-collapse: collapse;
+ font-size: 0.9em;
+}
+
+table tbody tr {
+ border-bottom: 1px solid #dddddd;
+}
+
+table th, td {
+ padding: 12px 15px;
+}
+
+table tbody tr:nth-of-type(even) {
+ background-color: #f3f3f3;
+}
+
+table tbody tr:nth-of-type(uneven) {
+ background-color: #009879;
+}