#!/bin/bash
XIBUILD=./xibuild
fetch-pkg-builds () {
git clone https://git.davidovski.xyz/xilinux/xipkgs
mkdir dist
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 "
packages for $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 "
$PKG_NAME |
src |
log |
$DESC |
$PKG_NAME.xipkg |
.info |
" >> $REPO_INDEX
done;
rm xibuild.report.log
echo "
Latest builds: $(date)
Legend:
- build skipped; no updates
- build failed; no previous version
- build failed; previous version exists
- build passed: new update
" >> $REPO_INDEX
cd dist/$REPO_NAME
ls -1 *.xipkg.info > packages.txt
cd -
# 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;
rm -rf xipkgs
rm -rf logs
rm -rf tmp
rm -rf xibuild.log
}
fetch-pkg-builds