For the large number of OCaml packages (~ 200) it takes a very long
time to recompute the list of dependencies. The real reason for this
is that we calculate the bin2src hash table over and over again for
each dependency. Each time it takes about 6 seconds.
Try one approach to caching this.
This does improve performance quite a lot, at the minor annoyance of
leaving ".depcache" files in the Fedora directory.
A future approach might consider allowing bin2src to be created once
when goals starts up and then making it available to all shell script
snippets. I'm not sure how to implement that.
Another possible approach in future would be to internalize the
(key, value) cache implied here. This would let us cache the result
of earlier runs so no recomputation would be needed.
# list of binary packages they build, so work this out in advance.
declare -A bin2src
for p in %fedora-source-packages; do
- for b in $(rpmspec -q --provides %fedora-dir/$p/%fedora-branch/$p.spec 2>/dev/null | awk '{print $1}'); do
- bin2src[$b]=$p
- done
+ p_specfile=%fedora-dir/$p/%fedora-branch/$p.spec
+ p_depcache=%fedora-dir/$p/%fedora-branch/.depcache
+ if ! test -f $p_depcache || test $p_specfile -nt $p_depcache; then
+ rm -f $p_depcache
+ for b in $(rpmspec -q --provides $p_specfile 2>/dev/null | awk '{print $1}'); do
+ echo "bin2src['$b']='$p'" >> $p_depcache
+ done
+ fi
+ source $p_depcache
done
for b in $(rpmspec -q --buildrequires $specfile 2>/dev/null |