summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2013-06-02 15:12:59 -0600
committerLuke Shumaker <LukeShu@sbcglobal.net>2013-06-05 20:01:06 -0600
commit12da94c924cb29dd83c4bbf6fd50d1d1fc660312 (patch)
tree11d72d386908df40bce89265403f9ad249da0230
parent24073402dd3d4324f117f12abc3c921cc3dc3750 (diff)
use common.sh:get_full_version() universally
-rwxr-xr-xsrc/fullpkg/fullpkg-build12
-rwxr-xr-xsrc/fullpkg/fullpkg-find17
-rwxr-xr-xsrc/mips64el-tools/mipsrelease7
-rwxr-xr-xsrc/toru/toru15
-rwxr-xr-xsrc/treepkg17
5 files changed, 8 insertions, 60 deletions
diff --git a/src/fullpkg/fullpkg-build b/src/fullpkg/fullpkg-build
index cbaea91..20e8c88 100755
--- a/src/fullpkg/fullpkg-build
+++ b/src/fullpkg/fullpkg-build
@@ -25,18 +25,6 @@ list_pkgs() {
}
}
-# return : full version spec, including epoch (if necessary), pkgver, pkgrel
-# usage : get_fullver( ${epoch:-0}, $pkgver, $pkgrel )
-get_fullver() {
- if [[ $1 -eq 0 ]]; then
-# zero epoch case, don't include it in version
- echo $2-$3
- else
- echo $1:$2-$3
- fi
-
-}
-
## Check all build_dir, fails if one PKGBUILD is nonfree
check_nonfree() {
find "$build_dir" -name PKGBUILD \
diff --git a/src/fullpkg/fullpkg-find b/src/fullpkg/fullpkg-find
index dbe65df..72a6585 100755
--- a/src/fullpkg/fullpkg-find
+++ b/src/fullpkg/fullpkg-find
@@ -11,18 +11,6 @@ guess_repo() {
basename $(dirname $(pwd))
}
-# return : full version spec, including epoch (if necessary), pkgver, pkgrel
-# usage : get_fullver( ${epoch:-0}, $pkgver, $pkgrel )
-get_fullver() {
- if [[ $1 -eq 0 ]]; then
-# zero epoch case, don't include it in version
- echo $2-$3
- else
- echo $1:$2-$3
- fi
-
-}
-
copy_files() {
local copydir="$build_dir/${pkgbase:-${pkgname[0]}}"
@@ -60,7 +48,6 @@ find_deps() {
local repo="${repo:-$(guess_repo)}"
local pkgbase="${pkgbase:-${pkgname[0]}}"
- local fullver="$(get_fullver ${epoch:-0} ${pkgver} ${pkgrel})"
if ! pkgbuild-check-nonfree > /dev/null 2> /dev/null; then
if [ "$?" -eq 15 ]; then
@@ -73,7 +60,7 @@ find_deps() {
# be always considered outdated: there is no package built named kdebase.
# TODO: maybe check for the package requested in case of recursive calls,
# instead of the first one listed?
- if is_built "${pkgname[0]}" "${fullver}"; then
+ if is_built "${pkgname[0]}" "$(get_full_version "${pkgname[0]}")"; then
exit 0 # pkg is built and updated
fi
@@ -91,7 +78,7 @@ find_deps() {
fi
# current package plus a space for every level
- msg2 "%${LEVEL}s${pkgbase}-${fullver}"
+ msg2 "%${LEVEL}s${pkgbase}-$(get_full_version)"
## Check next levels
declare -i next_level=$LEVEL+1
diff --git a/src/mips64el-tools/mipsrelease b/src/mips64el-tools/mipsrelease
index 30ebb46..bd7e217 100755
--- a/src/mips64el-tools/mipsrelease
+++ b/src/mips64el-tools/mipsrelease
@@ -36,14 +36,13 @@ main() {
# Get all needed sources
source PKGBUILD
- fullver=$(get_full_version)
pkgs=()
makepkg --source -f --skippgpcheck
msg "Adding packages to [stage3]..."
for name in "${pkgname[@]}"; do
- msg2 "${name} ${fullver}"
- pkgs+=(${PKGDEST}/${name}-${fullver}-*.pkg.tar.*)
+ msg2 "${name} $(get_full_version $name)"
+ pkgs+=(${PKGDEST}/${name}-$(get_full_version $name)-*.pkg.tar.*)
done
repo-add ${PKGDEST}/stage3.db.tar.gz "${pkgs[@]}"
@@ -53,7 +52,7 @@ main() {
mkdir -p ${WORKDIR}/abs/${CARCH}/${repo} >/dev/null
pushd ${WORKDIR}/abs/${CARCH}/${repo} >/dev/null
- tar xvf $SRCPKGDEST/${pkgbase:-${pkgname[0]}}-${fullver}${SRCEXT}
+ tar xvf $SRCPKGDEST/${pkgbase:-${pkgname[0]}}-$(get_full_version)${SRCEXT}
popd >/dev/null
exit $?
diff --git a/src/toru/toru b/src/toru/toru
index 5faa2f4..9930661 100755
--- a/src/toru/toru
+++ b/src/toru/toru
@@ -35,19 +35,6 @@ read_cache() {
return $?
}
-##
-# usage : get_full_version( $epoch, $pkgver, $pkgrel )
-# return : full version spec, including epoch (if necessary), pkgver, pkgrel
-##
-get_full_version() {
- if [[ $1 -eq 0 ]]; then
- # zero epoch case, don't include it in version
- echo $2-$3
- else
- echo $1:$2-$3
- fi
-}
-
# Outputs an ordered package-fullpkgver array
print_package_array() {
echo "$@" | tr " " "\n" | sort -u
@@ -167,7 +154,7 @@ update() {
# Keep removing unneeded stuff
unset package_${_pkg} >/dev/null 2>&1 || true
# Fill the list of packages to find
- packages_in_abs+=($_pkg-$(get_full_version ${epoch:-0} $pkgver $pkgrel))
+ packages_in_abs+=($_pkg-$(get_full_version $_pkg)
package_paths+=($_pkg:$_pkgpath)
done # end pkgnames
diff --git a/src/treepkg b/src/treepkg
index 795faea..10bebcf 100755
--- a/src/treepkg
+++ b/src/treepkg
@@ -37,25 +37,13 @@ trap 'trap_exit "TERM signal caught. Exiting..."' TERM HUP QUIT
trap 'trap_exit "Aborted by user! Exiting..."' INT
trap 'trap_exit "An unknown error has occurred. Exiting..."' ERR
-# return : full version spec, including epoch (if necessary), pkgver, pkgrel
-# usage : get_fullver( ${epoch:-0}, $pkgver, $pkgrel )
-get_fullver() {
- if [ $1 -eq 0 ]; then
- # zero epoch case, don't include it in version
- echo $2-$3
- else
- echo $1:$2-$3
- fi
-
-}
-
# Add line to build order cache in CSV format
# *must* be run from the PKGBUILD path
# status;depth;pkgbase;[epoch:]pkgver-pkgrel;path;repo
# $1 status
# $2 pkgname
add_order() {
- echo "${1};${DEPTH};${2:-${pkgbase}};${fullver};${PWD};$(guess_repo "$PWD")" >> "${BUILDORDER}"
+ echo "${1};${DEPTH};${2:-${pkgbase}};$(get_full_version ${2});${PWD};$(guess_repo "$PWD")" >> "${BUILDORDER}"
${VERBOSE} && msg2 "%${DEPTH}s${2:-${pkgbase}} [${1}]" || true
}
@@ -113,7 +101,6 @@ done
# Get useful values
pkgbase="${pkgbase:-${pkgname[0]}}"
-fullver=$(get_fullver ${epoch:-0} ${pkgver} ${pkgrel})
# Get or set the work dir
BUILDDIR="${1:-$(mktemp -d /tmp/${pkgbase}-treepkg-XXXx)}"
@@ -138,7 +125,7 @@ if ! ${BUILDNOW}; then
# If this package is already built quit silently
for _pkg in "${pkgname[@]}"; do
- if is_built "${_pkg}" "${fullver}"; then
+ if is_built "${_pkg}" "$(get_full_version ${_pkg})"; then
add_order "ignore"
exit 0
fi