mirror of https://github.com/KLayout/klayout.git
Issue 1623 (#1624)
* Fixing issue #1623 (Package installation with '-y' from command line does not work for URL or file) * Another bugfix: package installation with -y from file structure did not work as 'grain.xml' is not added to grain URL --------- Co-authored-by: Matthias Koefferlein <matthias@klayout.de>
This commit is contained in:
parent
cc7622b6b4
commit
b799391ec9
|
|
@ -179,6 +179,10 @@ SaltController::install_packages (const std::vector<std::string> &packages, bool
|
||||||
{
|
{
|
||||||
lay::SaltDownloadManager manager;
|
lay::SaltDownloadManager manager;
|
||||||
|
|
||||||
|
// This method is used for command-line installation ignoring the package index.
|
||||||
|
// Hence we have to download package information here:
|
||||||
|
manager.set_always_download_package_information (true);
|
||||||
|
|
||||||
lay::Salt salt_mine;
|
lay::Salt salt_mine;
|
||||||
if (! m_salt_mine_url.empty ()) {
|
if (! m_salt_mine_url.empty ()) {
|
||||||
tl::log << tl::to_string (tr ("Downloading package repository from %1").arg (tl::to_qstring (m_salt_mine_url)));
|
tl::log << tl::to_string (tr ("Downloading package repository from %1").arg (tl::to_qstring (m_salt_mine_url)));
|
||||||
|
|
|
||||||
|
|
@ -166,7 +166,7 @@ ConfirmationDialog::finish ()
|
||||||
|
|
||||||
SaltDownloadManager::SaltDownloadManager ()
|
SaltDownloadManager::SaltDownloadManager ()
|
||||||
{
|
{
|
||||||
// .. nothing yet ..
|
m_always_download_package_information = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -344,7 +344,7 @@ SaltDownloadManager::fetch_missing (const lay::Salt &salt, const lay::Salt &salt
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! p->downloaded && salt_mine.download_package_information ()) {
|
if (! p->downloaded && (m_always_download_package_information || salt_mine.download_package_information ())) {
|
||||||
|
|
||||||
// If requested, download package information to complete information from index or dependencies
|
// If requested, download package information to complete information from index or dependencies
|
||||||
if (tl::verbosity() >= 10) {
|
if (tl::verbosity() >= 10) {
|
||||||
|
|
@ -362,7 +362,7 @@ SaltDownloadManager::fetch_missing (const lay::Salt &salt, const lay::Salt &salt
|
||||||
if (! p->downloaded) {
|
if (! p->downloaded) {
|
||||||
|
|
||||||
if (p->name.empty ()) {
|
if (p->name.empty ()) {
|
||||||
throw tl::Exception (tl::to_string (tr ("No name given package from '%s' (from dependencies or command line installation request)")), p->url);
|
throw tl::Exception (tl::to_string (tr ("No name given for package from '%s' (from dependencies or command line installation request)")), p->url);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tl::verbosity() >= 10) {
|
if (tl::verbosity() >= 10) {
|
||||||
|
|
|
||||||
|
|
@ -103,6 +103,22 @@ public:
|
||||||
*/
|
*/
|
||||||
SaltDownloadManager ();
|
SaltDownloadManager ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Gets a flag indicating whether to always download package information
|
||||||
|
*/
|
||||||
|
bool always_download_package_information () const
|
||||||
|
{
|
||||||
|
return m_always_download_package_information;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Sets a flag indicating whether to always download package information
|
||||||
|
*/
|
||||||
|
void set_always_download_package_information (bool f)
|
||||||
|
{
|
||||||
|
m_always_download_package_information = f;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Registers an URL (with version) for download in the given target directory
|
* @brief Registers an URL (with version) for download in the given target directory
|
||||||
*
|
*
|
||||||
|
|
@ -176,6 +192,7 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
std::vector<Descriptor> m_registry;
|
std::vector<Descriptor> m_registry;
|
||||||
|
bool m_always_download_package_information;
|
||||||
|
|
||||||
bool needs_iteration ();
|
bool needs_iteration ();
|
||||||
void fetch_missing (const lay::Salt &salt, const lay::Salt &salt_mine, tl::AbsoluteProgress &progress);
|
void fetch_missing (const lay::Salt &salt, const lay::Salt &salt_mine, tl::AbsoluteProgress &progress);
|
||||||
|
|
|
||||||
|
|
@ -487,7 +487,7 @@ SaltGrain::load (tl::InputStream &p)
|
||||||
void
|
void
|
||||||
SaltGrain::save () const
|
SaltGrain::save () const
|
||||||
{
|
{
|
||||||
save (tl::to_string (QDir (tl::to_qstring (path ())).filePath (tl::to_qstring (grain_filename))));
|
save (tl::to_string (QDir (tl::to_qstring (path ())).filePath (tl::to_qstring (SaltGrain::spec_file ()))));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -503,7 +503,7 @@ SaltGrain::from_path (const std::string &path)
|
||||||
QDir dir (tl::to_qstring (path));
|
QDir dir (tl::to_qstring (path));
|
||||||
|
|
||||||
SaltGrain g;
|
SaltGrain g;
|
||||||
g.load (tl::to_string (dir.filePath (tl::to_qstring (grain_filename))));
|
g.load (tl::to_string (dir.filePath (tl::to_qstring (SaltGrain::spec_file ()))));
|
||||||
g.set_path (tl::to_string (dir.absolutePath ()));
|
g.set_path (tl::to_string (dir.absolutePath ()));
|
||||||
return g;
|
return g;
|
||||||
}
|
}
|
||||||
|
|
@ -552,7 +552,7 @@ SaltGrain::stream_from_url (std::string &generic_url, double timeout, tl::InputH
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
return new tl::InputStream (url);
|
return new tl::InputStream (url + "/" + SaltGrain::spec_file ());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -576,10 +576,10 @@ SaltGrain::is_grain (const std::string &path)
|
||||||
|
|
||||||
if (path[0] != ':') {
|
if (path[0] != ':') {
|
||||||
QDir dir (tl::to_qstring (path));
|
QDir dir (tl::to_qstring (path));
|
||||||
QString gf = dir.filePath (tl::to_qstring (grain_filename));
|
QString gf = dir.filePath (tl::to_qstring (SaltGrain::spec_file ()));
|
||||||
return QFileInfo (gf).exists ();
|
return QFileInfo (gf).exists ();
|
||||||
} else {
|
} else {
|
||||||
return QResource (tl::to_qstring (path + "/" + grain_filename)).isValid ();
|
return QResource (tl::to_qstring (path + "/" + SaltGrain::spec_file ())).isValid ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue