summaryrefslogtreecommitdiff
path: root/pbs-absrepo-convert
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2012-11-03 00:45:44 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2012-11-03 00:45:44 -0400
commitd2ef0c1c9925ec7f4d7494dd20a9c73451587592 (patch)
tree75c6c7c1148eb60688c176db90fea0cec6578447 /pbs-absrepo-convert
parente1b7cc252a63de40135cf6ed4ce1c96d9abca303 (diff)
improve performance of pbs-absrepo-convert's collect-data
Diffstat (limited to 'pbs-absrepo-convert')
-rwxr-xr-xpbs-absrepo-convert33
1 files changed, 10 insertions, 23 deletions
diff --git a/pbs-absrepo-convert b/pbs-absrepo-convert
index 29f749f..901b924 100755
--- a/pbs-absrepo-convert
+++ b/pbs-absrepo-convert
@@ -15,20 +15,6 @@ abort() {
cleanup
}
-collect-data-gc() {(
- cd "$TMPDIR"
- local files
- while [[ ! -f collect-data-filter-branch.done ]]; do
- files=`echo find.new*`
- cat -- $files 2>>/dev/null | sort -u > find.tmp
- rm -f -- $files
- mv find.tmp find.new
- sleep 10
- done
- mv find.new find
- rm -f collect-data-filter-branch.done
-)}
-
##
# Usage: collect-data
# Assumptions:
@@ -36,6 +22,7 @@ collect-data-gc() {(
# - git branch "master" exists and is untouched
# - TMPDIR is set and exists
# Effects:
+# - creates file "${TMPDIR}/commits"
# - creates file "${TMPDIR}/find"
# - creates file "${TMPDIR}/packages"
# - creates file "${TMPDIR}/architectures"
@@ -44,15 +31,15 @@ collect-data() {
msg "$(gettext "Collecting package data...")"
[[ $# = 0 ]] || { usage; return 1; }
- # main data collection #################################################
- collect-data-gc &
- git filter-branch --tree-filter pbs-absrepo-convert--filterlist master
- # notify collect-data-gc that filter-branch is done
- touch "${TMPDIR}/collect-data-filter-branch.done"
- # wait for collect-data-gc to finish
- while [[ ! -f "${TMPDIR}/find" ]]; do
- sleep 10;
- done
+ git log --pretty=format:'%H' master > "${TMPDIR}/commits"
+
+ # actual data collection ###############################################
+ local count="$(wc -l < "${TMPDIR}/commits")"
+ cat -n "${TMPDIR}/commits" | while read n commit; do
+ printf '\rscanning commit %s (%d/%d)' "$commit" "$n" "$count" >> /dev/tty
+ git ls-tree -rd --name-only "$commit"
+ done | fgrep /repos/ | sort -u > "${TMPDIR}/find"
+ echo # newline
# extract some things ##################################################
# packages