Compare commits

..

No commits in common. "d4306a3f7e6fb8460bfdee2d7aede16ff59b537d" and "850ca56ff74c916850cd34e5b995ecff7c9a45a0" have entirely different histories.

16 changed files with 110 additions and 117 deletions

View File

@ -27,7 +27,7 @@
# Check if we are in a git repo # Check if we are in a git repo
if ! git status >/dev/null; then if ! git status >/dev/null; then
printf "%s\n" "Not a git repo... exiting" >> /dev/stderr echo "Not a git repo... exiting"
exit 1 exit 1
fi fi
@ -46,20 +46,19 @@ fi
# This will likely exit firh error, because repoman # This will likely exit firh error, because repoman
# has to download some files (metadata.xsd) # has to download some files (metadata.xsd)
# We do that so we can truthfully test the actual latest commit # We do that so we can truthfully test the actual latest commit
printf "%s\n" \ echo ">>> Starting full test"
">>> Starting full test" \ echo "Running repoman -Idix"
"Running repoman -Idix"
repoman -Idix repoman -Idix
printf "%s\n" "Running pkgcheck scan" echo "Running pkgcheck scan"
pkgcheck scan pkgcheck scan
printf "%s\n" ">>> Starting latest commit test" echo ">>> Starting latest commit test"
test_success=true test_success=true
# Use pkgchek # Use pkgchek
printf "%s\n" "Running pkgcheck scan --commits" echo "Running pkgcheck scan --commits"
pkgcheck scan --commits || test_success=false pkgcheck scan --commits || test_success=false
# Iterate through changed files in last commit # Iterate through changed files in last commit
@ -79,9 +78,9 @@ do
if cd "${commit_dir}" if cd "${commit_dir}"
then then
printf "\n%s\n" \ echo
"Directory $(pwd):" \ echo "Directory $(pwd):"
"Running repoman -Idix" echo "Running repoman -Idix"
repoman -Idix || test_success=false repoman -Idix || test_success=false
cd - >/dev/null || return cd - >/dev/null || return
fi fi
@ -90,7 +89,7 @@ done
# If any of the QA tools fail the test will fail # If any of the QA tools fail the test will fail
if [ ${test_success} = false ] if [ ${test_success} = false ]
then then
printf "%s\n" ">>> Exiting with failure due to previous errors..." >> /dev/stderr echo ">>> Exiting with failure due to previous errors..."
exit 1 exit 1
else else
exit 0 exit 0

View File

@ -69,12 +69,8 @@ do
done done
# Output info with colors. # Output info with colors.
purple=$'\e[1;35m' echo -e "\e[1;33m${PACKAGE}\e[0m"
esc=$'\e[0m' echo -e " \e[1;35mPortage:\e[0m${PORTPACK_VERS}"
echo -e " \e[1;35mOverlay:\e[0m${OVERPACK_VERS}"
printf "%s\n" \
"${purple}${PACKAGE}${esc}" \
" ${purple}Portage:${esc}${PORTPACK_VERS}" \
" ${purple}Overlay:${esc}${OVERPACK_VERS}"
fi fi
done done

View File

@ -46,12 +46,11 @@ reset="$(tput sgr0)"
ok_msg() { ok_msg() {
printf "%s\n" "${bold}${green}* ${white}${1}${reset}" echo "${bold}${green}* ${white}${1}${reset}"
} }
err_msg() { err_msg() {
# redirect error messages to standard error stream echo "${bold}${red}* ${white}${1}${reset}"
printf "%s\n" "${bold}${red}* ${white}${1}${reset}" >> /dev/stderr
} }
usage() { usage() {
@ -104,7 +103,7 @@ do
if [ "${known_unique#*${pkg}}" = "${known_unique}" ] if [ "${known_unique#*${pkg}}" = "${known_unique}" ]
then then
nnuniq=$((nnuniq + 1)) nnuniq=$((nnuniq + 1))
printf "\n" echo
ok_msg "Package ${nnuniq} ${pkg}:" ok_msg "Package ${nnuniq} ${pkg}:"
use_eix --exact --force-color "${pkg}" use_eix --exact --force-color "${pkg}"
fi fi

View File

@ -36,5 +36,5 @@ then
su root -c "rm -fr ${cache}" || exit 1 su root -c "rm -fr ${cache}" || exit 1
fi fi
else else
printf "%s\n" "No pre-generated md5-cache found in ${cache}" >> /dev/stderr echo "No pre-generated md5-cache found in ${cache}"
fi fi

View File

@ -34,9 +34,8 @@ package="${package_directory%/}"
error_no_version() { error_no_version() {
printf "%s\n" \ echo "[ERROR]: No version given"
"[ERROR]: No version given" \ echo " Ran with option: ${1}"
" Ran with option: ${1}" >> /dev/stderr
exit 1 exit 1
} }
@ -46,11 +45,11 @@ git add .
case "${1}" case "${1}"
in in
"" ) "" )
printf "%s\n" "[DEBUG]: no additional arguments/options given" >> /dev/stderr echo "[DEBUG]: no additional arguments/options given"
repoman commit repoman commit
;; ;;
-b | --bump ) -b | --bump )
printf "%s\n" "[DEBUG]: to be: ${package}: bump to ${2}" echo "[DEBUG]: to be: ${package}: bump to ${2}"
if [ -n "${2}" ] if [ -n "${2}" ]
then then
repoman commit -m "${package}: bump to ${2}" repoman commit -m "${package}: bump to ${2}"
@ -59,7 +58,7 @@ in
fi fi
;; ;;
-d | --drop ) -d | --drop )
printf "%s\n" "[DEBUG]: to be: ${package}: drop old ${2}" echo "[DEBUG]: to be: ${package}: drop old ${2}"
if [ -n "${2}" ] if [ -n "${2}" ]
then then
repoman commit -m "${package}: drop old ${2}" repoman commit -m "${package}: drop old ${2}"
@ -68,11 +67,11 @@ in
fi fi
;; ;;
-* ) -* )
printf "%s\n" "[ERROR]: Unknown option ${1}" >> /dev/stderr echo "[ERROR]: Unknown option ${1}"
exit 1 exit 1
;; ;;
* ) * )
printf "%s\n" "[DEBUG]: to be: ${package}: ${*}" echo "[DEBUG]: to be: ${package}: ${*}"
repoman commit -m "${package}: ${*}" repoman commit -m "${package}: ${*}"
;; ;;
esac esac

View File

@ -54,7 +54,7 @@ do
# we want this to be privileged on Gentoo systems # we want this to be privileged on Gentoo systems
if [ "$(whoami)" != root ] && [ -z "${EPREFIX}" ] if [ "$(whoami)" != root ] && [ -z "${EPREFIX}" ]
then then
printf "%s\n" "Switching to the root account" echo "Switching to the root account"
su root -c "ebuild ${ebuild} clean test merge" su root -c "ebuild ${ebuild} clean test merge"
else else
ebuild "${ebuild}" clean test merge ebuild "${ebuild}" clean test merge

View File

@ -36,8 +36,9 @@ command_exists() {
if command -v "${1}" >/dev/null if command -v "${1}" >/dev/null
then then
return 0 return 0
else
return 1
fi fi
return 1
} }
if command_exists tput if command_exists tput
@ -57,7 +58,7 @@ eprefix_addpath() {
PATH=${1}:${PATH} PATH=${1}:${PATH}
export PATH export PATH
else else
printf "%s\n" "${eprefix_warn} ${1} not found" >> /dev/stderr echo "${eprefix_warn} ${1} not found"
fi fi
} }
@ -67,7 +68,7 @@ eprefix_addman() {
MANPATH=${1}:${MANPATH} MANPATH=${1}:${MANPATH}
export MANPATH export MANPATH
else else
printf "%s\n" "${eprefix_warn} ${1} not found" >> /dev/stderr echo "${eprefix_warn} ${1} not found"
fi fi
} }
@ -94,10 +95,9 @@ case ${-} in
: :
;; ;;
* ) * )
printf "%s\n" \ echo "${eprefix_bad} Error: not a login shell"
"${eprefix_bad} Error: not a login shell" \ echo "${eprefix_bad} Run: source ${0}"
"${eprefix_bad} Run: source ${0}" \ echo ">>> Exiting the shell"
">>> Exiting the shell" >> /dev/stderr
exit 1 exit 1
;; ;;
esac esac
@ -105,9 +105,8 @@ esac
# Exit if eprefix does not exist # Exit if eprefix does not exist
if [ ! -d "${EPREFIX}" ] if [ ! -d "${EPREFIX}" ]
then then
printf "%s\n" \ echo "${eprefix_bad} No ${EPREFIX} found!"
"${eprefix_bad} No ${EPREFIX} found!" \ echo ">>> Exiting the shell"
">>> Exiting the shell" >> /dev/stderr
sleep 3 sleep 3
exit 1 exit 1
fi fi
@ -179,42 +178,44 @@ FEATURES="${FEATURES} -usersandbox -sandbox"
export FEATURES export FEATURES
# Check if we are on a prefix profile # Check if we are on a prefix profile
printf "\n" echo ""
if command_exists eselect if command_exists eselect
then then
eprofile="$(eselect profile show)" eprofile="$(eselect profile show)"
if [[ "${eprofile}" == *prefix* ]] if [[ "${eprofile}" == *prefix* ]]
then then
printf "%s\n" "${eprefix_good} ${eprofile}" echo "${eprefix_good} ${eprofile}"
else else
printf "%s\n" "${eprefix_bad} You are not on a prefix profile" >> /dev/stderr echo "${eprefix_bad} You are not on a prefix profile"
fi fi
unset eprofile unset eprofile
else else
printf "%s\n" "${eprefix_bad} Could not determine running profile" >> /dev/stderr echo "${eprefix_bad} Could not determine running profile"
fi fi
# >>> Finish # >>> Finish
printf "\n%s\n" \ echo ""
">>> Sourced the eprefix script\n" \ echo ">>> Sourced the eprefix script"
"${eprefix_good} Prefix: ${EPREFIX}" \ echo ""
"${eprefix_good} Packages: $(eprefix_packages)" \ echo "${eprefix_good} Prefix: ${EPREFIX}"
"${eprefix_good} In World: $(eprefix_world)" \ echo "${eprefix_good} Packages: $(eprefix_packages)"
"${eprefix_good} Have fun! ;-)" echo "${eprefix_good} In World: $(eprefix_world)"
echo "${eprefix_good} Have fun! ;-)"
if command_exists emerge if command_exists emerge
then then
printf "\n%s\n" ">>> Environment ready" echo ""
echo ">>> Environment ready"
else else
printf "\n%s\n" \ echo ""
"${eprefix_bad} Could not locate emerge" \ echo "${eprefix_bad} Could not locate emerge"
"${eprefix_bad} Environment may be broken" \ echo "${eprefix_bad} Environment may be broken"
">>> Continuing anyway..." >> /dev/stderr echo ">>> Continuing anyway..."
fi fi

View File

@ -31,10 +31,9 @@ export PATH
if [ -z "${1}" ] if [ -z "${1}" ]
then then
printf "%s\n" \ echo "No overlay names given"
"No overlay names given" \ echo "Please give at least one overlay name as a commandline argument"
"Please give at least one overlay name as a commandline argument" \ echo "Exiting"
"Exiting" >> /dev/stderr
exit 1 exit 1
fi fi
@ -44,5 +43,5 @@ do
do do
euscan --nocolor --quiet "${ebuild}" | tee -a "euscan-${overlay}.log" euscan --nocolor --quiet "${ebuild}" | tee -a "euscan-${overlay}.log"
done done
printf "%s\n" ">>> Done scanning ${overlay}" echo ">>> Done scanning ${overlay}"
done done

View File

@ -21,8 +21,8 @@
function scanning(){ function scanning(){
EUSCAN=$(euscan --nocolor --quiet "$1") EUSCAN=$(euscan --nocolor --quiet "$1")
if [ -n "$EUSCAN" ]; then if [ -n "$EUSCAN" ]; then
printf "%s\n" "=============== NOW: $(find ./* -mindepth 2 -maxdepth 2 -name ''"$1"'*.ebuild' | tail -1) ================= echo "=============== NOW: $(find ./* -mindepth 2 -maxdepth 2 -name ''"$1"'*.ebuild' | tail -1) =================
$(printf "%s\n" "$EUSCAN" | tail -1)" $(echo -e "$EUSCAN" | tail -1)"
fi fi
} }
@ -33,7 +33,7 @@ function folder(){
for FILE in */* for FILE in */*
do do
PACKAGE=$(printf "%s\n" "$FILE" | grep -Eo '[A-z0-9_-]+$') PACKAGE=$(echo "$FILE" | grep -Eo '[A-z0-9_-]+$')
PACKAGES+=("$PACKAGE") PACKAGES+=("$PACKAGE")
done done
@ -47,15 +47,14 @@ function folder(){
wait "$j" wait "$j"
done done
printf "%s\n" ">>> Done scanning $1" echo -n ">>> Done scanning $1"
} }
function nofolder(){ function nofolder(){
if [ -z "${1}" ]; then if [ -z "${1}" ]; then
printf "%s\n" \ echo "No overlay names given"
"No overlay names given" \ echo "Please give at least one overlay name as a commandline argument"
"Please give at least one overlay name as a commandline argument" \ echo "Exiting"
"Exiting" >> /dev/stderr
exit 1 exit 1
fi fi
@ -71,23 +70,23 @@ do
wait "$j" wait "$j"
done done
printf "%s\n" ">>> Done scanning ${overlay}" echo -n ">>> Done scanning ${overlay}"
done done
} }
function help(){ function help(){
printf "%s\n" \ echo "You can use:"
"You can use:" \ echo "* -r or --repo <HERE-REPO-NAME>"
"* -r or --repo <HERE-REPO-NAME>" \ echo "* -f or --folder <FOLDER-NAME>"
"* -f or --folder <FOLDER-NAME>\n" \ echo
"Example of usage" \ echo "Example of usage"
"./euscan-parallel -r src_prepare-overlay" \ echo "./euscan-parallel -r src_prepare-overlay"
"./euscan-parallel -f ~/git/src_prepare-overlay" echo "./euscan-parallel -f ~/git/src_prepare-overlay"
} }
function main(){ function main(){
[ "$(whereis eix | wc -w)" -le "1" ] && { printf "%s\n" "The eix is NOT installed" >> /dev/stderr; exit; } [ "$(whereis eix | wc -w)" -le "1" ] && { echo "The eix is NOT installed"; exit; }
[ "$(whereis euscan | wc -w)" -le "1" ] && { printf "%s\n" "The euscan is NOT installed" >> /dev/stderr; exit; } [ "$(whereis euscan | wc -w)" -le "1" ] && { echo "The euscan is NOT installed"; exit; }
case $1 in case $1 in
-h|--help) -h|--help)
help help
@ -99,7 +98,7 @@ function main(){
folder "$2" | tee -a "euscan-$(date -I).log" folder "$2" | tee -a "euscan-$(date -I).log"
;; ;;
*) *)
printf "%s\n" "No found variable" >> /dev/stderr; printf "\n"; help echo "No found variable"; echo; help
esac esac
} }

View File

@ -26,7 +26,7 @@ export PATH
emsg() { emsg() {
printf "%s\n" "$(tput bold)$(tput setaf 6)>>> $(tput setaf 4)$(date +%H:%M:%S)$(tput setaf 7) ${*} $(tput sgr0)" echo "$(tput bold)$(tput setaf 6)>>> $(tput setaf 4)$(date +%H:%M:%S)$(tput setaf 7) ${*} $(tput sgr0)"
} }
edie() { edie() {

View File

@ -74,15 +74,15 @@ main() {
ebuild="$(basename "$(pwd)")-9999.ebuild" ebuild="$(basename "$(pwd)")-9999.ebuild"
if [ ! -f "${ebuild}" ] if [ ! -f "${ebuild}" ]
then then
printf "%s\n" "${ebuild_template}" > "${ebuild}" echo "${ebuild_template}" > "${ebuild}"
else else
printf "%s\n" "Already exists: ${ebuild}" >> /dev/stderr echo "Already exists: ${ebuild}"
fi fi
if [ ! -f "metadata.xml" ] if [ ! -f "metadata.xml" ]
then then
printf "%s\n" "${metadata_template}" > "metadata.xml" echo "${metadata_template}" > "metadata.xml"
else else
printf "%s\n" "Already exists: metadata.xml" >> /dev/stderr echo "Already exists: metadata.xml"
fi fi
} }
@ -91,11 +91,10 @@ if [ -f ../../profiles/repo_name ]
then then
main main
else else
printf "%s\n" \ echo "Are you in a overlay repo?"
"Are you in a overlay repo?" \ echo "To use this script successfully:"
"To use this script successfully:" \ echo "1. Create a \${CATEGOTY}/\${PN} directory"
"1. Create a \${CATEGOTY}/\${PN} directory" \ echo "2. Change directory to it"
"2. Change directory to it" \ echo "3. Execute ${0}"
"3. Execute ${0}" >> /dev/stderr
exit 1 exit 1
fi fi

2
src/pn
View File

@ -26,4 +26,4 @@ trap 'exit 128' INT
cd "${1:-$(pwd)}" || exit 1 cd "${1:-$(pwd)}" || exit 1
path="$(git rev-parse --show-prefix)" path="$(git rev-parse --show-prefix)"
printf "%s\n" "${path%/}" echo "${path%/}"

View File

@ -24,7 +24,7 @@
if [ -z "$1" ]; then if [ -z "$1" ]; then
printf "%s\n" "Must specify a file to modify..." echo "Must specify a file to modify..."
exit 1 exit 1
fi fi
regex='^=?(\S+)(?:-[[:digit:]]+\S*)(\s)(\S+)$' regex='^=?(\S+)(?:-[[:digit:]]+\S*)(\s)(\S+)$'

View File

@ -36,13 +36,12 @@ main() {
case ${1} case ${1}
in in
-h | -help | --help ) -h | -help | --help )
printf "%s\n" \ echo "Usage: ${0}"
"Usage: ${0}" \ echo "Performed in this script:"
"Performed in this script:" \ echo "1. remove Manifest file"
"1. remove Manifest file" \ echo "2. regen Manifest with 'repoman manifest'"
"2. regen Manifest with 'repoman manifest'" \ echo "3. Check with 'repoman -Idx full'"
"3. Check with 'repoman -Idx full'" \ echo "4. Check with 'pkgcheck scan'"
"4. Check with 'pkgcheck scan'"
;; ;;
* ) * )
main main

View File

@ -48,13 +48,12 @@ ignored_dirs=(
# This will likely exit firh error, because repoman # This will likely exit firh error, because repoman
# has to download some files (metadata.xsd) # has to download some files (metadata.xsd)
# We do that so we can truthfully test the actual latest commit # We do that so we can truthfully test the actual latest commit
printf "%s\n" \ echo ">>> Starting full test"
">>> Starting full test" \ echo "Running repoman -Idix"
"Running repoman -Idix"
repoman -Idix repoman -Idix
printf "%s\n" ">>> Starting latest commit test" echo ">>> Starting latest commit test"
# If any of the QA checks fail the test will fail # If any of the QA checks fail the test will fail
test_success=true test_success=true
@ -71,16 +70,17 @@ do
do do
if [[ "${commit_dir}" = *"${i_dir}"* ]] if [[ "${commit_dir}" = *"${i_dir}"* ]]
then then
printf "\n%s\n" "Ignoring ${commit_dir}" echo
echo "Ignoring ${commit_dir}"
continue 2 continue 2
fi fi
done done
if cd "${commit_dir}" if cd "${commit_dir}"
then then
printf "\n%s\n" \ echo
"Checking ${commit_dir}" \ echo "Checking ${commit_dir}"
"Running repoman -Idix" echo "Running repoman -Idix"
repoman -Idix || test_success="false" repoman -Idix || test_success="false"
cd - >/dev/null || return cd - >/dev/null || return
fi fi
@ -88,9 +88,9 @@ done
if [ "${test_success}" = "false" ] if [ "${test_success}" = "false" ]
then then
printf "%s\n" ">>> Exiting with failure due to previous errors" >> /dev/stderr echo ">>> Exiting with failure due to previous errors"
exit 1 exit 1
else else
printf "%s\n" ">>> Exiting successfully" echo ">>> Exiting successfully"
exit 0 exit 0
fi fi

15
test.sh
View File

@ -30,15 +30,16 @@ exit_result=0
run_test() { run_test() {
for file in ${2} for file in ${2}
do do
printf "%s\n" "File ${file}... checking" echo "File ${file}... checking"
if command "${1}" "${file}" if command "${1}" "${file}"
then then
printf "%s\n" " file is correct" echo " file is correct"
else else
printf "%s\n" " there were errors found in the file" >> /dev/stderr echo " there were errors found in the file"
exit_result=1 exit_result=1
fi fi
printf "%s\n\n" "Done: ${file}" echo "Done: ${file}"
echo
done done
} }
@ -51,9 +52,11 @@ run_test pylint "${py_files}"
if [ ${exit_result} = 0 ] if [ ${exit_result} = 0 ]
then then
printf "%s\n" "No errors reported" "Exiting successfully" echo "No errors reported"
echo "Exiting successfully"
exit ${exit_result} exit ${exit_result}
else else
printf "%s\n" "Some errors reported" "Exiting without success" >> /dev/stderr echo "Some errors reported"
echo "Exiting without success"
exit ${exit_result} exit ${exit_result}
fi fi