Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --version option and About dialog #125

Merged
merged 2 commits into from
Jul 12, 2024

Conversation

martinling
Copy link
Member

This PR adds a --version command line option, and an About dialog to the UI.

Version information is captured at compile time with the git_version macro, so that it is possible to identify builds from non-release versions.

The About dialog includes basic package information, the BSD license text for Packetry itself, and some system information: OS, architecture and GTK library version in use.

It does not yet include copyright or license information for any dependencies.

@martinling martinling linked an issue Jul 12, 2024 that may be closed by this pull request
@martinling martinling requested a review from mossmann July 12, 2024 13:32
Copy link
Member

@mossmann mossmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great, but I get some warnings when I click the menu button:

(packetry:95267): Gtk-CRITICAL **: 15:54:33.990: _gtk_css_corner_value_get_x: assertion 'corner->class == &GTK_CSS_VALUE_CORNER' failed

(packetry:95267): Gtk-CRITICAL **: 15:54:33.990: _gtk_css_corner_value_get_y: assertion 'corner->class == &GTK_CSS_VALUE_CORNER' failed

@mossmann
Copy link
Member

mossmann commented Jul 12, 2024

I'm on:

OS: linux
Architecture: x86_64
GTK version: 4.10.4

I think this is a GTK bug fixed in: https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/6092

@martinling
Copy link
Member Author

I'm on 4.12.5 and I don't see those messages. I think we can assume it's not our fault.

@martinling martinling merged commit 50d0f41 into greatscottgadgets:main Jul 12, 2024
8 checks passed
@mossmann
Copy link
Member

I realized just too late that there is an issue with this when building outside a git repository:

   Compiling packetry v0.1.0 (/tmp/packetry)
error: git describe exited with status 128: fatal: not a git repository (or any of the parent directories): .git
   --> src/ui.rs:998:31
    |
998 |     const GIT_VERSION: &str = git_version::git_version!();
    |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: this error originates in the macro `git_version::git_version` (in Nightly builds, run with -Z macro-backtrace for more info)

error: git describe exited with status 128: fatal: not a git repository (or any of the parent directories): .git
  --> src/main.rs:56:41
   |
56 |         println!("Packetry version {}", git_version::git_version!())
   |                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: this error originates in the macro `git_version::git_version` (in Nightly builds, run with -Z macro-backtrace for more info)

error: could not compile `packetry` (bin "packetry") due to 2 previous errors

This would happen if someone downloads a "source code" archive from a release on GitHub or (as some distro packagers are known to do) checks out a tag from the repo but omits the .git directory. We solve this problem in HackRF by including the a hard-coded version number within the repo and falling back to the hard-coded number if the git method fails.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add an About dialog with version and copyright information
2 participants