[arch-projects] [devtools] [PATCH 0/3] commitpkg: Version control check improvements (v2)
Reverted the changes to the "install"/"changelog" version control check as well as the patch merging both loops. Added proper quoting. Lukas Fleischer (3): commitpkg: Proper quoting in version control checks commitpkg: Avoid unnecessary use of grep(1) commitpkg: Use positive patterns in SVN checks commitpkg | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) -- 1.7.6
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> --- commitpkg | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/commitpkg b/commitpkg index 9856df1..999c35f 100755 --- a/commitpkg +++ b/commitpkg @@ -78,9 +78,9 @@ case "$repo" in esac # check if all local source files are under version control -for s in ${source[@]}; do - echo $s | grep -Fvq '://' && \ - svn status $s | grep -q '^\?' && \ +for s in "${source[@]}"; do + echo "$s" | grep -Fvq '://' && \ + svn status "$s" | grep -q '^\?' && \ abort "$s is not under version control" done @@ -90,7 +90,7 @@ for i in 'changelog' 'install'; do for file in $filelist; do # evaluate any bash variables used eval file=${file} - if svn status ${file} | grep -q '^\?'; then + if svn status "${file}" | grep -q '^\?'; then abort "${file} is not under version control" fi done -- 1.7.6
Use bash patterns instead of using grep(1) to check if a source file contains the string "://". Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> --- commitpkg | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/commitpkg b/commitpkg index 999c35f..07c28d4 100755 --- a/commitpkg +++ b/commitpkg @@ -79,9 +79,9 @@ esac # check if all local source files are under version control for s in "${source[@]}"; do - echo "$s" | grep -Fvq '://' && \ - svn status "$s" | grep -q '^\?' && \ - abort "$s is not under version control" + if [[ $s != *://* ]] && svn status "$s" | grep -q '^\?'; then + abort "$s is not under version control" + fi done # check if changelog and install files are under version control -- 1.7.6
In addition to what we had before, this will also detect: * Non-existent files. * Files that are missing or scheduled for deletion. * Ignored files. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> --- commitpkg | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/commitpkg b/commitpkg index 07c28d4..07b0994 100755 --- a/commitpkg +++ b/commitpkg @@ -79,7 +79,7 @@ esac # check if all local source files are under version control for s in "${source[@]}"; do - if [[ $s != *://* ]] && svn status "$s" | grep -q '^\?'; then + if [[ $s != *://* ]] && ! svn status -v "$s" | grep -q '^[ AMRX~]'; then abort "$s is not under version control" fi done @@ -90,7 +90,7 @@ for i in 'changelog' 'install'; do for file in $filelist; do # evaluate any bash variables used eval file=${file} - if svn status "${file}" | grep -q '^\?'; then + if ! svn status -v "${file}" | grep -q '^[ AMRX~]'; then abort "${file} is not under version control" fi done -- 1.7.6
participants (1)
-
Lukas Fleischer