mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH] ptxdist-2011.01.0 bug in make ipkg-push
@ 2011-11-29 15:59 Benoît BURNICHON
  2011-12-02 15:26 ` Michael Olbrich
  2011-12-08 15:37 ` Michael Olbrich
  0 siblings, 2 replies; 12+ messages in thread
From: Benoît BURNICHON @ 2011-11-29 15:59 UTC (permalink / raw)
  To: ptxdist

Now, ptxd_ipkg_rev_smaller does not enforce a revision to be 1.2.3-4 but
allows everything debian like.
---
 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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [ptxdist] [PATCH] ptxdist-2011.01.0 bug in make ipkg-push
  2011-11-29 15:59 [ptxdist] [PATCH] ptxdist-2011.01.0 bug in make ipkg-push 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   ` [ptxdist] [PATCH] ptxdist-2011.01.0 bug in make ipkg-push Benoît BURNICHON
  2011-12-08 15:37 ` Michael Olbrich
  1 sibling, 2 replies; 12+ messages in thread
From: Michael Olbrich @ 2011-12-02 15:26 UTC (permalink / raw)
  To: ptxdist

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [ptxdist] [PATCH] ptxd_ipkg_rev_smaller: fix compare
  2011-12-02 15:26 ` Michael Olbrich
@ 2011-12-03  4:46   ` Jon Ringle
  2011-12-05 10:35   ` [ptxdist] [PATCH] ptxdist-2011.01.0 bug in make ipkg-push Benoît BURNICHON
  1 sibling, 0 replies; 12+ messages in thread
From: Jon Ringle @ 2011-12-03  4:46 UTC (permalink / raw)
  To: ptxdist

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

Thanks to Benoît BURNICHON for porting to ptxdist

Signed-off-by: Jon Ringle <jon@ringle.org>
---
 scripts/libptxdist.sh |   63 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 63 insertions(+), 0 deletions(-)

diff --git a/scripts/libptxdist.sh b/scripts/libptxdist.sh
index 4385566..a08d0dc 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`
@@ -760,6 +803,26 @@ ptxd_ipkg_rev_smaller() {
 	[ $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.5.4


-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [ptxdist] [PATCH] ptxdist-2011.01.0 bug in make ipkg-push
  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
  1 sibling, 0 replies; 12+ messages in thread
From: Benoît BURNICHON @ 2011-12-05 10:35 UTC (permalink / raw)
  To: ptxdist

[-- 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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [ptxdist] [PATCH] ptxdist-2011.01.0 bug in make ipkg-push
  2011-11-29 15:59 [ptxdist] [PATCH] ptxdist-2011.01.0 bug in make ipkg-push Benoît BURNICHON
  2011-12-02 15:26 ` Michael Olbrich
@ 2011-12-08 15:37 ` Michael Olbrich
  2011-12-08 15:41   ` Michael Olbrich
  2011-12-08 15:45   ` Jon Ringle
  1 sibling, 2 replies; 12+ messages in thread
From: Michael Olbrich @ 2011-12-08 15:37 UTC (permalink / raw)
  To: ptxdist

Hi,

so I accidentally pushed it before I could really review it...
I had some time today and I think it's at least better than before.

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.

Well, not everything debian like, '~' is not handled correctly, right?
Maybe something like this:
------------------------------------------------------------------------
--- libptxdist.sh	2011-12-08 16:11:21.143970557 +0100
+++ libptxdist.sh	2011-12-08 16:15:00.300421956 +0100
@@ -741,13 +741,14 @@
 #
 ptxd_ipkg_rev_decimal_convert() {
 	local ver=$*
-	while echo $ver | grep -q '[^0-9.]'
+	while echo $ver | grep -q '[^0-9.~]'
 	do
-		local char=`echo -n $ver | sed 's/.*\([^0-9.]\).*/\1/'`
+		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 -r "s/\.?~/.-1/g"`
 	ver=`echo $ver | sed 's/\.\./.0/g'`
 
 	echo "$ver"
------------------------------------------------------------------------

So I've been thinking about this whole version issue. The next step would
be all versions with '-'. Maybe we should always add '-1' as packages
revision. That would solve the problem for most of the packages is the
list, you posted some time ago.
What remains are 'broken' versions. For those few we could do, e.g.:

MYSQL_VERSION		:= 5.1.14-beta
MYSQL_XPKG_VERSION	:= 5.1.14~beta

For that we would need something like the patch above.

Comments?

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

-- 
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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [ptxdist] [PATCH] ptxdist-2011.01.0 bug in make ipkg-push
  2011-12-08 15:37 ` Michael Olbrich
@ 2011-12-08 15:41   ` Michael Olbrich
  2011-12-08 15:45   ` Jon Ringle
  1 sibling, 0 replies; 12+ messages in thread
From: Michael Olbrich @ 2011-12-08 15:41 UTC (permalink / raw)
  To: ptxdist

On Thu, Dec 08, 2011 at 04:37:38PM +0100, Michael Olbrich wrote:
> Hi,
> 
> so I accidentally pushed it before I could really review it...
> I had some time today and I think it's at least better than before.
> 
> 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.
> 
> Well, not everything debian like, '~' is not handled correctly, right?
> Maybe something like this:
> ------------------------------------------------------------------------
> --- libptxdist.sh	2011-12-08 16:11:21.143970557 +0100
> +++ libptxdist.sh	2011-12-08 16:15:00.300421956 +0100
> @@ -741,13 +741,14 @@
>  #
>  ptxd_ipkg_rev_decimal_convert() {
>  	local ver=$*
> -	while echo $ver | grep -q '[^0-9.]'
> +	while echo $ver | grep -q '[^0-9.~]'
>  	do
> -		local char=`echo -n $ver | sed 's/.*\([^0-9.]\).*/\1/'`
> +		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 -r "s/\.?~/.-1/g"`

+	ver=`echo $ver | sed -r "s/\.?~/.-1./g"`

I think.

Michael

>  	ver=`echo $ver | sed 's/\.\./.0/g'`
>  
>  	echo "$ver"
> ------------------------------------------------------------------------
> 
> So I've been thinking about this whole version issue. The next step would
> be all versions with '-'. Maybe we should always add '-1' as packages
> revision. That would solve the problem for most of the packages is the
> list, you posted some time ago.
> What remains are 'broken' versions. For those few we could do, e.g.:
> 
> MYSQL_VERSION		:= 5.1.14-beta
> MYSQL_XPKG_VERSION	:= 5.1.14~beta
> 
> For that we would need something like the patch above.
> 
> Comments?
> 
> 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
> 
> -- 
> 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
> 

-- 
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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [ptxdist] [PATCH] ptxdist-2011.01.0 bug in make ipkg-push
  2011-12-08 15:37 ` Michael Olbrich
  2011-12-08 15:41   ` Michael Olbrich
@ 2011-12-08 15:45   ` Jon Ringle
  2011-12-08 15:55     ` Michael Olbrich
  1 sibling, 1 reply; 12+ messages in thread
From: Jon Ringle @ 2011-12-08 15:45 UTC (permalink / raw)
  To: ptxdist


[-- Attachment #1.1: Type: text/plain, Size: 2147 bytes --]

On Thu, Dec 8, 2011 at 10:37 AM, Michael Olbrich
<m.olbrich@pengutronix.de>wrote:

> Hi,
>
> so I accidentally pushed it before I could really review it...
> I had some time today and I think it's at least better than before.
>
> 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.
>
> Well, not everything debian like, '~' is not handled correctly, right?
> Maybe something like this:
> ------------------------------------------------------------------------
> --- libptxdist.sh       2011-12-08 16:11:21.143970557 +0100
> +++ libptxdist.sh       2011-12-08 16:15:00.300421956 +0100
> @@ -741,13 +741,14 @@
>  #
>  ptxd_ipkg_rev_decimal_convert() {
>        local ver=$*
> -       while echo $ver | grep -q '[^0-9.]'
> +       while echo $ver | grep -q '[^0-9.~]'
>        do
> -               local char=`echo -n $ver | sed 's/.*\([^0-9.]\).*/\1/'`
> +               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 -r "s/\.?~/.-1/g"`
>         ver=`echo $ver | sed 's/\.\./.0/g'`
>
>         echo "$ver"
> ------------------------------------------------------------------------
>
> So I've been thinking about this whole version issue. The next step would
> be all versions with '-'. Maybe we should always add '-1' as packages
> revision. That would solve the problem for most of the packages is the
> list, you posted some time ago.
> What remains are 'broken' versions. For those few we could do, e.g.:
>
> MYSQL_VERSION           := 5.1.14-beta
> MYSQL_XPKG_VERSION      := 5.1.14~beta
>
> Sounds like a good idea.
Seems like the pkg_XPKG_VERSION could be autogenerated based on the
pkg_VERSION so you wouldn't have to update all the package files. If there
is no '-' character in the version then pkg_XPKG_VERSION would be equal to
pkg_VERSION

Jon

[-- Attachment #1.2: Type: text/html, Size: 2745 bytes --]

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

-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [ptxdist] [PATCH] ptxdist-2011.01.0 bug in make ipkg-push
  2011-12-08 15:45   ` Jon Ringle
@ 2011-12-08 15:55     ` Michael Olbrich
  2011-12-08 17:38       ` Benoît BURNICHON
  0 siblings, 1 reply; 12+ messages in thread
From: Michael Olbrich @ 2011-12-08 15:55 UTC (permalink / raw)
  To: ptxdist

On Thu, Dec 08, 2011 at 10:45:00AM -0500, Jon Ringle wrote:
> On Thu, Dec 8, 2011 at 10:37 AM, Michael Olbrich
> <m.olbrich@pengutronix.de>wrote:
> 
> > Hi,
> >
> > so I accidentally pushed it before I could really review it...
> > I had some time today and I think it's at least better than before.
> >
> > 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.
> >
> > Well, not everything debian like, '~' is not handled correctly, right?
> > Maybe something like this:
> > ------------------------------------------------------------------------
> > --- libptxdist.sh       2011-12-08 16:11:21.143970557 +0100
> > +++ libptxdist.sh       2011-12-08 16:15:00.300421956 +0100
> > @@ -741,13 +741,14 @@
> >  #
> >  ptxd_ipkg_rev_decimal_convert() {
> >        local ver=$*
> > -       while echo $ver | grep -q '[^0-9.]'
> > +       while echo $ver | grep -q '[^0-9.~]'
> >        do
> > -               local char=`echo -n $ver | sed 's/.*\([^0-9.]\).*/\1/'`
> > +               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 -r "s/\.?~/.-1/g"`
> >         ver=`echo $ver | sed 's/\.\./.0/g'`
> >
> >         echo "$ver"
> > ------------------------------------------------------------------------
> >
> > So I've been thinking about this whole version issue. The next step would
> > be all versions with '-'. Maybe we should always add '-1' as packages
> > revision. That would solve the problem for most of the packages is the
> > list, you posted some time ago.

Or we could add '-1' if the version contains a '-'.

> > What remains are 'broken' versions. For those few we could do, e.g.:
> >
> > MYSQL_VERSION           := 5.1.14-beta
> > MYSQL_XPKG_VERSION      := 5.1.14~beta
> >
> > Sounds like a good idea.
> Seems like the pkg_XPKG_VERSION could be autogenerated based on the
> pkg_VERSION so you wouldn't have to update all the package files. If there
> is no '-' character in the version then pkg_XPKG_VERSION would be equal to
> pkg_VERSION

Yes, for most packages I want to reuse <PKG>_VERSION. <PKG>_XPKG_VERSION
should just be a way to overwrite the default if necessary.

Michael

-- 
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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [ptxdist] [PATCH] ptxdist-2011.01.0 bug in make ipkg-push
  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
  0 siblings, 2 replies; 12+ messages in thread
From: Benoît BURNICHON @ 2011-12-08 17:38 UTC (permalink / raw)
  To: ptxdist



> -----Original Message-----
> From: ptxdist-bounces@pengutronix.de [mailto:ptxdist-
> bounces@pengutronix.de] On Behalf Of Michael Olbrich
> Sent: Thursday, December 08, 2011 4:56 PM
> To: ptxdist@pengutronix.de
> Subject: Re: [ptxdist] [PATCH] ptxdist-2011.01.0 bug in make ipkg-push
>
> On Thu, Dec 08, 2011 at 10:45:00AM -0500, Jon Ringle wrote:
> > On Thu, Dec 8, 2011 at 10:37 AM, Michael Olbrich
> > <m.olbrich@pengutronix.de>wrote:
> >
> > > Hi,
> > >
> > > so I accidentally pushed it before I could really review it...
> > > I had some time today and I think it's at least better than before.
> > >
> > > 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.
> > >
> > > Well, not everything debian like, '~' is not handled correctly, right?

The possibly prepended ':' also is not taken into account.

> > > Maybe something like this:
> > > ------------------------------------------------------------------------
> > > --- libptxdist.sh       2011-12-08 16:11:21.143970557 +0100
> > > +++ libptxdist.sh       2011-12-08 16:15:00.300421956 +0100
> > > @@ -741,13 +741,14 @@
> > >  #
> > >  ptxd_ipkg_rev_decimal_convert() {
> > >        local ver=$*
> > > -       while echo $ver | grep -q '[^0-9.]'
> > > +       while echo $ver | grep -q '[^0-9.~]'
> > >        do
> > > -               local char=`echo -n $ver | sed 's/.*\([^0-9.]\).*/\1/'`
> > > +               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 -r "s/\.?~/.-1/g"`
> > >         ver=`echo $ver | sed 's/\.\./.0/g'`
> > >
> > >         echo "$ver"
> > > --------------------------------------------------------------------
> > > ----
> > >
> > > So I've been thinking about this whole version issue. The next step
> > > would be all versions with '-'. Maybe we should always add '-1' as
> > > packages revision. That would solve the problem for most of the
> > > packages is the list, you posted some time ago.
>
> Or we could add '-1' if the version contains a '-'.

Couldn't we just replace '-' by '+' in versions? There is not much difference in ASCII between the 2, only the ',' comes in between the 2.

>
> > > What remains are 'broken' versions. For those few we could do, e.g.:
> > >
> > > MYSQL_VERSION           := 5.1.14-beta
> > > MYSQL_XPKG_VERSION      := 5.1.14~beta
> > >
> > > Sounds like a good idea.
> > Seems like the pkg_XPKG_VERSION could be autogenerated based on the
> > pkg_VERSION so you wouldn't have to update all the package files. If
> > there is no '-' character in the version then pkg_XPKG_VERSION would
> > be equal to pkg_VERSION
>
> Yes, for most packages I want to reuse <PKG>_VERSION.
> <PKG>_XPKG_VERSION should just be a way to overwrite the default if
> necessary.
>
So replacements would be as follows:

CANFESTIVAL_VERSION := 3-20081204-1
MYSQL_VERSION := 5.1.14-beta
SPEEX_VERSION  := 1.2rc1

Detection of pre-versions: s/-?\(alpha|beta|gamma|rc\)/~\1/g
tr/-/+/

CANFESTIVAL_XPKG_VERSION := 3+20081204+1
MYSQL_XPKG_VERSION := 5.1.14~beta
SPEEX_XPKG_VERSION  := 1.2~rc1


________________________________

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [ptxdist] [PATCH] ptxdist-2011.01.0 bug in make ipkg-push
  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
  1 sibling, 0 replies; 12+ messages in thread
From: Michael Olbrich @ 2011-12-09 10:09 UTC (permalink / raw)
  To: ptxdist

On Thu, Dec 08, 2011 at 05:38:26PM +0000, Benoît BURNICHON wrote:
> 
> 
> > -----Original Message-----
> > From: ptxdist-bounces@pengutronix.de [mailto:ptxdist-
> > bounces@pengutronix.de] On Behalf Of Michael Olbrich
> > Sent: Thursday, December 08, 2011 4:56 PM
> > To: ptxdist@pengutronix.de
> > Subject: Re: [ptxdist] [PATCH] ptxdist-2011.01.0 bug in make ipkg-push
> >
> > On Thu, Dec 08, 2011 at 10:45:00AM -0500, Jon Ringle wrote:
> > > On Thu, Dec 8, 2011 at 10:37 AM, Michael Olbrich
> > > <m.olbrich@pengutronix.de>wrote:
> > >
> > > > Hi,
> > > >
> > > > so I accidentally pushed it before I could really review it...
> > > > I had some time today and I think it's at least better than before.
> > > >
> > > > 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.
> > > >
> > > > Well, not everything debian like, '~' is not handled correctly, right?
> 
> The possibly prepended ':' also is not taken into account.

True, but that's not realy something we care about right now. An since it's
not part of the upstream version, it should be split off in ptxd_ipkg_split
anyways, right?

Hmmm, but the current check fails for versions that do not start with a
number. ptxd_ipkg_rev_decimal_convert returns something starting with '.'.
I'm running a possible fix through a test script right now. It calls
ptxdist quite often, so it'll take a few hours....

> > > > Maybe something like this:
> > > > ------------------------------------------------------------------------
> > > > --- libptxdist.sh       2011-12-08 16:11:21.143970557 +0100
> > > > +++ libptxdist.sh       2011-12-08 16:15:00.300421956 +0100
> > > > @@ -741,13 +741,14 @@
> > > >  #
> > > >  ptxd_ipkg_rev_decimal_convert() {
> > > >        local ver=$*
> > > > -       while echo $ver | grep -q '[^0-9.]'
> > > > +       while echo $ver | grep -q '[^0-9.~]'
> > > >        do
> > > > -               local char=`echo -n $ver | sed 's/.*\([^0-9.]\).*/\1/'`
> > > > +               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 -r "s/\.?~/.-1/g"`
> > > >         ver=`echo $ver | sed 's/\.\./.0/g'`
> > > >
> > > >         echo "$ver"
> > > > --------------------------------------------------------------------
> > > > ----
> > > >
> > > > So I've been thinking about this whole version issue. The next step
> > > > would be all versions with '-'. Maybe we should always add '-1' as
> > > > packages revision. That would solve the problem for most of the
> > > > packages is the list, you posted some time ago.
> >
> > Or we could add '-1' if the version contains a '-'.
> 
> Couldn't we just replace '-' by '+' in versions? There is not much
> difference in ASCII between the 2, only the ',' comes in between the 2.

I don't really care. Any other opinions?

> >
> > > > What remains are 'broken' versions. For those few we could do, e.g.:
> > > >
> > > > MYSQL_VERSION           := 5.1.14-beta
> > > > MYSQL_XPKG_VERSION      := 5.1.14~beta
> > > >
> > > > Sounds like a good idea.
> > > Seems like the pkg_XPKG_VERSION could be autogenerated based on the
> > > pkg_VERSION so you wouldn't have to update all the package files. If
> > > there is no '-' character in the version then pkg_XPKG_VERSION would
> > > be equal to pkg_VERSION
> >
> > Yes, for most packages I want to reuse <PKG>_VERSION.
> > <PKG>_XPKG_VERSION should just be a way to overwrite the default if
> > necessary.
> >
> So replacements would be as follows:
> 
> CANFESTIVAL_VERSION := 3-20081204-1
> MYSQL_VERSION := 5.1.14-beta
> SPEEX_VERSION  := 1.2rc1
> 
> Detection of pre-versions: s/-?\(alpha|beta|gamma|rc\)/~\1/g
> tr/-/+/

And the tr/_/./ we have right now, right? (ptxd_make_xpkg_common).
I'll probably just add it there.

Michael

-- 
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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [ptxdist] [PATCH] more pkg_xpkg_version sanitizing
  2011-12-08 17:38       ` Benoît BURNICHON
  2011-12-09 10:09         ` Michael Olbrich
@ 2011-12-09 14:20         ` Michael Olbrich
  2011-12-12 16:51           ` Jon Ringle
  1 sibling, 1 reply; 12+ messages in thread
From: Michael Olbrich @ 2011-12-09 14:20 UTC (permalink / raw)
  To: ptxdist; +Cc: Michael Olbrich

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
---

Does this look right? I'm also checking for '~' before alpha etc. otherwise
it will be duplicated if it's already there.

Michael

 scripts/lib/ptxd_make_xpkg_common.sh |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/scripts/lib/ptxd_make_xpkg_common.sh b/scripts/lib/ptxd_make_xpkg_common.sh
index deccd12..e1b7013 100644
--- a/scripts/lib/ptxd_make_xpkg_common.sh
+++ b/scripts/lib/ptxd_make_xpkg_common.sh
@@ -70,9 +70,11 @@ ptxd_make_xpkg_init() {
     #
     # sanitize pkg_version
     #
+    # separate (alpha|beta|gamma|rc) with "~"
     # replace "_" by "."
+    # replace "-" by "+"
     #
-    pkg_xpkg_version="${pkg_version//_/.}"
+    pkg_xpkg_version="$(sed -r 's/[~-]?(alpha|beta|gamma|rc)/~\1/g' <<< ${pkg_version} | tr '_-' '.+')"
     if [ -z ${pkg_xpkg_version} ]; then
 	ptxd_bailout "${FUNCNAME}: please define <PKG>_VERSION"
     fi
-- 
1.7.7.3


-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [ptxdist] [PATCH] more pkg_xpkg_version sanitizing
  2011-12-09 14:20         ` [ptxdist] [PATCH] more pkg_xpkg_version sanitizing Michael Olbrich
@ 2011-12-12 16:51           ` Jon Ringle
  0 siblings, 0 replies; 12+ messages in thread
From: Jon Ringle @ 2011-12-12 16:51 UTC (permalink / raw)
  To: ptxdist; +Cc: Michael Olbrich


[-- Attachment #1.1: Type: text/plain, Size: 1156 bytes --]

On Fri, Dec 9, 2011 at 9:20 AM, Michael Olbrich <m.olbrich@pengutronix.de>wrote:

> Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
> ---
>
> Does this look right? I'm also checking for '~' before alpha etc. otherwise
> it will be duplicated if it's already there.
>
> Michael
>
>  scripts/lib/ptxd_make_xpkg_common.sh |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/scripts/lib/ptxd_make_xpkg_common.sh
> b/scripts/lib/ptxd_make_xpkg_common.sh
> index deccd12..e1b7013 100644
> --- a/scripts/lib/ptxd_make_xpkg_common.sh
> +++ b/scripts/lib/ptxd_make_xpkg_common.sh
> @@ -70,9 +70,11 @@ ptxd_make_xpkg_init() {
>     #
>     # sanitize pkg_version
>     #
> +    # separate (alpha|beta|gamma|rc) with "~"
>     # replace "_" by "."
> +    # replace "-" by "+"
>     #
> -    pkg_xpkg_version="${pkg_version//_/.}"
> +    pkg_xpkg_version="$(sed -r 's/[~-]?(alpha|beta|gamma|rc)/~\1/g' <<<
> ${pkg_version} | tr '_-' '.+')"
>     if [ -z ${pkg_xpkg_version} ]; then
>        ptxd_bailout "${FUNCNAME}: please define <PKG>_VERSION"
>     fi
>

I tested this with the dialog package and it worked as expected.

Jon

[-- Attachment #1.2: Type: text/html, Size: 1707 bytes --]

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

-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2011-12-12 16:51 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-29 15:59 [ptxdist] [PATCH] ptxdist-2011.01.0 bug in make ipkg-push 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   ` [ptxdist] [PATCH] ptxdist-2011.01.0 bug in make ipkg-push Benoît BURNICHON
2011-12-08 15:37 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox