problem programatically locating a latest bundle at a blessing level

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

problem programatically locating a latest bundle at a blessing level

Steve Whitson
Hi,

I'm having some trouble with the retrieval of a bundle.  here's the method I'm using:
    Store.Pundle class>> allVersionsWithName: aName andBlessingLevel: aBlessingLevel

Our build mechanism calls this method to locate all the versions of a given bundle at a given blessing level.

This may not be the right way to do this, but it has been working for me for many years now.

The problem I'm having is that today, in our port to 7.7 (from 7.4) I am getting into a recursive loop in this method.  In the following section of code I'm getting back another bundle name, and if the bundle name doesn't match the one I'm after it adds it to otherNames.

otherNames := basicVersions inject: OrderedCollection new into: [:sum :each |
        | parent |
        parent := each parentRecord.
        (parent notNil and: [parent name ~= aName])
            ifTrue: [sum add: parent name].
        sum].

It then recursively calls this method (allVersionWithName: andBlessingLevel:) with each of the items placed in otherNames.  It seems odd that it would be interested in bundles of a different name... must be handling the possibility that a bundle was renamed.  Anyhow... it results in a recursive loop.  I'm guessing that somehow my parenting is out of whack on the particular bundle I'm after.

Any ideas on a solution to this?

Thanks much,
    -Steve
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: problem programatically locating a latest bundle at ablessing level

Holger Kleinsorgen-4
  the new Store II API doesn't seem to include a similar selector, but
you can simply use Glorp to find matching packages, wich also allows
more flexible queries to select suitable versions:

  |  query |
  query := Query readManyOf: Store.Glorp.StorePackage
       where: [:each | each name = 'SomePackage' AND: [ each
currentBlessingLevel >= Store.Policies blessingPolicy defaultBlessing ]].
  query orderBy: [:each | each timestamp descending].
  ^ StoreLoginFactory currentStoreSession execute: query

There's probably nothing wrong with the parentRecord entries. The
implementation of #allVersionsWithName:andBlessingLevel: is flawed.
Consider the following example:

1. Create package "A" and publish it
2. Rename it to "B and publish it
3. Rename it back to "A" and publish it

Store.Package allVersionsWithName: 'A' andBlessingLevel: 20

   now happily refuses to terminate.

> Hi,
>
> I'm having some trouble with the retrieval of a bundle.  here's the
> method I'm using:
>     Store.Pundle class>> allVersionsWithName: aName andBlessingLevel:
> aBlessingLevel
>
> Our build mechanism calls this method to locate all the versions of a
> given bundle at a given blessing level.
>
> This may not be the right way to do this, but it has been working for
> me for many years now.
>
> The problem I'm having is that today, in our port to 7.7 (from 7.4) I
> am getting into a recursive loop in this method.  In the following
> section of code I'm getting back another bundle name, and if the
> bundle name doesn't match the one I'm after it adds it to otherNames.
>
> /otherNames := basicVersions inject: OrderedCollection new into: [:sum
> :each |
>         | parent |
>         parent := each parentRecord.
>         (parent notNil and: [parent name ~= aName])
>             ifTrue: [sum add: parent name].
>         sum].
> /
> It then recursively calls this method (allVersionWithName:
> andBlessingLevel:) with each of the items placed in otherNames.  It
> seems odd that it would be interested in bundles of a different
> name... must be handling the possibility that a bundle was renamed.  
> Anyhow... it results in a recursive loop.  I'm guessing that somehow
> my parenting is out of whack on the particular bundle I'm after.
>
> Any ideas on a solution to this?
>
> Thanks much,
>     -Steve

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: problem programatically locating a latest bundle at ablessing level

Steve Whitson
  Thanks for the response.  This sounds like the new approach I was after.

Yes... your 1.2.3. example is exactly the situation I have.

     -Steve

On 8/14/2010 5:44 PM, Holger Kleinsorgen wrote:

>    the new Store II API doesn't seem to include a similar selector, but
> you can simply use Glorp to find matching packages, wich also allows
> more flexible queries to select suitable versions:
>
>    |  query |
>    query := Query readManyOf: Store.Glorp.StorePackage
>         where: [:each | each name = 'SomePackage' AND: [ each
> currentBlessingLevel>= Store.Policies blessingPolicy defaultBlessing ]].
>    query orderBy: [:each | each timestamp descending].
>    ^ StoreLoginFactory currentStoreSession execute: query
>
> There's probably nothing wrong with the parentRecord entries. The
> implementation of #allVersionsWithName:andBlessingLevel: is flawed.
> Consider the following example:
>
> 1. Create package "A" and publish it
> 2. Rename it to "B and publish it
> 3. Rename it back to "A" and publish it
>
> Store.Package allVersionsWithName: 'A' andBlessingLevel: 20
>
>     now happily refuses to terminate.
>
>> Hi,
>>
>> I'm having some trouble with the retrieval of a bundle.  here's the
>> method I'm using:
>>      Store.Pundle class>>  allVersionsWithName: aName andBlessingLevel:
>> aBlessingLevel
>>
>> Our build mechanism calls this method to locate all the versions of a
>> given bundle at a given blessing level.
>>
>> This may not be the right way to do this, but it has been working for
>> me for many years now.
>>
>> The problem I'm having is that today, in our port to 7.7 (from 7.4) I
>> am getting into a recursive loop in this method.  In the following
>> section of code I'm getting back another bundle name, and if the
>> bundle name doesn't match the one I'm after it adds it to otherNames.
>>
>> /otherNames := basicVersions inject: OrderedCollection new into: [:sum
>> :each |
>>          | parent |
>>          parent := each parentRecord.
>>          (parent notNil and: [parent name ~= aName])
>>              ifTrue: [sum add: parent name].
>>          sum].
>> /
>> It then recursively calls this method (allVersionWithName:
>> andBlessingLevel:) with each of the items placed in otherNames.  It
>> seems odd that it would be interested in bundles of a different
>> name... must be handling the possibility that a bundle was renamed.
>> Anyhow... it results in a recursive loop.  I'm guessing that somehow
>> my parenting is out of whack on the particular bundle I'm after.
>>
>> Any ideas on a solution to this?
>>
>> Thanks much,
>>      -Steve
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc