Initial upload of HyprArch releng configuration

This commit is contained in:
2026-03-03 20:31:33 +00:00
commit 7df61351c0
634 changed files with 36355 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
/* === This file is part of Calamares - <https://calamares.io> ===
*
* SPDX-FileCopyrightText: 2020 Adriaan de Groot <groot@kde.org>
* SPDX-License-Identifier: GPL-3.0-or-later
*
* Calamares is Free Software: see the License-Identifier above.
*
*/
#ifndef GEOIP_GEOIPFIXED_H
#define GEOIP_GEOIPFIXED_H
#include "Interface.h"
namespace Calamares
{
namespace GeoIP
{
/** @brief GeoIP with a fixed return value
*
* The data is ignored entirely and the attribute value is returned unchanged.
* Note that you still need to provide a usable URL for a successful GeoIP
* lookup -- the URL's data is just ignored.
*
* @note This class is an implementation detail.
*/
class GeoIPFixed : public Interface
{
public:
/** @brief Configure the value to return from rawReply()
*
* An empty string, which would not be a valid zone name, is
* translated to "Europe/Amsterdam".
*/
explicit GeoIPFixed( const QString& value = QString() );
virtual RegionZonePair processReply( const QByteArray& ) override;
virtual QString rawReply( const QByteArray& ) override;
};
} // namespace GeoIP
} // namespace Calamares
#endif

View File

@@ -0,0 +1,44 @@
/* === This file is part of Calamares - <https://calamares.io> ===
*
* SPDX-FileCopyrightText: 2018-2019 Adriaan de Groot <groot@kde.org>
* SPDX-License-Identifier: GPL-3.0-or-later
*
* Calamares is Free Software: see the License-Identifier above.
*
*/
#ifndef GEOIP_GEOIPJSON_H
#define GEOIP_GEOIPJSON_H
#include "Interface.h"
namespace Calamares
{
namespace GeoIP
{
/** @brief GeoIP lookup for services that return JSON.
*
* This is the original implementation of GeoIP lookup,
* (e.g. using the FreeGeoIP.net service), or similar.
*
* The data is assumed to be in JSON format with a time_zone attribute.
*
* @note This class is an implementation detail.
*/
class GeoIPJSON : public Interface
{
public:
/** @brief Configure the attribute name which is selected.
*
* If an empty string is passed in (not a valid attribute name),
* then "time_zone" is used.
*/
explicit GeoIPJSON( const QString& attribute = QString() );
virtual RegionZonePair processReply( const QByteArray& ) override;
virtual QString rawReply( const QByteArray& ) override;
};
} // namespace GeoIP
} // namespace Calamares
#endif

View File

@@ -0,0 +1,37 @@
/* === This file is part of Calamares - <https://calamares.io> ===
*
* SPDX-FileCopyrightText: 2018 Adriaan de Groot <groot@kde.org>
* SPDX-License-Identifier: GPL-3.0-or-later
*
* Calamares is Free Software: see the License-Identifier above.
*
*/
#ifndef GEOIPTESTS_H
#define GEOIPTESTS_H
#include <QObject>
class GeoIPTests : public QObject
{
Q_OBJECT
public:
GeoIPTests();
~GeoIPTests() override;
private Q_SLOTS:
void initTestCase();
void testFixed();
void testJSON();
void testJSONalt();
void testJSONbad();
void testXML();
void testXML2();
void testXMLalt();
void testXMLbad();
void testSplitTZ();
void testGet();
};
#endif

View File

@@ -0,0 +1,44 @@
/* === This file is part of Calamares - <https://calamares.io> ===
*
* SPDX-FileCopyrightText: 2018-2019 Adriaan de Groot <groot@kde.org>
* SPDX-License-Identifier: GPL-3.0-or-later
*
* Calamares is Free Software: see the License-Identifier above.
*
*/
#ifndef GEOIP_GEOIPXML_H
#define GEOIP_GEOIPXML_H
#include "Interface.h"
namespace Calamares
{
namespace GeoIP
{
/** @brief GeoIP lookup with XML data
*
* The data is assumed to be in XML format with a
* <Response><TimeZone></TimeZone></Response>
* element, which contains the text (string) for the region/zone. This
* format is expected by, e.g. the Ubiquity installer.
*
* @note This class is an implementation detail.
*/
class GeoIPXML : public Interface
{
public:
/** @brief Configure the element tag which is selected.
*
* If an empty string is passed in (not a valid element tag),
* then "TimeZone" is used.
*/
explicit GeoIPXML( const QString& element = QString() );
virtual RegionZonePair processReply( const QByteArray& ) override;
virtual QString rawReply( const QByteArray& ) override;
};
} // namespace GeoIP
} // namespace Calamares
#endif

View File

@@ -0,0 +1,86 @@
/* === This file is part of Calamares - <https://calamares.io> ===
*
* SPDX-FileCopyrightText: 2019 Adriaan de Groot <groot@kde.org>
* SPDX-License-Identifier: GPL-3.0-or-later
*
* Calamares is Free Software: see the License-Identifier above.
*
*/
#ifndef GEOIP_HANDLER_H
#define GEOIP_HANDLER_H
#include "Interface.h"
#include <QString>
#include <QVariantMap>
#include <QtConcurrent/QtConcurrentRun>
namespace Calamares
{
namespace GeoIP
{
/** @brief Handle one complete GeoIP lookup.
*
* This class handles one complete GeoIP lookup. Create it with
* suitable configuration values, then call get(). This is a
* synchronous API and will return an invalid zone pair on
* error or if the configuration is not understood. For an
* async API, use query().
*/
class DLLEXPORT Handler
{
public:
enum class Type
{
None, // No lookup, returns empty string
JSON, // JSON-formatted data, returns extracted field
XML, // XML-formatted data, returns extracted field
Fixed // Returns selector string verbatim
};
/** @brief An unconfigured handler; this always returns errors. */
Handler();
/** @brief A handler for a specific GeoIP source.
*
* The @p implementation name selects an implementation; currently JSON and XML
* are supported. The @p url is retrieved by query() and then the @p selector
* is used to select something from the data returned by the @url.
*/
Handler( const QString& implementation, const QString& url, const QString& selector );
~Handler();
/** @brief Synchronously get the GeoIP result.
*
* If the Handler is valid, then do the actual fetching and interpretation
* of data and return the result. An invalid Handler will return an
* invalid (empty) result.
*/
RegionZonePair get() const;
/// @brief Like get, but don't interpret the contents
QString getRaw() const;
/** @brief Asynchronously get the GeoIP result.
*
* See get() for the return value.
*/
QFuture< RegionZonePair > query() const;
/// @brief Like query, but don't interpret the contents
QFuture< QString > queryRaw() const;
bool isValid() const { return m_type != Type::None; }
Type type() const { return m_type; }
QString url() const { return m_url; }
QString selector() const { return m_selector; }
private:
Type m_type;
const QString m_url;
const QString m_selector;
};
} // namespace GeoIP
} // namespace Calamares
#endif

View File

@@ -0,0 +1,127 @@
/* === This file is part of Calamares - <https://calamares.io> ===
*
* SPDX-FileCopyrightText: 2018-2019 Adriaan de Groot <groot@kde.org>
* SPDX-License-Identifier: GPL-3.0-or-later
*
* Calamares is Free Software: see the License-Identifier above.
*
*/
#ifndef GEOIP_INTERFACE_H
#define GEOIP_INTERFACE_H
#include "DllMacro.h"
#include <QDebug>
#include <QString>
#include <QUrl>
#include <tuple>
class QByteArray;
namespace Calamares
{
namespace GeoIP
{
/** @brief A Region, Zone pair of strings
*
* A GeoIP lookup returns a timezone, which is represented as a Region,
* Zone pair of strings (e.g. "Europe" and "Amsterdam"). Generally,
* pasting the strings back together with a "/" is the right thing to
* do. The Zone **may** contain a "/" (e.g. "Kentucky/Monticello").
*/
class DLLEXPORT RegionZonePair
{
public:
/** @brief Construct from two strings, like qMakePair(). */
RegionZonePair( const QString& region, const QString& zone )
: m_region( region )
, m_zone( zone )
{
}
/** @brief Construct from an existing pair. */
RegionZonePair( const RegionZonePair& p )
: RegionZonePair( p.m_region, p.m_zone )
{
}
/** @brief An invalid zone pair (empty strings). */
RegionZonePair() = default;
bool isValid() const { return !m_region.isEmpty(); }
QString region() const { return m_region; }
QString zone() const { return m_zone; }
friend bool operator==( const RegionZonePair& lhs, const RegionZonePair& rhs ) noexcept
{
return std::tie( lhs.m_region, lhs.m_zone ) == std::tie( rhs.m_region, rhs.m_zone );
}
QString asString() const { return isValid() ? region() + QChar( '/' ) + zone() : QString(); }
private:
QString m_region;
QString m_zone;
};
inline QDebug&
operator<<( QDebug&& s, const RegionZonePair& tz )
{
return s << tz.asString();
}
inline QDebug&
operator<<( QDebug& s, const RegionZonePair& tz )
{
return s << tz.asString();
}
/** @brief Splits a region/zone string into a pair.
*
* Cleans up the string by removing backslashes (\\)
* since some providers return silly-escaped names. Replaces
* spaces with _ since some providers return human-readable names.
* Splits on the first / in the resulting string, or returns a
* pair of empty QStrings if it can't. (e.g. America/North Dakota/Beulah
* will return "America", "North_Dakota/Beulah").
*/
DLLEXPORT RegionZonePair splitTZString( const QString& s );
/**
* @brief Interface for GeoIP retrievers.
*
* A GeoIP retriever takes a configured URL (from the config file)
* and can handle the data returned from its interpretation of that
* configured URL, returning a region and zone.
*/
class DLLEXPORT Interface
{
public:
virtual ~Interface();
/** @brief Handle a (successful) request by interpreting the data.
*
* Should return a ( <zone>, <region> ) pair, e.g.
* ( "Europe", "Amsterdam" ). This is called **only** if the
* request to the fullUrl was successful; the handler
* is free to read as much, or as little, data as it
* likes. On error, returns a RegionZonePair with empty
* strings (e.g. ( "", "" ) ).
*/
virtual RegionZonePair processReply( const QByteArray& ) = 0;
/** @brief Get the raw reply data. */
virtual QString rawReply( const QByteArray& ) = 0;
protected:
Interface( const QString& element = QString() );
QString m_element; // string for selecting from data
};
} // namespace GeoIP
} // namespace Calamares
#endif