minor bug fixes + major performance updates
This commit is contained in:
parent
ecc6c5fcd2
commit
1758ab6947
32
etools
32
etools
@ -4,9 +4,10 @@
|
|||||||
|
|
||||||
# NOTE: parse config, gets run when sourced
|
# NOTE: parse config, gets run when sourced
|
||||||
function etools_configure() {
|
function etools_configure() {
|
||||||
. ./config.sh
|
ETOOLS_DIR=$(dirname "${BASH_SOURCE[0]}")
|
||||||
|
. "$ETOOLS_DIR"/config.sh
|
||||||
_configure
|
_configure
|
||||||
./config.sh
|
"$ETOOLS_DIR"/config.sh
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -20,7 +21,7 @@ function etools_smart_find() {
|
|||||||
if [ ! "${2}" = "" ]; then
|
if [ ! "${2}" = "" ]; then
|
||||||
[ ! -d "${2}" ] && [ ! -d "${ETOOLS_REPO_PATH}/${2}" ] && \
|
[ ! -d "${2}" ] && [ ! -d "${ETOOLS_REPO_PATH}/${2}" ] && \
|
||||||
eerror "no valid repository name" && return 2;
|
eerror "no valid repository name" && return 2;
|
||||||
. ./helper.sh
|
. "$ETOOLS_DIR"/helper.sh
|
||||||
if [[ "${2}" == /* ]]; then
|
if [[ "${2}" == /* ]]; then
|
||||||
# rely on word splitting for all of these
|
# rely on word splitting for all of these
|
||||||
# shellcheck disable=SC2046
|
# shellcheck disable=SC2046
|
||||||
@ -30,12 +31,12 @@ function etools_smart_find() {
|
|||||||
_most_probable "$1" $(_filter $(_formatted_find "${1}" "${ETOOLS_REPO_PATH}/${2}"))
|
_most_probable "$1" $(_filter $(_formatted_find "${1}" "${ETOOLS_REPO_PATH}/${2}"))
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
. ./helper.sh
|
. "$ETOOLS_DIR"/helper.sh
|
||||||
# shellcheck disable=SC2046
|
# shellcheck disable=SC2046
|
||||||
_most_probable "$1" $(_filter $(_formatted_find "${1}" "/var/db/repos"))
|
_most_probable "$1" $(_filter $(_formatted_find "${1}" "/var/db/repos"))
|
||||||
fi
|
fi
|
||||||
# unset helper functions
|
# unset helper functions
|
||||||
./helper.sh
|
"$ETOOLS_DIR"/helper.sh
|
||||||
unset _etools_packages
|
unset _etools_packages
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,12 +54,12 @@ function etools_get_version() {
|
|||||||
return 2;
|
return 2;
|
||||||
|
|
||||||
local latest=:
|
local latest=:
|
||||||
. ./helper.sh
|
. "$ETOOLS_DIR"/helper.sh
|
||||||
[ "$ETOOLS_CHECK_LIVE" ] && if _matches_live "$1"; then
|
[ "$ETOOLS_CHECK_LIVE" ] && if _matches_live "$1"; then
|
||||||
# use ls over find for simplicity
|
# use ls over find for simplicity
|
||||||
# shellcheck disable=SC2012
|
# shellcheck disable=SC2012
|
||||||
latest="$(ls -1vr "${ETOOLS_REPO_PATH:-/var/db/repos}"/*/"$1"/*9999*.ebuild | head -1 2>/dev/null)"
|
latest="$(ls -1vr "${ETOOLS_REPO_PATH:-/var/db/repos}"/*/"$1"/*9999*.ebuild | head -1 2>/dev/null)"
|
||||||
[ -n "$latest" ] && _extract_version "$latest" && ./helper.sh && return 0;
|
[ -n "$latest" ] && _extract_version "$latest" && "$ETOOLS_DIR"/helper.sh && return 0;
|
||||||
fi
|
fi
|
||||||
if [ "$ETOOLS_CHECK_TESTING" ]; then
|
if [ "$ETOOLS_CHECK_TESTING" ]; then
|
||||||
. /etc/portage/make.conf
|
. /etc/portage/make.conf
|
||||||
@ -70,11 +71,10 @@ function etools_get_version() {
|
|||||||
if [[ "$ACCEPT_KEYWORDS" == *"~$arch"* ]] || _matches_testing "$1" "\~$arch"; then
|
if [[ "$ACCEPT_KEYWORDS" == *"~$arch"* ]] || _matches_testing "$1" "\~$arch"; then
|
||||||
latest=$(_get_latest "$1" "${2:-${package_offset[$1]:-0}}" "~$arch")
|
latest=$(_get_latest "$1" "${2:-${package_offset[$1]:-0}}" "~$arch")
|
||||||
fi
|
fi
|
||||||
[ -n "$latest" ] && _extract_version "$latest" && ./helper.sh && return 0;
|
[ -n "$latest" ] && _extract_version "$latest" && "$ETOOLS_DIR"/helper.sh && return 0;
|
||||||
fi
|
fi
|
||||||
_get_latest "$1" "${2:-${package_offset[$1]:-0}}" "$arch"
|
latest=$(_get_latest "$1" "${2:-${package_offset[$1]:-0}}" "$arch")
|
||||||
|
[ -n "$latest" ] && _extract_version "$latest" && "$ETOOLS_DIR"/helper.sh && return 0;
|
||||||
[ -n "$latest" ] && _extract_version "$latest" && ./helper.sh && return 0;
|
|
||||||
ewarn "No version found for package: $1$( (( ! ${2:-${package_offset[$1]:-0}} == 0 )) && echo " with offset $offset")"
|
ewarn "No version found for package: $1$( (( ! ${2:-${package_offset[$1]:-0}} == 0 )) && echo " with offset $offset")"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ function etools_current_version() {
|
|||||||
return 2;
|
return 2;
|
||||||
local latest=:
|
local latest=:
|
||||||
local files_content=()
|
local files_content=()
|
||||||
. ./helper.sh
|
. "$ETOOLS_DIR"/helper.sh
|
||||||
|
|
||||||
for file in /var/db/pkg/"$1"-[0-9]*/; do
|
for file in /var/db/pkg/"$1"-[0-9]*/; do
|
||||||
if [[ -d "$file" ]]; then
|
if [[ -d "$file" ]]; then
|
||||||
@ -101,10 +101,10 @@ function etools_current_version() {
|
|||||||
for package in "${files_content[@]}"; do
|
for package in "${files_content[@]}"; do
|
||||||
_extract_version "$package"
|
_extract_version "$package"
|
||||||
done
|
done
|
||||||
./helper.sh
|
"$ETOOLS_DIR"/helper.sh
|
||||||
else
|
else
|
||||||
_extract_version "${files_content[$2]}"
|
_extract_version "${files_content[$2]}"
|
||||||
./helper.sh
|
"$ETOOLS_DIR"/helper.sh
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,8 +133,8 @@ function etools_unset() {
|
|||||||
eerror;
|
eerror;
|
||||||
do
|
do
|
||||||
unset $variable
|
unset $variable
|
||||||
./helper.sh
|
"$ETOOLS_DIR"/helper.sh
|
||||||
./config.sh
|
"$ETOOLS_DIR"/config.sh
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -50,4 +50,8 @@ ETOOLS_DEBUG=false
|
|||||||
# }
|
# }
|
||||||
|
|
||||||
|
|
||||||
|
# check live/testing version for latest enabled version
|
||||||
|
ETOOLS_CHECK_LIVE=true
|
||||||
|
ETOOLS_CHECK_TESTING=true
|
||||||
|
|
||||||
# vim: filetype=sh
|
# vim: filetype=sh
|
||||||
|
|||||||
@ -200,16 +200,17 @@ function _get_latest() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
(( offset >= 0 )) && ewarn "Unused offset of: $(( offset + 1 )), from specified offset of: $2" "\n"
|
[ -z "$latest" ] && (( offset < 0 )) && ewarn "Unused offset of: $(( offset + 1 )), from specified offset of: $2" "\n"
|
||||||
echo "$latest"
|
echo "$latest"
|
||||||
}
|
}
|
||||||
|
|
||||||
function _extract_version() {
|
function _extract_version() {
|
||||||
local ebuild="$1"
|
local ebuild="$1"
|
||||||
local revision=:
|
local revision=
|
||||||
|
[[ $ebuild =~ (-r[0-9])\.ebuild$ ]] && revision="${BASH_REMATCH[1]}"
|
||||||
ebuild=${ebuild%.ebuild}
|
ebuild=${ebuild%.ebuild}
|
||||||
revision=$(echo "$ebuild" | sed -n 's/.*\(-r[0-9]\+\).*/\1/p')
|
|
||||||
ebuild=${ebuild/-r[[:digit:]]}
|
ebuild=${ebuild/-r[[:digit:]]}
|
||||||
ebuild=${ebuild##*-}
|
ebuild=${ebuild##*-}
|
||||||
echo "$ebuild$revision"
|
echo "$ebuild$revision"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user