-
-
Notifications
You must be signed in to change notification settings - Fork 127
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
base: main
Are you sure you want to change the base?
Conversation
Tested and working locally: cd /etc/deb-get/99.local.d
wget https://raw.githubusercontent.com/rasa/deb-get/refs/heads/1248-fix-gitkraken/01-main/packages/gitkraken
deb-get update # optional
deb-get install gitkraken |
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}") |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 )
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}") |
There was a problem hiding this comment.
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 ...
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}") |
There was a problem hiding this comment.
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 🤷
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}") |
There was a problem hiding this comment.
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 "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.
Since we are already using
sed
, I figure let's go all the way and just usesed
.I know it's cryptic as h*ll, but it works. :)