amazonlinux / amazon-linux-2023

Amazon Linux 2023
https://aws.amazon.com/linux/amazon-linux-2023/
Other
526 stars 39 forks source link

[Package Request] - jless #433

Open danfuzz opened 1 year ago

danfuzz commented 1 year ago

What package is missing from Amazon Linux 2023? Please describe and include package name.

Jless is a command-line / shell-based interactive JSON viewer, kinda like less but specifically for JSON (hence the name). Its home page is https://jless.io/.

Is this an update to existing package or new package request?

New package request.

Is this package available in Amazon Linux 2? If it is available via external sources such as EPEL, please specify.

Not in Amazon Linux 2 (AFAIK). See https://jless.io/ at the bottom of the page for the list of ways it's currently packaged.

Any additional information you'd like to include. (use-cases, etc)

It's super-handy!

cohml commented 8 months ago

+1 to this request.

daniejstriata commented 8 months ago

jless is not found in Fedora. I did compile it in my COPR repo from source in herE: https://copr.fedorainfracloud.org/coprs/faramirza/al2023/package/jless/ I used the jless github repo for the source and my fork has the spec file here: https://github.com/daniejstriata/jless/blob/main/jless.spec If you want to package your own.

cohml commented 8 months ago

That sound wonderful! But I must admit, I am completely out of my depth building Rust programs from source on Linux...

@daniejstriata - If you know from first-hand experience that it is possible - that is, to manually create a working binary on AWS EC2 (bonus points for RHEL8 as well!) - would you be able to share detailed, reproducible instructions for how to do that?

daniejstriata commented 8 months ago

@cohml You can build for most RPM based distros in COPR.

  1. Create account with Fedora.
  2. You want to be able to login to: https://copr.fedorainfracloud.org/
  3. Create a new Project. This project is what will become the repo. 3.1 Give it a name and select the distros you want to build for. 3.2 Leave everything else as is.
  4. Add your Packages to your Project. 4.1 Source Packages from Fedora or Centos-Stream:
  5. These packages should build as long as the dependencies are met and don't require internet access to build.
  6. Click "New Package"
  7. Click "distgit"
  8. Under Package Name add the name of the package you want to build as it is found in Fedora or Centos-Stream
  9. Select appropriate source from "DistGit instance"
  10. Tick "Auto-rebuild the package" so it auto builds when the Fedora/Centos-Stream package is updated. Since you did not specify "Committish" you'll build the version in Rawhide if you selected Fedora. I prefer building with Centos-Stream as much as possible, especially missing dependencies.
  11. Save
  12. Now you can can try to build it by clicking the rebuild button next to the package.
    4.2 Source Packages from other sources not found in Fedora/Centos-Stream.
  13. Building RPM for rust can become a bit more tricky. Fedora often creates a rpm package for each dependency. Those dependencies will most probably will be missing in AL2023 or RHEL8. You'll need to build the package based on a RPM spec file of your own making. jless was made like this.
  14. Clone the github repo for the app you want to build.
  15. In your fork add a SPEC file that matches the Package name you want to build.
  16. Ensure that the Source URL in the SPEC is the URL pointing to the matching tar.gz in the github release source.
  17. In COPR Create new Package.
  18. Stay on SCM
  19. Give the package a name.
  20. Keep Type git
  21. Use your forked repo in Clone URL
  22. Enter SPEC File name found in your repo.
  23. tick Auto-rebuild if automatic rebuilds are desired
  24. Save.
  25. Building packages is easy enough. From Builds: You'll see your latest Package being built. The status once built should be success. If it failed you will need to enter the BuildID. Identify what failed.
  26. Scroll to the bottom
  27. If the "Source state" failed it usually means the package was not found.
  28. If the failure is next to a Chroot Name instance State, then:
  29. Click on builder-live.log.gz
  30. The log will tell you why it failed. Often it is a missing dependency at the end of the log.
    
    Here is my `jless` github repo:
    `https://github.com/daniejstriata/jless`
    Look at the jless.spec.
    As it is installing rust from the internet (I did not package the rust dependencies. I'm letting cargo do the heavy lifting by sourcing the required dependencies) therefore you need to tick the "Enable internet access during this build" when building this type of package. (Creating a package like that would not be allowed in Fedora proper. All your dependencies must be provided by the OS.)
    You might want a host running al2023 and build the Spec file there before moving on to a COPR build.

Take note of the package's requirements like minimum versions of rust or gcc required to build the package. Can it build by following the steps from the developer provided on the Distro you need it on? Don't build packages that change your system too much. Don't upgrade / rebuild core packages. If you do, from that point on you're no longer using the distro you started off with. You don't want a Frankenstein. unsafe { Dragons::hatch(); } Once a package is built, install it somewhere to see that it does install and what else would change before adopting it. Packages in the Project are automatically available to be used to build other packages which are depending on them.

Refer to. https://docs.fedoraproject.org/en-US/package-maintainers/Packaging_Tutorial_GNU_Hello/ (I don't know of Fedora has an equivalent of the following) https://wiki.debian.org/DontBreakDebian

Once you have created a package, you can add the repo on your hosts by following the steps in CORP under the Overview section.

cohml commented 8 months ago

You are an absolute hero, thank you for your service!!