[Beignet] [PATCH RFC] Add AppStream metadata

Yang, Rong R rong.r.yang at intel.com
Tue Feb 28 08:40:59 UTC 2017


metadata_license is just the license for this XML, right?
If so, MIT is ok for me, what your opinion? 
I have no problem with id section.

open(os.path.join(source_directory,"src/cl_device_data.h"),"r",encoding= 'utf-8')
has an error in python2.x:
TypeError: 'encoding' is an invalid keyword argument for this function
Add `from io import open` can fix it.

The other part LGTM.
Thanks.

> -----Original Message-----
> From: Beignet [mailto:beignet-bounces at lists.freedesktop.org] On Behalf Of
> Rebecca N. Palmer
> Sent: Monday, January 16, 2017 7:18
> To: beignet at lists.freedesktop.org
> Subject: [Beignet] [PATCH RFC] Add AppStream metadata
> 
> AppStream is a standard for software metadata, including what hardware a
> driver supports:
> https://www.freedesktop.org/software/appstream/docs/chap-
> Metadata.html
> 
> Signed-off-by: Rebecca N. Palmer <rebecca_palmer at zoho.com>
> ---
> Before this is pushed, <metadata_license> needs to be filled in:
> AppStream prefer a permissive license (such as CC0-1.0 or MIT) for metadata
> to allow it to easily be combined into a distribution-wide file, and I hereby
> agree to this for the contents of this patch, but as the supported hardware
> list is extracted from the source (to make sure it is kept up to date), this
> might also need your agreement.
> 
> <id> recommends the reverseddomainname.softwarename format simply
> as a convenient way to ensure it is unique: it need not be related to <url>.  If
> you prefer to use one of your other domains (e.g.
> org.01.beignet) you need to change all the places it appears in this patch,
> including the filename.
> 
> diff --git a/CMakeLists.txt b/CMakeLists.txt index a24ccb9..aa9a32d 100644
> --- a/CMakeLists.txt
> +++ b/CMakeLists.txt
> @@ -37,6 +37,7 @@ INCLUDE (GNUInstallDirs OPTIONAL)  # support old
> CMake without GNUInstallDirs  if (NOT CMAKE_INSTALL_FULL_LIBDIR)
>    set (CMAKE_INSTALL_FULL_LIBDIR "${CMAKE_INSTALL_PREFIX}/lib")
> +  set (CMAKE_INSTALL_FULL_DATADIR "${CMAKE_INSTALL_PREFIX}/share")
>    set (BEIGNET_LIBRARY_ARCHITECTURE "")  else (NOT
> CMAKE_INSTALL_FULL_LIBDIR)
>    set (BEIGNET_LIBRARY_ARCHITECTURE
> "${CMAKE_LIBRARY_ARCHITECTURE}") @@ -317,6 +318,10 @@
> IF(BUILD_EXAMPLES)
>  ADD_SUBDIRECTORY(examples)
>  ENDIF(BUILD_EXAMPLES)
> 
> +add_custom_target(metainfo ALL
> +                  COMMAND ${PYTHON_EXECUTABLE}
> +${CMAKE_CURRENT_SOURCE_DIR}/update_metainfo_xml.py
> +"${LIBCL_DRIVER_VERSION_MAJOR}.${LIBCL_DRIVER_VERSION_MINOR}.${
> LIBCL_DR
> +IVER_VERSION_PATCH}" ${CMAKE_CURRENT_BINARY_DIR}) install (FILES
> +${CMAKE_CURRENT_BINARY_DIR}/com.intel.beignet.metainfo.xml
> DESTINATION
> +${CMAKE_INSTALL_FULL_DATADIR}/metainfo)
> +
>  SET(CPACK_SET_DESTDIR ON)
>  SET(CPACK_PACKAGE_VERSION_MAJOR
> "${LIBCL_DRIVER_VERSION_MAJOR}")
> SET(CPACK_PACKAGE_VERSION_MINOR
> "${LIBCL_DRIVER_VERSION_MINOR}") diff --git
> a/com.intel.beignet.metainfo.xml.in b/com.intel.beignet.metainfo.xml.in
> new file mode 100644
> index 0000000..66b74d0
> --- /dev/null
> +++ b/com.intel.beignet.metainfo.xml.in
> @@ -0,0 +1,18 @@
> +<?xml version="1.0" encoding="UTF-8"?>
> +<component type="driver">
> +<id>com.intel.beignet</id>
> +<name>Beignet</name>
> +<summary>OpenCL (GPU compute) driver for Intel GPUs</summary>
> +<description>This allows using Intel integrated GPUs for general
> +computation, speeding up some applications.</description> <provides>
> + at modalias_list@ </provides> <metadata_license></metadata_license>
> +<project_license>LGPL-2.1+</project_license>
> +<url
> +type="homepage">https://www.freedesktop.org/wiki/Software/Beignet/
> </url
> +> <url
> +type="bugtracker">https://bugs.freedesktop.org/buglist.cgi?product=Beig
> +net&component=Beignet&resolution=---</url>
> +<developer_name>Intel</developer_name>
> +<releases>
> +<release version="@version@"></release> </releases> </component>
> diff --git a/update_metainfo_xml.py b/update_metainfo_xml.py new file
> mode 100755 index 0000000..7d5278c
> --- /dev/null
> +++ b/update_metainfo_xml.py
> @@ -0,0 +1,31 @@
> +#!/usr/bin/python
> +
> +import re
> +import sys
> +import os.path
> +
> +if len(sys.argv) != 3:
> +    raise TypeError("requires version_string and output_directory")
> +version_string = sys.argv[1] output_directory = sys.argv[2]
> +source_directory = os.path.dirname(sys.argv[0]) source_file =
> +open(os.path.join(source_directory,"src/cl_device_data.h"),"r",encoding
> += 'utf-8') device_ids = [] supported = False # first few devices in the
> +file aren't supported for line in source_file:
> +    device_id = re.match(r"#define\s+PCI_CHIP_([A-Za-z0-9_]+)\s+0x([0-9A-
> Fa-f]+)",line)
> +    if device_id is None:
> +        continue
> +    if "IVYBRIDGE" in device_id.group(1):
> +        supported = True # start of supported devices
> +    if supported:
> +        device_ids.append(device_id.group(2).upper())
> +source_file.close()
> +modalias_list_string =
> +"\n".join("<modalias>pci:v00008086d0000{}*</modalias>".format(device_i
> d
> +) for device_id in sorted(device_ids)) metadata_file_in =
> +open(os.path.join(source_directory,"com.intel.beignet.metainfo.xml.in")
> +,"r",encoding = 'utf-8') metadata_string = metadata_file_in.read()
> +metadata_file_in.close()
> +metadata_string =
> +metadata_string.replace("@modalias_list@",modalias_list_string).replace
> +("@version@",version_string) metadata_file_out =
> +open(os.path.join(output_directory,"com.intel.beignet.metainfo.xml"),"w
> +",encoding = 'utf-8')
> +metadata_file_out.write(metadata_string)
> +metadata_file_out.close()
> 
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/beignet


More information about the Beignet mailing list