From: Francesco R <vivo@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Subject: Re: [gentoo-dev] Re: RFC: qt.eclass
Date: Fri, 01 Jul 2005 15:17:43 +0200 [thread overview]
Message-ID: <42C54277.70400@gentoo.org> (raw)
In-Reply-To: <200507011115.18488.pauldv@gentoo.org>
Paul de Vrieze wrote:
>On Thursday 30 June 2005 23:11, Dan Armak wrote:
>
>
>>Instead of 'exit 1', qt_min_version should use die. I use that in
>>deprange and it does work inside $DEPEND.
>>
>>
>
>Wouldn't this be a good time to implement actual dependency ranges in
>portage. Btw. I normally use the following hack that portage might
>actually be made to understand:
>
>DEPEND="<x11-libs/qt-4.0 !<x11-libs/qt-3.2.1"
>
>Paul
>
>
>
Hum ranges ? This remember me something ... ahh yes I've written a pair
of function to apply patches only for ranges of versions, pure bash
inheriting versionator.eclass .
Here they are:
# this function use "version_compare" to check if a version number
# fall inside a range.
# the range may include or not the extremes, a square bracket mean
# that the extreme is included, a round one mean that the extreme
# fall outside the range.
# examples:
# with $PVR=3 these ones evaluates as _true_:
# [2,4] [3,4] [2,3] [,4] [2,]
# (2,4)
# (,4) (2,) [3,3] [3,4) (2,3]
# with $PVR=3 these ones evaluates as _false_:
# [8,9]
# (3,4) (2,3) (8,9)
# (3,3)
check_version_range() {
local range_s="${1}"
local have_s="${2:-${PVR}}"
[[ -z "$range_s" ]] && return 1
local bound kind vc
bound=${range_s%%,*}
bound=${bound:1}
bound=${bound:-0}
local kind=${range_s:0:1}
case "$kind" in
'[') kind=2;;
'(') kind=1;;
*) die "check_version_range left kind error: \"${range_s}\""
return 50;;
esac
version_compare "${bound}" "${have_s}"
[[ $? -gt $kind ]] && return 2
local bound=${range_s##*,}
bound=${bound:0:$(( ${#bound} -1 ))}
bound=${bound:-99999}
local kind=${range_s:$(( ${#range_s} -1 ))}
case "$kind" in
']') kind=2;;
')') kind=3;;
*) die "check_version_range right kind error: \"${range_s}\""
return 50;;
esac
#'
version_compare "${bound}" "${have_s}"
vt=$?
[[ $vt -lt $kind ]] && return 3
return 0
}
# Find all the applicable patch files in a directory and move them in
# EPATCH_SOURCE (yes EPATCH_SOURCE here is a /destination/)
# two optional arguments are accepted:
# 1) directory where find the candidate patches (default to $FILESDIR)
# 2) version on which check applicable patches (default to $PVR)
# the file examined must have one or more line starting with the string
# "###MY_VER_RANGE" and followed from one or two version numbers (VN).
# For every of the so formatted lines the function will check if our
# version is greatest or equal to the first VN and less than the second
# VN (defaulted to infinite if empty)
# example:
###MY_VER_RANGE 4.0 4.0.16
###MY_VER_RANGE 4.1 4.1.4
###MY_VER_RANGE 5.0
# if a patch contains these three lines then:
# all version >= 4.0 but < 4.0.16,
# all version >= 4.1 but < 4.0.16,
# all version >= 5.0 will be affected by this patch
#
# bug uses version_compare declared experimental
# <vivo@g.o> (2005-05-18)
copy_applicable_patches() {
local filesdir="${1:-${FILESDIR}}"
local have_s="${2:-${PVR}}"
[[ -d "${EPATCH_SOURCE}" ]] || die "\$EPATCH_SOURCE must be a directory"
[[ -d "${filesdir}" ]] || die 'sourcedir must be a directory'
local filecandidates=""
filecandidates="$( ls ${filesdir}/*.${EPATCH_SUFFIX} 2>/dev/null )"
if [[ -z $filecandidates ]] ; then
einfo "No candidate patches found (lucky version?)"
return 0
fi
local ver_ranges use_flags
local has_ver=1 has_use=1
local apply=1
local filelist=""
for x in ${filecandidates} ; do
# Gater data
ver_ranges=$( head -n50 "${x}" | sed '/^###MY_VER_RANGE/'\!'d; s///;q' )
use_flags=$( head -n50 "${x}" | sed '/^###MY_USE_FLAG/'\!'d; s///;q' )
if [[ -n "${ver_ranges}" || -n "${use_flags}" ]] ; then
if [[ -z "${ver_ranges}" ]] ; then
has_ver=0
else
has_ver=1
for y in ${ver_ranges} ; do
if check_version_range "${y}" "${have_s}" ; then
has_ver=0
continue
fi
done
fi
if [[ -z "${use_flags}" ]] ; then
has_use=0
else
has_use=1
for y in ${use_flags} ; do
if [[ "${y:0:1}" == "-" ]] ; then
if ! useq "${y:1}" ; then
has_use=0
continue
fi
else
if useq "${y}" ; then
has_use=0
continue
fi
fi
done
fi
if [[ $has_ver -eq 0 && $has_use -eq 0 ]] ; then
filelist="${filelist} ${x}"
einfo "adding $(basename ${x}) ${ver_ranges} ${use_flags}"
else
einfo "skipping $(basename ${x}) ${ver_ranges} ${use_flags}"
fi
fi
done
filelist="${filelist:1}"
[[ -n "$filelist" ]] && cp $filelist "${EPATCH_SOURCE}"
}
--
gentoo-dev@gentoo.org mailing list
next prev parent reply other threads:[~2005-07-01 13:20 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-30 17:54 [gentoo-dev] RFC: qt.eclass Caleb Tennis
2005-06-30 18:58 ` Donnie Berkholz
2005-06-30 19:15 ` Mike Frysinger
2005-06-30 19:35 ` Caleb Tennis
2005-06-30 19:33 ` Caleb Tennis
2005-06-30 19:37 ` [gentoo-dev] " Michael Sterrett -Mr. Bones.-
2005-06-30 20:06 ` Dan Armak
2005-06-30 20:36 ` Aron Griffis
2005-06-30 20:42 ` Caleb Tennis
2005-06-30 21:05 ` Mike Frysinger
2005-06-30 21:11 ` Dan Armak
2005-06-30 21:38 ` Aron Griffis
2005-06-30 22:12 ` Thomas de Grenier de Latour
2005-07-01 7:42 ` Dan Armak
2005-07-01 13:56 ` Aron Griffis
2005-07-01 14:45 ` Dan Armak
2005-07-01 15:03 ` Thomas de Grenier de Latour
2005-07-01 15:14 ` Jonathan Smith
2005-07-01 15:33 ` Dan Armak
2005-07-02 11:43 ` foser
2005-07-02 12:52 ` Dan Armak
2005-07-02 13:15 ` Thomas de Grenier de Latour
2005-07-04 1:08 ` Brian D. Harring
2005-07-01 20:19 ` Paul de Vrieze
2005-07-01 21:00 ` Dan Armak
2005-07-02 7:17 ` Marius Mauch
2005-07-02 21:02 ` Paul de Vrieze
2005-07-01 15:34 ` Dan Armak
2005-07-02 2:50 ` Aron Griffis
2005-07-01 14:48 ` Caleb Tennis
2005-07-02 2:56 ` Aron Griffis
2005-07-01 9:15 ` Paul de Vrieze
2005-07-01 12:28 ` Dan Armak
2005-07-01 12:33 ` Paul de Vrieze
2005-07-01 13:17 ` Francesco R [this message]
2005-07-01 13:31 ` Francesco R
2005-07-02 11:48 ` foser
2005-06-30 20:08 ` Caleb Tennis
2005-06-30 20:01 ` [gentoo-dev] " Thomas de Grenier de Latour
2005-06-30 20:07 ` Thomas de Grenier de Latour
2005-06-30 20:09 ` Caleb Tennis
2005-06-30 21:12 ` Olivier Crete
2005-07-01 8:55 ` Chris Bainbridge
2005-07-01 12:29 ` Dan Armak
2005-07-01 12:35 ` Caleb Tennis
2005-07-01 15:35 ` Alec Joseph Warner
2005-07-01 15:55 ` Caleb Tennis
2005-07-01 9:18 ` Paul de Vrieze
2005-07-02 19:41 ` Gregorio Guidi
2005-07-02 20:09 ` Dan Armak
2005-07-02 20:30 ` Gregorio Guidi
2005-07-02 20:54 ` Caleb Tennis
2005-07-04 10:51 ` Gregorio Guidi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=42C54277.70400@gentoo.org \
--to=vivo@gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox