[Libosinfo] [v2] Add an optional 'snapshot' tag to OS entries

Christophe Fergeau cfergeau at redhat.com
Mon Nov 4 09:22:55 UTC 2013


NACK, Daniel's comments still stand, and
https://www.redhat.com/archives/libosinfo/2013-October/msg00015.html is not
useful at all to convince people that we should go with this for now, or
to help out.

Christophe

On Sun, Nov 03, 2013 at 06:23:06PM +0000, Zeeshan Ali (Khattak) wrote:
> Applications can use this to determine if an OS is just a snapshot and
> not an actual released product yet. For example, gnome-continuous images
> for development snapshots of GNOME and pre-release and nightly build ISOs
> of Fedora etc.
> ---
>  data/schemas/libosinfo.rng |  5 +++++
>  osinfo/libosinfo.syms      |  4 ++++
>  osinfo/osinfo_loader.c     |  1 +
>  osinfo/osinfo_os.c         | 18 ++++++++++++++++++
>  osinfo/osinfo_os.h         |  6 ++++--
>  5 files changed, 32 insertions(+), 2 deletions(-)
> 
> diff --git a/data/schemas/libosinfo.rng b/data/schemas/libosinfo.rng
> index 735ced0..1e572e2 100644
> --- a/data/schemas/libosinfo.rng
> +++ b/data/schemas/libosinfo.rng
> @@ -481,6 +481,11 @@
>          <optional>
>            <ref name='devices-rel'/>
>          </optional>
> +        <optional>
> +          <element name='is-snapshot'>
> +            <ref name='bool'/>
> +          </element>
> +        </optional>
>          <zeroOrMore>
>            <ref name='resources'/>
>          </zeroOrMore>
> diff --git a/osinfo/libosinfo.syms b/osinfo/libosinfo.syms
> index ccd7c30..85ae67a 100644
> --- a/osinfo/libosinfo.syms
> +++ b/osinfo/libosinfo.syms
> @@ -444,6 +444,10 @@ LIBOSINFO_0.2.8 {
>  	osinfo_product_get_release_date_string;
>  } LIBOSINFO_0.2.7;
>  
> +LIBOSINFO_0.2.9 {
> +	osinfo_os_get_is_snapshot;
> +} 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 f852de8..0c873a0 100644
> --- a/osinfo/osinfo_loader.c
> +++ b/osinfo/osinfo_loader.c
> @@ -1097,6 +1097,7 @@ static void osinfo_loader_os(OsinfoLoader *loader,
>      const gchar *const keys[] = {
>          OSINFO_OS_PROP_FAMILY,
>          OSINFO_OS_PROP_DISTRO,
> +        OSINFO_OS_PROP_IS_SNAPSHOT,
>          NULL
>      };
>      if (!id) {
> diff --git a/osinfo/osinfo_os.c b/osinfo/osinfo_os.c
> index 638d9c1..5544036 100644
> --- a/osinfo/osinfo_os.c
> +++ b/osinfo/osinfo_os.c
> @@ -402,6 +402,24 @@ const gchar *osinfo_os_get_distro(OsinfoOs *os)
>  }
>  
>  /**
> + * osinfo_os_get_is_snapshot:
> + * @os: an #OsinfoOs
> + *
> + * Use this to determine if @os is just a snapshot and not an actual released
> + * product yet. For example, gnome-continuous images for development snapshots
> + * of GNOME and pre-release and nightly build ISOs of Fedora etc.
> + *
> + * Returns: (transfer none): %TRUE if @os is a snapshot, %FALSE otherwise.
> + */
> +gboolean osinfo_os_get_is_snapshot(OsinfoOs *os)
> +{
> +    g_return_val_if_fail(OSINFO_IS_OS(os), FALSE);
> +
> +    return osinfo_entity_get_param_value_boolean(OSINFO_ENTITY(os),
> +                                                 "is-snapshot");
> +}
> +
> +/**
>   * osinfo_os_get_media_list:
>   * @os: an operating system
>   *
> diff --git a/osinfo/osinfo_os.h b/osinfo/osinfo_os.h
> index d667e3b..93b5961 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_IS_SNAPSHOT "is-snapshot"
>  
>  /* object */
>  struct _OsinfoOs
> @@ -93,6 +94,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);
> +gboolean osinfo_os_get_is_snapshot(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
> 
> _______________________________________________
> Libosinfo mailing list
> Libosinfo at redhat.com
> https://www.redhat.com/mailman/listinfo/libosinfo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libosinfo/attachments/20131104/23a9eac4/attachment.sig>


More information about the Libosinfo mailing list