summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2021-10-06 20:09:17 +0100
committerdavidovski <david@davidovski.xyz>2021-10-06 20:09:17 +0100
commitc7680a4b80867c41ddee4b8cf4c5a3c7acc1f7e8 (patch)
treedec624741d3c8a7a34a04049976e2b9b0b6a4a08
parent49f3f0aa5a3b61b1dcb4ce08043ec44f8823d967 (diff)
Added syncing capabilities
-rwxr-xr-xbuild-repo.sh151
-rwxr-xr-xxibuild2
2 files changed, 92 insertions, 61 deletions
diff --git a/build-repo.sh b/build-repo.sh
index 038e4f6..d22fa1c 100755
--- a/build-repo.sh
+++ b/build-repo.sh
@@ -2,94 +2,125 @@
XIBUILD=./xibuild
-fetch-pkg-builds () {
+fetch () {
git clone https://git.davidovski.xyz/xilinux/xipkgs
mkdir dist
+}
+build () {
for REPO in $(du -h xipkgs/repo/* | awk '{print $2}'); do
REPO_NAME=$(echo $REPO | cut -d"/" -f2-)
REPO_INDEX=dist/$REPO_NAME/index.html
REPO_LIST=dist/$REPO_NAME/packages.txt
-
- echo "<html>
- <head>
- <title>packages for $REPO_NAME</title>
- <link rel='stylesheet' type='text/css' href='/style.css'>
- </head>
- <body>
- <h1>Packages in <a href='../'>$REPO_NAME</a></h1>
- <table>" > $REPO_INDEX
+
+ start-index $REPO_NAME $REPO_INDEX
printf "" > xibuild.report.log
for BUILD_FILE in $REPO/*; do
DEST=dist/$REPO_NAME
$XIBUILD -o $DEST $BUILD_FILE
-
- PKG_NAME=$(basename $BUILD_FILE .xibuild)
- DESC=$(grep $PKG_NAME xibuild.report.log | cut -d" " -f3-)
-
- COLOR="none"
- if grep $PKG_NAME xibuild.report.log | grep -q new; then
- COLOR="lime"
- fi
- if grep $PKG_NAME xibuild.report.log | grep -q fail; then
- if [ ! -f $DEST ]; then
- COLOR="orange"
- else
- COLOR="red"
- fi
- fi
- echo "
- <tr style='background-color: $COLOR'>
- <td>$PKG_NAME</td>
- <td><a href='src/$PKG_NAME.xibuild'>src</a></td>
- <td><a href='logs/$PKG_NAME.log'>log</a></td>
- <td>$DESC</td>
- <td><a href='$PKG_NAME.xipkg'>$PKG_NAME.xipkg</a></td>
- <td><a href='$PKG_NAME.xipkg.info'>.info</a></td>
-</tr>
-" >> $REPO_INDEX
+
+ extend-index $BUILD_FILE $REPO_INDEX
done;
rm xibuild.report.log
+ conclude-index $REPO_INDEX
- echo "</table>
+ generate-package-list
+ add-additional
+ done;
+}
- <p>Latest builds: <b>$(date)</b></p>
+start-index () {
+ echo "<html>
+ <head>
+ <title>packages for $1</title>
+ <link rel='stylesheet' type='text/css' href='/style.css'>
+ </head>
+ <body>
+ <h1>Packages in <a href='../'>$1</a></h1>
+ <table>" > $2
+}
- <h3>Legend:</h3>
- <ul>
- <li style='background-color: none'>build skipped; no updates</li>
- <li style='background-color: red'>build failed; no previous version</li>
- <li style='background-color: orange'>build failed; previous version exists</li>
- <li style='background-color: lime'>build passed: new update</li>
- </ul>
- </body>
- </html>
- " >> $REPO_INDEX
+extend-index () {
+ PKG_NAME=$(basename $1 .xibuild)
+ DESC=$(grep $PKG_NAME xibuild.report.log | cut -d" " -f3-)
+
+ COLOR="none"
+ if grep $PKG_NAME xibuild.report.log | grep -q new; then
+ COLOR="lime"
+ fi
+ if grep $PKG_NAME xibuild.report.log | grep -q fail; then
+ if [ ! -f $DEST ]; then
+ COLOR="orange"
+ else
+ COLOR="red"
+ fi
+ fi
+ echo "
+ <tr style='background-color: $COLOR'>
+ <td>$PKG_NAME</td>
+ <td><a href='src/$PKG_NAME.xibuild'>src</a></td>
+ <td><a href='logs/$PKG_NAME.log'>log</a></td>
+ <td>$DESC</td>
+ <td><a href='$PKG_NAME.xipkg'>$PKG_NAME.xipkg</a></td>
+ <td><a href='$PKG_NAME.xipkg.info'>.info</a></td>
+ </tr>
+ " >> $2
+}
- cd dist/$REPO_NAME
- ls -1 *.xipkg.info > packages.txt
- cd -
+conclude-index () {
+ echo "</table>
+
+ <p>Latest builds: <b>$(date)</b></p>
+
+ <h3>Legend:</h3>
+ <ul>
+ <li style='background-color: none'>build skipped; no updates</li>
+ <li style='background-color: red'>build failed; no previous version</li>
+ <li style='background-color: orange'>build failed; previous version exists</li>
+ <li style='background-color: lime'>build passed: new update</li>
+ </ul>
+ </body>
+ </html>
+ " >> $1
+}
- # move logs and sources
- mv logs/* dist/$REPO_NAME/logs
-
- mkdir -p dist/$REPO_NAME/src
- mv $REPO/* dist/$REPO_NAME/src/
-
- # add key for whole repo
- cp keychain/xi.pub dist/repo/
- done;
+generate-package-list () {
+ cd dist/$REPO_NAME
+ ls -1 *.xipkg.info > packages.txt
+ cd -
+}
+
+add-additional () {
+ # move logs and sources
+ mv logs/* dist/$REPO_NAME/logs
+
+ mkdir -p dist/$REPO_NAME/src
+ mv $REPO/* dist/$REPO_NAME/src/
+ # add key for whole repo
+ cp keychain/xi.pub dist/repo/
+}
+clean () {
rm -rf xipkgs
rm -rf logs
rm -rf tmp
rm -rf xibuild.log
}
-fetch-pkg-builds
+sync () {
+ [[ $# = 0 ]] || rsync -vLta --no-perms --no-owner --no-group --delete -z -e ssh ./dist/ $1
+}
+
+
+# update the repository
+
+fetch
+build
+clean
+sync $@
diff --git a/xibuild b/xibuild
index 1ef7264..06fecb8 100755
--- a/xibuild
+++ b/xibuild
@@ -47,7 +47,7 @@ xibuild () {
clean () {
# clean up
rm -rf $PKG_BUILD_DIR
- rmdir $XI_ROOT/tmp > /dev/null 2>&1
+ rmdir $XI_ROOT/tMp > /dev/null 2>&1
}
build () {