index : checker | |
Archlinux32 consistency checker | gitolite user |
summaryrefslogtreecommitdiff |
-rwxr-xr-x | bin/check | 38 | ||||
-rwxr-xr-x | bin/setup | 36 | ||||
-rwxr-xr-x | bin/update | 46 |
diff --git a/bin/check b/bin/check new file mode 100755 index 0000000..43a047c --- /dev/null +++ b/bin/check @@ -0,0 +1,38 @@ +#!/bin/oksh + +BASE="${0%/*}/.." +. "${BASE}/conf/default.conf" + +if test ! -d "${state_dir}"; then + echo "no upstream git state repo of packages.. exiting.." + exit 1 +fi + +if test ! -d "${packages_dir}"; then + echo "no directory for uptream package descriptions.. exiting.." + exit 1 +fi + +find "${state_dir}"/{core,extra}-{any,x86_64} -type f > /tmp/update_packages.$$ +nof_packages=`cat /tmp/update_packages.$$ | wc -l` + +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 + +# find duplicate entries in state repo +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" + done + done +done + +# TODO: update all single package directories +# TODO: update all AUR package directories diff --git a/bin/setup b/bin/setup new file mode 100755 index 0000000..f1e252c --- /dev/null +++ b/bin/setup @@ -0,0 +1,36 @@ +#!/bin/oksh + +BASE="${0%/*}/.." +. "${BASE}/conf/default.conf" + +echo "base dir: ${base_dir}" +echo "script dir: ${script_dir}" +echo "state dir: ${state_dir}" +echo "packages dir: ${packages_dir}" + +if test ! -d "${state_dir}"; then + echo "no upstream git state repo of packages.. cloning.." + git clone https://gitlab.archlinux.org/archlinux/packaging/state.git "${state_dir}" +else + echo "upstream git state repo exists.." +fi + +if test ! -d "${packages_dir}"; then + echo "creating directory for uptream package description.." + mkdir -p "${packages_dir}" +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 + echo "package directory ${packages_dir}/${repo}-${arch} doesn't exist, creating it.." + mkdir "${packages_dir}/${repo}-${arch}" + else + echo "package directory ${packages_dir}/${repo}-${arch} exists" + fi + done +done + +# TODO: AUR directory diff --git a/bin/update b/bin/update new file mode 100755 index 0000000..31333dc --- /dev/null +++ b/bin/update @@ -0,0 +1,46 @@ +#!/bin/oksh + +BASE="${0%/*}/.." +. "${BASE}/conf/default.conf" + +if test ! -d "${state_dir}"; then + echo "no upstream git state repo of packages.. exiting.." + exit 1 +fi + +if test ! -d "${packages_dir}"; then + echo "no directory for uptream package descriptions.. exiting.." + exit 1 +fi + +git -C "${state_dir}" pull + +find "${state_dir}"/{core,extra}-{any,x86_64} -type f > /tmp/update_packages.$$ +nof_packages=`cat /tmp/update_packages.$$ | wc -l` + +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" + +sleep 10 + +for pkgfile in `cat /tmp/update_packages.$$`; do + repo=`echo "${pkgfile}" | rev | cut -f 2 -d / | rev` + OLDIFS="$IFS" + IFS=" " + while read pkgname pkgver tag revision; do + echo "${repo} ${pkgname}" + if test ! -d "${packages_dir}/${repo}/${pkgname}"; then + cd "${packages_dir}/${repo}" || exit 1 + pkgctl repo clone --protocol=https "${pkgname}" + sleep 10 + else + true +# git -C "${packages_dir}/${repo}/${pkgname}" pull + fi + done < $pkgfile + IFS="$OLDIFS" +done +# TODO: update all single package directories +# TODO: update all AUR package directories |