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

fix(gitkraken): empty VERSION_PUBLISHED (fixes #1248) #1249

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions 01-main/packages/gitkraken
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
DEFVER=1
get_website "https://help.gitkraken.com/gitkraken-client/current/"
ARCHS_SUPPORTED="amd64"
get_website "https://www.gitkraken.com/download/linux-deb"
if [ "${ACTION}" != "prettylist" ]; then
VERSION_PUBLISHED=$(grep -m 1 'id="version-' "${CACHE_FILE}" | sed -e 's/<[^>]*>//g' | cut -d' ' -f2)
VERSION_PUBLISHED=$(sed -n -E "0,/.*name:\s*'([^']+)'/s//\1/p" "${CACHE_FILE}")
Copy link
Member

@philclifford philclifford Jan 19, 2025

Choose a reason for hiding this comment

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

This results in a CTRL-M at the end of the published version,which upsets dpkg --compare-versions when you update.

 deb-get show gitkraken| cat -v -
[...]
  [^[[32m+^[[0m] Including local package gitkraken
[...]  
GitKraken
  Package:	gitkraken
  Repository:	99-local
  Updater:	deb-get
  Installed:	10.6.1
  Published:	10.6.1^M
deb-get update
[...]
Fetched 160 kB in 7s (22.4 kB/s)
Reading package lists...
' has bad syntax: invalid character in version number
 is available.n (10.6.1) has an update pending. 10.6.1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@philclifford Sorry, I'm not sure what, exactly, the error is. Is there a Ctrl-M at the end of the version?

I tested it, and it installed fine on Ubuntu 24.04, using the above command. I will retest.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, sorry to be unclear (at 4am ;-) ) - it is a Ctrl-M at the end of the version. That only really affects update (because dpkg --compare-versions complains ) and probably upgrade (which will continually want to upgrade because the compare "fails" ). Install will work fine as it just fetches the deb and installs it without comparing (except if the deb turns out to be the same version it'll skip the install )

Copy link
Member

@philclifford philclifford Jan 19, 2025

Choose a reason for hiding this comment

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

    VERSION_PUBLISHED=$(grep -E 'name:.*' $CACHE_FILE | grep -Eo  '([[:digit:]]+\.)+[[:digit:]]+' )

Not a single elegant sed but it works (for now) and is almost readable ...

Copy link
Member

@philclifford philclifford Jan 19, 2025

Choose a reason for hiding this comment

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

    VERSION_PUBLISHED=$(sed -n -E "s/.*name:\s*'([0-9]+\.[0-9]+\.[0-9]+).*/\1/p" "$CACHE_FILE")

sed version which also works

I cannot understand at all why this clunky thing works but your elegant and simple one adds a Ctrl-M 🤷

Copy link
Member

@philclifford philclifford Jan 19, 2025

Choose a reason for hiding this comment

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

Suggested change
VERSION_PUBLISHED=$(sed -n -E "0,/.*name:\s*'([^']+)'/s//\1/p" "${CACHE_FILE}")
VERSION_PUBLISHED=$(sed -n -E "s/.*name:\s*'([^']*)'.*/\1/p" "$CACHE_FILE")

This works and appears to successfully dispense with the CTRL-M while capturing whatever's between the quotes.

fi
URL="https://release.gitkraken.com/linux/gitkraken-amd64.deb"
PRETTY_NAME="GitKraken"
WEBSITE="https://www.gitkraken.com/invite/ieih1QR3"
WEBSITE="https://www.gitkraken.com/git-client"
SUMMARY="Intuitive Git GUI & powerful Git CLI."
Loading