Gentoo Archives: gentoo-dev

From: Fabian Groffen <grobian@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] euses(1) Reimplementation
Date: Thu, 09 Jul 2020 06:39:44
Message-Id: 20200709063930.GU37387@gentoo.org
In Reply to: [gentoo-dev] euses(1) Reimplementation by Ashley Dixon
1 Hi Ashley,
2
3 Sounds like you've put some work into this. You could compare against
4 `quse -D <flag>` (from portage-utils) as well to get another point of
5 measure.
6
7 I don't know what you did measure euses against though, it seems fairly
8 fast to me (env PORTDIR=`q -e PORTDIR` euses -v libressl), is there a
9 specific case you're focussing on?
10
11 Thanks,
12 Fabian
13
14
15 On 09-07-2020 02:33:28 +0100, Ashley Dixon wrote:
16 > Hi, Gentoo-Dev.
17 >
18 > A while ago, I had a bit of a rant on Gentoo-User regarding the current issues
19 > with `app-portage/euses`. Specifically, the fact that it does not work on newer
20 > Gentoo-like systems which have moved away from PORTDIR and conform to the
21 > repos.conf/ syntax [1, 2, 3]. There are also some bugs/issues in the code, such
22 > as malloc(3)'ing without checking the result, et cetera.
23 >
24 > Over the past month or so, I've completed a ground-up rewrite which provides a
25 > similar interface and functionality, that remedies all of these issues, and adds
26 > a few useful features on top; it is also written in standard C with no
27 > dependencies other than the standard library. In addition to processing all the
28 > repositories described in the repos.conf directory, it is also written to be
29 > remarkably robust, optionally working from the PORTDIR make.conf key-value pair
30 > or environment variable for legacy systems. (As an initial user pointed out,
31 > make.conf cannot be used if it is a directory, and will only touched at all if
32 > the legacy option is enabled and the $PORTDIR environment variable is unset or
33 > infeasible.)
34 >
35 > Almost all of the features from the original euses tool are present, with extras
36 > to facilitate multi-repo searching (in the rare event that a non-Gentoo.git
37 > repository has USE-description files). From my testing, it is equally, if not
38 > more, performant than the original tool, despite the extra work of traversing
39 > the meta-repository description files. A copy of the help page is included here,
40 > for convenience (run with the `-h` or `--help` option):
41 >
42 > ash-euses command-line argument summary.
43 > Syntax: ./ash-euses [options] substrings
44 >
45 > --list-repos -r Prepend a list of located repositories (repos.conf/ only).
46 > --repo-names -n Print repository names for each match.
47 > --repo-paths -p Print repository details for each match (implies repo-names).
48 > --help -h Print this help information and exit.
49 > --version -v Prepend version and license information to the output.
50 > --strict -s Search only in the flag field, excluding the description.
51 > --portdir -d Attempt to use the PORTDIR value.
52 > --quiet -q Do not complain about PORTDIR.
53 > --no-case -c Perform a case-insensitive search across the files.
54 > --print-needles -e Prepend each match with the relevant needle substring.
55 > --no-interrupt -i Do not interrupt the search results with warnings.
56 > --package -k Restrict the search to category-package description files.
57 > --colour -o Print the package, flag, and description in distinct colours.
58 > -- Consider all further arguments as substrings/queries.
59 >
60 > There's also a man page in the tree, providing deeper explanations for these
61 > command-line arguments: `ash-euses.1`.
62 >
63 > Off-line, I'm working on a strstr(3) (and strcasestr) reimplementation using the
64 > Two-Way string-matching algorithm [4] and shift tables, to remove the dependency
65 > on _GNU_SOURCE for the case-insensitive variant (it is very annoying that this
66 > is not a standard function, as it only defines CANON_ELEMENT to tolower(3) and
67 > calls glibc strstr [5]).
68 >
69 > For all my tests, the search yield is generally identical to euses(1). An ebuild
70 > is also included in the tree, however I am hardly experienced with writing them,
71 > so I'm not entirely sure if it respects the globally defined compiler flags.
72 > Regardless, I am posting here for anyone who is interested in using/testing this
73 > program, with the hope that it can provide an alternative for quick flag-lookup
74 > on newer, standards-conformant Gentoo-like systems.
75 >
76 > The source code is at [6], and a gzipped tarball of the latest release (v0.3)
77 > can be found at [7]. Thank you in advance to all interested parties.
78 >
79 > Cheers,
80 > Ashley.
81 >
82 > P.S. I really need a better name for this. A portmanteau of my first name, and
83 > the tool of which the program is a replica, doesn't seem very creative.
84 >
85 > [1] https://bugs.gentoo.org/546210
86 > [2] https://bugs.gentoo.org/378603
87 > [3] https://bugs.gentoo.org/663706#c4
88 > [4] https://dl.acm.org/doi/abs/10.1145/116825.116845
89 > [5] https://sourceware.org/git/?p=glibc.git;a=blob;f=string/strcasestr.c;h=d2964c5548b9ea7a68fc5b18b25ddfe7ddd6835c;hb=HEAD#l45
90 > [6] http://git.suugaku.co.uk/ash-euses/tree/
91 > [7] http://git.suugaku.co.uk/ash-euses/snapshot/ash-euses-0.3.tar.gz
92 >
93 > --
94 >
95 > Ashley Dixon
96 > suugaku.co.uk
97 >
98 > 2A9A 4117
99 > DA96 D18A
100 > 8A7B B0D2
101 > A30E BF25
102 > F290 A8AA
103 >
104
105
106
107 --
108 Fabian Groffen
109 Gentoo on a different level

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-dev] euses(1) Reimplementation Ashley Dixon <ash@××××××××××.uk>