From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail-vx0-f172.google.com ([209.85.220.172]) by metis.ext.pengutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1RG5L6-0004ps-Qk for ptxdist@pengutronix.de; Tue, 18 Oct 2011 10:48:02 +0200 Received: by vcbfo1 with SMTP id fo1so351576vcb.31 for ; Tue, 18 Oct 2011 01:47:54 -0700 (PDT) From: Jon Ringle Date: Tue, 18 Oct 2011 04:48:44 -0400 Message-Id: <1318927724-11103-1-git-send-email-jon@ringle.org> Subject: [ptxdist] [PATCH] ptxd_ipkg_rev_smaller: fix compare using dpkg --compare-versions Reply-To: ptxdist@pengutronix.de List-Id: PTXdist Development Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: ptxdist-bounces@pengutronix.de Errors-To: ptxdist-bounces@pengutronix.de To: ptxdist@pengutronix.de ptxd_ipkg_rev_smaller will return the wrong value if the version number does not include a $micro component. For example: pkgd_ipkg_rev_smaller foo_1.0-2_armel.ipk foo_1.0-1_armel.ipk will incorrectly return 0 pkgd_ipkg_rev_smaller will also fail if version components has non-numeric characters. Signed-off-by: Jon Ringle --- scripts/libptxdist.sh | 25 +------------------------ 1 files changed, 1 insertions(+), 24 deletions(-) diff --git a/scripts/libptxdist.sh b/scripts/libptxdist.sh index 48dbd64..d26171f 100644 --- a/scripts/libptxdist.sh +++ b/scripts/libptxdist.sh @@ -740,28 +740,5 @@ ptxd_ipkg_arch() { # # ptxd_ipkg_rev_smaller() { - - local first=`ptxd_ipkg_split $1` - local first_rev_upstream=`ptxd_ipkg_rev_upstream $first` - local first_rev_packet=`ptxd_ipkg_rev_package $first` - local second=`ptxd_ipkg_split $2` - local second_rev_upstream=`ptxd_ipkg_rev_upstream $second` - local second_rev_packet=`ptxd_ipkg_rev_package $second` - local first_major=`echo $first_rev_upstream | awk -F. '{print $1}'` - local first_minor=`echo $first_rev_upstream | awk -F. '{print $2}'` - local first_micro=`echo $first_rev_upstream | awk -F. '{print $3}'` - local second_major=`echo $second_rev_upstream | awk -F. '{print $1}'` - local second_minor=`echo $second_rev_upstream | awk -F. '{print $2}'` - local second_micro=`echo $second_rev_upstream | awk -F. '{print $3}'` - - [ $first_major -lt $second_major ] && return 0 - [ $first_major -gt $second_major ] && return 1 - [ $first_minor -lt $second_minor ] && return 0 - [ $first_minor -gt $second_minor ] && return 1 - [ $first_micro -lt $second_micro ] && return 0 - [ $first_micro -gt $second_micro ] && return 1 - [ $first_rev_packet -lt $second_rev_packet ] && return 0 - [ $first_rev_packet -gt $second_rev_packet ] && return 1 - - ptxd_error "packets $1 and $2 have the same revision" + dpkg --compare-versions $1 lt $2 } -- 1.7.0.4 -- ptxdist mailing list ptxdist@pengutronix.de