Update and modernize linux metadata files

* Switch to using org.kicad.kicad as the main app ID
* Move the appstream file to a metainfo file
* Rename all metadata files to use the reverse DNS scheme
* Add header matching to mime type files where possible
* Add a mime type for gerber job files
* Add a QA test that verifies all the linux metadata files and
  run it in CI
* Update the visible names in the launcher entries to be more
  consistent with the internal visible names
* Update various strings and items in the metainfo file so they
  are more descriptive and easier to read
This commit is contained in:
Ian McInerney 2021-03-21 14:26:05 +00:00
parent 311bb9c36e
commit 4fc41627e9
35 changed files with 752 additions and 156 deletions

View File

@ -40,3 +40,4 @@ include:
- local: '/.gitlab/Ubuntu-20.04-CI.yml' - local: '/.gitlab/Ubuntu-20.04-CI.yml'
- local: '/.gitlab/Windows-CI.yml' - local: '/.gitlab/Windows-CI.yml'
- local: '/.gitlab/coverity.yml' - local: '/.gitlab/coverity.yml'
- local: '/.gitlab/linux-metadata-validate.yml'

View File

@ -0,0 +1,43 @@
##########################################################################
# Run a validation of the metadata files for Linux
##########################################################################
validate_linux_metadata:
stage: test
needs: []
interruptible: false
# This is the only CI image with the utilities needed for this test
image: registry.gitlab.com/kicad/kicad-ci/source_containers/master/fedora:33
only:
refs:
- master
- branches
- merge_requests
- pushes
changes:
# Only run if the resources, its tests, or the translations are updated
- resources/linux/**/*
- qa/resources/linux/**/*
- translation/**/*
except:
- schedules
# Only build the metadata files in this CI job
script:
- mkdir -p build/linux
- cd build/linux
- cmake
-DCMAKE_BUILD_TYPE=Debug
-DKICAD_STDLIB_LIGHT_DEBUG=ON
-DKICAD_SCRIPTING=ON
-DKICAD_SCRIPTING_MODULES=ON
-DKICAD_SCRIPTING_PYTHON3=ON
-DKICAD_SCRIPTING_WXPYTHON=ON
-DKICAD_SCRIPTING_WXPYTHON_PHOENIX=ON
-DKICAD_SCRIPTING_ACTION_MENU=ON
-DKICAD_USE_OCE=OFF
-DKICAD_USE_OCC=ON
-DKICAD_SPICE=ON
-DKICAD_BUILD_I18N=ON
../../
- make metadata
- cd ../../
- ./qa/resources/linux/verifyMetadataFiles.sh ./ ./build/linux

View File

@ -22,7 +22,7 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
# #
# This file will configure the linux appdata.xml file to include the version # This file will configure the linux metainfo.xml file to include the version
# and build date. # and build date.
# It requires the following variables to be defined before its call: # It requires the following variables to be defined before its call:
@ -38,12 +38,12 @@ include( ${CMAKE_MODULE_PATH}/KiCadFullVersion.cmake )
# Create the date of the configure # Create the date of the configure
string( TIMESTAMP KICAD_CONFIG_TIMESTAMP "%Y-%m-%d" ) string( TIMESTAMP KICAD_CONFIG_TIMESTAMP "%Y-%m-%d" )
# Configure the KiCad appdata file # Configure the KiCad metainfo file
configure_file( ${SRC_PATH}/resources/linux/appdata/kicad.appdata.xml.in configure_file( ${SRC_PATH}/resources/linux/metainfo/org.kicad.kicad.metainfo.xml.in
${BUILD_PATH}/resources/linux/appdata/kicad.appdata.xml.in ${BUILD_PATH}/resources/linux/metainfo/org.kicad.kicad.metainfo.xml.in
@ONLY ) @ONLY )
# Ensure the file was configured successfully # Ensure the file was configured successfully
if( NOT EXISTS ${BUILD_PATH}/resources/linux/appdata/kicad.appdata.xml.in ) if( NOT EXISTS ${BUILD_PATH}/resources/linux/metainfo/org.kicad.kicad.metainfo.xml.in )
message( FATAL_ERROR "Configuration failed to write file kicad.appdata.xml.in" ) message( FATAL_ERROR "Configuration failed to write file org.kicad.kicad.metainfo.xml.in" )
endif() endif()

View File

@ -0,0 +1,10 @@
M48
;DRILL file {Pcbnew (2013-june-11)-stable} date Sun 22 Dec 2013 07:48:59 PM CST
;FORMAT={-:-/ absolute / inch / decimal}
FMAT,2
INCH,TZ
T1C0.025
T2C0.032
T3C0.032
T4C0.120
T5C0.126

View File

@ -0,0 +1,10 @@
M48
;DRILL file {Pcbnew (2013-june-11)-stable} date Sun 22 Dec 2013 07:48:59 PM CST
;FORMAT={-:-/ absolute / inch / decimal}
FMAT,2
INCH,TZ
T1C0.025
T2C0.032
T3C0.032
T4C0.120
T5C0.126

View File

@ -0,0 +1,5 @@
G04 (created by PCBNEW (2013-june-11)-stable) date Sun 22 Dec 2013 07:48:57 PM CST*
%MOIN*%
G04 Gerber Fmt 3.4, Leading zero omitted, Abs format*
%FSLAX34Y34*%
G01*

View File

@ -0,0 +1,8 @@
G04 (created by PCBNEW (2013-june-11)-stable) date Sun 22 Dec 2013 07:48:57 PM CST*
%MOIN*%
G04 Gerber Fmt 3.4, Leading zero omitted, Abs format*
%FSLAX34Y34*%
G01*
G70*
G90*
G04 APERTURE LIST*

View File

@ -0,0 +1,5 @@
G04 (created by PCBNEW (2013-june-11)-stable) date Sun 22 Dec 2013 07:48:57 PM CST*
%MOIN*%
G04 Gerber Fmt 3.4, Leading zero omitted, Abs format*
%FSLAX34Y34*%
G01*

View File

@ -0,0 +1,5 @@
%FSLAX34Y34*%
G04 (created by PCBNEW (2013-june-11)-stable) date Sun 22 Dec 2013 07:48:57 PM CST*
%MOIN*%
G04 Gerber Fmt 3.4, Leading zero omitted, Abs format*
G01*

View File

@ -0,0 +1,7 @@
G75*
G70*
%OFA0B0*%
%FSLAX24Y24*%
%IPPOS*%
%LPD*%
%AMOC8*

View File

@ -0,0 +1,5 @@
%MOIN*%
%FSLAX34Y34*%
G04 (created by PCBNEW (2013-june-11)-stable) date Sun 22 Dec 2013 07:48:57 PM CST*
G04 Gerber Fmt 3.4, Leading zero omitted, Abs format*
G01*

View File

@ -0,0 +1,15 @@
%TF.GenerationSoftware,KiCad,Pcbnew,(5.99.0-9879-gcc9787e47a)*%
%TF.CreationDate,2021-03-20T01:50:30+00:00*%
%TF.ProjectId,pic_programmer,7069635f-7072-46f6-9772-616d6d65722e,rev?*%
%TF.SameCoordinates,Original*%
%TF.FileFunction,Copper,L2,Bot*%
%TF.FilePolarity,Positive*%
%FSLAX46Y46*%
G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)*
G04 Created by KiCad (PCBNEW (5.99.0-9879-gcc9787e47a)) date 2021-03-20 01:50:30*
%MOMM*%
%LPD*%
G01*
G04 APERTURE LIST*
G04 Aperture macros list*
%AMRoundRect*

View File

@ -0,0 +1,19 @@
PCBNEW-BOARD Version 2 date Sun 22 Dec 2013 07:55:02 PM CST
# Created by Pcbnew(2013-june-11)-stable
$GENERAL
encoding utf-8
Units mm
LayerCount 2
EnabledLayers 1FFF8001
Links 102
NoConn 0
Di 68.381879 43.454319 158.927801 139.715241
Ndraw 169
Ntrack 481
Nzone 0
BoardThickness 1.6002
Nmodule 45
Nnets 46
$EndGENERAL

View File

@ -0,0 +1,19 @@
PCBNEW-BOARD Version 2 date Sun 22 Dec 2013 07:55:02 PM CST
# Created by Pcbnew(2013-june-11)-stable
$GENERAL
encoding utf-8
Units mm
LayerCount 2
EnabledLayers 1FFF8001
Links 102
NoConn 0
Di 68.381879 43.454319 158.927801 139.715241
Ndraw 169
Ntrack 481
Nzone 0
BoardThickness 1.6002
Nmodule 45
Nnets 46
$EndGENERAL

View File

@ -0,0 +1,10 @@
(kicad_pcb (version 20210228) (generator pcbnew)
(general
(thickness 1.6)
)
(paper "A4")
(title_block
(title "SERIAL PIC PROGRAMMER")
)

View File

@ -0,0 +1,10 @@
(kicad_pcb (version 20210228) (generator pcbnew)
(general
(thickness 1.6)
)
(paper "A4")
(title_block
(title "SERIAL PIC PROGRAMMER")
)

View File

@ -0,0 +1,22 @@
{
"board": {
"design_settings": {
"defaults": {
"board_outline_line_width": 0.381,
"copper_line_width": 0.381,
"copper_text_italic": false,
"copper_text_size_h": 1.524,
"copper_text_size_v": 2.032,
"copper_text_thickness": 0.30479999999999996,
"copper_text_upright": true,
"courtyard_line_width": 0.049999999999999996,
"dimension_precision": 1,
"dimension_units": 0,
"dimensions": {
"arrow_length": 1270000,
"extension_offset": 500000,
"keep_text_aligned": true,
"suppress_zeroes": false,
"text_position": 0,
"units_format": 1
},

View File

@ -0,0 +1,7 @@
update=21/11/2017 21:19:54
version=1
last_client=kicad
[cvpcb]
version=1
NetIExt=net
[cvpcb/libraries]

View File

@ -0,0 +1,10 @@
(kicad_sch (version 20210126) (generator eeschema)
(paper "A4")
(title_block
(title "JDM - COM84 PIC Programmer with 13V DC/DC converter")
(date "Sun 22 Mar 2015")
(rev "3")
(company "KiCad")
)

View File

@ -0,0 +1,10 @@
(kicad_sch (version 20210126) (generator eeschema)
(paper "A4")
(title_block
(title "JDM - COM84 PIC Programmer with 13V DC/DC converter")
(date "Sun 22 Mar 2015")
(rev "3")
(company "KiCad")
)

View File

@ -0,0 +1,14 @@
EESchema Schematic File Version 2
LIBS:power
LIBS:device
LIBS:transistors
LIBS:conn
LIBS:linear
LIBS:regul
LIBS:74xx
LIBS:cmos4000
LIBS:adc-dac
LIBS:memory
LIBS:xilinx
LIBS:special
LIBS:microcontrollers

View File

@ -0,0 +1,14 @@
EESchema Schematic File Version 2
LIBS:power
LIBS:device
LIBS:transistors
LIBS:conn
LIBS:linear
LIBS:regul
LIBS:74xx
LIBS:cmos4000
LIBS:adc-dac
LIBS:memory
LIBS:xilinx
LIBS:special
LIBS:microcontrollers

View File

@ -0,0 +1,303 @@
#!/bin/bash
# WARNING: This script will modify file assocations and MIME types on the system it
# runs on. Use at your own risk!
# The root of the code directory is the first argument
KICAD_CODE_DIR=$1
# The root of the build directory is the second argument
KICAD_BUILD_DIR=$2
KICAD_LAUNCHER_DIR=$KICAD_BUILD_DIR/resources/linux/launchers
KICAD_METAINFO_DIR=$KICAD_BUILD_DIR/resources/linux/metainfo
KICAD_MIME_DIR=$KICAD_BUILD_DIR/resources/linux/mime
KICAD_ICON_DIR=$KICAD_CODE_DIR/resources/linux/icons/hicolor
KICAD_MIME_TEST_FILES=$KICAD_CODE_DIR/qa/resources/linux/mimeFiles
###################################################################
# Verify the metainfo file
# There are two different checkers we can use, and each distro perfers
# different ones - so lets just test using them both and make them both
# happy.
###################################################################
METAINFO_VALID=1
echo "Validating metainfo files"
# Test using appstreamcli to see its errors
appstreamcli validate --explain --pedantic $KICAD_METAINFO_DIR/org.kicad.kicad.metainfo.xml
[ $? -ne 0 ] && METAINFO_VALID=0
# Test using the appstream-util package to see its errors
appstream-util validate-strict $KICAD_METAINFO_DIR/org.kicad.kicad.metainfo.xml
[ $? -ne 0 ] && METAINFO_VALID=0
if [ $METAINFO_VALID -eq 1 ]
then
echo "Metainfo files passed both checkers successfully"
fi
###################################################################
# Verify the launcher files
###################################################################
LAUNCHERS_VALID=1
echo ""
echo "Validating desktop launcher files"
# Bitmap2component
desktop-file-validate $KICAD_LAUNCHER_DIR/org.kicad.bitmap2component.desktop
[ $? -ne 0 ] && LAUNCHERS_VALID=0
# Eeschema standalone
desktop-file-validate $KICAD_LAUNCHER_DIR/org.kicad.eeschema.desktop
[ $? -ne 0 ] && LAUNCHERS_VALID=0
# GerbView
desktop-file-validate $KICAD_LAUNCHER_DIR/org.kicad.gerbview.desktop
[ $? -ne 0 ] && LAUNCHERS_VALID=0
# Main KiCad application
desktop-file-validate $KICAD_LAUNCHER_DIR/org.kicad.kicad.desktop
[ $? -ne 0 ] && LAUNCHERS_VALID=0
# PCB calculator
desktop-file-validate $KICAD_LAUNCHER_DIR/org.kicad.pcbcalculator.desktop
[ $? -ne 0 ] && LAUNCHERS_VALID=0
# Pcbnew standalond
desktop-file-validate $KICAD_LAUNCHER_DIR/org.kicad.pcbnew.desktop
[ $? -ne 0 ] && LAUNCHERS_VALID=0
if [ $LAUNCHERS_VALID -eq 1 ]
then
echo "All launcher files valid"
else
echo "Errors with launcher files"
fi
###################################################################
# Install the desktop and MIME-type files and update the databases
###################################################################
GERBER_MIME_INSTALLED=0
KICAD_MIME_INSTALLED=0
echo ""
echo "Installing MIME type files for testing"
mkdir -p ~/.local/share/mime
xdg-mime install --mode user $KICAD_MIME_DIR/kicad-gerbers.xml
[ $? -eq 0 ] && GERBER_MIME_INSTALLED=1
xdg-icon-resource install --mode user --context mimetypes --size 128 $KICAD_ICON_DIR/128x128/mimetypes/application-x-kicad-pcb.png
xdg-icon-resource install --mode user --context mimetypes --size 128 $KICAD_ICON_DIR/128x128/mimetypes/application-x-kicad-project.png
xdg-icon-resource install --mode user --context mimetypes --size 128 $KICAD_ICON_DIR/128x128/mimetypes/application-x-kicad-schematic.png
xdg-mime install --mode user $KICAD_MIME_DIR/kicad-kicad.xml
[ $? -eq 0 ] && KICAD_MIME_INSTALLED=1
# Install the desktop files
echo ""
echo "Installing desktop files for testing"
# Ensure the directory exists (it might not in the CI image)
mkdir -p ~/.local/share/applications
# For some reason, desktop-file-install doesn't seem to actually install it properly, so just copy them
cp $KICAD_LAUNCHER_DIR/org.kicad.bitmap2component.desktop ~/.local/share/applications/
cp $KICAD_LAUNCHER_DIR/org.kicad.eeschema.desktop ~/.local/share/applications/
cp $KICAD_LAUNCHER_DIR/org.kicad.gerbview.desktop ~/.local/share/applications/
cp $KICAD_LAUNCHER_DIR/org.kicad.kicad.desktop ~/.local/share/applications/
cp $KICAD_LAUNCHER_DIR/org.kicad.pcbcalculator.desktop ~/.local/share/applications/
cp $KICAD_LAUNCHER_DIR/org.kicad.pcbnew.desktop ~/.local/share/applications/
# Force a database update to get the desktop files and MIME types associated
update-desktop-database ~/.local/share/applications/
update-mime-database ~/.local/share/mime/
###################################################################
# Validate the MIME types
###################################################################
KICAD_MIME_VALID=1
GERBER_MIME_VALID=1
# Fake a Gnome desktop environment to force xdg-mime to query using gio and ensure the MIME types are installed
# for a desktop environment. Otherwise it fallsback to using the "file --mime-type" command, which has prebuilt
# magic files from https://github.com/file/file/blob/master/magic/Magdir/kicad and isn't affected by the MIME
# type files we just installed.
export DE=gnome
# Test install the gerber MIME file to test with it
echo ""
if [ $GERBER_MIME_INSTALLED -eq 1 ]
then
echo "Validating Gerber MIME-type"
# Test the drl extension default
OUT_STR=$(xdg-mime query default application/x-excellon 2>&1)
printf " Testing drill file default application: %s\n" "$OUT_STR"
[[ "$OUT_STR" != "org.kicad.gerbview.desktop" ]] && echo " ERROR" && GERBER_MIME_VALID=0
# Test the gerber extension default
OUT_STR=$(xdg-mime query default application/x-gerber 2>&1)
printf " Testing gerber file default application: %s\n" "$OUT_STR"
[[ "$OUT_STR" != "org.kicad.gerbview.desktop" ]] && echo " ERROR" && GERBER_MIME_VALID=0
# Test the drl extension
OUT_STR=$(xdg-mime query filetype $KICAD_MIME_TEST_FILES/gerbers/drillFiles/drillFile.drl 2>&1)
printf " Testing drill file with extension drl: %s\n" "$OUT_STR"
[[ "$OUT_STR" != "application/x-excellon" ]] && echo " ERROR" && GERBER_MIME_VALID=0
# Test the parsing of the header for M48
OUT_STR=$(xdg-mime query filetype $KICAD_MIME_TEST_FILES/gerbers/drillFiles/drillFileNoExt 2>&1)
printf " Testing drill file header M48 check: %s\n" "$OUT_STR"
[[ "$OUT_STR" != "application/x-excellon" ]] && echo " ERROR" && GERBER_MIME_VALID=0
# Test the official gbr extension
OUT_STR=$(xdg-mime query filetype $KICAD_MIME_TEST_FILES/gerbers/gerberFiles/gerber.gbr 2>&1)
printf " Testing gerber file with gbr extension: %s\n" "$OUT_STR"
[[ "$OUT_STR" != "application/x-gerber" ]] && echo " ERROR" && GERBER_MIME_VALID=0
# Test the parsing of the header for a comment (G04)
OUT_STR=$(xdg-mime query filetype $KICAD_MIME_TEST_FILES/gerbers/gerberFiles/gerberCommentNoExt 2>&1)
printf " Testing gerber file header G04 check: %s\n" "$OUT_STR"
[[ "$OUT_STR" != "application/x-gerber" ]] && echo " ERROR" && GERBER_MIME_VALID=0
# Test the parsing of the header for %FSLA
OUT_STR=$(xdg-mime query filetype $KICAD_MIME_TEST_FILES/gerbers/gerberFiles/gerberFSLANoExt 2>&1)
printf " Testing gerber file header %%FLSA check: %s\n" "$OUT_STR"
[[ "$OUT_STR" != "application/x-gerber" ]] && echo " ERROR" && GERBER_MIME_VALID=0
# Test the parsing of the header for %MO
OUT_STR=$(xdg-mime query filetype $KICAD_MIME_TEST_FILES/gerbers/gerberFiles/gerberMONoExt 2>&1)
printf " Testing gerber file header %%MO check: %s\n" "$OUT_STR"
[[ "$OUT_STR" != "application/x-gerber" ]] && echo " ERROR" && GERBER_MIME_VALID=0
# Test the parsing of the header for %TF.
OUT_STR=$(xdg-mime query filetype $KICAD_MIME_TEST_FILES/gerbers/gerberFiles/gerberTFNoExt 2>&1)
printf " Testing gerber file header %%TF. check: %s\n" "$OUT_STR"
[[ "$OUT_STR" != "application/x-gerber" ]] && echo " ERROR" && GERBER_MIME_VALID=0
# Test the parsing of the header for G75*.
OUT_STR=$(xdg-mime query filetype $KICAD_MIME_TEST_FILES/gerbers/gerberFiles/gerberG75NoExt 2>&1)
printf " Testing gerber file header G75* check: %s\n" "$OUT_STR"
[[ "$OUT_STR" != "application/x-gerber" ]] && echo " ERROR" && GERBER_MIME_VALID=0
# Test parsing another popular gerber extension (will require a lookup)
OUT_STR=$(xdg-mime query filetype $KICAD_MIME_TEST_FILES/gerbers/gerberFiles/gerber.gts 2>&1)
printf " Testing gerber file with gts extension (not glob'd): %s\n" "$OUT_STR"
[[ "$OUT_STR" != "application/x-gerber" ]] && echo " ERROR" && GERBER_MIME_VALID=0
if [ $GERBER_MIME_VALID -eq 1 ]
then
echo "All Gerber MIME-type files valid"
else
echo "Errors with Gerber MIME-type files"
fi
else
echo "Gerber MIME type files not installed, skipping validation"
GERBER_MIME_VALID=0
fi
# Test install the KiCad MIME file to test with it
echo ""
if [ $KICAD_MIME_INSTALLED -eq 1 ]
then
echo "Validating KiCad MIME-type"
# Test the KiCad project file extension default
OUT_STR=$(xdg-mime query default application/x-kicad-project 2>&1)
printf " Testing KiCad project file default application: %s\n" "$OUT_STR"
[[ "$OUT_STR" != "org.kicad.kicad.desktop" ]] && echo " ERROR" && KICAD_MIME_VALID=0
# Test the KiCad schematic file extension default
OUT_STR=$(xdg-mime query default application/x-kicad-schematic 2>&1)
printf " Testing KiCad schematic file default application: %s\n" "$OUT_STR"
[[ "$OUT_STR" != "org.kicad.eeschema.desktop" ]] && echo " ERROR" && KICAD_MIME_VALID=0
# Test the KiCad project file extension default
OUT_STR=$(xdg-mime query default application/x-kicad-pcb 2>&1)
printf " Testing KiCad board file default application: %s\n" "$OUT_STR"
[[ "$OUT_STR" != "org.kicad.pcbnew.desktop" ]] && echo " ERROR" && KICAD_MIME_VALID=0
# Test the old pcbnew board file extension (brd) - (will cause lookup since not glob'd)
OUT_STR=$(xdg-mime query filetype $KICAD_MIME_TEST_FILES/kicad/boardFiles/brd.brd 2>&1)
printf " Testing old Pcbnew board file with extension brd: %s\n" "$OUT_STR"
[[ "$OUT_STR" != "application/x-kicad-pcb" ]] && echo " ERROR" && KICAD_MIME_VALID=0
# Test the old pcbnew board file with header check
OUT_STR=$(xdg-mime query filetype $KICAD_MIME_TEST_FILES/kicad/boardFiles/brdNoExt 2>&1)
printf " Testing old Pcbnew board file header: %s\n" "$OUT_STR"
[[ "$OUT_STR" != "application/x-kicad-pcb" ]] && echo " ERROR" && KICAD_MIME_VALID=0
# Test the new pcbnew board file extension (kicad_pcb)
OUT_STR=$(xdg-mime query filetype $KICAD_MIME_TEST_FILES/kicad/boardFiles/kicadpcb.kicad_pcb 2>&1)
printf " Testing new Pcbnew board file with extension kicad_pcb: %s\n" "$OUT_STR"
[[ "$OUT_STR" != "application/x-kicad-pcb" ]] && echo " ERROR" && KICAD_MIME_VALID=0
# Test the new pcbnew board file with header check
OUT_STR=$(xdg-mime query filetype $KICAD_MIME_TEST_FILES/kicad/boardFiles/kicadpcbNoExt 2>&1)
printf " Testing new Pcbnew board file header: %s\n" "$OUT_STR"
[[ "$OUT_STR" != "application/x-kicad-pcb" ]] && echo " ERROR" && KICAD_MIME_VALID=0
# Test the old eeschema schematic file extension (sch)
OUT_STR=$(xdg-mime query filetype $KICAD_MIME_TEST_FILES/kicad/schematicFiles/sch.sch 2>&1)
printf " Testing old Eeschema schematic file with extension sch: %s\n" "$OUT_STR"
[[ "$OUT_STR" != "application/x-kicad-schematic" ]] && echo " ERROR" && KICAD_MIME_VALID=0
# Test the brd extension
OUT_STR=$(xdg-mime query filetype $KICAD_MIME_TEST_FILES/kicad/schematicFiles/schNoExt 2>&1)
printf " Testing old Eeschema schematic file header: %s\n" "$OUT_STR"
[[ "$OUT_STR" != "application/x-kicad-schematic" ]] && echo " ERROR" && KICAD_MIME_VALID=0
# Test the new Eeschema schematic file extension (kicad_sch)
OUT_STR=$(xdg-mime query filetype $KICAD_MIME_TEST_FILES/kicad/schematicFiles/kicadsch.kicad_sch 2>&1)
printf " Testing new Eeschema schematic file with extension kicad_sch: %s\n" "$OUT_STR"
[[ "$OUT_STR" != "application/x-kicad-schematic" ]] && echo " ERROR" && KICAD_MIME_VALID=0
# Test the new Eeschema board file with header check
OUT_STR=$(xdg-mime query filetype $KICAD_MIME_TEST_FILES/kicad/schematicFiles/kicadschNoExt 2>&1)
printf " Testing new Eeschema schematic file header: %s\n" "$OUT_STR"
[[ "$OUT_STR" != "application/x-kicad-schematic" ]] && echo " ERROR" && KICAD_MIME_VALID=0
# Test the old project file extension (pro)
OUT_STR=$(xdg-mime query filetype $KICAD_MIME_TEST_FILES/kicad/projectFiles/pro.pro 2>&1)
printf " Testing old KiCad project file with extension pro: %s\n" "$OUT_STR"
[[ "$OUT_STR" != "application/x-kicad-project" ]] && echo " ERROR" && KICAD_MIME_VALID=0
# Test the new project file extension (kicad_pro)
OUT_STR=$(xdg-mime query filetype $KICAD_MIME_TEST_FILES/kicad/projectFiles/kicadpro.kicad_pro 2>&1)
printf " Testing new KiCad project file with extension kicad_pro: %s\n" "$OUT_STR"
[[ "$OUT_STR" != "application/x-kicad-project" ]] && echo " ERROR" && KICAD_MIME_VALID=0
if [ $KICAD_MIME_VALID -eq 1 ]
then
echo "All KiCad MIME-type files valid"
else
echo "Errors with KiCad MIME-type files"
fi
else
echo "KiCad MIME type files not installed, skipping validation"
KICAD_MIME_VALID=0
fi
###################################################################
# Process return codes to flag errors for CI
###################################################################
[ $METAINFO_VALID -ne 0 ] && exit 1
[ $LAUNCHERS_VALID -ne 0 ] && exit 1
[ $KICAD_MIME_VALID -ne 0 ] && exit 1
[ $GERBER_MIME_VALID -ne 0 ] && exit 1
exit 0

View File

@ -5,47 +5,47 @@ if( APPLE )
#TODO Generate this at runtime as well #TODO Generate this at runtime as well
include( ${CMAKE_MODULE_PATH}/WritePlatformMetadata_macos.cmake ) include( ${CMAKE_MODULE_PATH}/WritePlatformMetadata_macos.cmake )
elseif( UNIX ) elseif( UNIX )
# Add the command to configure the linux appdata file with the version information # Add the command to configure the linux metainfo file with the version information
add_custom_command( add_custom_command(
OUTPUT ${PROJECT_BINARY_DIR}/resources/linux/appdata/kicad.appdata.xml.in OUTPUT ${PROJECT_BINARY_DIR}/resources/linux/metainfo/org.kicad.kicad.metainfo.xml.in
COMMAND ${CMAKE_COMMAND} COMMAND ${CMAKE_COMMAND}
-DSRC_PATH=${PROJECT_SOURCE_DIR} -DSRC_PATH=${PROJECT_SOURCE_DIR}
-DBUILD_PATH=${PROJECT_BINARY_DIR} -DBUILD_PATH=${PROJECT_BINARY_DIR}
-DCMAKE_MODULE_PATH=${PROJECT_SOURCE_DIR}/CMakeModules -DCMAKE_MODULE_PATH=${PROJECT_SOURCE_DIR}/CMakeModules
-P ${CMAKE_MODULE_PATH}/BuildSteps/WritePlatformMetadata_linux.cmake -P ${CMAKE_MODULE_PATH}/BuildSteps/WritePlatformMetadata_linux.cmake
DEPENDS ${CMAKE_MODULE_PATH}/BuildSteps/WritePlatformMetadata_linux.cmake DEPENDS ${CMAKE_MODULE_PATH}/BuildSteps/WritePlatformMetadata_linux.cmake
COMMENT "Configuring Linux appdata" COMMENT "Configuring Linux metainfo"
) )
# Read the appdata from the binary directory because it has been configured by Cmake already # Read the metainfo from the binary directory because it has been configured by Cmake already
# to have the version string in it # to have the version string in it
linux_metadata_translation( ${PROJECT_BINARY_DIR}/resources/linux/appdata/kicad.appdata.xml.in linux_metadata_translation( ${PROJECT_BINARY_DIR}/resources/linux/metainfo/org.kicad.kicad.metainfo.xml.in
${PROJECT_BINARY_DIR}/resources/linux/appdata/kicad.appdata.xml ${PROJECT_BINARY_DIR}/resources/linux/metainfo/org.kicad.kicad.metainfo.xml
${PROJECT_SOURCE_DIR}/translation/pofiles ) ${PROJECT_SOURCE_DIR}/translation/pofiles )
# All the desktop files are read from the source directory # All the desktop files are read from the source directory
linux_metadata_translation( ${PROJECT_SOURCE_DIR}/resources/linux/launchers/bitmap2component.desktop.in linux_metadata_translation( ${PROJECT_SOURCE_DIR}/resources/linux/launchers/org.kicad.bitmap2component.desktop.in
${PROJECT_BINARY_DIR}/resources/linux/launchers/bitmap2component.desktop ${PROJECT_BINARY_DIR}/resources/linux/launchers/org.kicad.bitmap2component.desktop
${PROJECT_SOURCE_DIR}/translation/pofiles ) ${PROJECT_SOURCE_DIR}/translation/pofiles )
linux_metadata_translation( ${PROJECT_SOURCE_DIR}/resources/linux/launchers/eeschema.desktop.in linux_metadata_translation( ${PROJECT_SOURCE_DIR}/resources/linux/launchers/org.kicad.eeschema.desktop.in
${PROJECT_BINARY_DIR}/resources/linux/launchers/eeschema.desktop ${PROJECT_BINARY_DIR}/resources/linux/launchers/org.kicad.eeschema.desktop
${PROJECT_SOURCE_DIR}/translation/pofiles ) ${PROJECT_SOURCE_DIR}/translation/pofiles )
linux_metadata_translation( ${PROJECT_SOURCE_DIR}/resources/linux/launchers/gerbview.desktop.in linux_metadata_translation( ${PROJECT_SOURCE_DIR}/resources/linux/launchers/org.kicad.gerbview.desktop.in
${PROJECT_BINARY_DIR}/resources/linux/launchers/gerbview.desktop ${PROJECT_BINARY_DIR}/resources/linux/launchers/org.kicad.gerbview.desktop
${PROJECT_SOURCE_DIR}/translation/pofiles ) ${PROJECT_SOURCE_DIR}/translation/pofiles )
linux_metadata_translation( ${PROJECT_SOURCE_DIR}/resources/linux/launchers/kicad.desktop.in linux_metadata_translation( ${PROJECT_SOURCE_DIR}/resources/linux/launchers/org.kicad.kicad.desktop.in
${PROJECT_BINARY_DIR}/resources/linux/launchers/kicad.desktop ${PROJECT_BINARY_DIR}/resources/linux/launchers/org.kicad.kicad.desktop
${PROJECT_SOURCE_DIR}/translation/pofiles ) ${PROJECT_SOURCE_DIR}/translation/pofiles )
linux_metadata_translation( ${PROJECT_SOURCE_DIR}/resources/linux/launchers/pcbcalculator.desktop.in linux_metadata_translation( ${PROJECT_SOURCE_DIR}/resources/linux/launchers/org.kicad.pcbcalculator.desktop.in
${PROJECT_BINARY_DIR}/resources/linux/launchers/pcbcalculator.desktop ${PROJECT_BINARY_DIR}/resources/linux/launchers/org.kicad.pcbcalculator.desktop
${PROJECT_SOURCE_DIR}/translation/pofiles ) ${PROJECT_SOURCE_DIR}/translation/pofiles )
linux_metadata_translation( ${PROJECT_SOURCE_DIR}/resources/linux/launchers/pcbnew.desktop.in linux_metadata_translation( ${PROJECT_SOURCE_DIR}/resources/linux/launchers/org.kicad.pcbnew.desktop.in
${PROJECT_BINARY_DIR}/resources/linux/launchers/pcbnew.desktop ${PROJECT_BINARY_DIR}/resources/linux/launchers/org.kicad.pcbnew.desktop
${PROJECT_SOURCE_DIR}/translation/pofiles ) ${PROJECT_SOURCE_DIR}/translation/pofiles )
# Translate the MIME info, which are read from the source directory # Translate the MIME info, which are read from the source directory
@ -58,13 +58,13 @@ elseif( UNIX )
${PROJECT_SOURCE_DIR}/translation/pofiles ) ${PROJECT_SOURCE_DIR}/translation/pofiles )
add_custom_target( metadata ALL add_custom_target( metadata ALL
DEPENDS ${PROJECT_BINARY_DIR}/resources/linux/appdata/kicad.appdata.xml DEPENDS ${PROJECT_BINARY_DIR}/resources/linux/metainfo/org.kicad.kicad.metainfo.xml
${PROJECT_BINARY_DIR}/resources/linux/launchers/bitmap2component.desktop ${PROJECT_BINARY_DIR}/resources/linux/launchers/org.kicad.bitmap2component.desktop
${PROJECT_BINARY_DIR}/resources/linux/launchers/eeschema.desktop ${PROJECT_BINARY_DIR}/resources/linux/launchers/org.kicad.eeschema.desktop
${PROJECT_BINARY_DIR}/resources/linux/launchers/gerbview.desktop ${PROJECT_BINARY_DIR}/resources/linux/launchers/org.kicad.gerbview.desktop
${PROJECT_BINARY_DIR}/resources/linux/launchers/kicad.desktop ${PROJECT_BINARY_DIR}/resources/linux/launchers/org.kicad.kicad.desktop
${PROJECT_BINARY_DIR}/resources/linux/launchers/pcbcalculator.desktop ${PROJECT_BINARY_DIR}/resources/linux/launchers/org.kicad.pcbcalculator.desktop
${PROJECT_BINARY_DIR}/resources/linux/launchers/pcbnew.desktop ${PROJECT_BINARY_DIR}/resources/linux/launchers/org.kicad.pcbnew.desktop
${PROJECT_BINARY_DIR}/resources/linux/mime/kicad-gerbers.xml ${PROJECT_BINARY_DIR}/resources/linux/mime/kicad-gerbers.xml
${PROJECT_BINARY_DIR}/resources/linux/mime/kicad-kicad.xml ${PROJECT_BINARY_DIR}/resources/linux/mime/kicad-kicad.xml
) )
@ -95,11 +95,11 @@ elseif( UNIX )
) )
# Install appstream metadata (app store entry) # Install appstream metadata (app store entry)
install( DIRECTORY ${PROJECT_BINARY_DIR}/resources/linux/appdata/ install( DIRECTORY ${PROJECT_BINARY_DIR}/resources/linux/metainfo/
DESTINATION ${CMAKE_INSTALL_DATADIR}/appdata DESTINATION ${CMAKE_INSTALL_DATADIR}/metainfo
COMPONENT resources COMPONENT resources
FILES_MATCHING FILES_MATCHING
PATTERN "*appdata.xml" PATTERN "*metainfo.xml"
PATTERN "*.in" EXCLUDE PATTERN "*.in" EXCLUDE
) )
endif() endif()

View File

@ -1,80 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright (C) 2016-2017 Lubomir Rintel <lkundrak@v3.sk> -->
<!-- Copyright (C) 2016-2021 KiCad Developers, see AUTHORS.txt for contributors. -->
<component type="desktop">
<id>org.kicad_pcb.kicad</id>
<name>KiCad</name>
<launchable type="desktop-id">kicad.desktop</launchable>
<project_license>GPL-3.0-or-later</project_license>
<metadata_license>CC-BY-SA-4.0</metadata_license>
<summary>EDA Suite</summary>
<provides>
<binary>kicad</binary>
<binary>eeschema</binary>
<binary>pcbnew</binary>
<binary>gerbview</binary>
<binary>pl_editor</binary>
<binary>bitmap2component</binary>
<binary>pcb_calculator</binary>
</provides>
<translation type="gettext">kicad</translation>
<keywords>
<keyword>KiCad</keyword>
<keyword>EDA</keyword>
<keyword>PCB</keyword>
<keyword>Schema</keyword>
<keyword>PcbNew</keyword>
<keyword>Eeschema</keyword>
</keywords>
<description>
<p>
KiCad is a Cross Platform and Open Source Electronics Design Automation Suite.
The programs handle Schematic Capture, and PCB Layout with Gerber output.
</p>
</description>
<screenshots>
<screenshot type="default">
<image width="1280" height="791">https://kicad.org/img/screenshots/appstream/kicad_6.png</image>
</screenshot>
<screenshot>
<caption>Eeschema Schematic Editor</caption>
<image width="1280" height="791">https://kicad.org/img/screenshots/appstream/eeschema_6.png</image>
</screenshot>
<screenshot>
<caption>PcbNew PCB Layout</caption>
<image width="1280" height="791">https://kicad.org/img/screenshots/appstream/pcbnew_6.png</image>
</screenshot>
<screenshot>
<caption>PcbNew 3D Viewer</caption>
<image width="1280" height="791">https://kicad.org/img/screenshots/appstream/3dviewer_6.png</image>
</screenshot>
</screenshots>
<url type="homepage">https://kicad.org/</url>
<url type="bugtracker">https://kicad.org/help/report-a-bug/</url>
<url type="help">https://docs.kicad.org/</url>
<url type="donation">https://go.kicad.org/donate</url>
<url type="translate">https://hosted.weblate.org/projects/kicad/</url>
<update_contact>kicad-developers@lists.launchpad.net</update_contact>
<developer_name>The KiCad Developers</developer_name>
<!-- This is actually a valid tag, but the utilities don't think so -->
<content_rating type="oars-1.1" />
<releases>
<release version="@KICAD_VERSION_FULL@" date="@KICAD_CONFIG_TIMESTAMP@" />
</releases>
</component>

View File

@ -5,6 +5,7 @@ Icon=bitmap2component
Type=Application Type=Application
Categories=Science;Electronics; Categories=Science;Electronics;
Exec=bitmap2component Exec=bitmap2component
Name=Bitmap to Component Converter Name=KiCad Image Converter
GenericName=Bitmap to Component Converter GenericName=Bitmap to Component Converter
Comment=Create a component from a bitmap for use with KiCad Comment=Create a component from a bitmap for use with KiCad
Keywords=bitmap2component

View File

@ -6,6 +6,7 @@ Type=Application
Categories=Science;Electronics; Categories=Science;Electronics;
Exec=eeschema %f Exec=eeschema %f
MimeType=application/x-kicad-schematic; MimeType=application/x-kicad-schematic;
Name=Eeschema (Standalone) Name=KiCad Schematic Editor (Standalone)
GenericName=Electronic schematic capture GenericName=Schematic Capture Tool
Comment=KiCad electronic schematic design (standalone) Comment=Standalone schematic editor for KiCad schematics
Keywords=eeschema

View File

@ -5,7 +5,8 @@ Icon=gerbview
Type=Application Type=Application
Categories=Science;Electronics; Categories=Science;Electronics;
Exec=gerbview Exec=gerbview
MimeType=application/x-gerber;application/x-excellon MimeType=application/x-gerber;application/x-excellon;application/x-gerber-job
Name=GerbView Name=KiCad Gerber Viewer
GenericName=Gerber File Viewer GenericName=Gerber File Viewer
Comment=View Gerber files Comment=View Gerber files
Keywords=gerbview

View File

@ -8,5 +8,5 @@ Exec=kicad %f
MimeType=application/x-kicad-project; MimeType=application/x-kicad-project;
Name=KiCad Name=KiCad
GenericName=EDA Suite GenericName=EDA Suite
Comment=Electronic Design Automation suite Comment=Suite of tools for schematic design and circuit board layout
X-Desktop-File-Install-Version=0.22 X-Desktop-File-Install-Version=0.22

View File

@ -5,6 +5,6 @@ Icon=pcbcalculator
Type=Application Type=Application
Categories=Science;Electronics; Categories=Science;Electronics;
Exec=pcb_calculator Exec=pcb_calculator
Name=PCB Calculator Name=KiCad PCB Calculator
GenericName=PCB Calculator GenericName=PCB Calculator
Comment=Calculator for various electronics-related computations Comment=Calculator for various electronics-related computations

View File

@ -6,6 +6,7 @@ Type=Application
Categories=Science;Electronics; Categories=Science;Electronics;
Exec=pcbnew %f Exec=pcbnew %f
MimeType=application/x-kicad-pcb; MimeType=application/x-kicad-pcb;
Name=Pcbnew (Standalone) Name=KiCad PCB Editor (Standalone)
GenericName=PCB layout GenericName=PCB layout editor
Comment=KiCad printed circuit board layout (standalone) Comment=Standalone circuit board editor for KiCad boards
Keywords=pcbnew

View File

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright (C) 2016-2017 Lubomir Rintel <lkundrak@v3.sk> -->
<!-- Copyright (C) 2016-2021 KiCad Developers, see AUTHORS.txt for contributors. -->
<component type="desktop">
<id>org.kicad.kicad</id>
<name>KiCad</name>
<launchable type="desktop-id">org.kicad.kicad.desktop</launchable>
<project_license>GPL-3.0-or-later</project_license>
<metadata_license>CC-BY-SA-4.0</metadata_license>
<summary>An EDA suite for schematic and circuit board design</summary>
<provides>
<binary>kicad</binary>
<binary>eeschema</binary>
<binary>pcbnew</binary>
<binary>gerbview</binary>
<binary>pl_editor</binary>
<binary>bitmap2component</binary>
<binary>pcb_calculator</binary>
<mediatype>application/x-gerber</mediatype>
<mediatype>application/x-excellon</mediatype>
<mediatype>application/x-kicad-project</mediatype>
<mediatype>application/x-kicad-schematic</mediatype>
<mediatype>application/x-kicad-pcb</mediatype>
</provides>
<translation type="gettext">kicad</translation>
<keywords>
<keyword>KiCad</keyword>
<keyword>EDA</keyword>
<keyword>PCB</keyword>
<keyword>Schema</keyword>
<keyword>PcbNew</keyword>
<keyword>Eeschema</keyword>
<keyword>Gerber</keyword>
</keywords>
<categories>
<category>Electronics</category>
<category>Engineering</category>
<category>Science</category>
<category>Electricity</category>
</categories>
<description>
<p>
KiCad is a free and open-source electronics design automation (EDA) suite. It features schematic capture, integrated circuit simulation, printed circuit board (PCB) layout, 3D rendering, and plotting/data export to numerous formats. KiCad also includes a high-quality component library featuring thousands of symbols, footprints, and 3D models. KiCad has minimal system requirements and runs on Linux, Windows, and macOS.
</p>
</description>
<screenshots>
<screenshot type="default">
<image width="1280" height="791">https://kicad.org/img/screenshots/appstream/kicad_6.png</image>
</screenshot>
<screenshot>
<caption>KiCad Schematic Editor</caption>
<image width="1280" height="791">https://kicad.org/img/screenshots/appstream/eeschema_6.png</image>
</screenshot>
<screenshot>
<caption>KiCad PCB Layout Editor</caption>
<image width="1280" height="791">https://kicad.org/img/screenshots/appstream/pcbnew_6.png</image>
</screenshot>
<screenshot>
<caption>KiCad 3D Viewer</caption>
<image width="1280" height="791">https://kicad.org/img/screenshots/appstream/3dviewer_6.png</image>
</screenshot>
</screenshots>
<url type="homepage">https://kicad.org/</url>
<url type="bugtracker">https://kicad.org/help/report-an-issue/</url>
<url type="help">https://docs.kicad.org/</url>
<url type="donation">https://go.kicad.org/donate</url>
<url type="translate">https://hosted.weblate.org/projects/kicad/</url>
<update_contact>kicad-developers@lists.launchpad.net</update_contact>
<developer_name>The KiCad Developers</developer_name>
<!-- This is actually a valid tag, but the utilities don't think so -->
<content_rating type="oars-1.1" />
<releases>
<release version="@KICAD_VERSION_FULL@" date="@KICAD_CONFIG_TIMESTAMP@" />
</releases>
</component>

View File

@ -2,15 +2,32 @@
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info"> <mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
<mime-type type="application/x-gerber"> <mime-type type="application/x-gerber">
<sub-class-of type="text/plain"/> <sub-class-of type="text/plain"/>
<comment>Gerber File</comment> <comment>Gerber file</comment>
<glob pattern="*.gbr"/> <glob pattern="*.gbr"/>
<!--Try to match with some common opening commands-->
<magic priority="50">
<!--A comment line-->
<match type="string" offset="0" value="G04"/>
<!--Some setup macros-->
<match type="string" offset="0" value="%FSLA"/>
<match type="string" offset="0" value="%MO"/>
<match type="string" offset="0" value="%TF."/>
<!--Seems to be common with files exported from some programs-->
<match type="string" offset="0" value="G75*"/>
</magic>
</mime-type>
<mime-type type="application/x-gerber-job">
<sub-class-of type="text/plain"/>
<comment>Gerber job file</comment>
<glob pattern="*.gbrjob"/>
</mime-type> </mime-type>
<mime-type type="application/x-excellon"> <mime-type type="application/x-excellon">
<sub-class-of type="text/plain"/> <sub-class-of type="text/plain"/>
<comment>Excellon drill file</comment> <comment>Excellon drill file</comment>
<glob pattern="*.drl"/> <glob pattern="*.drl"/>
<magic priority="50"> <magic priority="50">
<match value="M48" type="string" offset="0"/> <!--This is always the header for an excellon drill file-->
<match type="string" offset="0" value="M48"/>
</magic> </magic>
</mime-type> </mime-type>
</mime-info> </mime-info>

View File

@ -11,10 +11,22 @@
<comment>KiCad Schematic</comment> <comment>KiCad Schematic</comment>
<glob pattern="*.sch"/> <glob pattern="*.sch"/>
<glob pattern="*.kicad_sch"/> <glob pattern="*.kicad_sch"/>
<magic priority="100">
<!--The new schematic file (.kicad_sch) header-->
<match type="string" offset="0" value="(kicad_sch"/>
<!--The old schematic file (.sch) header-->
<match type="string" offset="0" value="EESchema Schematic File"/>
</magic>
</mime-type> </mime-type>
<mime-type type="application/x-kicad-pcb"> <mime-type type="application/x-kicad-pcb">
<sub-class-of type="text/plain"/> <sub-class-of type="text/plain"/>
<comment>KiCad Printed Circuit Board</comment> <comment>KiCad Printed Circuit Board</comment>
<glob pattern="*.kicad_pcb"/> <glob pattern="*.kicad_pcb"/>
<magic priority="100">
<!--The new board file (.kicad_pcb) header-->
<match type="string" offset="0" value="(kicad_pcb"/>
<!--The old board file (.brd) header-->
<match type="string" offset="0" value="PCBNEW-BOARD"/>
</magic>
</mime-type> </mime-type>
</mime-info> </mime-info>

View File

@ -12,6 +12,6 @@ pcb_calculator
pcbnew pcbnew
plugins plugins
tools tools
resources/linux/appdata
resources/linux/launchers resources/linux/launchers
resources/linux/metainfo
resources/linux/mime resources/linux/mime