meson: also indent scripts with 8 spaces

This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2017-04-24 19:40:02 -04:00
parent dd6ab3df74
commit b884196cc1
21 changed files with 113 additions and 83 deletions

View File

@ -21,4 +21,7 @@
(eval . (c-set-offset 'arglist-close 0))))
(nxml-mode . ((nxml-child-indent . 2)
(fill-column . 119)))
(meson-mode . ((meson-indent-basic . 8))))
(meson-mode . ((meson-indent-basic . 8)))
(sh-mode . ((sh-basic-offset . 8)
(sh-indentation . 8)))
(awk-mode . ((c-basic-offset . 8))))

View File

@ -1,5 +1,9 @@
BEGIN{ print "static const char* const af_names[] = { "}
!/AF_FILE/ && !/AF_ROUTE/ && !/AF_LOCAL/ {
printf " [%s] = \"%s\",\n", $1, $1
BEGIN{
print "static const char* const af_names[] = { "
}
!/AF_FILE/ && !/AF_ROUTE/ && !/AF_LOCAL/ {
printf " [%s] = \"%s\",\n", $1, $1
}
END{
print "};"
}
END{print "};"}

View File

@ -1,5 +1,9 @@
BEGIN{ print "static const char* const arphrd_names[] = { "}
!/CISCO/ {
printf " [ARPHRD_%s] = \"%s\",\n", $1, $1
BEGIN{
print "static const char* const arphrd_names[] = { "
}
!/CISCO/ {
printf " [ARPHRD_%s] = \"%s\",\n", $1, $1
}
END{
print "};"
}
END{print "};"}

View File

@ -1,5 +1,9 @@
BEGIN{ print "static const char* const capability_names[] = { "}
{
printf " [%s] = \"%s\",\n", $1, tolower($1)
BEGIN{
print "static const char* const capability_names[] = { "
}
{
printf " [%s] = \"%s\",\n", $1, tolower($1)
}
END{
print "};"
}
END{print "};"}

View File

@ -1,4 +1,9 @@
BEGIN{ print "static const char* const errno_names[] = { " }
BEGIN{
print "static const char* const errno_names[] = { "
}
!/EDEADLOCK/ && !/EWOULDBLOCK/ && !/ENOTSUP/ {
printf " [%s] = \"%s\",\n", $1, $1 }
END{ print "};" }
printf " [%s] = \"%s\",\n", $1, $1
}
END{
print "};"
}

View File

@ -1,5 +1,5 @@
#!/bin/sh -eu
$1 -E -dM -include sys/socket.h - </dev/null | \
grep -Ev 'AF_UNSPEC|AF_MAX' | \
awk '/^#define[ \t]+AF_[^ \t]+[ \t]+PF_[^ \t]/ { print $2; }'
grep -Ev 'AF_UNSPEC|AF_MAX' | \
awk '/^#define[ \t]+AF_[^ \t]+[ \t]+PF_[^ \t]/ { print $2; }'

View File

@ -1,5 +1,5 @@
#!/bin/sh -eu
$1 -dM -include net/if_arp.h - </dev/null | \
awk '/^#define[ \t]+ARPHRD_[^ \t]+[ \t]+[^ \t]/ { print $2; }' | \
sed -e 's/ARPHRD_//'
awk '/^#define[ \t]+ARPHRD_[^ \t]+[ \t]+[^ \t]/ { print $2; }' | \
sed -e 's/ARPHRD_//'

View File

@ -1,5 +1,5 @@
#!/bin/sh -eu
$1 -dM -include linux/capability.h -include "$2" -include "$3" - </dev/null | \
awk '/^#define[ \t]+CAP_[A-Z_]+[ \t]+/ { print $2; }' | \
grep -v CAP_LAST_CAP
awk '/^#define[ \t]+CAP_[A-Z_]+[ \t]+/ { print $2; }' | \
grep -v CAP_LAST_CAP

View File

@ -1,4 +1,4 @@
#!/bin/sh -eu
$1 -dM -include errno.h - </dev/null | \
awk '/^#define[ \t]+E[^ _]+[ \t]+/ { print $2; }'
awk '/^#define[ \t]+E[^ _]+[ \t]+/ { print $2; }'

View File

@ -1,6 +1,6 @@
#!/bin/sh -eu
if nm -D -u "$1" | grep ' U '; then
echo "Undefined symbols detected!"
exit 1
echo "Undefined symbols detected!"
exit 1
fi

View File

@ -1,12 +1,14 @@
BEGIN{
keywords=0 ; FS="," ;
print "extern const char load_fragment_gperf_nulstr[];" ;
print "const char load_fragment_gperf_nulstr[] ="
keywords=0 ; FS="," ;
print "extern const char load_fragment_gperf_nulstr[];" ;
print "const char load_fragment_gperf_nulstr[] ="
}
keyword==1 {
print "\"" $$1 "\\0\""
print "\"" $$1 "\\0\""
}
/%%/ {
keyword=1
keyword=1
}
END {
print ";"
}
END { print ";" }

View File

@ -1,5 +1,9 @@
BEGIN{ print "const char *audit_type_to_string(int type) {\n\tswitch(type) {" }
BEGIN{
print "const char *audit_type_to_string(int type) {\n\tswitch(type) {"
}
{
printf " case AUDIT_%s: return \"%s\";\n", $1, $1
}
END{ print " default: return NULL;\n\t}\n}\n" }
END{
print " default: return NULL;\n\t}\n}\n"
}

View File

@ -5,10 +5,10 @@ shift
includes=""
for i in "$@"; do
includes="$includes -include $i"
includes="$includes -include $i"
done
$cpp -dM $includes - </dev/null | \
grep -vE 'AUDIT_.*(FIRST|LAST)_' | \
sed -r -n 's/^#define\s+AUDIT_(\w+)\s+([0-9]{4})\s*$$/\1\t\2/p' | \
sort -k2
grep -vE 'AUDIT_.*(FIRST|LAST)_' | \
sed -r -n 's/^#define\s+AUDIT_(\w+)\s+([0-9]{4})\s*$$/\1\t\2/p' | \
sort -k2

View File

@ -1,7 +1,11 @@
BEGIN{ print "const char *dns_type_to_string(int type) {\n\tswitch(type) {" }
{
printf " case DNS_TYPE_%s: return ", $1;
sub(/_/, "-");
printf "\"%s\";\n", $1
BEGIN{
print "const char *dns_type_to_string(int type) {\n\tswitch(type) {"
}
{
printf " case DNS_TYPE_%s: return ", $1;
sub(/_/, "-");
printf "\"%s\";\n", $1
}
END{
print " default: return NULL;\n\t}\n}\n"
}
END{ print " default: return NULL;\n\t}\n}\n" }

View File

@ -1,11 +1,11 @@
BEGIN {
print "/* GENERATED FILE */";
print "#define ORDERED"
print "/* GENERATED FILE */";
print "#define ORDERED"
}
{
if (!match($0, "^#include"))
gsub(/hashmap/, "ordered_hashmap");
gsub(/HASHMAP/, "ORDERED_HASHMAP");
gsub(/Hashmap/, "OrderedHashmap");
print
if (!match($0, "^#include"))
gsub(/hashmap/, "ordered_hashmap");
gsub(/HASHMAP/, "ORDERED_HASHMAP");
gsub(/Hashmap/, "OrderedHashmap");
print
}

View File

@ -1,4 +1,4 @@
#!/bin/sh -eu
$1 -dM -include linux/input.h - </dev/null | \
awk '/^#define[ \t]+KEY_[^ ]+[ \t]+[0-9K]/ { if ($2 != "KEY_MAX") { print $2 } }'
awk '/^#define[ \t]+KEY_[^ ]+[ \t]+[0-9K]/ { if ($2 != "KEY_MAX") { print $2 } }'

View File

@ -5,7 +5,7 @@ systemd_efi="$2"
boot_stub="$3"
splash_bmp="$4"
if [ -z "$out" -o -z "$systemd_efi" -o -z "$boot_stub" -o -z "$splash_bmp" ]; then
exit 1
exit 1
fi
# create GPT table with EFI System Partition
@ -27,12 +27,12 @@ cp "$systemd_efi" mnt/EFI/BOOT/BOOTX64.efi
mkdir mnt/EFI/Linux
echo -n "foo=yes bar=no root=/dev/fakeroot debug rd.break=initqueue" >mnt/cmdline.txt
objcopy \
--add-section .osrel=/etc/os-release --change-section-vma .osrel=0x20000 \
--add-section .cmdline=mnt/cmdline.txt --change-section-vma .cmdline=0x30000 \
--add-section .splash="$splash_bmp" --change-section-vma .splash=0x40000 \
--add-section .linux=/boot/$(cat /etc/machine-id)/$(uname -r)/linux --change-section-vma .linux=0x2000000 \
--add-section .initrd=/boot/$(cat /etc/machine-id)/$(uname -r)/initrd --change-section-vma .initrd=0x3000000 \
"$boot_stub" mnt/EFI/Linux/linux-test.efi
--add-section .osrel=/etc/os-release --change-section-vma .osrel=0x20000 \
--add-section .cmdline=mnt/cmdline.txt --change-section-vma .cmdline=0x30000 \
--add-section .splash="$splash_bmp" --change-section-vma .splash=0x40000 \
--add-section .linux=/boot/$(cat /etc/machine-id)/$(uname -r)/linux --change-section-vma .linux=0x2000000 \
--add-section .initrd=/boot/$(cat /etc/machine-id)/$(uname -r)/initrd --change-section-vma .initrd=0x3000000 \
"$boot_stub" mnt/EFI/Linux/linux-test.efi
# install entries
mkdir -p mnt/loader/entries

View File

@ -2,19 +2,19 @@
# output width
if "$1" --help | grep -v 'default:' | grep -E -q '.{80}.'; then
echo "$(basename "$1") --help output is too wide:"
"$1" --help | awk 'length > 80' | grep -E --color=yes '.{80}'
exit 1
echo "$(basename "$1") --help output is too wide:"
"$1" --help | awk 'length > 80' | grep -E --color=yes '.{80}'
exit 1
fi
# no --help output to stdout
if "$1" --help 2>&1 1>/dev/null | grep .; then
echo "$(basename "$1") --help prints to stderr"
exit 2
echo "$(basename "$1") --help prints to stderr"
exit 2
fi
# error output to stderr
if ! "$1" --no-such-parameter 2>&1 1>/dev/null | grep -q .; then
echo "$(basename "$1") with an unknown parameter does not print to stderr"
exit 3
echo "$(basename "$1") with an unknown parameter does not print to stderr"
exit 3
fi

View File

@ -1,7 +1,7 @@
#!/bin/sh -eu
git shortlog -s `git describe --abbrev=0`.. | \
cut -c8- | \
sed 's/ / /g' | \
awk '{ print $$0 "," }' | \
sort -u
cut -c8- | \
sed 's/ / /g' | \
awk '{ print $$0 "," }' | \
sort -u

View File

@ -5,7 +5,7 @@
mkdir -vp "$(dirname "${DESTDIR:-}$2")"
if [ "$(dirname $1)" = . ]; then
ln -vfs -T "$1" "${DESTDIR:-}$2"
ln -vfs -T "$1" "${DESTDIR:-}$2"
else
ln -vfs -T --relative "${DESTDIR:-}$1" "${DESTDIR:-}$2"
ln -vfs -T --relative "${DESTDIR:-}$1" "${DESTDIR:-}$2"
fi

View File

@ -5,23 +5,23 @@ target="$2"
unit="$3"
case "$target" in
*/?*) # a path, but not just a slash at the end
dir="${DESTDIR:-}${target}"
;;
*)
dir="${DESTDIR:-}${unitdir}/${target}"
;;
*/?*) # a path, but not just a slash at the end
dir="${DESTDIR:-}${target}"
;;
*)
dir="${DESTDIR:-}${unitdir}/${target}"
;;
esac
unitpath="${DESTDIR:-}${unitdir}/${unit}"
case "$target" in
*/)
mkdir -p -m 0755 "$dir"
;;
*)
mkdir -p -m 0755 "$(basename "$dir")"
;;
*/)
mkdir -p -m 0755 "$dir"
;;
*)
mkdir -p -m 0755 "$(basename "$dir")"
;;
esac
ln -vfs --relative "$unitpath" "$dir"