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

Provide a standalone .deb package #123

Closed
Meakk opened this issue Dec 8, 2021 · 20 comments
Closed

Provide a standalone .deb package #123

Meakk opened this issue Dec 8, 2021 · 20 comments

Comments

@Meakk
Copy link
Member

Meakk commented Dec 8, 2021

Currently, we provide a .tar.gz and a .tar.xz package for Linux.
It's not clear how to use it after extraction to have a better integration with the system.

We need to document the installation steps.
We can also provide a .deb package easily with the CPack generator but we need help for testing.

@Meakk
Copy link
Member Author

Meakk commented Dec 8, 2021

@whiiiskyy FYI

@mwestphal
Copy link
Contributor

Definitely agree, I will take care of documenting the installation steps !

@Meakk
Copy link
Member Author

Meakk commented Dec 8, 2021

@whiiiskyy You can try to fork F3D and modify this line

set(CPACK_GENERATOR TGZ TXZ)

You can add DEB after TXZ and create a pull request so the CI pipeline is triggered on our side and it will generate the .deb automatically so you can download it and test it.
There is a good chance you will have to add more information to the DEB package, in which case you can set additional CMake variables (please refer to the documentation)

We would appreciate it if you can contribute, please let me know in case you need more help.

@HakunMatat4
Copy link

EDIT: DEB package is working like a charm.

@Meakk I believe only once in life I created a .deb package (Ubuntu back in the day).
It does nothing more than what I did but in an automated process.

This is my first Git public help so sorry for my mess.

.tar.gz and a .tar.xz package for Linux provided by you guys, have everything organised in the structure it has to be, 10/10. The only missing thing was that share bin lib should be within a folder called usr. I didn't notice so during my first test nothing happened.

After the copy/paste I did this morning, F3D fully integrated with Linux Mint which is awesome. Usually, things get ugly.
It should work exactly the same with Ubuntu/ Debian, etc.

Regarding to "There is a good chance you will have to add more information to the DEB package", I opened few DEB packages here, like Slack for example, and the structure is:

  • file "debian-binary" with the value of " 2.0" --------- The same value appears within other DEB package. No idea.
  • data.tar.xz: a folder called "."(dot), and then the same folders structure available within F3D .tar.gz as explained above
  • control.tar.xz: a folder called "."(dot), a file called control which requests dependencies, suggestions, architecture, size, etc, like:
Package: f3d
Version: 1.2.0
Section: cad
Priority: optional
Homepage: https://github.com/f3d-app/f3d/
Architecture: amd64
Installed-Size: 76176 -------------------- I checked the size of the folder
Maintainer: F3D <f3d@f3d.com>
Description: A fast and minimalist 3D viewer

I've checked Slack, Telegram, Discord, all DEB files have the same structure above.
With all of that being said, the only missing part from which my first test failed was missing the folder usr.
The TEST folder structure looks like:

├── DEBIAN
│   └── control
└── usr
    ├── bin
    │   └── f3d
    ├── lib
    │   └── libf3d.so
    └── share
        ├── applications
        │   └── f3d.desktop
        ├── doc
        │   └── f3d
        │       ├── LICENSE
        │       ├── README.md
        │       └── THIRD_PARTY_LICENSES.md
        ├── icons
        │   └── hicolor
        │       ├── 32x32
        │       │   └── apps
        │       │       └── f3d.png
        │       ├── 48x48
        │       │   └── apps
        │       │       └── f3d.png
        │       ├── 64x64
        │       │   └── apps
        │       │       └── f3d.png
        │       └── scalable
        │           └── apps
        │               └── f3d.svg
        ├── metainfo
        │   └── com.f3d-app.F3D.metainfo.xml
        ├── mime
        │   └── packages
        │       ├── f3d-3d-exodus-formats.xml
        │       ├── f3d-3d-formats.xml
        │       ├── f3d-3d-image-formats.xml
        │       ├── f3d-assimp-formats.xml
        │       ├── f3d-cad-formats.xml
        │       └── f3d-vtk-formats.xml
        └── thumbnailers
            └── f3d.thumbnailer

To keep things simple, I removed non-essential folders like zsh fish bash, just to make things simpler for now.

Then I run dpkg-deb --build --root-owner-group TEST (TEST is the folder name, yeah, I should have used something more professional) which generated a TEST.deb file, so I deleted the installation I did this morning and installed the package I just generated:

 /home/w/SO/3/f3d-1.2.0-Linux ▓▒░ dpkg -i F3D.deb                                            ░▒▓ ✔ │ root@OptiPlex-7040 
Selecting previously unselected package f3d.
(Reading database ... 497821 files and directories currently installed.)
Preparing to unpack F3D.deb ...
Unpacking f3d (1.2.0) ...
Setting up f3d (1.2.0) ...
Processing triggers for gnome-menus (3.36.0-1ubuntu1) ...
Processing triggers for desktop-file-utils (0.24+linuxmint1) ...
Processing triggers for mime-support (3.64ubuntu1) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Processing triggers for shared-mime-info (1.15-1) ...

Everything is working like a charm, all files were copied to their system location, 100% integrated with the system, I can find F3D under the applications menu. This only happened because F3D isn't a complex tool, it is simple, light and powerful.

The only thing I am not sure if the DEB package can do is to send the file config.json under ~/.config/f3d/

The documentation @mwestphal mentioned, should cover the ~/.cache in case the thumbnail doesn't work, my case.

I hope you guys understand my messy explanation. I will check on this tomorrow, 00 AM Aussie time now!

@Meakk
Copy link
Member Author

Meakk commented Dec 8, 2021

Thanks a lot for the tests @whiiiskyy, it's very useful!
It seems like providing a .deb archive would be great addition for Debian-based users.

Then I run dpkg-deb --build --root-owner-group TEST

This is great for testing, but we need to rely on CPack to generate it automatically during the CI pipeline execution (see my previous message).
Let me know if you need help to create a pull request, I know it can be confusing if you are not a developer.

The only thing I am not sure if the DEB package can do is to send the file config.json under ~/.config/f3d/

config.json should be installed system-wise in /etc/f3d/config.json by the package
The file ~/.config/f3d/config.json can be added by the user so it takes precedence over the system config file.

The documentation @mwestphal mentioned, should cover the ~/.cache in case the thumbnail doesn't work, my case.

I'm confused, what's in ~/.cache folder?

@HakunMatat4
Copy link

HakunMatat4 commented Dec 8, 2021

Sure thing @Meakk , I will do the test you requested using the PR. Please, allow me some time tomorrow, well, within few hours. 1AM now.

The .cache folder I mentioned is covered under troubleshooting section. At first, my 3D STL files thumbnail didn't work, so I renamed the folder instead of deleting it, just for precaution.
After this, the STL/OBJ thumbnail were automatically generated.

@Meakk
Copy link
Member Author

Meakk commented Dec 8, 2021

Sure thing @Meakk , I will do the test you requested using the PR. Please, allow me some time tomorrow, well, within few hours. 1AM now.

No rush, take all the time you need. Thanks again for your help.

@mwestphal
Copy link
Contributor

separating the doc issue here: #128

@mwestphal mwestphal changed the title Improve Linux release packages Provide a standalone .deb package Dec 9, 2021
@HakunMatat4
Copy link

@Meakk I have tried to push the changes but got access denied.
Git isn't my strongest so it could be it

git clone https://github.com/f3d-app/f3d.git
git checkout -b deb_package

Added DEB to the line 77 `set(CPACK_GENERATOR TGZ TXZ DEB)`

git add .
git commit -m "Added DEB to cPack generator"
git push --set-upstream origin deb_package

Independent of this, the folder paths to work with DEB system needs to be updated.
Both tar.gz and tar.xz have the same structure.
Basically, as I mentioned before share bin lib should be within a folder called usr

As I experienced that during my manual test, without the above, F3D won't be installed.

I have removed the DEB package I generated manually.
I can confirm it is no longer installed and thumbnails is no longer available.
I will wait for the official DEB and start from there.

 /home/whisley ▓▒░ dpkg -r f3d                                                                                                    ░▒▓ ✔ │ root@OptiPlex-7040 
(Reading database ... 498200 files and directories currently installed.)
Removing f3d (1.2.0) ...
Processing triggers for shared-mime-info (1.15-1) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Processing triggers for gnome-menus (3.36.0-1ubuntu1) ...
Processing triggers for desktop-file-utils (0.24+linuxmint1) ...
Processing triggers for mime-support (3.64ubuntu1) ...
 /home/whisley ▓▒░                                       

Please, let me know what I should do next.
Cheers

@Meakk
Copy link
Member Author

Meakk commented Dec 10, 2021

Hi @whiiiskyy
You need to fork F3D (click on the button at the top right of this page), it will create a repository https://github.com/whiiiskyy/f3d
Then, you need to add locally the new remote: git remote add fork git@github.com:whiiiskyy/f3d.git
Push your local change to this remote: git push --set-upstream fork deb_package
If you go to your fork page, you will see a green button to create the Pull Request. Once the PR is created, the CI is triggered, and you will be able to download the .deb (you will have to wait approximately 5 minutes until it is completed)

@mwestphal
Copy link
Contributor

Need any help @whiiiskyy ?

@HakunMatat4
Copy link

@Meakk @mwestphal sorry guys, gonna have a look at this today. Monday morning here.

@Meakk
Copy link
Member Author

Meakk commented Dec 12, 2021

No worries. Thanks for your help.

@HakunMatat4
Copy link

HakunMatat4 commented Dec 12, 2021

@Meakk I managed to get it done, I told you guys Git isn't my strongest lol
First of all, I need to use clone, if I just run that git remote add fork git@github.com:whiiiskyy/f3d.git it gives me a load of errors.
This is what I did and this is the PR: #146

git clone https://github.com/whiiiskyy/f3d.git
git checkout -b deb_package
MAKE THE CHANGES
git add .
git commit -m "Added DEB to cPack generator"
git push --set-upstream origin deb_package

Please, let me know if that is what you expected.
Thank you

@mwestphal
Copy link
Contributor

For reference, here is the right way to setup for contributing to F3D (and many other github project using the fork paradigm), even in the context of using git lfs

  1. Create a fork from the original project clicking on the button in github
  2. Clone the original project using https protocol: git clone https://github.com/f3d-app/f3d.git
  3. In the local repository, add you own remote using git protocol: git remote add username git@github.com:username/f3d.git
  4. Commit on the local repo
  5. Push on your remote: git push username
  6. Create a PR from your repo to original repo

I suspect this went wrong at step two for you.

The problem with your current setup is that you will not get update to master unless you click the "fetch upstream" button within github. Not a big deal at all in the context of this issue but you may want to fix that at some point.

Btw, we definitelly should document all that, and we will.

I hope this helps :)

@HakunMatat4
Copy link

Thanks for that @mwestphal it is my first somewhat contribution. I did try to help on Pi-Hole documentation but didn't get much help to explain how this git thing works so I gave up, I didn't learn.
Sorry for giving you guys more headache than actually helping :P

I will redo everything as you requested once this PR is sorted out.
About the .rpm you mentioned, I should be able to spin up a CentOS VM to check that out in case there is nobody to test it. I manage CentOS text mode only servers so I should have no problem playing around with its desktop version.

Thank you

@mwestphal
Copy link
Contributor

@whiiiskyy no worries, we are verry happy to assist a contributor, especially for a first contribution :).

Let us know if you need any further help.

@HakunMatat4
Copy link

@mwestphal , I got everything set but first....

I've followed as requested but like before I got some permission issues.
I have bothered you guys enough about this so I went to check Git official documentation: https://docs.github.com/en/get-started/quickstart/fork-a-repo
To sync: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

~/GITHUB/f3d  master ▓▒░ git remote -v                                                                                                                ░▒▓ ✔ 
origin	https://github.com/whiiiskyy/f3d.git (fetch)
origin	https://github.com/whiiiskyy/f3d.git (push)
upstream	https://github.com/f3d-app/f3d.git (fetch)
upstream	https://github.com/f3d-app/f3d.git (push)

I got everything working, I can git checkout deb_package the branch for the PR I created before, I can also sync my local repo:

git fetch upstream
git checkout main
git merge upstream/master                                                                                                    ░▒▓ ✔ 
Updating e12c983..81ba8e8
Fast-forward
 src/F3DLoader.cxx               |  7 +++++++
 src/F3DLog.cxx                  | 10 ++--------
 src/F3DLog.h                    |  2 --
 src/vtkF3DWin32OutputWindow.cxx |  4 +---
 4 files changed, 10 insertions(+), 13 deletions(-)

So I believe I got the fork set and the sync in place.

I noticed that the build failed because of CPack Error: Problem compressing the directory

This CPack is new to me, I did some googling and It appears that this problem is related to either the path /usr/share/cmake-3.22/Modules/Internal/CPack/CPackDeb.cmake:793 (cpack_deb_prepare_package_vars) which is too long or because this process is trying to do an in-source build or whatever that means.

The few posts I saw mentioned that in-source build. I am not sure what that would mean here.
I am not sure if this has anything to do with CPack running under /usr/share/ when f3d application is also under /usr/share and this is what they call in-source build

Well, I hope to be helping rather than the opposite haha

Thanks

@Meakk
Copy link
Member Author

Meakk commented Dec 13, 2021

Fixed by #146

@Meakk
Copy link
Member Author

Meakk commented Dec 13, 2021

Thanks @whiiiskyy !

@Meakk Meakk closed this as completed Dec 13, 2021
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

No branches or pull requests

3 participants