Skip to content

Workflow for Linux systems (the deb executable file will be generated)#417

Merged
arvanus merged 7 commits into
mariuz:masterfrom
baldeuniversel:master
Apr 9, 2025
Merged

Workflow for Linux systems (the deb executable file will be generated)#417
arvanus merged 7 commits into
mariuz:masterfrom
baldeuniversel:master

Conversation

@baldeuniversel

@baldeuniversel baldeuniversel commented Apr 8, 2025

Copy link
Copy Markdown
Contributor

Hi ! @arvanus .

The necessary changes have been applied (an optimal [or almost] way of doing things for the Github repository https://github.com/mariuz/flamerobin).

I tested the app, everything is okay.

During installation, for example, on Ubuntu.

If there is a dependency issue, simply run the following command to install the necessary dependencies.
sudo apt install -f

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hello @baldeuniversel, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

Summary of Changes

This pull request introduces the necessary files and scripts to generate a Debian package (.deb) for the FlameRobin database administration tool on Linux systems. It includes control files, pre-installation and post-installation scripts, and necessary files for the application's proper functioning, such as the desktop entry and launcher script. The scripts handle tasks like dependency checks, directory creation, and symbolic link creation.

Highlights

  • DEBIAN Control File: The control file specifies package metadata like name, version, dependencies, and description.
  • Pre-installation Script (preinst): The preinst script checks for system compatibility, including the GLIBC version, and creates a temporary directory.
  • Post-installation Script (postinst): The postinst script handles tasks after installation, such as copying the desktop file, updating the desktop database, and creating a symbolic link to the executable.
  • Launcher Script: The flamerobin-launcher script sets the LD_LIBRARY_PATH environment variable and launches the main FlameRobin executable.
  • Desktop Entry: The flamerobin.desktop file provides information for the desktop environment to create a launcher icon for FlameRobin.

Changelog

Click here to see the changelog
  • templates/trees/deb/flamerobin/DEBIAN/control
    • Added the control file with package metadata, including dependencies and description.
  • templates/trees/deb/flamerobin/DEBIAN/postinst
    • Added the postinst script to handle post-installation tasks.
    • The script checks for the existence of /usr/local/share/applications/ and creates it if it doesn't exist.
    • Copies the flamerobin.desktop file to /usr/local/share/applications/.
    • Updates the desktop database.
    • Creates a symbolic link for the executable in /usr/local/bin/ or /usr/bin/.
  • templates/trees/deb/flamerobin/DEBIAN/preinst
    • Added the preinst script to perform checks before installation.
    • Checks for the existence of /tmp and creates /tmp/flamerobin if it doesn't exist.
    • Verifies that the operating system is GNU/Linux.
    • Checks if the GLIBC version is greater than or equal to 2.39.
  • templates/trees/deb/flamerobin/opt/flamerobin/bin/.flamerobin_exec
    • Added a placeholder file for the flamerobin executable.
  • templates/trees/deb/flamerobin/opt/flamerobin/bin/flamerobin-launcher
    • Added the flamerobin-launcher script to set the library path and launch the application.
  • templates/trees/deb/flamerobin/opt/flamerobin/lib/.flamerobin_lib_depends
    • Added a placeholder file for flamerobin library dependencies.
  • templates/trees/deb/flamerobin/opt/flamerobin/share/applications/flamerobin.desktop
    • Added the flamerobin.desktop file for desktop integration.
  • templates/trees/deb/flamerobin/opt/flamerobin/share/man/man1/flamerobin.1
    • Added the man page for flamerobin.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.


A deb package is made,
For Linux, a program displayed,
Scripts run with care,
Ensuring all's fair,
FlameRobin's now easily swayed.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

The pull request introduces changes to create a workflow for Linux systems, specifically generating a .deb executable file for FlameRobin. The changes include modifications to the control file, preinst, and postinst scripts, as well as updates to the launcher and desktop entry. Overall, the changes seem well-structured, but there are a few areas that could be improved for clarity, security, and maintainability.

Summary of Findings

  • GLIBC Version Check: The preinst script includes a check for GLIBC version. While this is good for ensuring compatibility, the method used to retrieve the version might not be robust across all systems. Consider using a more reliable method or providing a fallback mechanism.
  • Error Handling: Several scripts use || exit 1 for error handling. While this works, it doesn't provide much information about the failure. Consider adding more descriptive error messages to aid in debugging.
  • Redundant Checks: The postinst script contains redundant checks for directory existence and path inclusion. These can be simplified to improve readability and efficiency.

Merge Readiness

The pull request introduces important functionality for creating .deb packages. However, there are some areas that need improvement before merging. Specifically, the GLIBC version check should be made more robust, error handling should be improved with more descriptive messages, and redundant checks in the postinst script should be simplified. I am unable to approve this pull request, and recommend that others review and approve this code before merging. I recommend that the pull request not be merged until the high severity issues are addressed.

Comment thread templates/trees/deb/flamerobin/DEBIAN/preinst Outdated
Comment thread templates/trees/deb/flamerobin/DEBIAN/preinst Outdated
Comment thread templates/trees/deb/flamerobin/DEBIAN/postinst Outdated
Comment thread templates/trees/deb/flamerobin/DEBIAN/postinst Outdated
Comment thread templates/trees/deb/flamerobin/DEBIAN/postinst Outdated
Comment thread templates/trees/deb/flamerobin/DEBIAN/postinst Outdated
Comment thread templates/trees/deb/flamerobin/DEBIAN/preinst Outdated
@baldeuniversel

Copy link
Copy Markdown
Contributor Author

Gemini is still far from being the best (at least not in Bash).

Some of these recommendations are simply flawed.

Like :

cp -r /opt/flamerobin/share/applications/flamerobin.desktop /usr/local/share/applications/ || \
    echo -e "Failed to copy the desktop file" && exit 1

The above syntax does not correct.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Hi @baldeuniversel,

Thanks for pointing out the potential issue with the cp command syntax in the postinst script. You're right that the current syntax might not be the most robust. I'll offer a suggestion to improve the error handling and ensure the command behaves as expected.

I'll provide a code suggestion in a review comment on the postinst file.

@baldeuniversel

Copy link
Copy Markdown
Contributor Author

Hi @baldeuniversel,

Thanks for pointing out the potential issue with the cp command syntax in the postinst script. You're right that the current syntax might not be the most robust. I'll offer a suggestion to improve the error handling and ensure the command behaves as expected.

I'll provide a code suggestion in a review comment on the postinst file.

One of the solutions would be :

#
cp -r /opt/flamerobin/share/applications/flamerobin.desktop /usr/local/share/applications/ || \
    { echo -e "Failed to copy the desktop file [ ...flamerobin.desktop -> /usr/local/share/applications ]"; exit 1; }

@baldeuniversel

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

The pull request introduces necessary changes to create a deb executable file for Linux systems. The changes include adding control files, preinst and postinst scripts, launcher scripts, and desktop entry files. Overall, the changes seem well-structured and address the objective. However, there are some areas that could be improved for clarity and robustness.

Summary of Findings

  • Error Handling in postinst: The postinst script includes error handling for directory creation and file copying, but it could be more robust by checking for the existence of the target directories before attempting to copy files. Additionally, consider using more descriptive error messages to aid in debugging.
  • Path Handling in postinst: The postinst script checks for the existence of /usr/local/bin/ and /usr/bin/ before creating symbolic links. However, it might be beneficial to use command -v to check if flamerobin-launcher exists in the PATH before creating the symbolic link.
  • Temporary Directory Handling in preinst: The preinst script creates a temporary directory /tmp/flamerobin. It's important to ensure that this directory is properly cleaned up after the installation or uninstallation to prevent potential issues with disk space or security.

Merge Readiness

The pull request is almost ready for merging. However, the identified issues should be addressed to improve the robustness and maintainability of the installation process. Specifically, enhancing error handling in postinst, improving path handling, and ensuring proper cleanup of the temporary directory in preinst are recommended. I am unable to approve this pull request, and recommend that others review and approve this code before merging.

Comment thread templates/trees/deb/flamerobin/DEBIAN/postinst Outdated
Comment thread templates/trees/deb/flamerobin/DEBIAN/postinst Outdated
Comment thread templates/trees/deb/flamerobin/DEBIAN/postinst Outdated
Comment thread templates/trees/deb/flamerobin/DEBIAN/preinst Outdated
@baldeuniversel

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

The pull request introduces a workflow for Linux systems to generate a deb executable file for FlameRobin. The changes include adding necessary files and scripts for packaging. Overall, the changes seem reasonable, but there are a few areas that could be improved for clarity and maintainability.

Summary of Findings

  • Inconsistent use of shebang: The shebang line (#!/bin/bash) is missing in some bash scripts, which can lead to unexpected behavior if the script is executed without explicitly specifying the interpreter.
  • Error handling in postinst script: The postinst script includes error handling, but it could be more robust by checking for errors after each command and providing more informative error messages.
  • Redundant checks in postinst script: The postinst script contains redundant checks for directory existence and PATH inclusion, which can be simplified.

Merge Readiness

The pull request is not ready for merging. There are some high and medium severity issues that need to be addressed before merging. I recommend addressing these before merging. I am unable to directly approve the pull request, and users should have others review and approve this code before merging.

Comment thread templates/trees/deb/flamerobin/DEBIAN/control
Comment thread templates/trees/deb/flamerobin/DEBIAN/postinst Outdated
Comment thread templates/trees/deb/flamerobin/DEBIAN/postinst Outdated
Comment thread templates/trees/deb/flamerobin/DEBIAN/postinst
Comment thread templates/trees/deb/flamerobin/DEBIAN/postinst Outdated
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. As a reminder, free tier users are limited to 5 requests per day. Please wait up to 24 hours and I will start processing your requests again!

2 similar comments
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. As a reminder, free tier users are limited to 5 requests per day. Please wait up to 24 hours and I will start processing your requests again!

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. As a reminder, free tier users are limited to 5 requests per day. Please wait up to 24 hours and I will start processing your requests again!

@arvanus

arvanus commented Apr 9, 2025

Copy link
Copy Markdown
Collaborator

@baldeuniversel
nice! Thank you
Any chance to use the file version automatically from /src/frversion.h file to define de .deb version in the CI?

@gemini-code-assist

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Hi @arvanus,

That's a great idea to automatically fetch the version from src/frversion.h for the .deb package! This would definitely streamline the release process and reduce the chance of manual errors. I'm not able to implement this myself, but I can offer some guidance for @baldeuniversel on how to achieve this in the CI pipeline.

One approach would be to use sed or awk in the CI script to extract the version number from src/frversion.h and then use that variable when creating the .deb package. For example:

VERSION=$(grep FR_VERSION_STRING src/frversion.h | awk '{print $3}' | tr -d '"')

echo "Version: $VERSION" > templates/trees/deb/flamerobin/DEBIAN/control

This snippet extracts the FR_VERSION_STRING from the header file, removes the quotes, and then writes it to the Version field in the control file. @baldeuniversel, you could incorporate this into your CI script.

@baldeuniversel

Copy link
Copy Markdown
Contributor Author

@baldeuniversel nice! Thank you Any chance to use the file version automatically from /src/frversion.h file to define de .deb version in the CI?

@gemini-code-assist

Yep ! It will be done.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Thanks @baldeuniversel for confirming that you'll address @arvanus' suggestion to automatically fetch the version from src/frversion.h! Let me know if you have any questions about the sed or awk approach I outlined, or if you'd like to explore other options.

@baldeuniversel

Copy link
Copy Markdown
Contributor Author

Hi @arvanus,

That's a great idea to automatically fetch the version from src/frversion.h for the .deb package! This would definitely streamline the release process and reduce the chance of manual errors. I'm not able to implement this myself, but I can offer some guidance for @baldeuniversel on how to achieve this in the CI pipeline.

One approach would be to use sed or awk in the CI script to extract the version number from src/frversion.h and then use that variable when creating the .deb package. For example:

VERSION=$(grep FR_VERSION_STRING src/frversion.h | awk '{print $3}' | tr -d '"')

echo "Version: $VERSION" > templates/trees/deb/flamerobin/DEBIAN/control

This snippet extracts the FR_VERSION_STRING from the header file, removes the quotes, and then writes it to the Version field in the control file. @baldeuniversel, you could incorporate this into your CI script.

This is a very bad suggestion gemini 🙂.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Hi @baldeuniversel,

I understand your concern about the suggestion I provided for extracting the version from src/frversion.h. Could you elaborate on why you think it's a bad suggestion? Knowing the specific issues you see with it will help me provide a more relevant and helpful alternative. Perhaps there are edge cases or specific scenarios where it might fail that I haven't considered.

@baldeuniversel

baldeuniversel commented Apr 9, 2025

Copy link
Copy Markdown
Contributor Author

Hi @baldeuniversel,

I understand your concern about the suggestion I provided for extracting the version from src/frversion.h. Could you elaborate on why you think it's a bad suggestion? Knowing the specific issues you see with it will help me provide a more relevant and helpful alternative. Perhaps there are edge cases or specific scenarios where it might fail that I haven't considered.

gemini, your last command will erase what was in the control file. That's not the expected behavior 🧐.

@baldeuniversel

Copy link
Copy Markdown
Contributor Author

@baldeuniversel nice! Thank you Any chance to use the file version automatically from /src/frversion.h file to define de .deb version in the CI?

@gemini-code-assist

Done !

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Hi @baldeuniversel,

You're absolutely right! My apologies for the oversight. Using > will indeed overwrite the contents of the control file, which is not the desired behavior.

Instead of overwriting, we should append to the file. Here's a corrected approach using >> to append the version information:

echo "Version: $VERSION" >> templates/trees/deb/flamerobin/DEBIAN/control

This will add the Version field to the end of the control file without erasing its existing content. Thanks for catching that! I'm still under development, and your feedback helps me learn and improve.

@baldeuniversel

Copy link
Copy Markdown
Contributor Author

for the oversight.

This isn't the expected behavior.

Don't worry 😊, I've already done the job.

@arvanus

arvanus commented Apr 9, 2025

Copy link
Copy Markdown
Collaborator

Nice, anything else?
If not I'll merge ASAP :)

@baldeuniversel

Copy link
Copy Markdown
Contributor Author

Nice, anything else? If not I'll merge ASAP :)

It's okay for me !

@arvanus
arvanus merged commit f147f0e into mariuz:master Apr 9, 2025
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.

2 participants