[gparted] Fix configuration version compare issue affecting libparted from GIT (#753525)



commit bdbb6729f81162bc7814b6535beb09687b4df3c7
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Tue Aug 11 19:29:12 2015 +0100

    Fix configuration version compare issue affecting libparted from GIT (#753525)
    
    When configuring GParted build with libparted from GIT it may perform
    the version compares incorrectly and think the version of libparted is
    higher that it actually is.  Libparted uses the number of commits from
    the last git tag as the third part of the version number.
    
    For example install libparted from one commit before release 3.1, 142
    commits after release 3.0.
        $ git checkout v3.1^
        $ describe
        v3.0-142-g82327a3
        $ ./bootstrap
        $ ./configure --prefix=/tmp/parted-3.0-git
        $ make && make install
    
    Configure GParted:
        $ export CPPFLAGS=-I/tmp/parted-3.0-git/include
        $ export LDFLAGS=-L/tmp/parted-3.0-git/lib
        $ export LD_RUN_PATH=/tmp/parted-3.0-git/lib
        $ export PKG_CONFIG_PATH=/tmp/parted-3.0-git/lib/pkgconfig
        $ ./configure
        ...
        checking for libparted >= 1.7.1 (querying pkg-config)... 3.0.142-8232
        checking for 2.0 <= libparted <= 3.0 (loop table creation doesn't delete old partitions)... (cached) 
no
        checking for libparted >= 2.2 (improved pt re-read)... (cached) yes
        checking for ped_file_system_resize in -lparted... no
        checking for ped_file_system_resize in -lparted-fs-resize... yes
        checking for libparted >= 3.2 (online resize)... (cached) no
        ...
    Libparted is reported as version 3.0.142, but checking of the version
    between 2.0 and 3.0 inclusive fails.
    
    The configure script is multiplying components of the version by 100
    when adding them together.
        $ echo 3.0.142-8232 | awk -F. '{print $1 * 10000 + $2 * 100 + $3}'
        30142
    
    So it is only allowing up to 99 commits before it is equivalent to the
    second minor number increasing by one.  Increase the multiplication
    factor to 10000, allowing up to 9999 commits between releases.  An order
    of magnitude more commits than so far seen between parted releases.
    
    Bug 753525 - Configuration issues when using non-system location or
                 non-released versions of libparted

 configure.ac |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 3f949c0..bc3a450 100644
--- a/configure.ac
+++ b/configure.ac
@@ -52,13 +52,13 @@ dnl 2) Check by linking and running a program to report libparted version direct
 LIBPARTED_REQUIRED_VERSION='1.7.1'
 AC_MSG_CHECKING([for libparted >= $LIBPARTED_REQUIRED_VERSION (querying pkg-config)])
 LIBPARTED_REQUIRED_INT=`echo "$LIBPARTED_REQUIRED_VERSION" |
-       $AWK -F. '{print $1 * 10000 + $2 * 100 + $3}'`
+       $AWK -F. '{print $1 * 1000000 + $2 * 10000 + $3}'`
 dnl 1) Check using pkg-config.
 PKG_CHECK_EXISTS(
        [libparted],
        [LIBPARTED_FOUND_VERSION=`$PKG_CONFIG --modversion libparted`
         LIBPARTED_FOUND_INT=`echo "$LIBPARTED_FOUND_VERSION" |
-               $AWK -F. '{print $1 * 10000 + $2 * 100 + $3}'`
+               $AWK -F. '{print $1 * 1000000 + $2 * 10000 + $3}'`
         AC_MSG_RESULT([$LIBPARTED_FOUND_VERSION])
         test "$LIBPARTED_FOUND_INT" -ge "$LIBPARTED_REQUIRED_INT" ||
                AC_MSG_ERROR([*** libparted too old.  Require libparted >= $LIBPARTED_REQUIRED_VERSION but 
only found libparted $LIBPARTED_FOUND_VERSION.])
@@ -90,7 +90,7 @@ int main()
                dnl Run test program again to cache libparted version.
                [LIBPARTED_FOUND_VERSION=`./conftest$EXEEXT`
                 LIBPARTED_FOUND_INT=`echo "$LIBPARTED_FOUND_VERSION" |
-                       $AWK -F. '{print $1 * 10000 + $2 * 100 + $3}'`
+                       $AWK -F. '{print $1 * 1000000 + $2 * 10000 + $3}'`
                 test "$LIBPARTED_FOUND_INT" -ge "$LIBPARTED_REQUIRED_INT" ||
                        AC_MSG_ERROR([*** libparted too old.  Require libparted >= 
$LIBPARTED_REQUIRED_VERSION but only found libparted $LIBPARTED_FOUND_VERSION.])
                ],
@@ -105,9 +105,9 @@ LIBPARTED_MIN_WANTED_VERSION='2.0'
 LIBPARTED_MAX_WANTED_VERSION='3.0'
 AC_MSG_CHECKING([for $LIBPARTED_MIN_WANTED_VERSION <= libparted <= $LIBPARTED_MAX_WANTED_VERSION (loop table 
creation doesn't delete old partitions)])
 LIBPARTED_MIN_WANTED_INT=`echo "$LIBPARTED_MIN_WANTED_VERSION" |
-       $AWK -F. '{print $1 * 10000 + $2 * 100 + $3}'`
+       $AWK -F. '{print $1 * 1000000 + $2 * 10000 + $3}'`
 LIBPARTED_MAX_WANTED_INT=`echo "$LIBPARTED_MAX_WANTED_VERSION" |
-       $AWK -F. '{print $1 * 10000 + $2 * 100 + $3}'`
+       $AWK -F. '{print $1 * 1000000 + $2 * 10000 + $3}'`
 if test "$LIBPARTED_MIN_WANTED_INT" -le "$LIBPARTED_FOUND_INT" -a \
         "$LIBPARTED_FOUND_INT" -le "$LIBPARTED_MAX_WANTED_INT"; then
        need_loop_delete_old_ptns_workaround=yes
@@ -126,7 +126,7 @@ dnl (> 512 bytes).
 LIBPARTED_WANTED_VERSION='2.2'
 AC_MSG_CHECKING([for libparted >= $LIBPARTED_WANTED_VERSION (improved pt re-read)])
 LIBPARTED_WANTED_INT=`echo "$LIBPARTED_WANTED_VERSION" |
-       $AWK -F. '{print $1 * 10000 + $2 * 100 + $3}'`
+       $AWK -F. '{print $1 * 1000000 + $2 * 10000 + $3}'`
 if test "$LIBPARTED_FOUND_INT" -ge "$LIBPARTED_WANTED_INT"; then
        AC_DEFINE([USE_LIBPARTED_LARGE_SECTOR_SUPPORT], 1,
                  [Define to 1 to use libparted large sector support])
@@ -176,7 +176,7 @@ dnl Check for libparted >= 3.2 for online resize support.
 LIBPARTED_WANTED_VERSION='3.2'
 AC_MSG_CHECKING([for libparted >= $LIBPARTED_WANTED_VERSION (online resize)])
 LIBPARTED_WANTED_INT=`echo "$LIBPARTED_WANTED_VERSION" |
-       $AWK -F. '{print $1 * 10000 + $2 * 100 + $3}'`
+       $AWK -F. '{print $1 * 1000000 + $2 * 10000 + $3}'`
 if test "$LIBPARTED_FOUND_INT" -ge "$LIBPARTED_WANTED_INT"; then
        have_online_resize=yes
        AC_MSG_RESULT([(cached) yes])


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]