mirror of https://github.com/KLayout/klayout.git
Introducing sparse tag for salt mine repo to indicate it is not required to always download package information
This commit is contained in:
parent
579bee3b75
commit
880c8fbb05
|
|
@ -28,6 +28,7 @@
|
|||
#include "tlLog.h"
|
||||
#include "tlInternational.h"
|
||||
#include "tlWebDAV.h"
|
||||
#include "tlEnv.h"
|
||||
#if defined(HAVE_GIT2)
|
||||
# include "tlGit.h"
|
||||
#endif
|
||||
|
|
@ -69,6 +70,13 @@ Salt::root ()
|
|||
return m_root;
|
||||
}
|
||||
|
||||
bool
|
||||
Salt::download_package_information () const
|
||||
{
|
||||
// $KLAYOUT_ALWAYS_DOWNLOAD_PACKAGE_INFO
|
||||
return tl::app_flag ("always-download-package-info") || m_root.sparse ();
|
||||
}
|
||||
|
||||
Salt::flat_iterator
|
||||
Salt::begin_flat ()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -199,6 +199,11 @@ public:
|
|||
*/
|
||||
SaltGrains &root ();
|
||||
|
||||
/**
|
||||
* @brief Gets a value indicating whether the collection wants package information to be downloaded always
|
||||
*/
|
||||
bool download_package_information () const;
|
||||
|
||||
signals:
|
||||
/**
|
||||
* @brief A signal triggered before one of the collections changed
|
||||
|
|
|
|||
|
|
@ -39,14 +39,6 @@ namespace lay
|
|||
|
||||
// ----------------------------------------------------------------------------------
|
||||
|
||||
static bool download_package_information ()
|
||||
{
|
||||
// $KLAYOUT_ALWAYS_DOWNLOAD_PACKAGE_INFO
|
||||
return tl::app_flag ("always-download-package-info");
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
|
||||
ConfirmationDialog::ConfirmationDialog (QWidget *parent)
|
||||
: QDialog (parent), m_confirmed (false), m_cancelled (false), m_aborted (false), m_file (50000, true)
|
||||
{
|
||||
|
|
@ -327,6 +319,9 @@ SaltDownloadManager::fetch_missing (const lay::Salt &salt, const lay::Salt &salt
|
|||
// Downloading is required if:
|
||||
// - A package download is requested without a name (package can't be looked up in the package index)
|
||||
// - Or a name is given, but not found in the package index
|
||||
//
|
||||
// Downloading can be bypassed if the package index (salt mine) specifies "sparse=false".
|
||||
// In that case, the package index will have all information about the package.
|
||||
|
||||
if (! p->name.empty ()) {
|
||||
|
||||
|
|
@ -349,7 +344,7 @@ SaltDownloadManager::fetch_missing (const lay::Salt &salt, const lay::Salt &salt
|
|||
|
||||
}
|
||||
|
||||
if (! p->downloaded && download_package_information ()) {
|
||||
if (! p->downloaded && salt_mine.download_package_information ()) {
|
||||
|
||||
// If requested, download package information to complete information from index or dependencies
|
||||
if (tl::verbosity() >= 10) {
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ namespace lay
|
|||
{
|
||||
|
||||
SaltGrains::SaltGrains ()
|
||||
: m_sparse (true)
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
|
@ -54,6 +55,12 @@ SaltGrains::set_name (const std::string &n)
|
|||
m_name = n;
|
||||
}
|
||||
|
||||
void
|
||||
SaltGrains::set_sparse (const bool &f)
|
||||
{
|
||||
m_sparse = f;
|
||||
}
|
||||
|
||||
void
|
||||
SaltGrains::set_title (const std::string &t)
|
||||
{
|
||||
|
|
@ -302,6 +309,7 @@ SaltGrains::consolidate ()
|
|||
|
||||
static tl::XMLElementList s_group_struct =
|
||||
tl::make_member (&SaltGrains::name, &SaltGrains::set_name, "name") +
|
||||
tl::make_member (&SaltGrains::sparse, &SaltGrains::set_sparse, "sparse") +
|
||||
tl::make_member (&SaltGrains::include, "include") +
|
||||
tl::make_element (&SaltGrains::begin_collections, &SaltGrains::end_collections, &SaltGrains::add_collection, "group", &s_group_struct) +
|
||||
tl::make_element (&SaltGrains::begin_grains, &SaltGrains::end_grains, &SaltGrains::add_grain, "salt-grain", SaltGrain::xml_elements ());
|
||||
|
|
@ -354,6 +362,9 @@ SaltGrains::include (const std::string &src_in)
|
|||
|
||||
lay::SaltGrains g;
|
||||
g.load (src);
|
||||
if (g.sparse ()) {
|
||||
m_sparse = true;
|
||||
}
|
||||
m_collections.splice (m_collections.end (), g.m_collections);
|
||||
m_grains.splice (m_grains.end (), g.m_grains);
|
||||
|
||||
|
|
|
|||
|
|
@ -78,6 +78,24 @@ public:
|
|||
*/
|
||||
void set_name (const std::string &p);
|
||||
|
||||
/**
|
||||
* @brief Gets a value indicating that the information in the grain collection is sparse
|
||||
*
|
||||
* If this flag is set to true (the default), the information in the collection needs
|
||||
* to be completed by pulling the original definition of the grain for the grain's URL.
|
||||
* If the flag is false, the information is complete and reflects the grain's original
|
||||
* definition.
|
||||
*/
|
||||
const bool &sparse () const
|
||||
{
|
||||
return m_sparse;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Sets a value indicating that the information in the grain collection is sparse
|
||||
*/
|
||||
void set_sparse (const bool &f);
|
||||
|
||||
/**
|
||||
* @brief Gets the title of the grain collection
|
||||
*
|
||||
|
|
@ -225,6 +243,7 @@ private:
|
|||
collections_type m_collections;
|
||||
grains_type m_grains;
|
||||
std::string m_url;
|
||||
bool m_sparse;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,14 +52,6 @@ namespace lay
|
|||
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
static bool download_package_information ()
|
||||
{
|
||||
// $KLAYOUT_ALWAYS_DOWNLOAD_PACKAGE_INFO
|
||||
return tl::app_flag ("always-download-package-info");
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* @brief A tiny dialog to select a template and a name for the grain
|
||||
*/
|
||||
|
|
@ -1238,7 +1230,7 @@ SaltManagerDialog::get_remote_grain_info (lay::SaltGrain *g, SaltGrainDetailsTex
|
|||
mp_downloaded_target = details;
|
||||
m_salt_mine_grain.reset (new lay::SaltGrain (*g));
|
||||
|
||||
if (download_package_information ()) {
|
||||
if (m_salt_mine.download_package_information () && m_salt_mine.grain_by_name (g->name ())) {
|
||||
|
||||
// Download actual grain definition file
|
||||
try {
|
||||
|
|
|
|||
Loading…
Reference in New Issue