72 Replies
bsherman
bshermanโ€ข6mo ago
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,
M2
M2โ€ข6mo ago
also the completion for just is looking only if the called command was just
bsherman
bshermanโ€ข6mo ago
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...
M2
M2โ€ข6mo ago
_just() {
local i cur prev opts cmds
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
cmd=""
opts=""

for i in ${COMP_WORDS[@]}
do
case "${i}" in
"$1")
cmd="just"
;;

*)
;;
esac
done

case "${cmd}" in
just)
_just() {
local i cur prev opts cmds
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
cmd=""
opts=""

for i in ${COMP_WORDS[@]}
do
case "${i}" in
"$1")
cmd="just"
;;

*)
;;
esac
done

case "${cmd}" in
just)
Is the logic to get into just completion
HikariKnight
HikariKnightโ€ข6mo ago
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 ๐Ÿ˜‚
bsherman
bshermanโ€ข6mo ago
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 test
HikariKnight
HikariKnightโ€ข6mo ago
havent set up the vm yet since i would end up setting up a VM with actual hardware passed through to it for better testing ๐Ÿคฃ
bsherman
bshermanโ€ข6mo ago
so you propose to append that to bash-completion/completions/just not add a new file?
M2
M2โ€ข6mo ago
M2
M2โ€ข6mo ago
Here you go
bsherman
bshermanโ€ข6mo ago
"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
HikariKnight
HikariKnightโ€ข6mo ago
seems to be just s/just/ujust/g so i can programmatically do that and pipe the output to the file ๐Ÿ‘€
M2
M2โ€ข6mo ago
yeah just don't change where it's a justfile
HikariKnight
HikariKnightโ€ข6mo ago
that shouldnt be a problem
bsherman
bshermanโ€ข6mo ago
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 RPM
HikariKnight
HikariKnightโ€ข6mo ago
can look into auto generating it later then
bsherman
bshermanโ€ข6mo ago
auto generating what?
HikariKnight
HikariKnightโ€ข6mo ago
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 ๐Ÿ˜…
bsherman
bshermanโ€ข6mo ago
well, i think what M2 provided lets bash use the just completion when called as ujust so there's not a need to do more
HikariKnight
HikariKnightโ€ข6mo ago
hmm 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
bsherman
bshermanโ€ข6mo ago
HikariKnight
HikariKnightโ€ข6mo ago
oh right i forgot the build script
bsherman
bshermanโ€ข6mo ago
everything with RPM spec is about staging stuff in the builddir before starting
HikariKnight
HikariKnightโ€ข6mo ago
im so used to making launchpad deb packages where you just specify where it goes and done ok its done and pushed
bsherman
bshermanโ€ข6mo ago
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 ๐Ÿ™‚
HikariKnight
HikariKnightโ€ข6mo ago
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 ๐Ÿ˜‚
bsherman
bshermanโ€ข6mo ago
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.
HikariKnight
HikariKnightโ€ข6mo ago
yeah but i dont know if rpm can execute just at install to run the completion command
bsherman
bshermanโ€ข6mo ago
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
HikariKnight
HikariKnightโ€ข6mo ago
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 it
bsherman
bshermanโ€ข6mo ago
ahhhhh i'm tracking with you now hmm...
HikariKnight
HikariKnightโ€ข6mo ago
i know with debs you can run post install commands to do stuff like that
bsherman
bshermanโ€ข6mo ago
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 first
HikariKnight
HikariKnightโ€ข6mo ago
think it already says that in the spec file ๐Ÿค” Supplements: just
bsherman
bshermanโ€ข6mo ago
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")
HikariKnight
HikariKnightโ€ข6mo ago
let me see what i can cook up then
bsherman
bshermanโ€ข6mo ago
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.
HikariKnight
HikariKnightโ€ข6mo ago
i tend to try automate when i can, which is what quickpassthrough is automation
bsherman
bshermanโ€ข6mo ago
reading quickpassthrough repo now
M2
M2โ€ข6mo ago
Thanks for the great conversation
HikariKnight
HikariKnightโ€ข6mo ago
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
bsherman
bshermanโ€ข6mo ago
I don't want to derail thread, but good stuff... stepping away for work call
HikariKnight
HikariKnightโ€ข6mo ago
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 --justfile
HikariKnight
HikariKnightโ€ข6mo ago
can confirm it generates a working completion file
No description
bsherman
bshermanโ€ข6mo ago
question: why perl and not sed?
HikariKnight
HikariKnightโ€ข6mo ago
I am know the perl regex syntax like the back of my hand
bsherman
bshermanโ€ข6mo ago
fair, but all our other build scripts use sed... I'm testing the PR now
HikariKnight
HikariKnightโ€ข6mo ago
i know most things use sed ๐Ÿ˜… i just never manage to remember the syntax when all other regex is based on perl regex
bsherman
bshermanโ€ข6mo ago
I think you need to test your code more ๐Ÿ™‚
HikariKnight
HikariKnightโ€ข6mo ago
it didnt work for you?
bsherman
bshermanโ€ข6mo ago
What I did... In a locally checked out copy of ublue-os/config
podman run --rm -it -v $(pwd):/source registry.fedoraproject.org/fedora
podman run --rm -it -v $(pwd):/source registry.fedoraproject.org/fedora
... Then in that container do the steps needed to build the RPM:
dnf install --disablerepo='*' --enablerepo='fedora,updates' --setopt install_weak_deps=0 --nodocs --assumeyes rpm-build systemd-rpm-macros wget jq git
cp -a /source/build /tmp/build
/tmp/build/ublue-os-just/build.sh

cd /tmp/ublue-os/rpmbuild/RPMS/noarch
dnf install ublue-os-just-0.20-1.fc39.noarch.rpm
dnf install --disablerepo='*' --enablerepo='fedora,updates' --setopt install_weak_deps=0 --nodocs --assumeyes rpm-build systemd-rpm-macros wget jq git
cp -a /source/build /tmp/build
/tmp/build/ublue-os-just/build.sh

cd /tmp/ublue-os/rpmbuild/RPMS/noarch
dnf install ublue-os-just-0.20-1.fc39.noarch.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 scriptlet
HikariKnight
HikariKnightโ€ข6mo ago
i will see if i can get it sedified then, if it can be
bsherman
bshermanโ€ข6mo ago
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
HikariKnight
HikariKnightโ€ข6mo ago
also i am putting the build deps on my fedora dev container so i can properly test building rpm
bsherman
bshermanโ€ข6mo ago
embrace the short-lived container ๐Ÿ˜„
podman run --rm -it -v $(pwd):/source registry.fedoraproject.org/fedora
podman run --rm -it -v $(pwd):/source registry.fedoraproject.org/fedora
๐Ÿ˜„
HikariKnight
HikariKnightโ€ข6mo ago
yeah but its nice for me to have it in my 2 dev containers
bsherman
bshermanโ€ข6mo ago
yep, nice to have... my point is... it's easy to test our Containerfile builds just by running local ephemeral containers
HikariKnight
HikariKnightโ€ข6mo ago
funny enough selinux denied podman ๐Ÿคฃ
bsherman
bshermanโ€ข6mo ago
$ cat ~/.config/containers/containers.conf
[containers]
env = [
"BUILDAH_FORMAT=docker"
]
label = false
$ cat ~/.config/containers/containers.conf
[containers]
env = [
"BUILDAH_FORMAT=docker"
]
label = false
it's helpful to just disable labels on user containers
HikariKnight
HikariKnightโ€ข6mo ago
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
bsherman
bshermanโ€ข6mo ago
yeah, it took me a while to get comfortable with it, too, but like anything, eventually it starts to feel normal
HikariKnight
HikariKnightโ€ข6mo ago
true ok seems like its sed -E compatible
bsherman
bshermanโ€ข6mo ago
@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!
HikariKnight
HikariKnightโ€ข6mo ago
almost all linux distros ship with perl so i am also just comfortable it being available for full regex compatibility ๐Ÿ˜„ pushing commit now
bsherman
bshermanโ€ข6mo ago
huzzah... the resulting diff of just/ujust after installing the RPM https://gist.github.com/bsherman/ff7f65ba64c27e939d19354f7dc1a11d
HikariKnight
HikariKnightโ€ข6mo ago
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
bsherman
bshermanโ€ข6mo ago
๐Ÿ™‚ yeah those are fun projects
HikariKnight
HikariKnightโ€ข6mo ago
yeah
bsherman
bshermanโ€ข6mo ago
i know that turned into a bigger project than you probably imaged today ๐Ÿ™‚ but i like the result!, thank you
HikariKnight
HikariKnightโ€ข6mo ago
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
M2
M2โ€ข6mo ago
Again. Super good conversation and learned a lot in this today.