diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-09-10 19:15:49 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-09-10 19:15:49 -0400 |
commit | 151b9b1d3524b565e7d3a7fa43b86e6bf66ac0e9 (patch) | |
tree | 436492f8f63543feb0ec0483bd05195d255137d0 | |
parent | 12e3360f833dbc83e995aed1ba67b74fc95e3ec3 (diff) |
clean up tools/
-rwxr-xr-x | tools/fixup.sh | 9 | ||||
-rwxr-xr-x | tools/notsd-find-includes (renamed from tools/find_includes) | 0 | ||||
-rwxr-xr-x | tools/notsd-fixup | 25 | ||||
-rwxr-xr-x | tools/notsd-fixup--includes (renamed from tools/fixup_includes) | 0 | ||||
-rwxr-xr-x | tools/notsd-move (renamed from tools/move.sh) | 37 | ||||
-rwxr-xr-x | tools/notsd-reset (renamed from tools/reset.sh) | 0 |
6 files changed, 36 insertions, 35 deletions
diff --git a/tools/fixup.sh b/tools/fixup.sh deleted file mode 100755 index 651feb6cf8..0000000000 --- a/tools/fixup.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -for lib in basic shared systemd-network systemd; do - pushd src/lib${lib}/include/${lib} - find . -type f -exec sed -ri -e "s|$lib/||" -- {} + - popd -done - -find src \( -name '*.h' -o -name '*.c' \) -type f -exec ./fixup_includes {} \; diff --git a/tools/find_includes b/tools/notsd-find-includes index 6dfb406fa3..6dfb406fa3 100755 --- a/tools/find_includes +++ b/tools/notsd-find-includes diff --git a/tools/notsd-fixup b/tools/notsd-fixup new file mode 100755 index 0000000000..feec1b8921 --- /dev/null +++ b/tools/notsd-fixup @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +fixup_makefiles() ( + find -type f -name Makefile|while read -r filename; do + sed -r -i "s|(/\.\.)*/config.mk|/$(realpath -ms --relative-to="${filename%/*}" config.mk)|" "$filename" + done +) + +fixup_includes() ( + find $(find . -type d -name include) -type d | while read -r dir; do + lib="${dir##*/}" + pushd "$dir" + find . -type f -exec sed -ri -e "s|$lib/||" -- {} + + popd + done + + find src \( -name '*.h' -o -name '*.c' \) -type f -exec "$0"--includes {} \; +) + +main() { + fixup_makefiles + fixup_includes +} + +main "$@" diff --git a/tools/fixup_includes b/tools/notsd-fixup--includes index 957733cdc0..957733cdc0 100755 --- a/tools/fixup_includes +++ b/tools/notsd-fixup--includes diff --git a/tools/move.sh b/tools/notsd-move index a0ca642d57..3a9f4b4a8c 100755 --- a/tools/move.sh +++ b/tools/notsd-move @@ -678,24 +678,7 @@ breakup_makefile() ( fi done < <(fixup_makefile <Makefile.am) rm .tmp.move.all -) - -fixup_includes() ( - find src \( -name '*.h' -o -name '*.c' \) \ - -exec grep '#include ["<]sd-' -l -- {} + | - xargs -d $'\n' sed -ri \ - -e 's|#include "(sd-[^"]*)"|#include <systemd/\1>|' \ - -e 's|#include <(sd-[^>]*)>|#include <systemd/\1>|' -) - -fixup_makefile() { - sed -r \ - -e '/^[^# ]*:/ { s|^(\s*)\S+/|\1$(outdir)/| }' \ - -e 's|^if (.*)|ifneq ($(\1),)|' \ - -e 's|--version-script=.*/([^/]+)\.sym|--version-script=$(srcdir)/\1.sym|g' -} -fixup_makefiles() ( sed -ri \ -e '/^ \$\(AM_V_at\)\$\(MKDIR_P\) \$\(dir \$@\)/d' \ -e 's/ \$\(CFLAGS\) / /g' \ @@ -706,11 +689,15 @@ fixup_makefiles() ( src/libsystemd/src/Makefile \ src/libsystemd/src/sd-journal/Makefile \ src/grp-udev/libudev-core/Makefile - find -type f -name Makefile|while read -r filename; do - sed -r -i "s|(/\.\.)*/config.mk|/$(realpath -ms --relative-to="${filename%/*}" config.mk)|" "$filename" - done ) +fixup_makefile() { + sed -r \ + -e '/^[^# ]*:/ { s|^(\s*)\S+/|\1$(outdir)/| }' \ + -e 's|^if (.*)|ifneq ($(\1),)|' \ + -e 's|--version-script=.*/([^/]+)\.sym|--version-script=$(srcdir)/\1.sym|g' +} + breakup_zshcompletion() ( sed_expr=' 1 { @@ -742,11 +729,9 @@ move() ( >&2 echo ' => move_files' move_files >&2 echo ' => breakup_makefile' - #breakup_makefile - >&2 echo ' => fixup_includes' - fixup_includes - >&2 echo ' => fixup_makefiles' - #fixup_makefiles + breakup_makefile + >&2 echo ' => ./tools/notsd-fixup' + ./tools/notsd-fixup ) main() { @@ -762,7 +747,7 @@ main() { move git add . - git commit -m './tools/move.sh' + git commit -m './tools/notsd-move' git merge -s ours notsystemd/postmove git checkout notsystemd/postmove git merge tmp/postmove diff --git a/tools/reset.sh b/tools/notsd-reset index d7141587fa..d7141587fa 100755 --- a/tools/reset.sh +++ b/tools/notsd-reset |