[Libosinfo] [PATCH 1/4] Add release status info to OS entries
Zeeshan Ali (Khattak)
zeeshanak at gnome.org
Tue Nov 26 16:00:37 UTC 2013
Applications can use this to determine if an OS is an actual released
OS, a pre-release or a development snapshot.
Co-author: Christophe Fergeau <cfergeau at redhat.com>
---
data/schemas/libosinfo.rng | 11 +++++++++++
osinfo/libosinfo.syms | 5 +++++
osinfo/osinfo_loader.c | 1 +
osinfo/osinfo_os.c | 19 +++++++++++++++++++
osinfo/osinfo_os.h | 21 +++++++++++++++++++--
5 files changed, 55 insertions(+), 2 deletions(-)
diff --git a/data/schemas/libosinfo.rng b/data/schemas/libosinfo.rng
index d491832..a504266 100644
--- a/data/schemas/libosinfo.rng
+++ b/data/schemas/libosinfo.rng
@@ -481,6 +481,9 @@
<optional>
<ref name='devices-rel'/>
</optional>
+ <optional>
+ <ref name='release-status'/>
+ </optional>
<zeroOrMore>
<ref name='resources'/>
</zeroOrMore>
@@ -740,4 +743,12 @@
<param name="pattern">strict|warn|none</param>
</data>
</define>
+
+ <define name='release-status'>
+ <element name='release-status'>
+ <data type="string">
+ <param name="pattern">snapshot|prerelease|released</param>
+ </data>
+ </element>
+ </define>
</grammar>
diff --git a/osinfo/libosinfo.syms b/osinfo/libosinfo.syms
index ccd7c30..fa5be4e 100644
--- a/osinfo/libosinfo.syms
+++ b/osinfo/libosinfo.syms
@@ -444,6 +444,11 @@ LIBOSINFO_0.2.8 {
osinfo_product_get_release_date_string;
} LIBOSINFO_0.2.7;
+LIBOSINFO_0.2.9 {
+ osinfo_os_get_release_status;
+ osinfo_release_status_get_type;
+} LIBOSINFO_0.2.8;
+
/* Symbols in next release...
LIBOSINFO_0.0.2 {
diff --git a/osinfo/osinfo_loader.c b/osinfo/osinfo_loader.c
index 9873cbd..bb7e9a4 100644
--- a/osinfo/osinfo_loader.c
+++ b/osinfo/osinfo_loader.c
@@ -1166,6 +1166,7 @@ static void osinfo_loader_os(OsinfoLoader *loader,
const OsinfoEntityKey keys[] = {
{ OSINFO_OS_PROP_FAMILY, G_TYPE_STRING },
{ OSINFO_OS_PROP_DISTRO, G_TYPE_STRING },
+ { OSINFO_OS_PROP_RELEASE_STATUS, G_TYPE_STRING },
{ NULL, G_TYPE_INVALID }
};
diff --git a/osinfo/osinfo_os.c b/osinfo/osinfo_os.c
index 638d9c1..8d1cc66 100644
--- a/osinfo/osinfo_os.c
+++ b/osinfo/osinfo_os.c
@@ -402,6 +402,25 @@ const gchar *osinfo_os_get_distro(OsinfoOs *os)
}
/**
+ * osinfo_os_get_release_status:
+ * @os: an #OsinfoOs
+ *
+ * Use this to determine the release status of the @os.
+ *
+ * Returns: (transfer none): release status of @os.
+ */
+OsinfoReleaseStatus osinfo_os_get_release_status(OsinfoOs *os)
+{
+ g_return_val_if_fail(OSINFO_IS_OS(os), OSINFO_RELEASE_STATUS_RELEASED);
+
+ return osinfo_entity_get_param_value_enum
+ (OSINFO_ENTITY(os),
+ OSINFO_OS_PROP_RELEASE_STATUS,
+ OSINFO_TYPE_RELEASE_STATUS,
+ OSINFO_RELEASE_STATUS_RELEASED);
+}
+
+/**
* osinfo_os_get_media_list:
* @os: an operating system
*
diff --git a/osinfo/osinfo_os.h b/osinfo/osinfo_os.h
index d667e3b..433c511 100644
--- a/osinfo/osinfo_os.h
+++ b/osinfo/osinfo_os.h
@@ -55,8 +55,9 @@ typedef struct _OsinfoOsClass OsinfoOsClass;
typedef struct _OsinfoOsPrivate OsinfoOsPrivate;
-#define OSINFO_OS_PROP_FAMILY "family"
-#define OSINFO_OS_PROP_DISTRO "distro"
+#define OSINFO_OS_PROP_FAMILY "family"
+#define OSINFO_OS_PROP_DISTRO "distro"
+#define OSINFO_OS_PROP_RELEASE_STATUS "release-status"
/* object */
struct _OsinfoOs
@@ -78,6 +79,21 @@ struct _OsinfoOsClass
/* class members */
};
+/**
+ * OsinfoReleaseStatus:
+ * @OSINFO_RELEASE_STATUS_RELEASED: A released OS.
+ * @OSINFO_RELEASE_STATUS_SNAPSHOT: A continuous integration snapshot and not
+ * an actual released product yet. For example, gnome-continuous images for
+ * development snapshots of GNOME and nightly build ISOs of Fedora etc.
+ * @OSINFO_RELEASE_STATUS_PRERELEASE: A pre-release. For example, alpha and
+ * beta pre-releases of Fedora etc.
+ */
+typedef enum {
+ OSINFO_RELEASE_STATUS_RELEASED,
+ OSINFO_RELEASE_STATUS_SNAPSHOT,
+ OSINFO_RELEASE_STATUS_PRERELEASE
+} OsinfoReleaseStatus;
+
GType osinfo_os_get_type(void);
OsinfoOs *osinfo_os_new(const gchar *id);
@@ -93,6 +109,7 @@ OsinfoDeviceLinkList *osinfo_os_get_device_links(OsinfoOs *os, OsinfoFilter *fil
OsinfoDeviceLink *osinfo_os_add_device(OsinfoOs *os, OsinfoDevice *dev);
const gchar *osinfo_os_get_family(OsinfoOs *os);
const gchar *osinfo_os_get_distro(OsinfoOs *os);
+OsinfoReleaseStatus osinfo_os_get_release_status(OsinfoOs *os);
OsinfoMediaList *osinfo_os_get_media_list(OsinfoOs *os);
void osinfo_os_add_media(OsinfoOs *os, OsinfoMedia *media);
OsinfoTreeList *osinfo_os_get_tree_list(OsinfoOs *os);
--
1.8.4.2
More information about the Libosinfo
mailing list