From c27e4a3cd0fd13bd63532bba81b0549450b68376 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Wed, 7 Jan 2015 20:58:54 +0100 Subject: rename scripts to more consistent names Signed-off-by: Jo-Philipp Wich --- diffindex.sh | 17 -------- pkgupdate-build.sh | 121 +++++++++++++++++++++++++++++++++++++++++++++++++++++ pkgupdate-count.sh | 10 +++++ pkgupdate-diff.sh | 17 ++++++++ pkgupdate-watch.sh | 28 +++++++++++++ pkgupdate.sh | 121 ----------------------------------------------------- watchcompile.sh | 28 ------------- watchresults.sh | 10 ----- 8 files changed, 176 insertions(+), 176 deletions(-) delete mode 100755 diffindex.sh create mode 100755 pkgupdate-build.sh create mode 100755 pkgupdate-count.sh create mode 100755 pkgupdate-diff.sh create mode 100755 pkgupdate-watch.sh delete mode 100755 pkgupdate.sh delete mode 100755 watchcompile.sh delete mode 100755 watchresults.sh diff --git a/diffindex.sh b/diffindex.sh deleted file mode 100755 index ce8752b..0000000 --- a/diffindex.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -. ./shared/functions.sh - -for target in $(fetch_remote_targets); do - for feed in $(fetch_remote_feeds "$target"); do - R="$CACHE_DIR/mirror/$target/packages/$feed" - L="$CACHE_DIR/repo-local/$target/packages/$feed" - - if [ -s "$L/Packages" -a -s "$R/Packages.gz" ]; then - echo -en "\nTarget $target Feed $feed\n\n" - zcat "$R/Packages.gz" > "$R/Packages" - diff -u "$R/Packages" "$L/Packages" - rm "$R/Packages" - fi - done -done | less diff --git a/pkgupdate-build.sh b/pkgupdate-build.sh new file mode 100755 index 0000000..84563c6 --- /dev/null +++ b/pkgupdate-build.sh @@ -0,0 +1,121 @@ +#!/bin/bash + +. ./shared/functions.sh + +terminate() { + local jobs="$(jobs -p)" + + echo "Terminating..." + + pkill -P $$ + exit 1 +} + +trap terminate INT TERM + +do_clean=0 +do_build=0 +do_index=0 +do_rsync=0 +do_dependants=0 +do_update=0 + +num_jobs=$(grep processor /proc/cpuinfo | wc -l) + +use_targets="" +use_packages="" +use_sources="" + +usage() { + cat <<-EOT +$0 {-a|-c|-i|-r} [-j jobs] -p package [-p package ...] + + -a + Perform all build steps (compile, rebuild, rsync) + + -c + Perform clean step in SDK. + + -b + Compile packages for all architectures. + + -i + Rebuild indexes for all architectures. + + -r + Rsync files for all architecures. + + -d + Process dependant packages as well (useful for libraries) + + -u + Update remote metadata. + + -j jobs + Use the given number of jobs when compiling packages. + Default is $num_jobs jobs. + + -p package[:feed] + Add given package to the queue. If a feed suffix is + given then prefer this feed name when installing the + package into the SDK. + + -t target + Restrict operation to given targets. + + -D + Print download URL and exit. + + -U + Print upload URL and exit. + + EOT + exit 1 +} + +while getopts ":abcirduj:p:s:t:" opt; do + case "$opt" in + a) + do_clean=1 + do_build=1 + do_index=1 + do_rsync=1 + ;; + c) do_clean=1 ;; + b) do_build=1 ;; + i) do_index=1 ;; + r) do_rsync=1 ;; + d) do_dependants=1 ;; + u) do_update=1 ;; + j) num_jobs="$OPTARG" ;; + p) use_packages="${use_packages:+$use_packages }$OPTARG" ;; + s) use_sources="${use_sources:+$use_sources }$OPTARG" ;; + t) use_targets="${use_targets:+$use_targets }$OPTARG" ;; + esac +done + +[ -z "$use_packages" ] && [ -z "$use_sources" ] && [ $do_update -lt 1 ] && usage + +if [ $do_clean -gt 0 ]; then + echo "* Purging local cache" + rm -rf "$CACHE_DIR/repo-local" +fi + +if [ $do_update -gt 0 ] || [ ! -d "$CACHE_DIR/mirror" ]; then + mkdir -p "$CACHE_DIR" + echo "* Preparing metadata" + rm -f "$CACHE_DIR/.mirrored" + rm -rf "$CACHE_DIR/repo-remote"/*/*/packages + fetch_remote_index +fi + +if [ -n "$use_sources" ]; then + for src in $use_sources; do + for pkg in $(find_source_provided_pkgs "$src"); do + echo "* Selecting package $pkg for source $src" + use_packages="${use_packages:+$use_packages }$pkg" + done + done +fi + +[ -n "$use_packages" ] && run_jobs $use_packages diff --git a/pkgupdate-count.sh b/pkgupdate-count.sh new file mode 100755 index 0000000..e65b3dc --- /dev/null +++ b/pkgupdate-count.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +watch -n 5 ' + . ./shared/functions.sh + + for target in $(fetch_remote_targets); do + echo -n "$target: " + find "$CACHE_DIR/repo-local/$target" -name "*.ipk" 2>/dev/null | wc -l + done +' diff --git a/pkgupdate-diff.sh b/pkgupdate-diff.sh new file mode 100755 index 0000000..ce8752b --- /dev/null +++ b/pkgupdate-diff.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +. ./shared/functions.sh + +for target in $(fetch_remote_targets); do + for feed in $(fetch_remote_feeds "$target"); do + R="$CACHE_DIR/mirror/$target/packages/$feed" + L="$CACHE_DIR/repo-local/$target/packages/$feed" + + if [ -s "$L/Packages" -a -s "$R/Packages.gz" ]; then + echo -en "\nTarget $target Feed $feed\n\n" + zcat "$R/Packages.gz" > "$R/Packages" + diff -u "$R/Packages" "$L/Packages" + rm "$R/Packages" + fi + done +done | less diff --git a/pkgupdate-watch.sh b/pkgupdate-watch.sh new file mode 100755 index 0000000..64a8ff9 --- /dev/null +++ b/pkgupdate-watch.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +. ./shared/functions.sh + +sdkdir="$(readlink -f $CACHE_DIR/sdk/)/" + +while true; do + out="$( + date + grep -slE "^Uid:\s+$(id -u)\s" /proc/[0-9]*/status | while read pid; do + pid="${pid#/proc/}" + pid="${pid%/status}" + + cwd="$(readlink "/proc/$pid/cwd" 2>/dev/null)" + case "$cwd" in $sdkdir*) + cmd="$(cat "/proc/$pid/cmdline" 2>/dev/null | tr '\0' ' ' | head -n 1)" + #case "$cmd" in "make -C "*) + cwd="${cwd%%/build_dir/*}" + echo "[${cwd:${#sdkdir}}] ${cmd:0:72}" + #;; esac + ;; esac + done | sort + )" + + clear + echo "$out" + sleep 2 +done diff --git a/pkgupdate.sh b/pkgupdate.sh deleted file mode 100755 index 84563c6..0000000 --- a/pkgupdate.sh +++ /dev/null @@ -1,121 +0,0 @@ -#!/bin/bash - -. ./shared/functions.sh - -terminate() { - local jobs="$(jobs -p)" - - echo "Terminating..." - - pkill -P $$ - exit 1 -} - -trap terminate INT TERM - -do_clean=0 -do_build=0 -do_index=0 -do_rsync=0 -do_dependants=0 -do_update=0 - -num_jobs=$(grep processor /proc/cpuinfo | wc -l) - -use_targets="" -use_packages="" -use_sources="" - -usage() { - cat <<-EOT -$0 {-a|-c|-i|-r} [-j jobs] -p package [-p package ...] - - -a - Perform all build steps (compile, rebuild, rsync) - - -c - Perform clean step in SDK. - - -b - Compile packages for all architectures. - - -i - Rebuild indexes for all architectures. - - -r - Rsync files for all architecures. - - -d - Process dependant packages as well (useful for libraries) - - -u - Update remote metadata. - - -j jobs - Use the given number of jobs when compiling packages. - Default is $num_jobs jobs. - - -p package[:feed] - Add given package to the queue. If a feed suffix is - given then prefer this feed name when installing the - package into the SDK. - - -t target - Restrict operation to given targets. - - -D - Print download URL and exit. - - -U - Print upload URL and exit. - - EOT - exit 1 -} - -while getopts ":abcirduj:p:s:t:" opt; do - case "$opt" in - a) - do_clean=1 - do_build=1 - do_index=1 - do_rsync=1 - ;; - c) do_clean=1 ;; - b) do_build=1 ;; - i) do_index=1 ;; - r) do_rsync=1 ;; - d) do_dependants=1 ;; - u) do_update=1 ;; - j) num_jobs="$OPTARG" ;; - p) use_packages="${use_packages:+$use_packages }$OPTARG" ;; - s) use_sources="${use_sources:+$use_sources }$OPTARG" ;; - t) use_targets="${use_targets:+$use_targets }$OPTARG" ;; - esac -done - -[ -z "$use_packages" ] && [ -z "$use_sources" ] && [ $do_update -lt 1 ] && usage - -if [ $do_clean -gt 0 ]; then - echo "* Purging local cache" - rm -rf "$CACHE_DIR/repo-local" -fi - -if [ $do_update -gt 0 ] || [ ! -d "$CACHE_DIR/mirror" ]; then - mkdir -p "$CACHE_DIR" - echo "* Preparing metadata" - rm -f "$CACHE_DIR/.mirrored" - rm -rf "$CACHE_DIR/repo-remote"/*/*/packages - fetch_remote_index -fi - -if [ -n "$use_sources" ]; then - for src in $use_sources; do - for pkg in $(find_source_provided_pkgs "$src"); do - echo "* Selecting package $pkg for source $src" - use_packages="${use_packages:+$use_packages }$pkg" - done - done -fi - -[ -n "$use_packages" ] && run_jobs $use_packages diff --git a/watchcompile.sh b/watchcompile.sh deleted file mode 100755 index 64a8ff9..0000000 --- a/watchcompile.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -. ./shared/functions.sh - -sdkdir="$(readlink -f $CACHE_DIR/sdk/)/" - -while true; do - out="$( - date - grep -slE "^Uid:\s+$(id -u)\s" /proc/[0-9]*/status | while read pid; do - pid="${pid#/proc/}" - pid="${pid%/status}" - - cwd="$(readlink "/proc/$pid/cwd" 2>/dev/null)" - case "$cwd" in $sdkdir*) - cmd="$(cat "/proc/$pid/cmdline" 2>/dev/null | tr '\0' ' ' | head -n 1)" - #case "$cmd" in "make -C "*) - cwd="${cwd%%/build_dir/*}" - echo "[${cwd:${#sdkdir}}] ${cmd:0:72}" - #;; esac - ;; esac - done | sort - )" - - clear - echo "$out" - sleep 2 -done diff --git a/watchresults.sh b/watchresults.sh deleted file mode 100755 index e65b3dc..0000000 --- a/watchresults.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -watch -n 5 ' - . ./shared/functions.sh - - for target in $(fetch_remote_targets); do - echo -n "$target: " - find "$CACHE_DIR/repo-local/$target" -name "*.ipk" 2>/dev/null | wc -l - done -' -- cgit v1.2.3