mirror of https://github.com/KLayout/klayout.git
Some bug fixing
This commit is contained in:
parent
3e34d205e8
commit
a4df1eb10f
|
|
@ -515,6 +515,10 @@ SaltGrain::stream_from_url (std::string &generic_url, double timeout, tl::InputH
|
|||
throw tl::Exception (tl::to_string (QObject::tr ("No download link available")));
|
||||
}
|
||||
|
||||
if (tl::verbosity () >= 20) {
|
||||
tl::info << tr ("Downloading package info from ") << generic_url;
|
||||
}
|
||||
|
||||
lay::SaltParsedURL purl (generic_url);
|
||||
const std::string &url = purl.url ();
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ parse_git_url (tl::Extractor &ex, std::string &url, std::string &branch, std::st
|
|||
;
|
||||
}
|
||||
// server ("www.klayout.de")
|
||||
while (! ex.at_end () && (*ex != '/' && *ex != '+')) {
|
||||
while (! ex.at_end () && (*ex != '/' && *ex != '+' && *ex != '[')) {
|
||||
++ex;
|
||||
}
|
||||
|
||||
|
|
@ -47,6 +47,7 @@ parse_git_url (tl::Extractor &ex, std::string &url, std::string &branch, std::st
|
|||
|
||||
++ex;
|
||||
|
||||
// next component
|
||||
const char *c1 = ex.get ();
|
||||
while (! ex.at_end () && (*ex != '/' && *ex != '+' && *ex != '[')) {
|
||||
++ex;
|
||||
|
|
@ -55,7 +56,7 @@ parse_git_url (tl::Extractor &ex, std::string &url, std::string &branch, std::st
|
|||
|
||||
std::string comp (c1, c2 - c1);
|
||||
|
||||
if ((! ex.at_end () && *ex == '+') || comp.find (".git") == comp.size () - 4) {
|
||||
if ((! ex.at_end () && (*ex == '+' || *ex == '[')) || comp.find (".git") == comp.size () - 4) {
|
||||
// subfolder starts here
|
||||
break;
|
||||
}
|
||||
|
|
@ -68,6 +69,7 @@ parse_git_url (tl::Extractor &ex, std::string &url, std::string &branch, std::st
|
|||
return;
|
||||
}
|
||||
|
||||
// skip URL/subfolder separator
|
||||
if (*ex == '/') {
|
||||
while (! ex.at_end () && *ex == '/') {
|
||||
++ex;
|
||||
|
|
@ -76,6 +78,7 @@ parse_git_url (tl::Extractor &ex, std::string &url, std::string &branch, std::st
|
|||
++ex;
|
||||
}
|
||||
|
||||
// subfolders
|
||||
{
|
||||
const char *c1 = ex.get ();
|
||||
while (! ex.at_end () && *ex != '[') {
|
||||
|
|
|
|||
|
|
@ -130,3 +130,12 @@ TEST (19_GitSVNEmulationTagWithSubFolder)
|
|||
EXPECT_EQ (purl.branch (), "refs/tags/1.9");
|
||||
EXPECT_EQ (purl.subfolder (), "sub/folder");
|
||||
}
|
||||
|
||||
TEST (20_Example1)
|
||||
{
|
||||
lay::SaltParsedURL purl ("git+https://github.com/my-user/test-core[refs/tags/v1.1.0]");
|
||||
EXPECT_EQ (purl.protocol () == lay::Git, true);
|
||||
EXPECT_EQ (purl.url (), "https://github.com/my-user/test-core");
|
||||
EXPECT_EQ (purl.branch (), "refs/tags/v1.1.0");
|
||||
EXPECT_EQ (purl.subfolder (), "");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,17 +79,23 @@ GitObject::GitObject (const std::string &local_path)
|
|||
|
||||
if (local_path.empty ()) {
|
||||
// @@@ generic tempnam on Windows/Posix ...
|
||||
char tmp[] = "git2klayoutXXXXXX";
|
||||
mkstemp (tmp);
|
||||
char tmp[] = "/tmp/git2klayoutXXXXXX";
|
||||
if (mkdtemp (tmp) == NULL) {
|
||||
throw tl::Exception (tl::to_string (tr ("Unable to create temporary folder: %s")), (const char *) tmp);
|
||||
}
|
||||
m_local_path = tmp;
|
||||
m_is_temp = true;
|
||||
}
|
||||
|
||||
tl::mkpath (m_local_path);
|
||||
|
||||
// ensures the directory is clean
|
||||
tl::rm_dir_recursive (m_local_path); // @@@ TODO: error handling?
|
||||
tl::mkpath (m_local_path);
|
||||
if (! m_is_temp) {
|
||||
if (! tl::rm_dir_recursive (m_local_path)) {
|
||||
throw tl::Exception (tl::to_string (tr ("Unable to clean local Git repo path: %s")), m_local_path);
|
||||
}
|
||||
if (! tl::mkpath (m_local_path)) {
|
||||
throw tl::Exception (tl::to_string (tr ("Unable to regenerate local Git repo path: %s")), m_local_path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GitObject::~GitObject ()
|
||||
|
|
|
|||
Loading…
Reference in New Issue