Commit graph

65 commits

Author SHA1 Message Date
Franciszek Stachura
554bb11381 Refactor directory tree generation to use a namedtuple
* Fix #302 - Symlinks redirect to invalid paths (but only the directory
  tree part)
* Move more view-related logic to the template
2024-07-30 12:49:29 +02:00
Franciszek Stachura
76b7a8a659 Remove query.default_query and all related references
* Pass process env vars to script.sh ran from Query
2024-02-07 10:31:58 +01:00
Franciszek Stachura
88646d10b2 Close db on finished api call 2024-01-10 14:52:28 +01:00
Franciszek Stachura
55bb9d47b4 Move query and get_idents* functions into the Query class 2024-01-10 14:52:28 +01:00
Franciszek Stachura
910bdd7938 Add query class, env arg to script and scriptLines 2024-01-10 14:52:28 +01:00
Ziyue Pan
a627571baf Style: fix redundant parentheses and typos 2023-03-23 09:54:14 +01:00
Ziyue Pan
7c4886cf3c Style: fix redundant parentheses and typos
(cherry picked from commit cd89684ce633c4997b328395cc882de3ab655475)
2023-03-23 09:54:14 +01:00
Tamir Carmeli
76197b5973
BUGFIX: Don't double quote DT compatible strings (#229)
Both query.py and api.py call parse.quote(ident) which perform
url encoding twice on the identifier. For instance, when
ident="linux,kvm" the first encoding done in api.py changes the
ident to   GNU nano 6.2   /home/tamir/elixir/.git/COMMIT_EDITMSG *          │
BUGFIX: Don't double quote DT compatible strings

Both query.py and api.py call parse.quote(ident) which perform
url encoding twice on the identifier. For instance, when
ident="linux,kvm" the first encoding done in api.py changes the
ident to 'wow%2Cey' but the second encoding done in query.py
changes it to 'wow%252Cey' which is no longer valid.

Remove the call to parse.quote on api.py as only one quoting is
necessary, the one in query.py
2022-11-23 15:20:27 +01:00
Maxime Chretien (MixLeNain)
f6bcfabcdc query: Sort definitions by type
This sorts the definition buffer by file path and then by type (reversed)

Sorting by type in reverse order allows to have structs definitions
before members.

Signed-off-by: Maxime Chretien (MixLeNain) <mchretien@linuxmail.org>
2020-10-26 11:05:58 +01:00
Maxime Chretien
fd2335beaf queries: Support C macros in DT files
Signed-off-by: Maxime Chretien <maxime.chretien@bootlin.com>
2020-06-12 15:16:15 +02:00
Maxime Chretien
39586eaa6e query: Add query to get all keys of a database
Signed-off-by: Maxime Chretien <maxime.chretien@bootlin.com>
2020-06-11 14:38:44 +02:00
Maxime Chretien
b3d95d880b query.py: Add missing import
Signed-off-by: Maxime Chretien <maxime.chretien@bootlin.com>
2020-06-11 11:16:41 +02:00
Maxime Chretien
0d0c585e62 query.py: Remove uneeded lib.isIdent call
If the ident is in defs it's a valid ident ...

Signed-off-by: Maxime Chretien <maxime.chretien@bootlin.com>
2020-06-11 11:08:20 +02:00
Maxime Chretien
cd3d33a932 query.py: Split ident query in two functions
One for DT compatibles and the other one for the other idents

Signed-off-by: Maxime Chretien <maxime.chretien@bootlin.com>
2020-06-11 09:37:47 +02:00
Maxime Chretien
7c9d1b621d web.py/query.py: Always unquote idents and quote them for B queries
Some idents in C files are like $$divI and they quoted so they are not
found in the database.
However idents in the comps database are always quoted so we quote the
idents before searching in the comps database.

Signed-off-by: Maxime Chretien <maxime.chretien@bootlin.com>
2020-06-11 09:25:14 +02:00
Maxime Chretien
c1abf3d134 lib: Move decode function to lib.py
decode() is needed by FindCompatibleDts but importing query.py result in
an instantiation of the database (query.py line 29).

Moving it to lib.py allows to import it for FindCompatibleDts without
opening the database.

Signed-off-by: Maxime Chretien <maxime.chretien@bootlin.com>
2020-06-10 10:28:07 +02:00
Maxime Chretien
0759895f5f query.py : Make sure ident exists in db.comps_docs
Signed-off-by: Maxime Chretien <maxime.chretien@bootlin.com>
2020-06-08 15:37:59 +02:00
Maxime Chretien
ac170c8932 query.py: improve compatible string handling
Signed-off-by: Maxime Chretien <maxime.chretien@bootlin.com>
2020-06-08 15:37:59 +02:00
Maxime Chretien
76c68265d3 DT compatibles : Add a separate database for documentation
Idxes needs to be sorted in RefLists but documentation idxes are lower
than others and we added them latter in the RefList so there was a
problem. The easiest solution to solve that is to create a separate
database for documentations.

Signed-off-by: Maxime Chretien <maxime.chretien@bootlin.com>
2020-06-08 15:37:59 +02:00
Maxime Chretien
52e918120d query: return elements correctly
Signed-off-by: Maxime Chretien <maxime.chretien@bootlin.com>
2020-06-08 15:37:59 +02:00
Maxime Chretien
4a8c99b7e5 database: Enable db.comps only when needed
Signed-off-by: Maxime Chretien <maxime.chretien@bootlin.com>
2020-06-08 15:37:59 +02:00
Maxime Chretien
40151b6b87 query.py: Add support for DT compatible strings
The output is the same as other queries and files are sorted this way:
Defined : C/CPP/ASM files, where the drivers define the compatible
string
Documented : Documentation files, where the compatible string is documented
Referenced : DTS/DTSI files, where the compatible string is used to bind
a driver to a piece of hardware

Signed-off-by: Maxime Chretien <maxime.chretien@bootlin.com>
2020-06-08 15:37:59 +02:00
Maxime Chretien
0385f29296 web.py/query.py: Add option to search identifiers in all families
Signed-off-by: Maxime Chretien <maxime.chretien@bootlin.com>
2020-05-28 11:37:17 +02:00
Chris White
5e7cab18ca Added/updated copyright notices; whitespace fixes
No functional changes
2020-05-23 15:14:21 -04:00
Maxime Chretien
03f1d61e26 query.py: Add support for file families in queries
Also add a new query to get the family of a file.

Signed-off-by: Maxime Chretien <maxime.chretien@bootlin.com>
2020-05-22 10:29:24 +02:00
Maxime Chretien
ded9a1112e query.py: get latest indexed version instead of latest git version
This prevent bad queries when the git repo is more up to date than the
database.

Signed-off-by: Maxime Chretien <maxime.chretien@bootlin.com>
2020-05-19 17:41:32 +02:00
Maxime Chretien
ac491ab3f8 filters/makefilefile.py : Make sure the file or directory exists before creating a link
Signed-off-by: Maxime Chretien <maxime.chretien@bootlin.com>
2020-05-13 17:45:09 +02:00
Christopher White
8a6031c8a1 Add doc-comment extraction
- find-file-doc-comments.pl: new file
- data.py: Add database to store doc-comment locations
- script.sh: Add parse-docs subcommand
- update.py:
  - Add code to process doc comments
  - Update some variable names in hopes of reducing confusion
- query.py:
  - Add code to report doc comments
  - Update some variable names in hopes of reducing confusion

Also:
- t/TestEnvironment.pm: Add find_doc attribute
- t/interact.pl: Don't die if update.py fails
- t/TestHelpers.pm: Permit checking specific sections of query.py output
- t/300: update regexes per the preceding
- gitignore tags (ctags output) and .cache (api_test.py output)
2020-04-02 13:03:03 -04:00
Carmeli Tamir
e969b88e8b Implemented query cmd commands for ident and file 2019-12-30 15:00:44 -05:00
Michael Opdenacker
51a6dff682 Python parentheses coding style fixes
- According to https://www.python.org/dev/peps/pep-0008/

Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
2019-12-01 07:01:26 +01:00
Michael Opdenacker
04643178a2 Incomplete tags: remplace "UNKNOWN" by "FIXME"
- More likely to be reported as a bug by users

Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
2019-10-10 10:11:13 +02:00
Michael Opdenacker
3e7682b8b5 Remove duplicated code in previous commit
Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
2019-10-10 10:09:16 +02:00
Naveen Kaje
120efbf730 Parse the tag levels when applicable
This patch fixes the error when the query on the tagging
expects 3 levels (v3 v3.1 v3.1-rc0) but gets only one level
from the `script.sh list-tags -h`, resulting in the following error:

<snip>
/home/naveen/workspace/elixir/query.py in query(cmd='versions', *args=())
     53         for line in scriptLines ('list-tags', '-h'):
     54             decoded_line = decode(line)
=>   55             topmenu, submenu, tag = decoded_line.split(' ')
     56             if db.vers.exists (tag):
     57                 if topmenu not in versions:
topmenu undefined, submenu undefined, tag undefined, decoded_line = 'Tag_V1', \
decoded_line.split = <built-in method split of str object>
<snip>

Fix the issue by initializing the levels to 'UNKNOWN' first and
then processing the menu levels when applicable.

Signed-off-by: Naveen Kaje <naveen.kaje@juul.com>
2019-10-09 10:40:30 -05:00
Michael Opdenacker
afe2c33689 Remove leftover code
Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
2019-10-08 07:35:35 +02:00
Michael Opdenacker
453e8a127c Factorize the definition of supported extensions
Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
2019-10-08 07:33:36 +02:00
Michael Opdenacker
96316cd0b8 Hot fix for the "get-latest" query
- Remove the trailing \n character that was breaking
  identifier search for the latest version.

- Don't hesitate to replace with a better/cleaner
  solution.

Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
2019-10-07 16:02:07 +02:00
Carmeli Tamir
1a91f04927 Straightened the interface between query and web, as preparation to add a json api parallel to web 2019-10-05 00:27:52 -04:00
Michael Opdenacker
3c78f8a0fc Add some comments
Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
2019-10-04 13:07:54 +02:00
Michael Opdenacker
c6aee2ad9d Improve progress reporting + factorize LXR_DATA_DIR access
- For long runs, allows to see which project we are in, and the
  percentage of processed tags

Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
2019-10-03 13:33:26 +02:00
Carmeli Tamir
d926243164 Refactored ident query to use python objects rather than parsing REs 2019-10-02 00:01:46 -04:00
Chen-Yu Tsai
0ab49d012f Add basic support for C++ files
Include C++ files when indexing and tokenizing files.

Unfortunately due to how C++ utilizes namespaces and classes, this
currently introduces a large amount of false positives for unqualified
identifiers that look the same.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
2018-04-10 07:45:12 +00:00
Chen-Yu Tsai
883281e446 Use os.path.splitext to split out file extension
Python's standard library provides a function to split out file
extensions, and it also handles dot files correctly.

Use that instead of just retrieving the last two characters of
the file name.

This should help with issue #27.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
2018-04-10 07:44:25 +00:00
Mikaël Bouillot
537e6b3a7b Change business name 2018-02-15 21:27:00 +00:00
Mikaël Bouillot
1b4c0fc7d4 Update notices to match the new license 2017-06-27 14:13:28 +02:00
Silvio Fricke
b7e1cd3215 change shebang to be more flexible
Python developers tend to use `virtualenv` then a fixed shebang is contra
productive.

Signed-off-by: Silvio Fricke <silvio.fricke@gmail.com>
2017-06-14 10:30:51 +02:00
Mikaël Bouillot
6df19c144c Turn query into function 2017-05-10 21:41:20 +02:00
Mikaël Bouillot
6d7694dff9 Indent query body to turn into function 2017-05-10 21:20:51 +02:00
Mikaël Bouillot
7db38c24fd Add support for virtual 'latest' version
Fixes #8
2017-05-01 19:14:08 +02:00
Mikaël Bouillot
471134bf85 Move version hierarchy logic to script.sh 2017-04-06 21:04:26 +02:00
Mikaël Bouillot
80e113ab99 Don't deduce type from trailing slash
Instead of using a trailing slash in the path to tell trees from blobs,
we actually ask git the type of the object. Also, if the object is a
tree but lacks a trailing slash, we redirect to the correct URL.

Fixes #6
2017-03-09 18:37:40 +01:00