[sword-devel] Determining the repository a SWModule belongs to

Troy A. Griffitts scribe at crosswire.org
Fri Sep 27 14:13:14 MST 2019


Hi Tobias. There is some feature in InstallMgr which returns the status of a module as: not installed, installed but an update is available, installed and up to date. I know this isn't what you want, but was as far as we wanted to go with defining module info. I guess InstallMgr could add a line into the .conf when installing: InstalledFrom, but that could be a side load, a local repo, another SWORD application install on a local lan, or one of our remote sources which might not still host the module. So, I guess, without fully knowing your use case, are you looking for where the module is now available, or from where it was installed? Is there a use case you can describe which you see giving value to the user, maybe we can try to solve together?

Blessings,

Troy

On September 27, 2019 1:58:20 PM MST, contact at tklein.info wrote:
>Ok. In this case (if there are potentially multiple source repo's for  
>one given module) could a list be returned?
>This is quite common for 1:n relationships in databases as well ...
>
>Best regards,
>Tobias
>
>Quoting Greg Hellings <greg.hellings at gmail.com>:
>
>> Currently the engine does not intentionally preserve any information
>about
>> where a module comes from. This is why, for a single installer, it
>cannot
>> handle having parallel installs of the same module from different
>sources
>> (e.g. you can't have both CrossWire KJV and your own homegrown KJV in
>> parallel without giving your own a different module name).
>>
>> There's nothing stopping an application from creating different local
>> repos, one for each upstream, and then combining the two using its
>own
>> logic. However, this isn't something the library currently supports.
>The
>> fact that you can reverse engineer its source, at present, is only
>because
>> none of the main repositories duplicates module identifiers from any
>other
>> repositories. However there is nothing, technically speaking, that
>prevents
>> this. Thus, module pedigree is not, necessarily, a deterministic
>thing.
>>
>> --Greg
>>
>> On Fri, Sep 27, 2019 at 2:28 PM <contact at tklein.info> wrote:
>>
>>> Hi,
>>>
>>> Using the SWORD API, is there an easy way to determine the
>>> remote/source repository a module is coming from?
>>>
>>> I haven't found anything in the SWModule class or anywhere else.
>>>
>>> This would be my approach without any API method:
>>> 1) Get the config entry "PrefixPath" using
>>> SWModule::getConfigEntry("PrefixPath"). This returns something like
>>> this:
>>> /home/tobi/.sword/installMgr/20151110161300/
>>> 2) The last part of the path above is the "id" of the source
>repository
>>> 3) Looking up ~/.sword/installMgr/masterRepoList.conf I can find the
>>> mapping between the repo id and the actual repository name from a
>line
>>> like this one:
>20151110161300=FTPSource=eBible.org|ftp.ebible.org|/sword
>>>
>>> Would it make sense to provide a method in the SWModule or
>InstallMgr
>>> class to easily get this information?
>>> This would be useful meta information when showing an about dialog
>for
>>> a module and I also see other use cases.
>>>
>>> Best regards,
>>> Tobias
>>>
>>>
>>> _______________________________________________
>>> sword-devel mailing list: sword-devel at crosswire.org
>>> http://www.crosswire.org/mailman/listinfo/sword-devel
>>> Instructions to unsubscribe/change your settings at above page
>>>
>
>
>
>
>_______________________________________________
>sword-devel mailing list: sword-devel at crosswire.org
>http://www.crosswire.org/mailman/listinfo/sword-devel
>Instructions to unsubscribe/change your settings at above page

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.crosswire.org/pipermail/sword-devel/attachments/20190927/1d2eca9d/attachment-0001.html>


More information about the sword-devel mailing list