From 779a8022c2b4322b66e2882e85dde6a57e3312e3 Mon Sep 17 00:00:00 2001 From: Hunter Wittenborn Date: Fri, 15 Sep 2023 14:47:20 -0500 Subject: [PATCH] Remove duplicate releases in AppStream metadata file (#135) --- CHANGELOG.md | 8 +- Cargo.lock | 6 +- .../com.hunterwittenborn.Celeste.metainfo.xml | 607 +++++++++++++----- celeste-tray/Cargo.toml | 2 +- celeste/Cargo.toml | 2 +- celeste/src/main.rs | 6 +- justfile | 88 ++- libceleste/Cargo.toml | 2 +- makedeb/PKGBUILD | 2 +- snap/snapcraft.yaml | 2 +- 10 files changed, 523 insertions(+), 202 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b0778e..e0a75d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,10 +6,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.5.7] - 2023-09-15 +### Fixed +- Removed duplicate releases in AppStream metadata file. + ## [0.5.6] - 2023-09-14 ### Changed -- Changed to new application icons -- Added credits to about page +- Changed to new application icons. +- Added credits to about page. ## [0.5.5] - 2023-08-09 ### Fixed diff --git a/Cargo.lock b/Cargo.lock index 985b41f..782ad5b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -683,7 +683,7 @@ dependencies = [ [[package]] name = "celeste" -version = "0.5.6" +version = "0.5.7" dependencies = [ "base64 0.20.0", "blocking", @@ -722,7 +722,7 @@ dependencies = [ [[package]] name = "celeste-tray" -version = "0.5.6" +version = "0.5.7" dependencies = [ "gtk", "hw-msg", @@ -2380,7 +2380,7 @@ checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" [[package]] name = "libceleste" -version = "0.5.6" +version = "0.5.7" dependencies = [ "blocking", "futures", diff --git a/assets/com.hunterwittenborn.Celeste.metainfo.xml b/assets/com.hunterwittenborn.Celeste.metainfo.xml index 1f26ed9..7b43640 100644 --- a/assets/com.hunterwittenborn.Celeste.metainfo.xml +++ b/assets/com.hunterwittenborn.Celeste.metainfo.xml @@ -41,182 +41,467 @@ - - -

- Changes made in this release: -

-
    -
  • - Changed to new application icons -
  • -
  • - Added credits to about page -
  • -
-
+ +

+ Fixes in this release: +

+
    +
  • + Fixed duplicate releases in AppStream metadata file. +
  • +
- - -

- Fixes in this release: -

-
    -
  • - Update - - Cargo.toml - - and - - Cargo.lock - - to fix - - arm64 - - compile error. -
  • -
-
+ +

+ Changes in this release: +

+
    +
  • + Changed to new application icons. +
  • +
  • + Added credits to about page. +
  • +
- -

- Fixes in this release: -

-
    -
  • - Update - - Cargo.toml - - and - - Cargo.lock - - to fix - - arm64 - - compile error. -
  • -
-
+

+ Fixes in this release: +

+
    +
  • + Update + + Cargo.toml + + and + + Cargo.lock + + to fix + + arm64 + + compile error. +
  • +
- -

- Fixes in this release: -

-
    -
  • - Updated - - Cargo.lock - - to fix compile error. -
  • -
-
+

+ Fixes in this release: +

+
    +
  • + Updated + + Cargo.lock + + to fix compile error. +
  • +
- -

- Fixes in this release: -

-
    -
  • - Updated - - Cargo.lock - - to fix compile error. -
  • -
-
+

+ Fixes in this release: +

+
    +
  • + Updated + + Cargo.lock + + to fix compile error. +
  • +
- -

- Fixes in this release: -

-
    -
  • - Fixed more issues in automated Flathub packaging. -
  • -
-
+

+ Fixes in this release: +

+
    +
  • + Fixed more issues in automated Flathub packaging. +
  • +
- -

- Fixes in this release: -

-
    -
  • - Fixed automated Flathub packaging. -
  • -
-
+

+ Fixes in this release: +

+
    +
  • + Fixed automated Flathub packaging. +
  • +
- -

- Feature additions in this release: -

-
    -
  • - Added support for translations. -
  • -
-

- Changes made in this release: -

-
    -
  • - Fixed loading times when adding new sync directories. -
  • -
  • - Made autocompletions in sync directory additions more dynamic. -
  • -
-

- Fixes in this release: -

-
    -
  • - Fixed loading times when adding remotes with high storage usage. -
  • -
  • - Fixed freeze when ports needed by - - rclone authorize - - are already being used. -
  • -
-
+

+ New features in this release: +

+
    +
  • + Added support for translations. +
  • +
+

+ Changes in this release: +

+
    +
  • + Fixed loading times when adding new sync directories. +
  • +
  • + Made autocompletions in sync directory additions more dynamic. +
  • +
+

+ Fixes in this release: +

+
    +
  • + Fixed loading times when adding remotes with high storage usage. +
  • +
  • + Fixed freeze when ports needed by + + rclone authorize + + are already being used. +
  • +
- -

- Fixes in this release: -

-
    -
  • - Fixed HTML elements in metainfo release descriptions. -
  • -
-
-
- - - - - - - +

+ Fixes in this release: +

+
    +
  • + Fixed HTML elements in metainfo release descriptions. +
  • +
+
+ +

+ Fixes in this release: +

+
    +
  • + Fixed location of metainfo file. +
  • +
+
+ +

+ Fixes in this release: +

+
    +
  • + Add + + com.hunterwittenborn.Celeste.metainfo.xml + + to packaging. +
  • +
  • + Fixed Google Drive authentication for Google's branding requirements. +
  • +
+
+ +

+ Fixes in this release: +

+
    +
  • + Removed commented line in + + justfile + + . +
  • +
+
+ +

+ Changes in this release: +

+
    +
  • + Fixed panic when previously synced local dir no longer exists. +
  • +
  • + Fixed extra padding in certain windows. +
  • +
  • + Fixed recorded remote items incorrectly starting with + + / + + in Celeste's database. +
  • +
  • + Fixed long windows when multiple errors are present. +
  • +
+
+ +

+ Changes in this release: +

+
    +
  • + Removed no + + : + + requirement in username and password login fields. +
  • +
+
+ +

+ New features in this release: +

+
    +
  • + Added support for pCloud. +
  • +
+
+ +

+ Changes in this release: +

+
    +
  • + Fixed slash suffixes in local directory causing a crash in sync directory dialog. +
  • +
  • + Fixed remote directories not being placed correctly on the local system. +
  • +
+
+ +

+ Changes in this release: +

+
    +
  • + Fixed behavior of tray icon closing when main application crashes inside of Flatpak. +
  • +
  • + Fixed wordage on a couple CLI warning messages. +
  • +
+
+ +

+ Changes in this release: +

+
    +
  • + Closed tray icon when main application crashes. +
  • +
  • + Fixed new servers not showing up after all have been removed. +
  • +
  • + Fixed crash caused by incorrect server name being registered for Nextcloud and Owncloud servers. +
  • +
+
+ +

+ Changes in this release: +

+
    +
  • + Improved titlebars in main application window. +
  • +
+
+ +

+ Changes in this release: +

+
    +
  • + Added better error handing when sending DBus messages. +
  • +
+
+ +

+ New features in this release: +

+
    +
  • + Added Owncloud storage type. +
  • +
  • + Added ability to start up in the background. +
  • +
+
+ +

+ New features in this release: +

+
    +
  • + Added Google Drive storage type. +
  • +
+

+ Changes in this release: +

+
    +
  • + Fixed DBus connection names in Snapcraft config. +
  • +
+
+ +

+ Changes in this release: +

+
    +
  • + Fixed file names in + + justfile + + . +
  • +
+
+ +

+ Changes in this release: +

+
    +
  • + Fixed namespace used for symbolic icons and DBus connections. +
  • +
+
+ +

+ Changes in this release: +

+
    +
  • + Fixed location of symbolic icons during installation. +
  • +
+
+ +

+ New features in this release: +

+
    +
  • + Added Snap packaging +
  • +
+
+ +

+ New features in this release: +

+
    +
  • + Added tray icon. +
  • +
+
+ +

+ Changes in this release: +

+
    +
  • + Fixed vertical alignment of text in file/folder exclusion section. +
  • +
  • + Improved method for finding running Celeste instances. +
  • +
+
+ +

+ Changes in this release: +

+
    +
  • + Fixed missing icon on about page. +
  • +
  • + Updated progress text to show individual file checks. +
  • +
  • + Fixed missing popover button on main screen. +
  • +
  • + Fixed main screen window not closing after being reopened. +
  • +
+
+ +

+ Changes in this release: +

+
    +
  • + Fixed panic on launch from missing directory. +
  • +
+
+ +

+ Changes in this release: +

+
    +
  • + Added very hacky workaround to finally fix linker usage in AppImage. +
  • +
+
+ +

+ Changes in this release: +

+
    +
  • + Fixed more linker usage in AppImage. +
  • +
+
+ +

+ Changes in this release: +

+
    +
  • + Fixed linker usage and missing dependencies in AppImage. +
  • +
+
+ +

+ Changes in this release: +

+
    +
  • + Fixed MPR packaging. +
  • +
+
+ +

+ First release! 🥳 +

+
diff --git a/celeste-tray/Cargo.toml b/celeste-tray/Cargo.toml index b6f7352..fad17b0 100644 --- a/celeste-tray/Cargo.toml +++ b/celeste-tray/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "celeste-tray" -version = "0.5.6" +version = "0.5.7" edition = "2021" [dependencies] diff --git a/celeste/Cargo.toml b/celeste/Cargo.toml index 770adc4..7d64824 100644 --- a/celeste/Cargo.toml +++ b/celeste/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "celeste" -version = "0.5.6" +version = "0.5.7" edition = "2021" [dependencies] diff --git a/celeste/src/main.rs b/celeste/src/main.rs index eba1b27..8b756de 100644 --- a/celeste/src/main.rs +++ b/celeste/src/main.rs @@ -147,7 +147,7 @@ fn main() { let _stdout = stdout_thread.join().unwrap(); let stderr = stderr_thread.join().unwrap(); - let backtrace = { + let maybe_backtrace = { let mut backtrace = String::new(); let mut backtrace_found = false; @@ -172,7 +172,7 @@ fn main() { }; // Show the backtrace in the GUI if one was found. - if backtrace.is_some() { + if let Some(backtrace) = maybe_backtrace { app.connect_activate(move |app| { let window = ApplicationWindow::builder() .application(app) @@ -198,7 +198,7 @@ fn main() { .yalign(0.0) .build(); sections.append(&error_text); - sections.append(>k_util::codeblock(backtrace.as_ref().unwrap())); + sections.append(>k_util::codeblock(&backtrace)); window.set_content(Some(§ions)); window.show(); diff --git a/justfile b/justfile index a3430fc..766e4b7 100644 --- a/justfile +++ b/justfile @@ -32,49 +32,81 @@ update-versions: date="$(cat CHANGELOG.md | grep "^## \[${version}\]" | grep -o '[^ ]*$')" notes="$(parse-changelog CHANGELOG.md "${version}")" - just update-metainfo "${version}" "${date}" "${notes}" + just update-metainfo -update-metainfo version date notes: +update-metainfo: #!/usr/bin/env python3 import sys import markdown import bs4 + import re + from bs4 import BeautifulSoup, NavigableString - + from bs4.formatter import HTMLFormatter + + # Parse the metainfo and Changelog into BeautifulSoup objects. metainfo_path = "assets/com.hunterwittenborn.Celeste.metainfo.xml" - version = sys.argv[1] - date = sys.argv[2] - notes = markdown.markdown(sys.argv[3]) + changelog_path = "CHANGELOG.md" text = open(metainfo_path).read() + changelog_md = open(changelog_path).read() + changelog_html = markdown.markdown(changelog_md) soup = BeautifulSoup(text, features="xml") - release = soup.new_tag("release") - release["version"] = version - release["date"] = date - description = soup.new_tag("description") - description.append(BeautifulSoup(notes, "html.parser")) - - for h3 in description.find_all("h3"): - changed_header_str = "" + changelog_soup = BeautifulSoup(changelog_html, "html.parser") + releases = [] - if h3.contents[0] == "Fixed": - changed_header_str = "Fixes in this release:" - elif h3.contents[0] == "Changed": - changed_header_str = "Changes made in this release:" - elif h3.contents[0] == "Added": - changed_header_str = "Feature additions in this release:" + # The changelog is in a flat list of HTML tags. Group them into dicts of + # `version: [html-elements]` for easier usage. + versions = {} + current_version = None + + for tag in changelog_soup: + # We don't need empty lines, so ignore them. + if tag.text == "\n": + continue + # Version tags are '##' in markdown (i.e. an '

'). + elif tag.name == "h2" and tag.text != "[Unreleased]": + print(tag.text) + version = re.search("[^[][0-9.]*", tag.text).group(0) + date = re.search("[^ ]*$", tag.text).group(0) + + release_soup = BeautifulSoup("", "html.parser").release + release_soup["date"] = date + release_soup["version"] = version + + versions[version] = release_soup + current_version = version + # If we aren't on a version tag and haven't gotten any version yet, + # we're dealing with content before the first version tag and we + # should ignore it. + elif len(versions) == 0: + continue + # Appstream doesn't support headers in descriptions, so format them as `

` tags. + elif tag.name == "h3": + match tag.text: + case "Added": + header = "New features in this release:" + case "Changed": + header = "Changes in this release:" + case "Fixed": + header = "Fixes in this release:" + case _: + raise Exception(f"Unknown change type: `{tag.text}`") + + versions[version].append(BeautifulSoup(f"

{header}

", "html.parser")) + # Otherwise we're adding to the existing version. else: - raise Exception("Unknown header: " + str(h3)) + versions[version].append(tag) - header = soup.new_tag("p") - header.insert(0, NavigableString(changed_header_str)) - h3.insert_before(header) - h3.extract() + # Clear out the existing versions and write the new ones. + soup.component.releases.clear() - release.append(description) - soup.component.releases.findAll()[0].insert_before(release) - open(metainfo_path, "w").write(soup.prettify(formatter=bs4.formatter.HTMLFormatter(indent=4))) + for release in versions.values(): + soup.component.releases.append(release) + + output = soup.prettify(formatter=HTMLFormatter(indent=4)) + open(metainfo_path, "w").write(output) update-translations: xtr celeste/src/main.rs celeste-tray/src/main.rs libceleste/src/lib.rs --copyright-holder 'Hunter Wittenborn ' -o /dev/stdout --package-name 'Celeste' --package-version "$(just get-version)" > po/com.hunterwittenborn.Celeste.pot diff --git a/libceleste/Cargo.toml b/libceleste/Cargo.toml index 1257387..ea1f11d 100644 --- a/libceleste/Cargo.toml +++ b/libceleste/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "libceleste" -version = "0.5.6" +version = "0.5.7" edition = "2021" [lib] diff --git a/makedeb/PKGBUILD b/makedeb/PKGBUILD index 54d8d8b..86f7a3a 100644 --- a/makedeb/PKGBUILD +++ b/makedeb/PKGBUILD @@ -1,6 +1,6 @@ # Maintainer: Hunter Wittenborn pkgname=celeste -pkgver=0.5.6 +pkgver=0.5.7 pkgrel=1 pkgdesc='Sync your cloud files' arch=('any') diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index d0baddc..a164b69 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -1,6 +1,6 @@ name: celeste base: core22 -version: '0.5.6' +version: '0.5.7' summary: Sync your cloud files description: | Celeste is a GUI file synchronization client that can connect to almost any cloud provider you'd like. It provides a streamlined experience to back up your files, and integrates directly into your desktop system.