mirror of https://github.com/KLayout/klayout.git
Debugging git package download
This commit is contained in:
parent
08a790d7f7
commit
4e00a91e91
|
|
@ -497,25 +497,25 @@ Salt::create_grain (const SaltGrain &templ, SaltGrain &target, double timeout, t
|
|||
|
||||
} else if (! templ.url ().empty ()) {
|
||||
|
||||
if (templ.url ().find ("http:") == 0 || templ.url ().find ("https:") == 0) {
|
||||
lay::SaltParsedURL purl (templ.url ());
|
||||
|
||||
if (purl.url ().find ("http:") == 0 || purl.url ().find ("https:") == 0) {
|
||||
|
||||
// otherwise download from the URL using Git or SVN
|
||||
|
||||
lay::SaltParsedURL purl (templ.url ());
|
||||
|
||||
if (purl.protocol () == Git) {
|
||||
|
||||
#if defined(HAVE_GIT2)
|
||||
tl::info << QObject::tr ("Downloading package from '%1' to '%2' using Git protocol ..").arg (tl::to_qstring (templ.url ())).arg (tl::to_qstring (target.path ()));
|
||||
res = tl::GitObject::download (templ.url (), target.path (), purl.subfolder (), purl.branch (), timeout, callback);
|
||||
tl::info << QObject::tr ("Downloading package from '%1' to '%2' using Git protocol (ref='%3', subdir='%4') ..").arg (tl::to_qstring (purl.url ())).arg (tl::to_qstring (target.path ())).arg (tl::to_qstring (purl.branch ())).arg (tl::to_qstring (purl.subfolder ()));
|
||||
res = tl::GitObject::download (purl.url (), target.path (), purl.subfolder (), purl.branch (), timeout, callback);
|
||||
#else
|
||||
throw tl::Exception (tl::to_string (QObject::tr ("Unable to install package '%1' - git protocol not compiled in").arg (tl::to_qstring (target.name ()))));
|
||||
#endif
|
||||
|
||||
} else if (purl.protocol () == WebDAV || purl.protocol () == DefaultProtocol) {
|
||||
|
||||
tl::info << QObject::tr ("Downloading package from '%1' to '%2' using SVN/WebDAV protocol ..").arg (tl::to_qstring (templ.url ())).arg (tl::to_qstring (target.path ()));
|
||||
res = tl::WebDAVObject::download (templ.url (), target.path (), timeout, callback);
|
||||
tl::info << QObject::tr ("Downloading package from '%1' to '%2' using SVN/WebDAV protocol ..").arg (tl::to_qstring (purl.url ())).arg (tl::to_qstring (target.path ()));
|
||||
res = tl::WebDAVObject::download (purl.url (), target.path (), timeout, callback);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -384,9 +384,20 @@ GitObject::read (const std::string &org_url, const std::string &org_filter, cons
|
|||
bool
|
||||
GitObject::download (const std::string &url, const std::string &target, const std::string &subfolder, const std::string &branch, double timeout, tl::InputHttpStreamCallback *callback)
|
||||
{
|
||||
GitObject obj (target);
|
||||
obj.read (url, std::string (), subfolder, branch, timeout, callback);
|
||||
return false;
|
||||
try {
|
||||
|
||||
GitObject obj (target);
|
||||
obj.read (url, std::string (), subfolder, branch, timeout, callback);
|
||||
|
||||
return true;
|
||||
|
||||
} catch (tl::Exception &ex) {
|
||||
|
||||
tl::error << tl::sprintf (tl::to_string (tr ("Error downloading Git repo from %s (subdir '%s', ref '%s')")), url, subfolder, branch);
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
tl::InputStream *
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ public:
|
|||
*
|
||||
* Sub-directories are created if required.
|
||||
*
|
||||
* This method throws an exception if the directory structure could
|
||||
* This method returns false if the directory structure could
|
||||
* not be obtained or downloading of one file failed.
|
||||
*
|
||||
* "branch" is the remote ref to use. This can be a branch name, a tag name,
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ public:
|
|||
*
|
||||
* Sub-directories are created if required.
|
||||
*
|
||||
* This method throws an exception if the directory structure could
|
||||
* This method returns false if the directory structure could
|
||||
* not be obtained or downloading of one file failed.
|
||||
*/
|
||||
static bool download (const std::string &url, const std::string &target, double timeout = 60.0, tl::InputHttpStreamCallback *callback = 0);
|
||||
|
|
|
|||
Loading…
Reference in New Issue