index : checker | |
Archlinux32 consistency checker | gitolite user |
summaryrefslogtreecommitdiff |
-rwxr-xr-x | bin/check | 13 | ||||
-rwxr-xr-x | bin/setup | 7 | ||||
-rwxr-xr-x | bin/update | 131 | ||||
-rw-r--r-- | conf/default.conf | 1 | ||||
-rw-r--r-- | doc/TODOS | 2 | ||||
-rw-r--r-- | templates/summary.m4 | 2 |
@@ -15,11 +15,13 @@ fi find "${state_dir}"/{core,extra}-{any,x86_64} -type f > /tmp/update_packages.$$ nof_packages=`cat /tmp/update_packages.$$ | wc -l` +nof_aur_packages=`wc -l ${aur_state_dir}/packages | cut -f 1 -d ' '` 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" +echo "${nof_aur_packages} packages in AUR" > "${data_dir}/stats" echo "packages_state\t${nof_packages}" >> "${data_dir}/stats" @@ -43,9 +45,18 @@ done > "${data_dir}/missing_state_file" for pkgfile in `find "${packages_dir}" -type f -name PKGBUILD`; do repo_in_pkgfile=`echo $pkgfile | rev | cut -f 2-3 -d / | rev` + pkgname_in_pkgfile=`echo $pkgfile | rev | cut -f 2 -d / | rev` state_file="${state_dir}/${repo_in_pkgfile}" if test ! -f "${state_file}"; then - echo "${repo_in_pkgfile}\tnot in state repo anymore" >> "${data_dir}/missing_state_file" + grep "^${pkgname_in_pkgfile}$" "${aur_state_dir}/packages" 2>&1 >/dev/null + if test $? = 0; then + state='missing' + aur_state="<a href=\"https://aur.archlinux.org/packages/${pkgname_in_pkgfile}\">${pkgname_in_pkgfile}</a>" + else + state='missing' + aur_state='missing' + fi + echo "${repo_in_pkgfile}\t${state}\t${aur_state}" >> "${data_dir}/missing_state_file" fi done nof_missing_state_files=`cat ${data_dir}/missing_state_file | wc -l` @@ -41,4 +41,11 @@ else echo "data directory exists" fi +if test ! -d "${aur_state_dir}"; then + echo "no AUR state information directory exists.. creating it.." + mkdir "${aur_state_dir}" +else + echo "AUR state information directory exists." +fi + # TODO: AUR directory @@ -3,6 +3,54 @@ BASE="${0%/*}/.." . "${BASE}/conf/default.conf" +UPATE_UPSTREAM=0 +UPDATE_AUR=0 +STATS=0 +OPTIONS=`getopt -n update -o huas -l help,upstream,aur,stats -- "$@"` +if test $? != 0; then + echo "ERROR: internal error which using getopt.." >&2; + exit 1 +fi +eval set -- "$OPTIONS" +while true; do + case "$1" in + -h|--help) + echo "update [options]" + echo "" + echo "-u --upstream update from update git state and package repo" + echo "-a --aur update from the AUR" + echo "-s --stats compute and print statistics" + exit 0 + ;; + + -u|--uptream) + UPDATE_UPSTREAM=1 + shift + ;; + + -a|--aur) + UPDATE_AUR=1 + shift + ;; + + -s|--status) + STATS=1 + shift + ;; + + --) + shift + break + ;; + + *) + echo "ERROR: Internal error in getopt" >&2 + exit 1 + esac +done + +shift `expr $OPTIND - 1` + if test ! -d "${state_dir}"; then echo "no upstream git state repo of packages.. exiting.." exit 1 @@ -13,38 +61,69 @@ if test ! -d "${packages_dir}"; then exit 1 fi -echo "Updating main state git repo.." +if test ! -d "${aur_state_dir}"; then + echo "no AUR state directory exists of .. exiting.." + exit 1 +fi + +if test "${UPDATE_UPSTREAM}" = 1; then + echo "Updating main state git repo.." + + git -C "${state_dir}" pull -git -C "${state_dir}" pull + if test "${STATS}" = 1; then + echo "Checking statistics.." -echo "Checking statistics.." + 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` -find "${state_dir}"/{core,extra}-{any,x86_64} -type f > /tmp/update_packages.$$ -nof_packages=`cat /tmp/update_packages.$$ | wc -l` + echo "${nof_packages} packages in state repo" + echo "${nof_checked_out_packages} packages are checked out" -nof_checked_out_packages=`find "${packages_dir}" -type f -name PKGBUILD | wc -l` + sleep 10 + fi -echo "${nof_packages} packages in state repo" -echo "${nof_checked_out_packages} packages are checked out" + 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 +# TODO: find a way to find out whether the reference revision is in out +# current state repo and update only when we miss it. We can still +# do a full update when we need it, but here it just creates a lot +# of load.. +# git -C "${packages_dir}/${repo}/${pkgname}" pull + fi + done < $pkgfile + IFS="$OLDIFS" + done +fi -sleep 10 +if test "${UPDATE_AUR}" = 1; then + echo "Updating AUR state.." + + rm -f "${aur_state_dir}/packages" + wget --quiet -O "${aur_state_dir}/packages.gz" https://aur.archlinux.org/packages.gz + gunzip "${aur_state_dir}/packages.gz" + + if test "${STATS}" = 1; then + echo "Checking statistics.." + + nof_aur_packages=`wc -l ${aur_state_dir}/packages | cut -f 1 -d ' '` + + echo "${nof_aur_packages} packages in AUR" + + sleep 10 + fi +fi -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 diff --git a/conf/default.conf b/conf/default.conf index c8dd762..0f7417a 100644 --- a/conf/default.conf +++ b/conf/default.conf @@ -13,3 +13,4 @@ packages_dir="${base_dir}/packages" data_dir="${base_dir}/data" templates_dir="${base_dir}/templates" html_dir="${base_dir}/html" +aur_state_dir="${base_dir}/aur_state" @@ -1,3 +1,5 @@ +- rename dirs + - packages/upstream, state/upstream, state/aur, packages,aur or so - check if gitrevision is part of the packages_dir checkout, if not, and only then, do a git pull. - consistency checks diff --git a/templates/summary.m4 b/templates/summary.m4 index af084cd..60035af 100644 --- a/templates/summary.m4 +++ b/templates/summary.m4 @@ -43,7 +43,7 @@ _TABLE_END() _SECTION_HEADER(h2,_MISSING_STATE_FILE) <p>Candidates to be transfered to the AUR and to adopt there..</p> _TABLE_START() -_TABLE_HEADER(repository,status) +_TABLE_HEADER(repository,status in state repo,state in AUR) m4_esyscmd(`../scripts/tsv2tablerow ../data/missing_state_file') _TABLE_END() _SECTION_HEADER(h2,_MOVING_PACKAGES_TO_AUR) |