3 tools_dir=$(dirname "$0")
4 # shellcheck source=/dev/null
5 . "$tools_dir/common.sh" ''
7 if [ "$1" = '-n' ]; then
9 last=$(tail -n1 "$SHA1_FILE" | cut -f1 -d$'\t')
10 start_from=$(awk -F '\t' '/^[^#]/ && $3 == "'"$last"'" {
13 while (/^#/ || $2 == "branch");
19 if [ "$1" = '-s' ]; then
22 if [ -z "$start_from" ]; then
23 printf '-s requires a start tree\n' 1>&2
31 awk -F '\t' '/^[^#]/ && $3 == "'"$1"'" { print $'"$2"'; }' "$CTRL_FILE"
42 if ! cd ../mmotm; then
43 printf 'Cannot chdir to ../mmotm\n' 1>&2
46 if ! rsync -az --partial --exclude '.git*' \
47 --exclude broken-out.tar.gz --delete \
48 ozlabs.org::akpm/mmotm/. .; then
50 printf 'Fetcing mmotm failed\n' 1>&2
54 if [ "$(git status --porcelain)" ]; then
55 git commit -m "$(head -n 1 .DATE)"
63 url=$(get_field "$1" 4)
64 url=${url%/} # strip trailing / if necessary
66 if ! cd ../quilt; then
67 printf 'Cannot chdir to ../quilt\n' 1>&2
70 if ! [ -d "$1" ] && ! mkdir "$1"; then
71 printf 'Cannot create quilt directory for %s\n' "$1" 1>&2
75 printf 'Cannot chdir to quilt directory for %s\n' "$1" 1>&2
78 if ! wget -N -nv --no-cache "$url/series"; then
79 printf 'Wget of %s series file failed\n' "$1" 1>&2
85 find . -type f | sed 's,^./,,;/^series$/d' | sort >.series.old
86 if grep -q NEXT_PATCHES series; then
87 sed -n '/NEXT_PATCHES_START/,/NEXT_PATCHES_END/p' series
91 sed -e 's/[ \t]*#.*$//' -e '/^[ \t]*$/d' |
93 if [ -s .series.next ]; then
94 if ! wget -N -nv --no-cache -B "$url/" -i .series.next; then
95 printf 'Wget of series %s failed\n' "$1" 1>&2
102 comm -23 .series.old .series.next | xargs -r rm -f
103 rm -f .series.old .series.next
104 setfattr -x user.xdg.origin.url ./* >/dev/null 2>&1
109 if ! [ "$trees" ]; then
110 trees=$(awk -F '\t' '/^[^#]/ && $2 != "branch" { print $3 }' "$CTRL_FILE")
113 for name in $trees; do
114 if [ -n "$start_from" ]; then
115 if [ "$name" = "$start_from" ]; then
122 type=$(get_field "$name" 2)
123 if ! [ "$type" ]; then
124 printf '%s: unknown tree\n' "$name" 1>&2
128 printf '%s: %s\n' "$name" "$type"
130 tfun=$(type -t "$fun")
131 if [ "$tfun" = 'function' ]; then
136 if ! cd ../quilt; then
137 printf 'hmmm, what happened to the quilt directory?\n' 1>&2
141 if [ "$(git status --porcelain)" ]; then
142 git commit -v -a -m "$(date '+%F-%H:%M')" -e