[Libosinfo] [libosinfo 1/4] Add an optional 'is-snapshot' tag to OS entries

Marc-André Lureau marcandre.lureau at gmail.com
Thu Nov 7 00:17:56 UTC 2013


It's silly, but I think it's worth using the tag name 'pre-release'
over 'is-snapshot', as I wouldn't be surprised if some day libosinfo
would have to differentiate between disk/image snapshot and
"official/clean" pre-release. (one could have various
personal/modified "snapshots of a particular pre-release", not the
other way around)

On Wed, Nov 6, 2013 at 2:43 PM, Christophe Fergeau <cfergeau at redhat.com> 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.
>
> Based on a patch from Zeeshan Ali
> ---
>  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 d491832..88e5fbf 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 9716935..0be18b8 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_IS_SNAPSHOT, G_TYPE_BOOLEAN },
>          { NULL, G_TYPE_INVALID }
>      };
>
> 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



-- 
Marc-André Lureau




More information about the Libosinfo mailing list