summaryrefslogtreecommitdiff
path: root/gup/abgabe.gup
blob: a063884653b1212370d21e8faf673af195f90c64 (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 >${1}} <${manifest}