Patchwork [5/9] sat-solver: Fix build on uclibc

login
register
mail settings
Submitter Khem Raj
Date June 15, 2012, 6:12 a.m.
Message ID <c49e7e2915d4ade3dd67f706f12b3979a3b5c021.1339740433.git.raj.khem@gmail.com>
Download mbox | patch
Permalink /patch/29939/
State New
Headers show

Comments

Khem Raj - June 15, 2012, 6:12 a.m.
futimes is not available on uclibc so use utimes
qsort is also not as expected by sat-solver therefore
for uclibc we resort to using internal version of
qsort

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../sat-solver/sat-solver/futimes.patch            |   32 ++++++++++++++++++++
 meta/recipes-extended/sat-solver/sat-solver_git.bb |    3 ++
 2 files changed, 35 insertions(+), 0 deletions(-)
 create mode 100644 meta/recipes-extended/sat-solver/sat-solver/futimes.patch
Richard Purdie - June 15, 2012, 12:55 p.m.
On Thu, 2012-06-14 at 23:12 -0700, Khem Raj wrote:
> futimes is not available on uclibc so use utimes
> qsort is also not as expected by sat-solver therefore
> for uclibc we resort to using internal version of
> qsort
> 
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
>  .../sat-solver/sat-solver/futimes.patch            |   32 ++++++++++++++++++++
>  meta/recipes-extended/sat-solver/sat-solver_git.bb |    3 ++
>  2 files changed, 35 insertions(+), 0 deletions(-)
>  create mode 100644 meta/recipes-extended/sat-solver/sat-solver/futimes.patch
> 
> diff --git a/meta/recipes-extended/sat-solver/sat-solver/futimes.patch b/meta/recipes-extended/sat-solver/sat-solver/futimes.patch
> new file mode 100644
> index 0000000..b24d852
> --- /dev/null
> +++ b/meta/recipes-extended/sat-solver/sat-solver/futimes.patch
> @@ -0,0 +1,32 @@
> +This patch uses utimes instead of futimes for uclibc
> +since futimes is not available
> +
> +Upstream-Status: Pending
> +Signed-off-by: Khem Raj <raj.khem@gmail.com>
> +
> +Index: git/examples/solv.c
> +===================================================================
> +--- git.orig/examples/solv.c	2012-06-01 12:06:22.041552848 -0700
> ++++ git/examples/solv.c	2012-06-01 12:49:17.417677449 -0700
> +@@ -1027,7 +1027,8 @@
> +   int flags;
> + 
> +   cinfo = repo->appdata;
> +-  if (!(fp = fopen(calccachepath(repo, repoext), "r")))
> ++  const char* fname = calccachepath(repo, repoext);
> ++  if (!(fp = fopen(fname, "r")))
> +     return 0;
> +   if (fseek(fp, -sizeof(mycookie), SEEK_END) || fread(mycookie, sizeof(mycookie), 1, fp) != 1)
> +     {
> +@@ -1068,7 +1069,11 @@
> +       memcpy(cinfo->extcookie, myextcookie, sizeof(myextcookie));
> +     }
> +   if (mark)
> ++#ifdef __UCLIBC__
> ++    utimes(fname, 0);	/* try to set modification time */
> ++#else
> +     futimes(fileno(fp), 0);	/* try to set modification time */
> ++#endif
> +   fclose(fp);
> +   return 1;
> + }
> diff --git a/meta/recipes-extended/sat-solver/sat-solver_git.bb b/meta/recipes-extended/sat-solver/sat-solver_git.bb
> index b0382f6..b0daa6a 100644
> --- a/meta/recipes-extended/sat-solver/sat-solver_git.bb
> +++ b/meta/recipes-extended/sat-solver/sat-solver_git.bb
> @@ -20,6 +20,7 @@ SRC_URI = "git://github.com/openSUSE/sat-solver.git;protocol=git \
>             file://sat-solver_core.patch \
>             file://fix_gcc-4.6.0_compile_issue.patch \
>             file://0001-sat_xfopen.c-Forward-port-to-zlib-1.2.6-gzFile.patch \
> +           file://futimes.patch \
>            "
>  
>  S = "${WORKDIR}/git"
> @@ -28,6 +29,8 @@ EXTRA_OECMAKE += "-DRPM5=RPM5 -DOE_CORE=OE_CORE"
>  
>  EXTRA_OECMAKE += " -DLIB=${@os.path.basename('${libdir}')}"
>  
> +TUNE_CCARGS_libc-uclibc_append = " -DUSE_OWN_QSORT=1 "
> +

I suspect you mean TUNE_CCARGS_append_libc-uclibc here?

Cheers,

Richard
Bernhard Reutner-Fischer - June 15, 2012, 1:07 p.m.
On 15 June 2012 08:12, Khem Raj <raj.khem@gmail.com> wrote:
> futimes is not available on uclibc so use utimes

futimes is non-standard, use futimens instead (or utimes as in this case).

> qsort is also not as expected by sat-solver therefore
> for uclibc we resort to using internal version of
> qsort

What does that mean, please elaborate? uClibc does have qsort{,_r}..

thanks,
Khem Raj - June 15, 2012, 2:35 p.m.
On Fri, Jun 15, 2012 at 5:55 AM, Richard Purdie
<richard.purdie@linuxfoundation.org> wrote:
> On Thu, 2012-06-14 at 23:12 -0700, Khem Raj wrote:
>> futimes is not available on uclibc so use utimes
>> qsort is also not as expected by sat-solver therefore
>> for uclibc we resort to using internal version of
>> qsort
>>
>> Signed-off-by: Khem Raj <raj.khem@gmail.com>
>> ---
>>  .../sat-solver/sat-solver/futimes.patch            |   32 ++++++++++++++++++++
>>  meta/recipes-extended/sat-solver/sat-solver_git.bb |    3 ++
>>  2 files changed, 35 insertions(+), 0 deletions(-)
>>  create mode 100644 meta/recipes-extended/sat-solver/sat-solver/futimes.patch
>>
>> diff --git a/meta/recipes-extended/sat-solver/sat-solver/futimes.patch b/meta/recipes-extended/sat-solver/sat-solver/futimes.patch
>> new file mode 100644
>> index 0000000..b24d852
>> --- /dev/null
>> +++ b/meta/recipes-extended/sat-solver/sat-solver/futimes.patch
>> @@ -0,0 +1,32 @@
>> +This patch uses utimes instead of futimes for uclibc
>> +since futimes is not available
>> +
>> +Upstream-Status: Pending
>> +Signed-off-by: Khem Raj <raj.khem@gmail.com>
>> +
>> +Index: git/examples/solv.c
>> +===================================================================
>> +--- git.orig/examples/solv.c 2012-06-01 12:06:22.041552848 -0700
>> ++++ git/examples/solv.c      2012-06-01 12:49:17.417677449 -0700
>> +@@ -1027,7 +1027,8 @@
>> +   int flags;
>> +
>> +   cinfo = repo->appdata;
>> +-  if (!(fp = fopen(calccachepath(repo, repoext), "r")))
>> ++  const char* fname = calccachepath(repo, repoext);
>> ++  if (!(fp = fopen(fname, "r")))
>> +     return 0;
>> +   if (fseek(fp, -sizeof(mycookie), SEEK_END) || fread(mycookie, sizeof(mycookie), 1, fp) != 1)
>> +     {
>> +@@ -1068,7 +1069,11 @@
>> +       memcpy(cinfo->extcookie, myextcookie, sizeof(myextcookie));
>> +     }
>> +   if (mark)
>> ++#ifdef __UCLIBC__
>> ++    utimes(fname, 0);       /* try to set modification time */
>> ++#else
>> +     futimes(fileno(fp), 0); /* try to set modification time */
>> ++#endif
>> +   fclose(fp);
>> +   return 1;
>> + }
>> diff --git a/meta/recipes-extended/sat-solver/sat-solver_git.bb b/meta/recipes-extended/sat-solver/sat-solver_git.bb
>> index b0382f6..b0daa6a 100644
>> --- a/meta/recipes-extended/sat-solver/sat-solver_git.bb
>> +++ b/meta/recipes-extended/sat-solver/sat-solver_git.bb
>> @@ -20,6 +20,7 @@ SRC_URI = "git://github.com/openSUSE/sat-solver.git;protocol=git \
>>             file://sat-solver_core.patch \
>>             file://fix_gcc-4.6.0_compile_issue.patch \
>>             file://0001-sat_xfopen.c-Forward-port-to-zlib-1.2.6-gzFile.patch \
>> +           file://futimes.patch \
>>            "
>>
>>  S = "${WORKDIR}/git"
>> @@ -28,6 +29,8 @@ EXTRA_OECMAKE += "-DRPM5=RPM5 -DOE_CORE=OE_CORE"
>>
>>  EXTRA_OECMAKE += " -DLIB=${@os.path.basename('${libdir}')}"
>>
>> +TUNE_CCARGS_libc-uclibc_append = " -DUSE_OWN_QSORT=1 "
>> +
>
> I suspect you mean TUNE_CCARGS_append_libc-uclibc here?

indeed good catch. This was incorrect and it worked  because it overwrote
TUNE_CCARGS and I did not see it because the options I wanted
was still present and it was building.

I have updated the pull tree with this changed.

>
> Cheers,
>
> Richard
>
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

Patch

diff --git a/meta/recipes-extended/sat-solver/sat-solver/futimes.patch b/meta/recipes-extended/sat-solver/sat-solver/futimes.patch
new file mode 100644
index 0000000..b24d852
--- /dev/null
+++ b/meta/recipes-extended/sat-solver/sat-solver/futimes.patch
@@ -0,0 +1,32 @@ 
+This patch uses utimes instead of futimes for uclibc
+since futimes is not available
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+Index: git/examples/solv.c
+===================================================================
+--- git.orig/examples/solv.c	2012-06-01 12:06:22.041552848 -0700
++++ git/examples/solv.c	2012-06-01 12:49:17.417677449 -0700
+@@ -1027,7 +1027,8 @@
+   int flags;
+ 
+   cinfo = repo->appdata;
+-  if (!(fp = fopen(calccachepath(repo, repoext), "r")))
++  const char* fname = calccachepath(repo, repoext);
++  if (!(fp = fopen(fname, "r")))
+     return 0;
+   if (fseek(fp, -sizeof(mycookie), SEEK_END) || fread(mycookie, sizeof(mycookie), 1, fp) != 1)
+     {
+@@ -1068,7 +1069,11 @@
+       memcpy(cinfo->extcookie, myextcookie, sizeof(myextcookie));
+     }
+   if (mark)
++#ifdef __UCLIBC__
++    utimes(fname, 0);	/* try to set modification time */
++#else
+     futimes(fileno(fp), 0);	/* try to set modification time */
++#endif
+   fclose(fp);
+   return 1;
+ }
diff --git a/meta/recipes-extended/sat-solver/sat-solver_git.bb b/meta/recipes-extended/sat-solver/sat-solver_git.bb
index b0382f6..b0daa6a 100644
--- a/meta/recipes-extended/sat-solver/sat-solver_git.bb
+++ b/meta/recipes-extended/sat-solver/sat-solver_git.bb
@@ -20,6 +20,7 @@  SRC_URI = "git://github.com/openSUSE/sat-solver.git;protocol=git \
            file://sat-solver_core.patch \
            file://fix_gcc-4.6.0_compile_issue.patch \
            file://0001-sat_xfopen.c-Forward-port-to-zlib-1.2.6-gzFile.patch \
+           file://futimes.patch \
           "
 
 S = "${WORKDIR}/git"
@@ -28,6 +29,8 @@  EXTRA_OECMAKE += "-DRPM5=RPM5 -DOE_CORE=OE_CORE"
 
 EXTRA_OECMAKE += " -DLIB=${@os.path.basename('${libdir}')}"
 
+TUNE_CCARGS_libc-uclibc_append = " -DUSE_OWN_QSORT=1 "
+
 inherit cmake pkgconfig
 
 RDEPENDS_${PN} = "rpm-libs"