Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2024-09-14 13:18:14 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2024-09-14 13:18:14 +0200
commite9a7c61175caf1e7fca688fe69443b509335a2af (patch)
tree31bf3798fdf650ffd1aa46ff7306897da436ed02 /bin
parentc6b8602075156e9997d0504fc861f11cd60ab613 (diff)
generating first statistics page with M4
Diffstat (limited to 'bin')
-rwxr-xr-xbin/check9
-rwxr-xr-xbin/genhtml15
-rwxr-xr-xbin/setup8
-rwxr-xr-xbin/update4
4 files changed, 33 insertions, 3 deletions
diff --git a/bin/check b/bin/check
index 43a047c..f711bc6 100755
--- a/bin/check
+++ b/bin/check
@@ -21,15 +21,18 @@ nof_checked_out_packages=`find "${packages_dir}" -type f -name PKGBUILD | wc -l`
echo "${nof_packages} packages in state repo"
echo "${nof_checked_out_packages} packages are checked out"
-exit 0
+> "${data_dir}/stats"
+echo "packages_state\t${nof_packages}" >> "${data_dir}/stats"
+echo "packages_repos\t${nof_checked_out_packages}" >> "${data_dir}/stats"
# find duplicate entries in state repo
+> "${data_dir}/duplicates"
for duplicate in `find "${state_dir}"/{core,extra}-{any,x86_64} -type f | \
rev | cut -f 1 -d / | rev | sort | uniq -D | uniq`; do
for packages in `ls ${state_dir}/{core,extra}-{any,x86_64}/$duplicate 2>/dev/null`; do
for instance in `echo $packages | rev | cut -f 1,2 -d / | rev`; do
- echo -n "${instance} "
- cat "${state_dir}/$instance"
+ echo -n "${instance} " >> "${data_dir}/duplicates"
+ cat "${state_dir}/$instance" >> "${data_dir}/duplicates"
done
done
done
diff --git a/bin/genhtml b/bin/genhtml
new file mode 100755
index 0000000..8593727
--- /dev/null
+++ b/bin/genhtml
@@ -0,0 +1,15 @@
+#!/bin/oksh
+
+BASE="${0%/*}/.."
+. "${BASE}/conf/default.conf"
+
+if test ! -d "${html_dir}"; then
+ echo "no html output diretory found.. call setup first."
+ exit 1
+fi
+
+FILES="summary"
+
+for file in $FILES; do
+ m4 -I "${templates_dir}" -P < "${templates_dir}/${file}.m4" > "${html_dir}/${file}.html"
+done
diff --git a/bin/setup b/bin/setup
index f1e252c..150e168 100755
--- a/bin/setup
+++ b/bin/setup
@@ -22,6 +22,7 @@ else
echo "package directory exists"
fi
+
for repo in core extra; do
for arch in any x86_64; do
if test ! -d "${packages_dir}/${repo}-${arch}"; then
@@ -33,4 +34,11 @@ for repo in core extra; do
done
done
+if test ! -d "${data_dir}"; then
+ echo "creating directory for storing data.."
+ mkdir -p "${data_dir}"
+else
+ echo "data directory exists"
+fi
+
# TODO: AUR directory
diff --git a/bin/update b/bin/update
index 31333dc..7be65a1 100755
--- a/bin/update
+++ b/bin/update
@@ -13,8 +13,12 @@ if test ! -d "${packages_dir}"; then
exit 1
fi
+echo "Updating main state git repo.."
+
git -C "${state_dir}" pull
+echo "Checking statistics.."
+
find "${state_dir}"/{core,extra}-{any,x86_64} -type f > /tmp/update_packages.$$
nof_packages=`cat /tmp/update_packages.$$ | wc -l`