Re: [sword-devel] Question regarding InstallMgr

2022-12-14 Thread P Mosier

Okay, so I've made some progress but appear to be stalled a bit.

When instructed to install a module, the command line installmgr doesn't 
seem to call InstallMgr::refreshRemoteSource() at all, and somehow the 
call to do the install succeeds.  Yet my example below fails if I don't 
call to refresh the source.


However, if I DO call refreshRemoteSource(), I will end up downloading 
EVERY module, despite only specifying one:


int myInstallModule(const char* modname) {
    sword::InstallSource is("FTP");
    is.source = "ftp.crosswire.org";
    is.directory = "/pub/sword/raw";

    sword::SWBuf installpath = getenv("HOME");
    installpath += "/.sword/";
    sword::InstallMgr* im = new sword::InstallMgr(installpath);
    im->setUserDisclaimerConfirmed(true);

    // XXX -- the call below appears to be required
    int refresh = im->refreshRemoteSource();
    if (refresh) {
    printf("Refresh call failed, error: %d\n", refresh);
    exit(0);
    }

    // XXX -- this installs EVERY module, not just what is passed as an 
argument

    return im->installModule(, 0, modname, );
}

Someone have an idea what I might be missing?

Thanks,
- Paul M

On 12/8/22 16:18, Greg Hellings wrote:
I believe you will need to refresh that source before you call the 
install method. It's trying to look up the config file for that module 
and isn't finding it. Those get downloaded and cached by the 
Installmgr class when it refreshes a source.


--Greg

On Thu, Dec 8, 2022, 14:51 P Mosier  wrote:

Hello,

I am trying to figure out what the appropriate steps to take are for
programmatically installing a module through FTP.  Looking through
the
backend codebase, it seems like there are some configuration settings
that have to be initialized in SWMgr order for
InstallMgr::installModule
to work.  However, tracking this down has eluded me as InstallMgr
never
seems to be set up and called the same way twice.

I have this as a simple example:

 sword::SWMgr swrd;
 sword::InstallSource is("FTP");
     is.source = "ftp.crosswire.org ";
     is.directory = "/pub/sword";

     sword::InstallMgr im;
 im.installModule(, 0, "KJVA", );

The call to installModule segfaults at this line:

 module = mgr.config->getSections().find(modName);

I recognize it might be related to my own environment.  This is the
entire content of my /etc/sword:
[Install]
DataPath=/usr/share/sword/

Does someone have an idea for what I'm missing, or an example to
direct
me to so I can get a better handle on this area of code?

Thanks,
- Paul M

___
sword-devel mailing list: sword-devel@crosswire.org
http://crosswire.org/mailman/listinfo/sword-devel
Instructions to unsubscribe/change your settings at above page


___
sword-devel mailing list:sword-devel@crosswire.org
http://crosswire.org/mailman/listinfo/sword-devel
Instructions to unsubscribe/change your settings at above page
___
sword-devel mailing list: sword-devel@crosswire.org
http://crosswire.org/mailman/listinfo/sword-devel
Instructions to unsubscribe/change your settings at above page


Re: [sword-devel] Question regarding InstallMgr

2022-12-08 Thread Troy A. Griffitts
Hi Paul,

Have a look at the command line interface for installmgr here.

https://crosswire.org/svn/sword/trunk/utilities/installmgr.cpp

On December 8, 2022 1:50:48 PM MST, P Mosier  wrote:
>Hello,
>
>I am trying to figure out what the appropriate steps to take are for 
>programmatically installing a module through FTP.  Looking through the backend 
>codebase, it seems like there are some configuration settings that have to be 
>initialized in SWMgr order for InstallMgr::installModule to work.  However, 
>tracking this down has eluded me as InstallMgr never seems to be set up and 
>called the same way twice.
>
>I have this as a simple example:
>
>    sword::SWMgr swrd;
>    sword::InstallSource is("FTP");
>    is.source = "ftp.crosswire.org";
>    is.directory = "/pub/sword";
>
>    sword::InstallMgr im;
>    im.installModule(, 0, "KJVA", );
>
>The call to installModule segfaults at this line:
>
>    module = mgr.config->getSections().find(modName);
>
>I recognize it might be related to my own environment.  This is the entire 
>content of my /etc/sword:
>[Install]
>DataPath=/usr/share/sword/
>
>Does someone have an idea for what I'm missing, or an example to direct me to 
>so I can get a better handle on this area of code?
>
>Thanks,
>- Paul M
>
>___
>sword-devel mailing list: sword-devel@crosswire.org
>http://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.___
sword-devel mailing list: sword-devel@crosswire.org
http://crosswire.org/mailman/listinfo/sword-devel
Instructions to unsubscribe/change your settings at above page


Re: [sword-devel] Question regarding InstallMgr

2022-12-08 Thread Greg Hellings
I believe you will need to refresh that source before you call the install
method. It's trying to look up the config file for that module and isn't
finding it. Those get downloaded and cached by the Installmgr class when it
refreshes a source.

--Greg

On Thu, Dec 8, 2022, 14:51 P Mosier  wrote:

> Hello,
>
> I am trying to figure out what the appropriate steps to take are for
> programmatically installing a module through FTP.  Looking through the
> backend codebase, it seems like there are some configuration settings
> that have to be initialized in SWMgr order for InstallMgr::installModule
> to work.  However, tracking this down has eluded me as InstallMgr never
> seems to be set up and called the same way twice.
>
> I have this as a simple example:
>
>  sword::SWMgr swrd;
>  sword::InstallSource is("FTP");
>  is.source = "ftp.crosswire.org";
>  is.directory = "/pub/sword";
>
>  sword::InstallMgr im;
>  im.installModule(, 0, "KJVA", );
>
> The call to installModule segfaults at this line:
>
>  module = mgr.config->getSections().find(modName);
>
> I recognize it might be related to my own environment.  This is the
> entire content of my /etc/sword:
> [Install]
> DataPath=/usr/share/sword/
>
> Does someone have an idea for what I'm missing, or an example to direct
> me to so I can get a better handle on this area of code?
>
> Thanks,
> - Paul M
>
> ___
> sword-devel mailing list: sword-devel@crosswire.org
> http://crosswire.org/mailman/listinfo/sword-devel
> Instructions to unsubscribe/change your settings at above page
>
___
sword-devel mailing list: sword-devel@crosswire.org
http://crosswire.org/mailman/listinfo/sword-devel
Instructions to unsubscribe/change your settings at above page


[sword-devel] Question regarding InstallMgr

2022-12-08 Thread P Mosier

Hello,

I am trying to figure out what the appropriate steps to take are for 
programmatically installing a module through FTP.  Looking through the 
backend codebase, it seems like there are some configuration settings 
that have to be initialized in SWMgr order for InstallMgr::installModule 
to work.  However, tracking this down has eluded me as InstallMgr never 
seems to be set up and called the same way twice.


I have this as a simple example:

    sword::SWMgr swrd;
    sword::InstallSource is("FTP");
    is.source = "ftp.crosswire.org";
    is.directory = "/pub/sword";

    sword::InstallMgr im;
    im.installModule(, 0, "KJVA", );

The call to installModule segfaults at this line:

    module = mgr.config->getSections().find(modName);

I recognize it might be related to my own environment.  This is the 
entire content of my /etc/sword:

[Install]
DataPath=/usr/share/sword/

Does someone have an idea for what I'm missing, or an example to direct 
me to so I can get a better handle on this area of code?


Thanks,
- Paul M

___
sword-devel mailing list: sword-devel@crosswire.org
http://crosswire.org/mailman/listinfo/sword-devel
Instructions to unsubscribe/change your settings at above page