pkgin (probably not weekly) news 2

And here we are for week 2 !

There have been some fixes last week, issues were mainly spotted by orgrim, thanks to him !

The big one concerns a type of dewey/glob I’ve never been through before:

libao-[a-z]*-[0-9]*
Until now, I was able to handle the following (from `pkg_str.c`)
/*                                                                              
 * AFAIK, here are the dewey/glob we can find as dependencies                   
 *                                                                              
 * foo>=1.0 - 19129 entries                                                     
 * foo<1.0 - 1740 entries (only perl)                                           
 * foo>1.0 - 44 entries                                                         
 * foo< =2.0 - 1                                                                 
 * {foo>=1.0,bar>=2.0}                                                          
 * foo>=1.0<2.0                                                                 
 * foo{-bar,-baz}>=1.0                                                          
 * foo{-bar,-baz}-[0-9]*                                                        
 * foo-{bar,baz}                                                                
 * foo-1.0{,nb[0-9]*} - 260                                                     
 * foo-[0-9]* - 3214                                                            
 * foo-1.0 - 20                                                                 
 */
As there was no "easy" way of handling those double-globs dependencies, I took a simple approach: resolve dependency with a matching package when the pattern is too complex (`sqlite_callback.c`):
    /* map corresponding pkgname */
    if ((pkg_map = map_pkg_to_dep(plisthead, deptree->depend)) != NULL)
        XSTRDUP(deptree->name, pkg_map->name);
    else
        /* some dependencies just don't match anything */
        XSTRDUP(deptree->name, DEPS_PKGNAME);
Only drawback, this takes a bit more time, but at last, there's no possible error on dependency resolution. Maybe there's some more optimizations I can do to reduce time taken with this mapping. As planned, `pkgin` now depends on _pkgsrc's_ `pkg_install`, and the latter is pushed on top of the upgrade-list if there's a new version. I also fixed the many-versions-of-the-same-package problem with the following query (`pkgindb_queries.c`)
const char DIRECT_DEPS[] = /* prefer higher version */
    "SELECT REMOTE_DEPS_DEWEY, REMOTE_DEPS_PKGNAME "
    "FROM REMOTE_DEPS WHERE PKG_ID = "
    "(SELECT PKG_ID FROM REMOTE_PKG WHERE PKGNAME = '%s' "
    "ORDER BY FULLPKGNAME DESC LIMIT 1);";

Needs to be done:

  • Tests, tests, tests !
  • reproduce and fix 2 different bugs two users had; I’ve been unable to reproduce them at the moment
  • test Minix 3.2.0
    [tags]pkgin,code[/tags]