tensor5 / haskell-happstack

[haskell-happstack] repository for Arch Linux
https://github.com/tensor5/haskell-happstack
7 stars 3 forks source link

Speedup updates.sh by caching Pacman output #8

Closed nponeccop closed 9 years ago

nponeccop commented 9 years ago

After the patch updates.sh becomes an order of magnitude faster while remaining reasonably KISS.

It also lets you flexibly ignore or not ignore specific pacman repositories.

A yet another order of magnitude speedup is possible by using join and functional bash-fu. it's self-contained - paste to bash to see it mimicking update.sh -b:

join -e ccc -j1 -a1 \
        <(cblrepo list -d --no-repo | awk '{print "haskell-" tolower($1) " " $1 " " $2}' | sort) \
        <(pacman -Sl haskell-core | awk '{print $2 " " $3}' |sort) \
    | awk '$3 != $4 {print}' \
    | cut -d ' ' -f2 \
    | xargs echo cblrepo add

Note that join is designed to only operate on sorted data and thus this approach avoids quadratic algorithms entirely.

But I'm not sure if it's KISS enough.

tensor5 commented 9 years ago

Awesome!!

I used the join variant instead.

Thanks very much.