mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: "Benoît BURNICHON" <Benoit.BURNICHON@airtag.com>
To: "ptxdist@pengutronix.de" <ptxdist@pengutronix.de>
Subject: Re: [ptxdist] [PATCH] ptxdist-2011.01.0 bug in make ipkg-push
Date: Mon, 5 Dec 2011 10:35:34 +0000	[thread overview]
Message-ID: <3944866A166FC34A948C72DD5EDDCA2A1DC6F0B8@HQ0SBS01.airtag.local> (raw)
In-Reply-To: <20111202152602.GB16442@pengutronix.de>

[-- Attachment #1: Type: text/plain, Size: 7108 bytes --]

Hi Michael,

Sorry, my company mail server automatically appends the disclaimer to all my mails.

I enclosed the patch in case this was the reason you cannot apply the patch as well as taking the commit message of Jon Ringle which is more explanatory.

Cheers,

Ben

> -----Original Message-----
> From: ptxdist-bounces@pengutronix.de [mailto:ptxdist-
> bounces@pengutronix.de] On Behalf Of Michael Olbrich
> Sent: Friday, December 02, 2011 4:26 PM
> To: ptxdist@pengutronix.de
> Subject: Re: [ptxdist] [PATCH] ptxdist-2011.01.0 bug in make ipkg-push
>
> On Tue, Nov 29, 2011 at 03:59:41PM +0000, Benoît BURNICHON wrote:
> > Now, ptxd_ipkg_rev_smaller does not enforce a revision to be 1.2.3-4
> > but allows everything debian like.
>
> I cannot apply this patch. Please sent it again.
>
> Michael
>
> > ---
> >  scripts/libptxdist.sh |   76
> ++++++++++++++++++++++++++++++++++++++++--------
> >  1 files changed, 63 insertions(+), 13 deletions(-)
> >
> > diff --git a/scripts/libptxdist.sh b/scripts/libptxdist.sh index
> > 4385566..6b196cb 100644
> > --- a/scripts/libptxdist.sh
> > +++ b/scripts/libptxdist.sh
> > @@ -739,6 +739,49 @@ ptxd_ipkg_arch() {
> >
> >  #
> >  #
> > +ptxd_ipkg_rev_decimal_convert() {
> > +       local ver=$*
> > +       while echo $ver | grep -q '[^0-9.]'
> > +       do
> > +               local char=`echo -n $ver | sed 's/.*\([^0-9.]\).*/\1/'`
> > +               local char_dec=`echo -n $char | od -b | head -n 1 | awk '{print $2}'`
> > +               ver=`echo $ver | sed "s/$char/.$char_dec/g"`
> > +       done
> > +
> > +       ver=`echo $ver | sed 's/\.\./.0/g'`
> > +
> > +       echo "$ver"
> > +}
> > +
> > +#
> > +#
> > +ptxd_ipkg_do_version_check() {
> > +       local ver1=$1
> > +       local ver2=$2
> > +
> > +       [ "$ver1" == "$ver2" ] && return 10
> > +
> > +       local ver1front=`echo $ver1 | cut -d . -f 1`
> > +       local ver1back=`echo $ver1 | cut -d . -f 2-`
> > +       local ver2front=`echo $ver2 | cut -d . -f 1`
> > +       local ver2back=`echo $ver2 | cut -d . -f 2-`
> > +
> > +       if [ "$ver1front" != "$ver1" -o "$ver2front" != "$ver2" ]
> > +       then
> > +               [ "$ver1front" -lt "$ver2front" ] && return 9
> > +               [ "$ver1front" -gt "$ver2front" ] && return 11
> > +
> > +               [ "$ver1front" == "$ver1" ] || [ -z "$ver1back" ] && ver1back=0
> > +               [ "$ver2front" == "$ver2" ] || [ -z "$ver2back" ] && ver2back=0
> > +               ptxd_ipkg_do_version_check "$ver1back" "$ver2back"
> > +               return $?
> > +       else
> > +               [ "$ver1" -lt "$ver2" ] && return 9 || return 11
> > +       fi
> > +}
> > +
> > +#
> > +#
> >  ptxd_ipkg_rev_smaller() {
> >
> >         local first=`ptxd_ipkg_split $1` @@ -747,19 +790,26 @@
> > ptxd_ipkg_rev_smaller() {
> >         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
> > +
> > +       if [ "$first_rev_upstream" != "$second_rev_upstream" ]
> > +       then
> > +               local
> first_rev_upstream_decimal=`ptxd_ipkg_rev_decimal_convert
> $first_rev_upstream`
> > +               local
> second_rev_upstream_decimal=`ptxd_ipkg_rev_decimal_convert
> $second_rev_upstream`
> > +               ptxd_ipkg_do_version_check "$first_rev_upstream_decimal"
> "$second_rev_upstream_decimal"
> > +               case "$?" in
> > +                       9)
> > +                               return 0;
> > +                               ;;
> > +                       10)
> > +                               ;;
> > +                       11)
> > +                               return 1;
> > +                               ;;
> > +                       *)
> > +                               ptxd_error "issue while checking upstream revisions"
> > +               esac
> > +       fi
> > +
> >         [ $first_rev_packet -lt $second_rev_packet ] && return 0
> >         [ $first_rev_packet -gt $second_rev_packet ] && return 1
> >
> > --
> > 1.7.2.5
> >
> > ________________________________
> >
> > Ce courriel et toutes les pièces jointes sont confidentiels et peuvent être
> couverts par un privilège ou une protection légale. Il est établi à l’attention
> exclusive de ses destinataires. Toute utilisation de ce courriel non conforme à
> sa destination, toute diffusion ou toute publication, totale ou partielle, est
> interdite, sauf autorisation expresse préalable.
> > This email and any attachment are confidential and may be legally
> privileged or otherwise protected from disclosure. It is intended only for the
> stated addressee(s) and access to it by any other person(s) is unauthorized.
> Any use, dissemination or disclosure not in accordance with its purpose,
> either in whole or in part, is prohibited without our prior formal approval.
> > --
> > ptxdist mailing list
> > ptxdist@pengutronix.de
>
> --
> Pengutronix e.K.                           |                             |
> Industrial Linux Solutions                 | http://www.pengutronix.de/  |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
>
> --
> ptxdist mailing list
> ptxdist@pengutronix.de

________________________________

Ce courriel et toutes les pièces jointes sont confidentiels et peuvent être couverts par un privilège ou une protection légale. Il est établi à l’attention exclusive de ses destinataires. Toute utilisation de ce courriel non conforme à sa destination, toute diffusion ou toute publication, totale ou partielle, est interdite, sauf autorisation expresse préalable.
This email and any attachment are confidential and may be legally privileged or otherwise protected from disclosure. It is intended only for the stated addressee(s) and access to it by any other person(s) is unauthorized. Any use, dissemination or disclosure not in accordance with its purpose, either in whole or in part, is prohibited without our prior formal approval.

[-- Attachment #2: 0001-ptxd_ipkg_rev_smaller-fix-compare.patch --]
[-- Type: application/octet-stream, Size: 3592 bytes --]

From 226949efa1cb40fa313659b467efa55520206e50 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Beno=C3=AEt=20Burnichon?= <benoit.burnichon@airtag.com>
Date: Tue, 29 Nov 2011 14:59:46 +0100
Subject: [PATCH] ptxd_ipkg_rev_smaller: fix compare
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Derived from solution of the script given in the following thread:
http://list.us.dell.com/pipermail/dkms-devel/2004-July/000142.html

Porting it to ptxdist.

Signed-off-by: Benoît Burnichon <benoit.burnichon@airtag.com>
---
 scripts/libptxdist.sh |   76 ++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 63 insertions(+), 13 deletions(-)

diff --git a/scripts/libptxdist.sh b/scripts/libptxdist.sh
index 4385566..6b196cb 100644
--- a/scripts/libptxdist.sh
+++ b/scripts/libptxdist.sh
@@ -739,6 +739,49 @@ ptxd_ipkg_arch() {
 
 #
 #
+ptxd_ipkg_rev_decimal_convert() {
+	local ver=$*
+	while echo $ver | grep -q '[^0-9.]'
+	do
+		local char=`echo -n $ver | sed 's/.*\([^0-9.]\).*/\1/'`
+		local char_dec=`echo -n $char | od -b | head -n 1 | awk '{print $2}'`
+		ver=`echo $ver | sed "s/$char/.$char_dec/g"`
+	done
+
+	ver=`echo $ver | sed 's/\.\./.0/g'`
+
+	echo "$ver"
+}
+
+#
+#
+ptxd_ipkg_do_version_check() {
+	local ver1=$1
+	local ver2=$2
+
+	[ "$ver1" == "$ver2" ] && return 10
+
+	local ver1front=`echo $ver1 | cut -d . -f 1`
+	local ver1back=`echo $ver1 | cut -d . -f 2-`
+	local ver2front=`echo $ver2 | cut -d . -f 1`
+	local ver2back=`echo $ver2 | cut -d . -f 2-`
+
+	if [ "$ver1front" != "$ver1" -o "$ver2front" != "$ver2" ]
+	then
+		[ "$ver1front" -lt "$ver2front" ] && return 9
+		[ "$ver1front" -gt "$ver2front" ] && return 11
+
+		[ "$ver1front" == "$ver1" ] || [ -z "$ver1back" ] && ver1back=0
+		[ "$ver2front" == "$ver2" ] || [ -z "$ver2back" ] && ver2back=0
+		ptxd_ipkg_do_version_check "$ver1back" "$ver2back"
+		return $?
+	else
+		[ "$ver1" -lt "$ver2" ] && return 9 || return 11
+	fi
+}
+
+#
+#
 ptxd_ipkg_rev_smaller() {
 
 	local first=`ptxd_ipkg_split $1`
@@ -747,19 +790,26 @@ ptxd_ipkg_rev_smaller() {
 	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
+
+	if [ "$first_rev_upstream" != "$second_rev_upstream" ]
+	then
+		local first_rev_upstream_decimal=`ptxd_ipkg_rev_decimal_convert $first_rev_upstream`
+		local second_rev_upstream_decimal=`ptxd_ipkg_rev_decimal_convert $second_rev_upstream`
+		ptxd_ipkg_do_version_check "$first_rev_upstream_decimal" "$second_rev_upstream_decimal"
+		case "$?" in
+			9)
+				return 0;
+				;;
+			10)
+				;;
+			11)
+				return 1;
+				;;
+			*)
+				ptxd_error "issue while checking upstream revisions"
+		esac
+	fi
+
 	[ $first_rev_packet -lt $second_rev_packet ] && return 0
 	[ $first_rev_packet -gt $second_rev_packet ] && return 1
 
-- 
1.7.2.5


[-- Attachment #3: Type: text/plain, Size: 48 bytes --]

-- 
ptxdist mailing list
ptxdist@pengutronix.de

  parent reply	other threads:[~2011-12-05 10:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-29 15:59 Benoît BURNICHON
2011-12-02 15:26 ` Michael Olbrich
2011-12-03  4:46   ` [ptxdist] [PATCH] ptxd_ipkg_rev_smaller: fix compare Jon Ringle
2011-12-05 10:35   ` Benoît BURNICHON [this message]
2011-12-08 15:37 ` [ptxdist] [PATCH] ptxdist-2011.01.0 bug in make ipkg-push Michael Olbrich
2011-12-08 15:41   ` Michael Olbrich
2011-12-08 15:45   ` Jon Ringle
2011-12-08 15:55     ` Michael Olbrich
2011-12-08 17:38       ` Benoît BURNICHON
2011-12-09 10:09         ` Michael Olbrich
2011-12-09 14:20         ` [ptxdist] [PATCH] more pkg_xpkg_version sanitizing Michael Olbrich
2011-12-12 16:51           ` Jon Ringle

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=3944866A166FC34A948C72DD5EDDCA2A1DC6F0B8@HQ0SBS01.airtag.local \
    --to=benoit.burnichon@airtag.com \
    --cc=ptxdist@pengutronix.de \
    /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