rpmtsSetNotifyCallback()?

2010-12-13 Thread Per Øyvind Karlsen
(quoting https://qa.mandriva.com/show_bug.cgi?id=61690#c15)

 Comment #15 From Jeff Johnson on 2010-11-17 16:55:34 CEST (-)
[reply] 

There's this rpmts setter that should be wired up


/** \ingroup rpmts
 * Set dependency solver callback.
 * @param tstransaction set
 * @param (*solve)  dependency solver callback
 * @param solveData dependency solver callback data (opaque)
 * @return  0 on success
 */
int rpmtsSetSolveCallback(rpmts ts,
int (*solve) (rpmts ts, rpmds ds, const void * data),
const void * solveData)
/*...@modifies ts @*/;

Hint: MongoDB will be attached through the solve database callback.
And likely most of URPM's depsolving could be done more efficiently
if the rpmtsCheck() SolveCallback() were used intelligently.



Could you provide a bit more detailed/specific hint on how/where? :)

I'm currently looking into some various callback related issues in URPM,
and it's a new territory for me to get intimate with and fully grasp..

By the looks of the current code in URPM.xs, it does kinda look kinda dated,
hard to read and understand right away, suspecting that parts of it being broken
making it not easier to wrap my head around the whole thing..

So could you tell me where exactly in the code you're referring to, with an
example on how to implement, or a pointer to some easy to understand
example elsewhere? If spotted some clearly fudged code that I should
be aware of and that really needs to be fixed, that I guess would be the
most important though, stabbing around in the dark on unstable ground
easily gets a bit tedious..

I'm sure I'll probably be capable of figuring these things by myself, but
some hints will help get me there faster, proceed with the switch faster
with less hazzle  resulting FUD, and allow us to start focus on development
and time to invest in discussions around it again. :o)

I'll try get some overview the best I can meanwhile, just suspecting that
my efficiency could do better.. ;)

--
Regards,
Per Øyvind
__
RPM Package Managerhttp://rpm5.org
Developer Communication Listrpm-devel@rpm5.org


Re: rpmtsSetNotifyCallback()?

2010-12-13 Thread Jeff Johnson
Not rpmtsSetNotifyCallback() ... that is likely already
wired up in perl-URPM.

Wire up rpmtsSetSolveCallback() the same way. Yes,
different arguments, but all the glue should be the same.

The minimum necessary functionality is just to return 1 (aka not found).

You can also do a hand off to the existing rpmtsSolve() (this is what RPM plugs 
into
the callback). See below.

Read the code to see how it works. Its basically
1) look for an unsatisfied dependency
2) if you find a solution, read *.rpm and add the header to the 
transaction

return 0 if found, 1 if not found, and stay away from retry, its there just in
case but there's never been a need (and there should not ever be until
you start deleting already checked elements from the existing transaction ...)

But the bear minimum wwiring is just to stub in some perl routine
that returns 1. The plumbing is needed before functionality.

/** \ingroup rpmts
 * Attempt to solve a needed dependency using the solve database.
 * @param tstransaction set
 * @param dsdependency set
 * @param data  opaque data associated with callback
 * @return  -1 retry, 0 ignore, 1 not found
 */
/*...@-exportlocal@*/
int rpmtsSolve(rpmts ts, rpmds ds, const void * data)
/*...@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState 
@*/
/*...@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
/*...@=exportlocal@*/


hth

73 de Jeff
On Dec 13, 2010, at 7:24 PM, Per Øyvind Karlsen wrote:

 (quoting https://qa.mandriva.com/show_bug.cgi?id=61690#c15)
 
  Comment #15 From Jeff Johnson on 2010-11-17 16:55:34 CEST (-)
 [reply] 
 
 There's this rpmts setter that should be wired up
 
 
 /** \ingroup rpmts
 * Set dependency solver callback.
 * @param tstransaction set
 * @param (*solve)  dependency solver callback
 * @param solveData dependency solver callback data (opaque)
 * @return  0 on success
 */
 int rpmtsSetSolveCallback(rpmts ts,
int (*solve) (rpmts ts, rpmds ds, const void * data),
const void * solveData)
/*...@modifies ts @*/;
 
 Hint: MongoDB will be attached through the solve database callback.
 And likely most of URPM's depsolving could be done more efficiently
 if the rpmtsCheck() SolveCallback() were used intelligently.
 
 
 
 Could you provide a bit more detailed/specific hint on how/where? :)
 
 I'm currently looking into some various callback related issues in URPM,
 and it's a new territory for me to get intimate with and fully grasp..
 
 By the looks of the current code in URPM.xs, it does kinda look kinda dated,
 hard to read and understand right away, suspecting that parts of it being 
 broken
 making it not easier to wrap my head around the whole thing..
 
 So could you tell me where exactly in the code you're referring to, with an
 example on how to implement, or a pointer to some easy to understand
 example elsewhere? If spotted some clearly fudged code that I should
 be aware of and that really needs to be fixed, that I guess would be the
 most important though, stabbing around in the dark on unstable ground
 easily gets a bit tedious..
 
 I'm sure I'll probably be capable of figuring these things by myself, but
 some hints will help get me there faster, proceed with the switch faster
 with less hazzle  resulting FUD, and allow us to start focus on development
 and time to invest in discussions around it again. :o)
 
 I'll try get some overview the best I can meanwhile, just suspecting that
 my efficiency could do better.. ;)
 
 --
 Regards,
 Per Øyvind
 __
 RPM Package Managerhttp://rpm5.org
 Developer Communication Listrpm-devel@rpm5.org

__
RPM Package Managerhttp://rpm5.org
Developer Communication Listrpm-devel@rpm5.org