Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 1623 #1624

Merged
merged 2 commits into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/lay/lay/laySaltController.cc
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@ SaltController::install_packages (const std::vector<std::string> &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)));
Expand Down
6 changes: 3 additions & 3 deletions src/lay/lay/laySaltDownloadManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ ConfirmationDialog::finish ()

SaltDownloadManager::SaltDownloadManager ()
{
// .. nothing yet ..
m_always_download_package_information = false;
}

void
Expand Down Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down
17 changes: 17 additions & 0 deletions src/lay/lay/laySaltDownloadManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down Expand Up @@ -176,6 +192,7 @@ Q_OBJECT
};

std::vector<Descriptor> 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);
Expand Down
10 changes: 5 additions & 5 deletions src/lay/lay/laySaltGrain.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
}
Expand Down Expand Up @@ -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 ());

}
}
Expand All @@ -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 ();
}
}

Expand Down
Loading