summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2017-07-01 22:15:02 -0400
committerLuke Shumaker <lukeshu@lukeshu.com>2017-07-01 22:15:02 -0400
commit3f1ea48182ef0972e3df162a446cbcbbfc1e2a4e (patch)
treebf6b7e12d516c4597cf874d028a894bbb1e06fe2
parent838a73363333bd2eda5aaf08e41701760406987a (diff)
Synthesize directory listings when necessary
Now we need to base the git contents off of dat/pools/snaps/
-rwxr-xr-xbin/poolify43
1 files changed, 42 insertions, 1 deletions
diff --git a/bin/poolify b/bin/poolify
index e33821b..48dc828 100755
--- a/bin/poolify
+++ b/bin/poolify
@@ -23,6 +23,47 @@ main() {
ln -sr "$filedir/$filepart" "$snapdir"
done < "$1"
+ echo '# Pass 1.5'
+ # Looking at the data, there are 3 revisions that we DON'T
+ # have directory listings for. So we need to synthesize
+ # those.
+ #
+ # I created the list of listings to synthesize by not
+ # synthesizing anything, then looking for files ending in
+ # ".1". They are created during pass 2 if we have a file with
+ # no matching listing.
+ while read -r datetime dirpart newfiles; do
+ # We need to figure out which files to put in the
+ # directory listing. We're going to do that by
+ # mimicking the previous listing with that dirpart.
+ prevsnap=''
+ for isnap in dat/pools/snaps/*-"${dirpart//\//_}"; do
+ isnap=${isnap##*/}
+ if [[ "${isnap%%-*}" -lt "${datetime}00" ]]; then
+ prevsnap=$isnap
+ fi
+ done
+ if [[ -z "$prevsnap" ]]; then
+ >& printf 'Could not find listing of %s before %s\n' "$dirpart" "$datetime"
+ false
+ fi
+ # Ok, now copy that snapshot
+ snapdir=dat/pools/snaps/"${datetime}00-${dirpart//\//_}"
+ cp -aT dat/pools/snaps/"$prevsnap" "$snapdir"
+ # And touch file files we need to change
+ for filepart in $newfiles; do
+ name="$dirpart/$filepart"
+ filedir=dat/pools/files/"${datetime}-${name//\//_}"
+ mkdir -p -- "$filedir"
+ rm -- "$snapdir/$filepart"
+ ln -sr "$filedir/$filepart" "$snapdir"
+ done
+ done < <(printf '%s\n' \
+ '200303310700 PROGRAMS/CVTUTF ConvertUTF.c ConvertUTF.h harness.c' \
+ '200307291500 ALPHA/CVTUTF-1-1 ExpectedOutput.txt readme.txt' \
+ '200412210100 PROGRAMS/CVTUTF.OLD CVTUTF7.C CVTUTF7.H' \
+ )
+
echo '# Pass 2'
while read -r time url; do
name="${url##*/Public/}"
@@ -44,7 +85,7 @@ main() {
fi
done
if [[ -z "$mypool" ]]; then
- >&2 printf 'Could not find pool for %s %s' "$time" "$url"
+ >&2 printf 'Could not find pool for %s %s\n' "$time" "$url"
false
fi