summaryrefslogtreecommitdiff
path: root/pbs-absrepo-convert
diff options
context:
space:
mode:
Diffstat (limited to 'pbs-absrepo-convert')
-rwxr-xr-xpbs-absrepo-convert34
1 files changed, 18 insertions, 16 deletions
diff --git a/pbs-absrepo-convert b/pbs-absrepo-convert
index 7b0bdaf..29f749f 100755
--- a/pbs-absrepo-convert
+++ b/pbs-absrepo-convert
@@ -15,23 +15,17 @@ abort() {
cleanup
}
-_collect-data-gc() {
- local base=$1
- local files=`echo $base.new*`
- cat -- $files 2>>/dev/null | sort -u > $base.tmp
- rm -f -- $files
- mv $base.tmp $base.new
-}
-
collect-data-gc() {(
cd "$TMPDIR"
+ local files
while [[ ! -f collect-data-filter-branch.done ]]; do
- _collect-data-gc packages
- _collect-data-gc repo-arch
+ 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 packages.new packages
- mv repo-arch.new repo-arch
+ mv find.new find
rm -f collect-data-filter-branch.done
)}
@@ -42,25 +36,33 @@ collect-data-gc() {(
# - git branch "master" exists and is untouched
# - TMPDIR is set and exists
# Effects:
+# - creates file "${TMPDIR}/find"
# - creates file "${TMPDIR}/packages"
-# - creates file "${TMPDIR}/repo-arch"
# - creates file "${TMPDIR}/architectures"
##
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}/packages" ]]; do
+ while [[ ! -f "${TMPDIR}/find" ]]; do
sleep 10;
done
- # extract some data from those files
+
+ # extract some things ##################################################
+ # packages
+ {
+ < "${TMPDIR}/find" sed -r 's|^\./([^/]*)/.*|\1|'
+ } | sort -u > "${TMPDIR}/packages"
+ # architectures
{
echo master
- < "${TMPDIR}/repo-arch" sed -e 's/.*/-/' -e '/^any$/d'
+ < "${TMPDIR}/find" sed -e 's/.*/-/' -e '/^any$/d'
} | sort -u > "${TMPDIR}/architectures"
}