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

workdir-cd: script to cd to build dir of ebuild #20

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
10 changes: 10 additions & 0 deletions NEWS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
Release Notes
=============

iwdevtools-next (xxxx-xx-xx)
=============================

New
---
- workdir-cd: new tool to jump to the packages workdir in PORTAGE_TMPDIR and
then run a command in that directory such as listing its contents. (can
search for a partial atom, and use tab completion with bash/fish/zsh after
setting up shell integration)

iwdevtools-0.12.7 (2023-08-04)
==============================

Expand Down
73 changes: 73 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Overview
* `qa-openrc`_ tries to find a few common mistakes in OpenRC init scripts

+ `repo-cd`_ facilitates navigating Gentoo repos' directories with some perks
+ `workdir-cd`_ facilitates navigating Portage temp' directories with some perks
+ `eoldnew`_ emerges the previous version then newest, useful with `qa-cmp`_
+ `scrub-patch`_ removes dirt from patches and may suggest improvements
+ `find-unresolved`_ helps find missing libraries on a stripped embedded system
Expand Down Expand Up @@ -250,6 +251,78 @@ Results in::
Run ``repo-cd --help`` or see **repo-cd(1)** man page for details and
information about known limitations.

workdir-cd
-------
Dependencies: portage (portageq), libxml2 (xmllint)

Can be used to jump to the working directory (cd) of the specified atom.

If ``--path=default`` workdir-cd will try to get the path from ``protageq``.
If nothing is set as PORTAGE_TMPDIR in make.conf, the usual location of
TMPDIR is ``/var/tmp/portage``.

I unpack two packages using the ``ebuild`` command and then use the workcd
alias without an argument to navigate to the latest workdir in PORTAGE_TMPDIR::

~/dev/gentoo/app-admin/entr $ eval "$(command workdir-cd --bash=workcd --path="default")"
~/dev/gentoo/app-admin/entr $ ebuild entr-5.3-r1.ebuild unpack
Appending /home/pascal/dev/gentoo to PORTDIR_OVERLAY...
* entr-5.3.tar.gz BLAKE2B SHA512 size ;-) ... [ ok ]
>>> Unpacking source...
>>> Unpacking entr-5.3.tar.gz to /var/tmp/portage/app-admin/entr-5.3-r1/work
>>> Source unpacked in /var/tmp/portage/app-admin/entr-5.3-r1/work
~/dev/gentoo/app-admin/entr $ ebuild entr-5.4.ebuild unpack
Appending /home/pascal/dev/gentoo to PORTDIR_OVERLAY...
* entr-5.4.tar.gz BLAKE2B SHA512 size ;-) ... [ ok ]
>>> Unpacking source...
>>> Unpacking entr-5.4.tar.gz to /var/tmp/portage/app-admin/entr-5.4/work
>>> Source unpacked in /var/tmp/portage/app-admin/entr-5.4/work
+ LICENSE
+ Makefile.bsd
+ Makefile.linux
+ Makefile.macos
+ NEWS
+ README.md
+ configure
+ data.h
+ entr.c
+ entr.1
+ missing
+ system_test.sh
/var/tmp/portage/app-admin/entr-5.4/work/entr-5.4 $

If it is given a string other than '-' as the argument, workdir-cd will list
the found workdirs matching that argument::

/ $ workcd entr
? 1:/var/tmp/portage/app-admin/entr-5.3-r1 (default)
? 2:/var/tmp/portage/app-admin/entr-5.4
? Choice?

When the alias is ran with '-' as the argument, it will list all available workdirs
in tmpdir and ask for which one to cd into::

/ $ workcd -
? 1:/var/tmp/portage/app-admin/entr-5.4 (default)
? 2:/var/tmp/portage/app-admin/entr-5.3-r1
? 3:/var/tmp/portage/x11-misc/xscreensaver-6.06-r2
? 4:/var/tmp/portage/x11-misc/xscreensaver-6.07
? 5:/var/tmp/portage/sys-apps/systemd-253.6
? Choice?

Has some customization options, like hiding fields and running commands in
the directory (in the above case it ran ``ls`` by default), and these can
be saved in a ``workdir-cd.conf`` or like ``--path`` was above::

/ $ workcd entr --run="echo hello world"
? 1:/var/tmp/portage/app-admin/entr-5.3-r1 (default)
? 2:/var/tmp/portage/app-admin/entr-5.4
? Choice? 1
+ hello world

Run ``workdir-cd --help`` or see **workdir-cd(1)** man page for details and
information about known limitations.

eoldnew
-------
Dependencies: portage (portageq)
Expand Down
1 change: 1 addition & 0 deletions scripts/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ scripts = {
'qa-sed' : 'sed wrapper to detect if a call did no change',
'qa-vdb' : 'use portage VDB information to detect RDEPEND issues among others',
'repo-cd' : 'change directory based on atom then perform actions',
'workdir-cd' : 'change directory to workdir in PORTAGE_TMPDIR then perform actions',
'scrub-patch' : 'strip patches of useless cruft and suggest improvements'
}

Expand Down
Loading