Skip to content

Conversation

@Hook25
Copy link

@Hook25 Hook25 commented Sep 6, 2024

Hello, I have created a small snap for jd and use it daily! Shout out for the really nice job, it is super useful. I thought you may like this so here it is.

This is more of a conversation starter, if you like what you see (namely, you want to have the possibility to build a snap), please comment here, I will get someone who is better than me with snaps to actually look this over!

The snap should work as normal jd (it allows you to host the server and use it from the cli). To build it run:

$ snap install snapcraft
$ snapcraft --use-lxd

@josephburnett
Copy link
Owner

@Hook25 thanks for putting this up! Yeah, I would love to have this. I don't use snap but I want jd to be available easily however people get their tools. Have someone look it over and we'll put this up when you're ready. I'll try out snap in the meantime. Thanks!!

Copy link

@pedro-avalos pedro-avalos left a comment

Choose a reason for hiding this comment

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

Hey, I'm a colleague of Massimiliano. I have done some snap packaging, and he asked me to take a look at this PR. Here is my initial feedback. I will try to take a closer look this weekend.

@josephburnett
Copy link
Owner

@Hook25 @pedro-avalos can you update this to track 2.x.y releases? The latest is 2.0.1. I will be backporting only security fixes to the 1.x.y series. Perhaps we can use tracks?

ls
mv release/jd $CRAFT_PART_INSTALL/
# extract the version from main.go and set it as the snap version
VERSION=`grep "const version" main.go | grep -oP '"[\w\.-]+"' | grep -oP "[\w\.-]+"`
Copy link
Owner

Choose a reason for hiding this comment

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

It would be more stable to rely on the -version flag. E.g. go run . -version. Output looks like jd version HEAD and I will keep it stable, even if I change the way the version number works (e.g. if I provide it as a build parameter).

Copy link
Author

Choose a reason for hiding this comment

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

Hello, sorry I kinda abandoned this here. The point of that line is to extract an actual version from jd (as it doesn't seem to return the semver version from the -version flag if you run it from source, can't recall if this was intended). Regardless, the version is not a valid snap version as it can't contain spaces, and it is pretty useless (imagne downloading version HEAD from the store!).

Copy link
Owner

Choose a reason for hiding this comment

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

The code at HEAD doesn't have a version (it just returns HEAD). But the release binaries and associated tagged sources do. So you should be packaging a released version, not one built from head. You can still build from source, but you should should build from a released source.

@Hook25
Copy link
Author

Hook25 commented Feb 11, 2025

As for the release, you can use tracks, but I would probably just use 1 release channel. I didnt do anything on the store side, so I don't know what you mean by update this. Do you want me to rebase this on the current master?

@josephburnett
Copy link
Owner

As for the release, you can use tracks, but I would probably just use 1 release channel. I didnt do anything on the store side, so I don't know what you mean by update this. Do you want me to rebase this on the current master?

I don't know anything about the snap packaging format. But essentially you want to avoid packaging and releasing from HEAD or master. You should build and release a tagged release. Do you know how to make that happen?

@josephburnett
Copy link
Owner

You should build and release a tagged release. Do you know how to make that happen?

Somehow brew is able to track the latest version: https://github.com/Homebrew/homebrew-core/commits/23731cdfd178defe1ff6a5f2a4ece96651db9542/Formula/j/jd.rb

And the aux package is as well: https://aur.archlinux.org/cgit/aur.git/?h=jd-tool-bin

So you should be able to.

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.

3 participants