Appimage: Add metadata, don't include GTK libs, various fixes

This commit is contained in:
Rebecca Breu 2024-05-01 16:36:37 +02:00
parent 9356f53b40
commit 4aa6c2eb30
9 changed files with 93 additions and 17 deletions

View file

@ -1,11 +1,11 @@
[Desktop Entry]
Name=BeeRef
Comment=BeeRef 0.3.3-dev
GenericName=Image Viewer
Comment=A simple reference image viewer
Terminal=false
Exec=/home/yourname/path/to/BeeRef-0.3.3-dev-linux
Type=Application
Icon=/home/yourname/path/to/logo.png
Name[en_US]=BeeRef
MimeType=application/x-beeref;
Categories=Qt;KDE;Graphics;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 KiB

After

Width:  |  Height:  |  Size: 48 KiB

View file

@ -13,11 +13,11 @@
viewBox="0 0 50.536563 50.536564"
version="1.1"
id="svg8"
inkscape:version="0.92.4 (5da689c313, 2019-01-14)"
inkscape:version="1.0.2 (e86c870879, 2021-01-15)"
sodipodi:docname="logo.svg"
inkscape:export-filename="/home/rbreu/code/python/beeref/git/beeref/assets/logo.png"
inkscape:export-xdpi="201.03999"
inkscape:export-ydpi="201.03999">
inkscape:export-xdpi="128.67"
inkscape:export-ydpi="128.67">
<defs
id="defs2">
<inkscape:path-effect
@ -496,10 +496,10 @@
inkscape:document-units="mm"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="2560"
inkscape:window-height="1311"
inkscape:window-width="1280"
inkscape:window-height="656"
inkscape:window-x="0"
inkscape:window-y="55"
inkscape:window-y="27"
inkscape:window-maximized="1"
fit-margin-top="0"
fit-margin-left="0"

Before

Width:  |  Height:  |  Size: 63 KiB

After

Width:  |  Height:  |  Size: 63 KiB

View file

@ -4,7 +4,7 @@
<launchable type="desktop-id">org.beeref.BeeRef.desktop</launchable>
<name>BeeRef</name>
<developer_name>BeeRef</developer_name>
<summary>A Simple Reference Image Viewer</summary>
<summary>A simple reference image viewer</summary>
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-3.0</project_license>
<url type="homepage">https://beeref.org/</url>
@ -14,11 +14,13 @@
</description>
<screenshots>
<screenshot type="default">https://github.com/rbreu/beeref/blob/main/images/screenshot.png?raw=true</screenshot>
<screenshot type="default">
<image>https://github.com/rbreu/beeref/blob/main/images/screenshot.png?raw=true</image>
</screenshot>
</screenshots>
<releases>
<release version="0.3.3-dev" date="(unreleased)"></release>
<!-- <release version="0.3.3-dev" date="(unreleased)"></release> -->
<release version="0.3.2" date="2024-01-21"></release>
<release version="0.3.1" date="2023-12-10"></release>
<release version="0.3.0" date="2023-11-23"></release>

View file

@ -33,6 +33,7 @@ def test_main(args_mock, app_mock, qapp):
app_mock.return_value = qapp
args_mock.return_value.filename = None
args_mock.return_value.loglevel = 'WARN'
args_mock.return_value.debug_raise_error = ''
with patch.object(qapp, 'exec') as exec_mock:
main()
args_mock.assert_called_once_with(with_check=True)

View file

@ -10,6 +10,7 @@
import argparse
import glob
import json
import logging
import os
@ -176,11 +177,52 @@ with open('squashfs-root/AppRun', 'w') as f:
f.write('\n'.join(content))
os.chmod('squashfs-root/AppRun', 0o755)
logger.info('Copying appdata.xml...')
for f in glob.glob('squashfs-root/usr/share/metainfo/*'):
os.remove(f)
filename = 'org.beeref.BeeRef.appdata.xml'
shutil.copyfile(filename, f'squashfs-root/usr/share/metainfo/{filename}')
logger.info('Writing .desktop...')
for f in glob.glob('squashfs-root/usr/share/applications/*'):
os.remove(f)
for f in glob.glob('squashfs-root/*.desktop'):
os.remove(f)
content = f"""[Desktop Entry]
Name=BeeRef
GenericName=Image Viewer
Comment=A simple reference image viewer
Terminal=false
Exec=BeeRef-{BEEVERSION}
Type=Application
Icon=logo
MimeType=application/x-beeref;
Categories=Qt;KDE;Graphics;
X-KDE-NativeMimeType=application/x-beeref
X-KDE-ExtraNativeMimeTypes=
X-AppImage-Version={BEEVERSION}
"""
filename = 'squashfs-root/usr/share/applications/org.beeref.BeeRef.desktop'
with open(filename, 'w') as f:
f.write(content)
os.symlink('usr/share/applications/org.beeref.BeeRef.desktop',
'squashfs-root/BeeRef.desktop')
logger.info('Copying logos...')
shutil.copyfile('./beeref/assets/logo.svg', 'squashfs-root/logo.svg')
shutil.copyfile('./beeref/assets/logo.png', 'squashfs-root/.DirIcon')
url = ('https://github.com/AppImage/AppImageKit/releases/download/'
'continuous/appimagetool-x86_64.AppImage')
download_file(url, filename='appimagetool.appimage')
run_command('./appimagetool.appimage',
'squashfs-root',
f'BeeRef-{BEEVERSION}.appimage',
'--no-appstream')
f'BeeRef-{BEEVERSION}.appimage')

View file

@ -101,15 +101,19 @@ if os.path.exists(args.jsonfile):
data = json.loads(f.read())
known_libs = data['libs']
packages = set(data['packages'])
excludes = set(data['excludes'])
else:
logger.info(f'No file {args.jsonfile}; starting from scratch')
known_libs = []
packages = set()
excludes = set()
for lib in iter_lsofoutput(output):
links = what_links_to(lib)
if len(links) == 1:
if len(links) == 0:
pass
elif len(links) == 1:
lib = links[0]
else:
logger.warning(f'Double check: {lib} {links}')
@ -117,7 +121,7 @@ for lib in iter_lsofoutput(output):
if lib in known_libs:
logger.debug(f'Found known lib: {lib}')
else:
logger.debug(f'Found unknown lib: {lib}')
logger.debug(f'Found new lib: {lib}')
libs.append(lib)
@ -155,11 +159,11 @@ for line in response.splitlines():
line = strip_minor_versions(line)
exclude_masterlist.add(line)
excludes = []
for ex in exclude_masterlist:
for lib in (libs + known_libs):
if lib.endswith(ex):
excludes.append(ex)
excludes.add(ex)
continue

View file

@ -216,6 +216,8 @@
"libX11-xcb.so.1",
"libX11.so.6",
"libc.so.6",
"libcanberra-gtk-module.so",
"libcanberra-gtk3.so.0",
"libcom_err.so.2",
"libdl.so.2",
"libexpat.so.1",
@ -223,7 +225,12 @@
"libfreetype.so.6",
"libfribidi.so.0",
"libgcc_s.so.1",
"libgdk-3.so.0",
"libgdk_pixbuf-2.0.so.0",
"libgio-2.0.so.0",
"libgpg-error.so.0",
"libgvfscommon.so",
"libgvfsdbus.so",
"libharfbuzz.so.0",
"libm.so.6",
"libpthread.so.0",

View file

@ -0,0 +1,20 @@
Appimage : Explanations for including/excluding libraries
=========================================================
GTK/Gnome
---------
By default, in a Gnome session BeeRef pulls a couple of gtk/gdg libs. When opening a native Gnome/GTK file dialog, more gtk/gdl libs are loaded from the system, which might be incompatable.
https://github.com/rbreu/beeref/discussions/103
Current workaround: Exclude the following libs::
"libgvfsdbus.so"
"libcanberra-gtk-module.so"
"libgvfscommon.so"
"libcanberra-gtk3.so.0"
"libgdk-3.so.0"
"libgdk_pixbuf-2.0.so.0"
"libgio-2.0.so.0"