diff --git a/src/lay/lay/laySaltController.cc b/src/lay/lay/laySaltController.cc index 7862bf4cca..4e5e062a21 100644 --- a/src/lay/lay/laySaltController.cc +++ b/src/lay/lay/laySaltController.cc @@ -179,6 +179,10 @@ SaltController::install_packages (const std::vector &packages, bool { 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; 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))); diff --git a/src/lay/lay/laySaltDownloadManager.cc b/src/lay/lay/laySaltDownloadManager.cc index 753781d573..ef300f8a47 100644 --- a/src/lay/lay/laySaltDownloadManager.cc +++ b/src/lay/lay/laySaltDownloadManager.cc @@ -166,7 +166,7 @@ ConfirmationDialog::finish () SaltDownloadManager::SaltDownloadManager () { - // .. nothing yet .. + m_always_download_package_information = false; } 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 (tl::verbosity() >= 10) { @@ -362,7 +362,7 @@ SaltDownloadManager::fetch_missing (const lay::Salt &salt, const lay::Salt &salt if (! p->downloaded) { 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) { diff --git a/src/lay/lay/laySaltDownloadManager.h b/src/lay/lay/laySaltDownloadManager.h index 477555ada6..ffe408a04b 100644 --- a/src/lay/lay/laySaltDownloadManager.h +++ b/src/lay/lay/laySaltDownloadManager.h @@ -103,6 +103,22 @@ Q_OBJECT */ 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 * @@ -176,6 +192,7 @@ Q_OBJECT }; std::vector m_registry; + bool m_always_download_package_information; bool needs_iteration (); void fetch_missing (const lay::Salt &salt, const lay::Salt &salt_mine, tl::AbsoluteProgress &progress); diff --git a/src/lay/lay/laySaltGrain.cc b/src/lay/lay/laySaltGrain.cc index 6139574b39..f9c3cb1810 100644 --- a/src/lay/lay/laySaltGrain.cc +++ b/src/lay/lay/laySaltGrain.cc @@ -487,7 +487,7 @@ SaltGrain::load (tl::InputStream &p) void 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 @@ -503,7 +503,7 @@ SaltGrain::from_path (const std::string &path) QDir dir (tl::to_qstring (path)); 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 ())); return g; } @@ -552,7 +552,7 @@ SaltGrain::stream_from_url (std::string &generic_url, double timeout, tl::InputH } 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] != ':') { 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 (); } else { - return QResource (tl::to_qstring (path + "/" + grain_filename)).isValid (); + return QResource (tl::to_qstring (path + "/" + SaltGrain::spec_file ())).isValid (); } }