summaryrefslogtreecommitdiff
path: root/gup/abgabe.gup
blob: 693b8b82a08081d9fb0978606098c2ace09c62cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env zsh

dir=$(dirname $2)
manifest=${dir}/manifest

deps() {
    sort -u $manifest | awk -v "base=${dir}" '{ print base "/" $0; }' | xargs -d '\n' -I '{}' -- /usr/bin/env zsh -c "find '{}' 2>/dev/null || print '{}'" | filter
}

filter() {
    read -r -d '' script <<'EOF'
/\.class$/d
/(\/|^).gup(\/|$)/d
EOF
    sed -r $script
}

gup --update $manifest

deps | xargs gup --update

{ cd $dir && xargs -d '\n' -- find | filter | xargs -t -d '\n' -- zip - manifest >$(basename $2)} <${manifest}