could someone backport this to stable 1.7 tree?

it should fix emotion detection of debian multilib as it doesn't provide a
checkme file.


On Tue, Jan 8, 2013 at 9:57 PM, Enlightenment SVN <
no-re...@enlightenment.org> wrote:

> Log:
> efl/eina: fix debian multilib detection without magic file.
>
>   The algorithm will now consider valid bin, data orlocale as well if
>   magic file was not provided.
>
>
>
> Author:       barbieri
> Date:         2013-01-08 15:57:14 -0800 (Tue, 08 Jan 2013)
> New Revision: 82429
> Trac:         http://trac.enlightenment.org/e/changeset/82429
>
> Modified:
>   trunk/efl/ChangeLog trunk/efl/NEWS trunk/efl/src/lib/eina/eina_prefix.c
>
> Modified: trunk/efl/ChangeLog
> ===================================================================
> --- trunk/efl/ChangeLog 2013-01-08 23:45:48 UTC (rev 82428)
> +++ trunk/efl/ChangeLog 2013-01-08 23:57:14 UTC (rev 82429)
> @@ -1,8 +1,12 @@
> -2013-01-08 Mike Blumenkrantz
> +2013-01-08  Gustavo Sverzut Barbieri (k-s)
>
> +       * Fix eina_prefix_new() with debian multilib without magic check
> file.
> +
> +2013-01-08  Mike Blumenkrantz
> +
>          * Fix efreet desktop command parsing of https
>
> -2013-01-07 Sung W. Park (sung_)
> +2013-01-07  Sung W. Park (sung_)
>
>         * Pulled out evas gl backend binary shader file caching code from
>          evas_gl_shader.c file and made an internal generic caching api in
>
> Modified: trunk/efl/NEWS
> ===================================================================
> --- trunk/efl/NEWS      2013-01-08 23:45:48 UTC (rev 82428)
> +++ trunk/efl/NEWS      2013-01-08 23:57:14 UTC (rev 82429)
> @@ -104,3 +104,4 @@
>      * Fix ecore_con case where freeing server double-frees clients
>      * Fix build of Evas XCB backend
>      * Fix efreet desktop command parsing of https
> +    * Fix eina_prefix_new() with debian multilib without magic check file.
>
> Modified: trunk/efl/src/lib/eina/eina_prefix.c
> ===================================================================
> --- trunk/efl/src/lib/eina/eina_prefix.c        2013-01-08 23:45:48 UTC
> (rev 82428)
> +++ trunk/efl/src/lib/eina/eina_prefix.c        2013-01-08 23:57:14 UTC
> (rev 82429)
> @@ -376,6 +376,7 @@
>     const char *libdir = "lib";
>     const char *datadir = "share";
>     const char *localedir = "share";
> +   Eina_Bool from_lib = EINA_FALSE, from_bin = EINA_FALSE;
>
>     DBG("EINA PREFIX: argv0=%s, symbol=%p, magicsharefile=%s,
> envprefix=%s",
>         argv0, symbol, magicsharefile, envprefix);
> @@ -524,6 +525,7 @@
>                      {
>                         INF("Dlsym gave full path = %s",
> info_dl.dli_fname);
>                         STRDUP_REP(pfx->exe_path, info_dl.dli_fname);
> +                       from_lib = EINA_TRUE;
>                      }
>                 }
>            }
> @@ -542,6 +544,7 @@
>                              envprefix);
>                    return pfx;
>                 }
> +             from_bin = EINA_TRUE;
>  #ifndef _WIN32
>            }
>  #endif
> @@ -579,6 +582,9 @@
>                   pfx->prefix_path = malloc(p - pfx->exe_path + 1);
>                   if (pfx->prefix_path)
>                     {
> +                       Eina_Bool magic_found = EINA_FALSE;
> +                       int checks_passed = 0;
> +
>                        strncpy(pfx->prefix_path, pfx->exe_path,
>                                 p - pfx->exe_path);
>                        pfx->prefix_path[p - pfx->exe_path] = 0;
> @@ -589,55 +595,70 @@
>                                  pfx->prefix_path, bindir);
>                         STRDUP_REP(pfx->prefix_path_bin, buf);
>                         DBG("Have bin = %s", pfx->prefix_path_bin);
> +                       if ((!from_bin) && (stat(buf, &st) == 0))
> +                         checks_passed++;
> +
>                        /* lib */
>                        snprintf(buf, sizeof(buf), "%s" DSEP_S "%s",
>                                  pfx->prefix_path, libdir);
>                         STRDUP_REP(pfx->prefix_path_lib, buf);
>                         DBG("Have lib = %s", pfx->prefix_path_lib);
> +                       if ((!from_lib) && (stat(buf, &st) == 0))
> +                         checks_passed++;
> +
>                        /* locale */
>                        snprintf(buf, sizeof(buf), "%s" DSEP_S "%s",
>                                  pfx->prefix_path, localedir);
>                         STRDUP_REP(pfx->prefix_path_locale, buf);
>                         DBG("Have locale = %s", pfx->prefix_path_locale);
> +                       if (stat(buf, &st) == 0)
> +                         checks_passed++;
> +
>                        /* check if magic file is there - then our guess is
> right */
> -                       if (magic)
> +                       if (!magic)
> +                         DBG("No magic file");
> +                       else
>                           {
>                              DBG("Magic = %s", magic);
>                              snprintf(buf, sizeof(buf),
>                                       "%s" DSEP_S "%s" DSEP_S "%s",
>                                       pfx->prefix_path, datadir, magic);
>                              DBG("Check in %s", buf);
> +
> +                            if (stat(buf, &st) == 0)
> +                              {
> +                                 checks_passed++;
> +                                 magic_found = EINA_TRUE;
> +                                 DBG("Magic path %s stat passed", buf);
> +                              }
> +                            else
> +                              WRN("Missing magic path %s", buf);
>                           }
> -                      if ((!magic) || (stat(buf, &st) == 0))
> +
> +                      if (((!magic) && (checks_passed > 0)) ||
> +                           ((magic) && (magic_found)))
>                          {
> -                            if (buf[0])
> -                               DBG("Magic path %s stat passed", buf);
> -                            else
> -                               DBG("No magic file");
>                             snprintf(buf, sizeof(buf), "%s" DSEP_S "%s",
>                                       pfx->prefix_path, datadir);
>                              STRDUP_REP(pfx->prefix_path_data, buf);
>                          }
> -                      /* magic file not there. time to start hunting! */
>                        else
>                           {
> -                            if (buf[0])
> +                            for (;p > pfx->exe_path; p--)
>                                {
> -                                 for (;p > pfx->exe_path; p--)
> +                                 if (*p == DSEP_C)
>                                     {
> -                                      if (*p == DSEP_C)
> -                                        {
> -                                           p--;
> -                                           break;
> -                                        }
> +                                      p--;
> +                                      break;
>                                     }
> -                                 if (p > pfx->exe_path)
> -                                   {
> -                                      continue;
> -                                      DBG("Go back one directory");
> -                                   }
>                                }
> -                            WRN("Magic failed");
> +                            if (p > pfx->exe_path)
> +                              {
> +                                 int newlen = p - pfx->exe_path;
> +                                 DBG("Go back one directory (%.*s)",
> newlen, pfx->exe_path);
> +                                 continue;
> +                              }
> +                            WRN("No Prefix path (exhausted search
> depth)");
>                              _fallback(pfx, pkg_bin, pkg_lib, pkg_data,
>                                        pkg_locale, envprefix);
>                           }
>
>
>
> ------------------------------------------------------------------------------
> Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS
> and more. Get SQL Server skills now (including 2012) with LearnDevNow -
> 200+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
> SALE $99.99 this month only - learn more at:
> http://p.sf.net/sfu/learnmore_122512
> _______________________________________________
> enlightenment-svn mailing list
> enlightenment-...@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-svn
>



-- 
Gustavo Sverzut Barbieri
http://profusion.mobi embedded systems
--------------------------------------
MSN: barbi...@gmail.com
Skype: gsbarbieri
Mobile: +55 (19) 9225-2202
------------------------------------------------------------------------------
Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS
and more. Get SQL Server skills now (including 2012) with LearnDevNow -
200+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only - learn more at:
http://p.sf.net/sfu/learnmore_122512
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to