Merge #610: Release packaging improvements

2888db425df61a5e64ce12f9425bbef7cb3452b6 contrib: remove former script to generate Debian packages (Antoine Poinsot)
3e23bf5e35ac594340703ca9c68d6448f6d85f5f contrib: Debian packaging for releases (Antoine Poinsot)
8a7c2832697f342692ee2e420212c8d387248dff contrib: use a zip archive for the MacOS sample app folder (Antoine Poinsot)

Pull request description:

  This cleans up the MacOS distribution and adds Debian packaging to the release script. This gives users of Debian-based distributions (Ubuntu, etc..) a simple way of installing our software.

  Fixes https://github.com/wizardsardine/liana/issues/519.

ACKs for top commit:
  darosior:
    ACK 2888db425df61a5e64ce12f9425bbef7cb3452b6

Tree-SHA512: 04de4d455138e214dd73cf3d7d9623aae341271bf32201ef50eae4b3f07c572a4d2d7b4f3af9705d24a788ceffccedbfdca156fafbe9d7c475a8f655edf8e49a
This commit is contained in:
Antoine Poinsot 2023-08-18 14:31:09 +02:00
commit bdeaf93ec8
No known key found for this signature in database
GPG Key ID: E13FC145CD3F4304
7 changed files with 10 additions and 153 deletions

View File

@ -1,106 +0,0 @@
from shutil import copy as copyfile
from os.path import exists
from os import scandir
from shutil import rmtree
from os import remove
from os import mkdir
from os import chmod
from math import ceil
import subprocess
def get_size(path) -> int:
total = 0
with scandir(path) as it:
for entry in it:
if entry.is_file():
total += entry.stat().st_size
elif entry.is_dir():
total += get_size(entry.path)
return total
stop = False
if not exists('../target/release/lianad'):
print('Cannot find lianad binaries in target/release/')
stop = True
if not exists('../target/release/liana-cli'):
print('Cannot find liana-cli binaries in target/release/')
stop = True
if not exists('../gui/target/release/liana-gui'):
print('Cannot find liana-gui binaries in gui/target/release/')
stop = True
if not stop:
print("Liana version:")
version = float(input())
arch = subprocess.run("dpkg-architecture -q DEB_TARGET_ARCH", shell=True,
stdout=subprocess.PIPE).stdout.decode('utf-8')[:-1]
arch_multi = subprocess.run("dpkg-architecture -q DEB_TARGET_MULTIARCH", shell=True,
stdout=subprocess.PIPE).stdout.decode('utf-8')[:-1]
DIRNAME = f"liana-{version}-{arch_multi}"
if exists(DIRNAME):
rmtree(DIRNAME)
if exists(f"{DIRNAME}.deb"):
remove(f"{DIRNAME}.deb")
mkdir(DIRNAME)
mkdir(f"{DIRNAME}/DEBIAN")
mkdir(f"{DIRNAME}/opt")
mkdir(f"{DIRNAME}/opt/liana")
mkdir(f"{DIRNAME}/usr")
mkdir(f"{DIRNAME}/usr/bin")
mkdir(f"{DIRNAME}/usr/share")
mkdir(f"{DIRNAME}/usr/share/applications")
copyfile('../gui/ui/static/logos/liana-app-icon.png', f"{DIRNAME}/opt/liana/liana-app-icon.png")
copyfile('../target/release/lianad', f"{DIRNAME}/usr/bin/lianad")
copyfile('../target/release/liana-cli', f"{DIRNAME}/usr/bin/liana-cli")
copyfile('../gui/target/release/liana-gui', f"{DIRNAME}/usr/bin/liana-gui")
file = open(f"{DIRNAME}/usr/share/applications/Liana.desktop", "w")
lines = """#!/usr/bin/env xdg-open
[Desktop Entry]
Name=Liana
GenericName=Liana
Exec=/usr/bin/liana-gui
Terminal=False
Type=Application
Icon=/opt/liana/liana-app-icon.png
Categories=Finance;Network;"""
file.write(lines)
file.close()
size = ceil(get_size(DIRNAME)/1000) # kB
file = open(f"{DIRNAME}/DEBIAN/control", "w")
lines = f"Package: Liana\n"
lines += f"Version: {str(version)}\n"
lines += f"Architecture: {arch}\n"
lines += "Essential: no\n"
lines += f"Installed-Size: {size}\n"
lines += "Depends: udev, libfontconfig1-dev,libudev-dev, libc6 (>= 2.34)\n"
lines += "Priority: optionnal\n"
lines += f"Breaks: Liana (<< {str(version)})\n"
lines += f"Replaces: Liana (<< {str(version)})\n"
lines += """Maintainer: A. Poinsot <darosior@protonmail.com>
Homepage: https://www.wizardsardine.com/
Description: Liana is a Bitcoin wallet
"""
file.write(lines)
file.close()
subprocess.run(f"dpkg-deb --build {DIRNAME}", shell=True, check=True)
rmtree(DIRNAME)

Binary file not shown.

Binary file not shown.

View File

@ -1,44 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
<plist version="0.9">
<!-- Based on https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFBundles/BundleTypes/BundleTypes.html#//apple_ref/doc/uid/10000123i-CH101-SW5 -->
<!-- See also https://github.com/bitcoin/bitcoin/blob/master/share/qt/Info.plist.in as an example. -->
<dict>
<key>CFBundleName</key>
<string>Liana</string>
<key>CFBundleDisplayName</key>
<string>Liana</string>
<key>CFBundleIdentifier</key>
<string>com.wizardsardine.liana</string>
<key>CFBundleVersion</key>
<string>VERSION_PLACEHOLDER</string>
<key>CFBundleShortVersionString</key>
<string>VERSION_PLACEHOLDER</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleExecutable</key>
<string>Liana</string>
<key>LSMinimumSystemVersion</key>
<string>10.15.0</string>
<key>CFBundleIconFile</key>
<string>Liana.icns</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.finance</string>
</dict>
</plist>

View File

@ -1 +0,0 @@
APPL????

View File

@ -34,13 +34,21 @@ create_dir "$BUILD_DIR"
OUT_DIR="$BUILD_DIR" ./contrib/reproducible/guix/guix-build.sh
TARGET_DIR="$BUILD_DIR" ./contrib/reproducible/docker/docker-build.sh
# Create the Linux archive
# Create the Linux archive and Debian binary package.
(
cd "$BUILD_DIR"
create_dir "$LINUX_DIR_NAME"
cp "$BUILD_DIR/release/lianad" "$BUILD_DIR/release/liana-cli" "$BUILD_DIR/gui/release/liana-gui" ../README.md "$LINUX_DIR_NAME"
tar -czf "$LINUX_ARCHIVE" "$LINUX_DIR_NAME"
cp "$LINUX_ARCHIVE" "$RELEASE_DIR"
unzip ../contrib/release/debian/package.zip
sed -i "s/VERSION_PLACEHOLDER/$VERSION/g" ./package/DEBIAN/control
cp "$BUILD_DIR/release/lianad" "$BUILD_DIR/release/liana-cli" "$BUILD_DIR/gui/release/liana-gui" ../README.md ./package/usr/local/bin/
DIRNAME="liana_$VERSION-1_amd64"
mv ./package "$DIRNAME"
dpkg-deb --build "$DIRNAME"
mv "$DIRNAME.deb" "$RELEASE_DIR"
)
# Create the Windows archive and the raw executable
@ -61,7 +69,7 @@ TARGET_DIR="$BUILD_DIR" ./contrib/reproducible/docker/docker-build.sh
tar -czf "$MAC_ARCHIVE" "$MAC_DIR_NAME"
cp "$MAC_ARCHIVE" "$RELEASE_DIR"
cp -r ../contrib/release/macos/Liana.app ./
unzip ../contrib/release/macos/Liana.app.zip ./
sed -i "s/VERSION_PLACEHOLDER/$VERSION/g" ./Liana.app/Contents/Info.plist
cp "$BUILD_DIR/gui/x86_64-apple-darwin/release/liana-gui" ./Liana.app/Contents/MacOS/Liana
zip -ry Liana-noncodesigned.zip Liana.app