-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathweekly-update.sh
executable file
·29 lines (28 loc) · 1.11 KB
/
weekly-update.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash
# Copyright (c) Wikimedia Foundation, 2023-
# This program is free software, see LICENSE for details
# TODO: check args
IMAGE_DIR=${1:-images}
CURDATE=$(date +%Y%m%d)
pushd "$IMAGE_DIR" || exit
while IFS= read -r -d '' changelog; do
obj=$(dirname "$changelog")
# Exclude spark images, they're too big to rebuild every week.
if [[ "$obj" == *"spark"* ]]; then
echo "skipping rebuild of $obj"
continue
fi
cur_version=$(dpkg-parsechangelog -l "$changelog" --show-field Version)
version=$(echo "$cur_version" | sed -E 's/\-[0-9]{8}$//')
version="${version}-${CURDATE}"
if [[ -n $version ]]; then
DEBFULLNAME="Image build Bot" DEBEMAIL="[email protected]" dch -c "$changelog" -v "$version" --no-auto-nmu -D wikimedia --force-distribution "Weekly rebuild." 2>/dev/null
git add "$changelog"
else
echo "Could not find a version for $obj"
fi
done < <(find . -type f -name "changelog" -print0)
popd || exit
git commit -m "Weekly rebuild of $IMAGE_DIR - $CURDATE"
# you need push rights on the repository. Those should be granted to imageupdatebot
git push