feat(just): Add tab completion to ujust ...
@bsherman does this look right?
https://github.com/ublue-os/config/commit/d0522240cb5e4488d3a0b01d0478f7372fe46b69
72 Replies
threading ๐
i don't think that will work as epxected
so, you made that edit in the
%build
scriptlet... everything that happens there, if you want it to be in the RPM, needs to end up in the buildroot,also the completion for just is looking only if the called command was just
does that mean the symlink idea is not valid? i've not done much with completions, so apologies if i sent us down a rabbit trail
honestly, before building this stuff into RPMs it's a lot easier to test... i usually do a lot of local testing before i get to packaging/pushing commits...
Is the logic to get into just completion
if i need to edit that i can do that using perl, just show me what needs to be changed and i can process that ๐
or i can just to a
s/just/ujust/g
๐like for this...
if not wanting to risk you desktop system...
have a ublue/Silverblue VM, and
chattr -i /
on it and then just do the symlink normal to testhavent set up the vm yet
since i would end up setting up a VM with actual hardware passed through to it for better testing ๐คฃ
so you propose to append that to
bash-completion/completions/just
not add a new file?Here you go
"real" hardware is overated ๐ the main benefit is testing 3D hardware, etc, specific hardware driver support, and your personal machine will only have so much of that anyway
seems to be just
s/just/ujust/g
so i can programmatically do that and pipe the output to the file ๐yeah just don't change where it's a justfile
that shouldnt be a problem
yeah, i think simply add the
ujust-completion
file to the config repo , as provided by @M2 and make sure it gets included in the RPMcan look into auto generating it later then
auto generating what?
as in just have the rpm just grab the content of the just completion, parse it and modify it for ujust instead of supplying a hardcoded one
i... tend to over engineer things sometimes ๐
well, i think what M2 provided lets bash use the
just
completion when called as ujust
so there's not a need to do morehmm cant see what i am missing in the spec file, it says it cannot find ujust-completion ๐ค
https://github.com/ublue-os/config/pull/188
you'll need to add a line similar to these: https://github.com/ublue-os/config/blob/main/build/ublue-os-just/build.sh#L9-L12
oh right i forgot the build script
everything with RPM spec is about staging stuff in the builddir before starting
im so used to making launchpad deb packages where you just specify where it goes and done
ok its done and pushed
i haven't done launchpad, and it's been a long time since i built a deb from scratch... but i will say, i think we could probably simplify some of this process, but i didn't create it all so i haven't dove into a refactor yet ๐
i recently did a refactor of quickpassthrough from bash to golang
it took me a year (with irl distractions)
actual coding time maybe 3 weeks to a month
2023 was rough for me to say the least ๐
btw, i did misunderstand something with what M2 wrote above.,.. when i saw the code-snippet, i assumed that the attached file was only that, and it was some magic to tie into the
just
completion file...
but i realize i was wrong, and what you said about automating, @HikariKnight does make sense now.yeah but i dont know if rpm can execute just at install to run the completion command
it probably can't execut
just
but it can certainly:
s/just/ujust/g
so i can programmatically do that and pipe the output to the file
well just generates the file using
just --completions bash
and i could just pipe the output to perl and modify it on the fly before writing itahhhhh i'm tracking with you now
hmm...
i know with debs you can run post install commands to do stuff like that
in the
build.sh
, we could install just into the build container, then you can sed 's/just/ujust/g' /usr/share/bash-completion/completions/just > /tmp/ublue-os/rpmbuild/SOURCES/ujust-completion
instead of the cp
you can do %post
stuff in RPM also, so that's another option, though we'd need to ensure that ublue-os-just
requires that just
is installed firstthink it already says that in the spec file ๐ค
Supplements: just
yeah, I'd have to lookup the keyword ๐
I think Supplements is technicall a weak dependency, and we'd really prefer a hard dependency, since we'd be using
just
in our %post
If we want to build ujust-completion
from just-completion
then that Supplements
should also change to Requires
https://rpm-software-management.github.io/rpm/manual/spec.html (search "Supplements" and "Requires")let me see what i can cook up then
Hope i'm not being annoying ๐ I like that you wanted to "get it right" by doing the automation, so just trying to encourage that. It's much better to follow through on an idea like you had, rather than hard code something static which won't update with upstream.
i tend to try automate when i can, which is what quickpassthrough is
automation
reading
quickpassthrough
repo nowThanks for the great conversation
was told by the vfio people and looking-glass people "no dont do it, bad idea" but i make it clear when you start it that "hey this will attempt to configure the host"
yw
I don't want to derail thread, but good stuff...
stepping away for work call
just --completion bash | perl -pe 's/([\(_" ])just/\1ujust/g'
should generate a valid ujust completion file from what i gather @M2
well it will write it to STDOUT
it specifically does not match --justfilecan confirm it generates a working completion file
question: why perl and not sed?
I am know the perl regex syntax like the back of my hand
fair, but all our other build scripts use sed...
I'm testing the PR now
i know most things use sed ๐
i just never manage to remember the syntax when all other regex is based on perl regex
I think you need to test your code more ๐
it didnt work for you?
What I did...
In a locally checked out copy of ublue-os/config
...
Then in that container do the steps needed to build the RPM:
the %post step fails
/var/tmp/rpm-tmp.Q4qm98: line 2: perl: command not found
๐
perl is not guaranteed to be present and, I don't think we should require perl just to run that regex in a %post scriptleti will see if i can get it sedified then, if it can be
i'm happy to help with that... tinkering now
to be fair, i think perl *would *exist on silverblue systems... but the RPM spec needs to be clear that it's required, and that seems like a heavy requirement... arguably this RPM could be used on stripped down systems which don't have perl
also i am putting the build deps on my fedora dev container so i can properly test building rpm
embrace the short-lived container ๐
๐
yeah but its nice for me to have it in my 2 dev containers
yep, nice to have... my point is... it's easy to test our Containerfile builds just by running local ephemeral containers
funny enough selinux denied podman ๐คฃ
it's helpful to just disable labels on user containers
still learning dealing with selinux since im from a debian background ๐
think i have touched maybe 2 fedora installs since i started using linux in 2008 before ublue
yeah, it took me a while to get comfortable with it, too, but like anything, eventually it starts to feel normal
true
ok seems like its sed -E compatible
@HikariKnight i think you may want to update the description and code on PR 188
just --completion bash
is an error
you want
just --completions bash
right?
and yep! that's what I found as well!almost all linux distros ship with perl so i am also just comfortable it being available for full regex compatibility ๐
pushing commit now
huzzah... the resulting diff of just/ujust after installing the RPM
https://gist.github.com/bsherman/ff7f65ba64c27e939d19354f7dc1a11d
what can i say, i like perl regex ๐คฃ
i think the first project me and my first boss made together in perl was a dhcp server that used csv files for assigning static ip addresses and for configuring the network, worked great for what we needed it for. it was, something
๐
yeah
those are fun projects
yeah
i know that turned into a bigger project than you probably imaged today ๐ but i like the result!, thank you
i even wrote a runescape client launcher in perl back when runescape was java based just to fix all the issues it had on linux.
it fixed so much with the client people wanted a windows version so i wrote a perl intrepeter in perl that i then packaged with the PAR packager so that users didnt have to install perl directly to use the client. obviously the PAR packager was not meant to be used like that, and i would not recommend it. i just liked the idea of users only needing a 15mb dependency more than a 200mb dependency for 1 game client
oh i dont mind
im open to learning
especially if its something i enjoy
just dont push your luck with c++ ๐คฃ
i know some but i rather not touch it with a 10 meter pole
Again. Super good conversation and learned a lot in this today.