File indexing completed on 2024-11-24 04:55:00
0001 /* 0002 * SPDX-FileCopyrightText: 2022 Timothée Ravier <tim@siosm.fr> 0003 * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0004 */ 0005 0006 #ifndef OSTREEFORMAT_H 0007 #define OSTREEFORMAT_H 0008 0009 #include <QObject> 0010 #include <QString> 0011 0012 /* 0013 * Represents the different formats used by ostree to deliver images and updates. 0014 * 0015 * For the classic ostree format, see: 0016 * - https://ostreedev.github.io/ostree/repo/#refs 0017 * 0018 * For the new container format, see: 0019 * - https://github.com/ostreedev/ostree-rs-ext 0020 * - https://coreos.github.io/rpm-ostree/container/ 0021 */ 0022 class OstreeFormat : public QObject 0023 { 0024 Q_GADGET 0025 public: 0026 /* The format used by ostree to deliver updates */ 0027 enum Format { 0028 // Classic ostree format with a remote (repo), branch and ref logic similar to Git 0029 Classic = 0, 0030 // Container based format (ostree commit encapsulated into a container), with a repo 0031 // and tag logic 0032 OCI, 0033 // Unknown format, used for errors 0034 Unknown, 0035 }; 0036 Q_ENUM(Format) 0037 0038 OstreeFormat(Format format, const QString &source); 0039 0040 bool isValid() const; 0041 bool isClassic() const; 0042 bool isOCI() const; 0043 0044 QString repo() const; 0045 QString tag() const; 0046 0047 QString transport() const; 0048 QString remote() const; 0049 QString ref() const; 0050 0051 private: 0052 bool parseTransport(QStringList *); 0053 0054 /* Store the format used by ostree to pull each deployment */ 0055 Format m_format; 0056 0057 /* For the classic format: the ostree remote where the image come from 0058 * For the OCI format: The container repo URL */ 0059 QString m_remote; 0060 0061 /* For the classic format: the ostree ref (branch/name/version) used for the image 0062 * For the OCI format: The container image tag */ 0063 QString m_branch; 0064 0065 /* Only for the OCI format: The transport method used to get the container. 0066 * Also includes the Ostree remote when used for signature validation */ 0067 QString m_transport; 0068 }; 0069 0070 #endif