-
Notifications
You must be signed in to change notification settings - Fork 4
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
workdir-cd: script to cd to build dir of ebuild #20
base: master
Are you sure you want to change the base?
Conversation
57ed528
to
78f497d
Compare
To my own suprise this is working quite well already, just by changing the $REPOPATH |
scripts/workdir-cd
Outdated
found_default="true" | ||
break | ||
fi | ||
done < /etc/portage/make.conf || die "failed to read make.conf" |
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.
PORTAGE_TMPDIR is one of the bigger annoyance. Trying to read make.conf is more of a hack, and:
- make.conf can be a directory, and have other rules like "source another.conf"
- package.env may override PORTAGE_TMPDIR per package and then we just don't know
For 1. could use portageq to get the value, but portageq has meh startup time which is not great for cd
For 2, don't think there's much that can reasonably be done (automatically anyway)
An option could be to just use /var/tmp/portage by default and let the search paths be configurable (users could add extra paths for everything they use).
This aside, not sure if we really need an over-engineered tool (aka things in this project) to cd to workdir, ultimately just cd'ing to the latest timestamp directory in the tmpdir is about all that sounds useful.
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.
Thanks for your fast reply on this.
- Yes I was thinking about using portageq instead, but refrained from it because of the startup time.
If PORTAGE_TMPDIR isn't to be found in make.conf, we could just assume it's /var/tmp/portage. Users can set --path to something different in this case or put it in the config (once that's ready) - If that's the case users can still provide --path. Another option would be to fiddle with the output of emerge --info or something, but that is too slow again. I want this to be snappy and frictionless.
Idk if people really need this. The question if we have something like this came up in the German gentoo Linux meetup. When fiddling with ebuilds (e.g. writing patches) I use to cd into WORKDIR all the time.
I would love to integrate the thing you said, so when you run workdir-cd without a package argument it just goes to the latest work directory in the tmpdir. This would allow for even faster operation.
So if you don't want to have it I'm gonna shamelessly steal your script as a skeleton. I was hoping to get some input from this PR though, because my bash-fu isn't at good as yours
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.
I tested performance of portageq and its actually not that bad. So let's use that
8fe36bb
to
ae154bf
Compare
Signed-off-by: Pascal Jäger <[email protected]>
ae154bf
to
cba5bf1
Compare
I was wondering if we can make a similar script to repo-cd, but instead of changing into the ebuilds directory in the repo, we change into to current workdir in /var/tmp/portage or whatever is set as PORTAGE_TMPDIR
We use a similar thing in emacs ebuild-mode, getting the directory from the name of the currently open ebuild:
https://gitweb.gentoo.org/proj/ebuild-mode.git/tree/ebuild-mode.el#n552
This has tons of features that probably no one uses, because it is mostly copied from repo-cd.
I was wondering if we should just leave them in or better remove them.