Commit graph

910 commits

Author SHA1 Message Date
Thomas Perrot
4a0c0797d1 data, web: use raw strings for regex patterns
\d and \w in non-raw strings are invalid escape sequences that
generate SyntaxWarning in Python 3.12+ and will become SyntaxError in
a future version. Use rb'...' / r'...' to silence the warning and
future-proof the patterns.

Signed-off-by: Thomas Perrot <thomas.perrot@bootlin.com>
2026-05-06 10:58:42 +02:00
Thomas Perrot
a54519731f web: fix query handle leak
IndexResource and IncompleteURLRedirectResource handlers opened a
BerkeleyDB query handle but never called query.close(), leaking file
descriptors on every redirect request.

Signed-off-by: Thomas Perrot <thomas.perrot@bootlin.com>
2026-05-06 10:58:42 +02:00
Thomas Perrot
453580252b autocomplete: fix crash on empty cursor result
cur.get() returns None when no key >= the prefix exists (empty DB or
prefix past the last key). Unpacking None raised TypeError. Guard
against it by checking the result before unpacking.

Also, "while i <= 10" collected up to 11 results; changed to "i < 10"
to return at most 10 as intended.

Signed-off-by: Thomas Perrot <thomas.perrot@bootlin.com>
2026-05-06 10:58:42 +02:00
Théo Lebrun
e25dc5e6ee web: fix bug reporting link in get_error_page()
We used the ADD_ISSUE_LINK constant variable URL from two places. At
one, we forgot appending `?body=`. Add it by calling into the same
function that builds the URL once. Drop the constant URL now that it is
consumed from a single place.

Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
2026-05-06 10:56:57 +02:00
Thomas Perrot
fd03fb1ed0 query: fix variable shadowing in file_exists()
The loop variable "path" shadowed the function parameter of the same
name.
After populating the cache, line 103 compared the last iterated path
against the cache instead of the requested path, causing file_exists()
to incorrectly return True on the first call for any given version.

Signed-off-by: Thomas Perrot <thomas.perrot@bootlin.com>
2026-05-06 10:54:56 +02:00
Théo Lebrun
b5b875ed0b query: always pass get_latest_tag(rc=) arg
We were missing query.get_latest_tag(rc=) argument. Add it. Don't make
it a default, each caller must decide explicitely if they want RCs or
not.

Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
2026-05-06 10:53:57 +02:00
Thomas Perrot
ae07040c88 query: make get_latest_tag() always return a list
When rc=True the reversed() iterator is non-subscriptable, breaking the
sorted_tags[-1] fallback path; wrap it in list() to make it indexable.

Signed-off-by: Thomas Perrot <thomas.perrot@bootlin.com>
2026-05-06 10:52:54 +02:00
Théo Lebrun
26f20ae51c web: allow equal ("=") in file paths
glibc has a file named `=__ify` at root or in scripts/ inbetween
tags glibc-1.09 and glibc-2.1.91.

We have no specific reason to refuse equal signs so add it to the
regex. Tested locally on URL: /glibc/glibc-1.09/source/=__ify

Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
2026-04-29 14:07:00 +02:00
Thomas Petazzoni
7ee53451c1 static/messages.json: update training information
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2026-03-28 20:09:08 +01:00
Théo Lebrun
72c238cfe9 query: fix query.get_latest_tag() doccomment
It mentions that rc are excluded, but this is false with the new `rc`
boolean argument.

Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
2026-03-27 11:08:02 +01:00
Théo Lebrun
acf60d4136 query/web/api: support getting latest-rc
We support URLs like "/linux/latest/source" that redirect to the latest
tagged version. But this excludes release candidates. Add a "latest-rc"
that takes RCs into account.

Requested by Luca.

Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
2026-03-27 10:57:28 +01:00
Théo Lebrun
f260bb555e index: add VPP repository
FD.io's Vector Packet Processor (VPP) is a fast, scalable layer 2-4
multi-platform network stack. It runs in Linux Userspace on multiple
architectures including x86, ARM, and Power architectures.

Signed-off-by: Nicolas PLANEL <nplanel@cisco.com>
Signed-off-by: Nicolas PLANEL <nplanel@gmail.com>
Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
2026-03-03 14:29:58 +01:00
Nicolas PLANEL
cb818fe4a7 filter: allow customising prefix_path (default is "include")
VPP will need this.

Signed-off-by: Nicolas PLANEL <nplanel@cisco.com>
Signed-off-by: Nicolas PLANEL <nplanel@gmail.com>
Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
2026-03-03 14:29:55 +01:00
Thomas Petazzoni
f1b2c52450 static/messages.json: update training course details
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2025-11-30 14:48:42 +01:00
Thomas Petazzoni
ac70a9e1b7 Update training sessions dates
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2025-11-19 15:16:23 +01:00
Théo Lebrun
e1bdface0c templates/ident: improve "Identifier not used" message
"Identifier not used" is weird, replace it by "unknown identifier" and
 give the search identifier name in the header.

Also improve the autocomplete comment. Make it human-friendly and
explain why people got autocompleted to a symbol that does not exist.
Also, only show it if the symbol actually exists. That way we only
tell "maybe autocomplete lead you here" only in cases where
autocomplete can actually lead you here.

To test this feature:
 - search for any random symbol, you'll see "Unknown identifier '...'"
 - search for a symbol that exists in another version as the selected
   one. For example __NR_epoll_pwait2 appeared in musl v1.2.5. You'll
   see the same header message plus a comment about how the symbol
   exists in another version.

Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
2025-11-05 14:18:41 +01:00
Franciszek Stachura
1b24366093 templates/ident: add note about autocomplete to "Identifier not used"
Current autocomplete behaviour is unintuitive. It is a good idea to
explain to users why it can suggest invalid identifiers.
2025-11-05 09:48:06 +01:00
Franciszek Stachura
5ff8c70166 web: use GET for ident search form
With POST, if Anubis triggers on search request, user will be redirected
back to home page.
2025-11-05 09:48:06 +01:00
Théo Lebrun
11b6632d5d templates/topbar: add required attribute to search input
If we press enter without any search value, we get directed to
/$PROJECT/$VERSION/A/ident/ which is a "400 Bad Request".

As the search input is selected by default, this is any enter press
where the focus hasn't changed.

`required` documentation:
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/required

Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
2025-11-05 09:45:42 +01:00
Thomas Petazzoni
89aef0d77b static/messages.json: update training dates, fix typo
Edit by Théo: remove desktop/mobile blocks using:
⟩ jq --indent 4 '[.[] | .desktop]' static/messages.json | sponge static/messages.json

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2025-10-23 23:26:02 +02:00
Théo Lebrun
8fb444d0cd projects: add iproute2 project
Add iproute2 project. Pretty standard C project and versioning is as we
like it to be. Almost nothing to be done.

https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/
https://en.wikipedia.org/wiki/Iproute2
https://wiki.linuxfoundation.org/networking/iproute2

Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
2025-10-15 11:58:07 +02:00
Théo Lebrun
1a012d6b4b projects: add opensbi project
Add OpenSBI. Pretty standard C project and versioning is as we like it
to be. Did add a commit to interpret *.mk as part of the Makefile
family. Without that, CONFIG_* references aren't found.

https://github.com/riscv-software-src/opensbi
https://riscv.org/wp-content/uploads/2024/12/13.30-RISCV_OpenSBI_Deep_Dive_v5.pdf

Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
2025-10-15 11:56:58 +02:00
Théo Lebrun
773e2df1b5 lib.py: mark .mk files as makefiles
OpenSBI uses `.mk` files. The tokenizer does not get ran on files
without a family (sad). Adding this means we index references
inside .mk files, eg:

    # opensbi/lib/utils/i2c/objects.mk
    libsbiutils-objs-$(CONFIG_I2C) += i2c/i2c.o

Also, refactor the getFileFamily():
 - All usage of name/ext do a .lower() on them, move it to the top.
 - Use `x == "A"` checks rather than `x in ["A"]`.

Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
2025-10-15 11:56:58 +02:00
Théo Lebrun
05da14b295 static/messages.json: drop mobile object in each entry
Front-end code should handle both cases gracefully as
static/messages.json might be cached.

⟩ # Done using:
⟩ jq --indent 4 '[.[] | .desktop]' static/messages.json | sponge static/messages.json

Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
2025-07-25 12:26:16 +02:00
Franciszek Stachura
6a83ae7661 web: refactor message banners & support mobile
We had an hardcoded mobile banner that was nice looking but couldn't
deal with all the content for the various banners we want to display.

Also, it was a separate element to the desktop one. Unify them as a
single element that adapts (as it should) to desktop or mobile
viewports.
2025-07-25 12:26:04 +02:00
Thomas Petazzoni
7cdeaafa9c static/messages.json: update
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2025-07-25 12:25:40 +02:00
Thomas Petazzoni
3c41681075 static/messages.json: update
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2025-07-25 12:25:38 +02:00
Thomas Petazzoni
092d4496de static/messages.json: update
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2025-07-25 12:25:34 +02:00
Théo Lebrun
c0c5d2283c query: drop query.supports_dts_comp() getter method
Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
2025-03-07 16:16:34 +01:00
Théo Lebrun
e1fecd1c3f query: fix comment describing get_versions()
The comment was plain wrong. It said we returned a list.
We return nested OrderedDict structures.

Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
2025-03-07 16:16:34 +01:00
Franciszek Stachura
6f03eee42c CHANGELOG: Add info about changes in query tool 2025-03-07 16:16:34 +01:00
Franciszek Stachura
0dcf9d4197 query: Move CLI to utils/query.py
Call with python3 -m utils.query
2025-03-07 16:16:34 +01:00
Franciszek Stachura
6a071ff590 utils/speedtest: Make compatible with code changes 2025-03-07 16:16:34 +01:00
Franciszek Stachura
5563feaf78 query: Move dts commands to functions 2025-03-07 16:16:34 +01:00
Franciszek Stachura
ac5a64b972 query: Move 'exists' command to a function 2025-03-07 16:16:34 +01:00
Franciszek Stachura
2a93ee95fb query: Move 'dir' command to a function 2025-03-07 16:16:34 +01:00
Franciszek Stachura
5f9c6236a6 web: Replace query("family") with getFileFamily 2025-03-07 16:16:34 +01:00
Franciszek Stachura
53b1ffe208 query: Move 'file' command to a function 2025-03-07 16:16:34 +01:00
Franciszek Stachura
9bc76f0d8d query: Move 'type' command to a function 2025-03-07 16:16:34 +01:00
Franciszek Stachura
b646d650d4 query: Move 'versions' command to a function 2025-03-07 16:16:34 +01:00
Franciszek Stachura
2440d49731 query: Move 'ident' command to a function 2025-03-07 16:16:34 +01:00
Franciszek Stachura
64efb3d678 query: Move 'latest' command to a function 2025-03-07 16:16:34 +01:00
Théo Lebrun
0e846ccd6e script.sh: parse-defs: C: index defs that have a CONFIG_ in their line
Take the pm_ptr() macro as example:

⟩ ctags -x --kinds-c=+p+x --extras='-{anonymous}' include/linux/pm.h | grep pm_ptr
pm_ptr           macro       475 include/linux/pm.h #define pm_ptr(_ptr) PTR_IF(IS_ENABLED(CONFIG_PM), (_ptr))

The previous grep would remove the pm_ptr() line because it contains
CONFIG_. We only want to remove a line if it starts with CONFIG_.

Testing this commit:

⟩ export LXR_REPO_DIR=...
⟩ hash=97b0e23363c8283f53c361d8129ef90d7a2b9350
⟩ ./script.sh parse-defs $hash pm.h C | sort > /tmp/defs-pm-before.txt
⟩ # TODO: apply commit
⟩ ./script.sh parse-defs $hash pm.h C | sort > /tmp/defs-pm-after.txt
⟩ comm -13 /tmp/defs-pm-before.txt /tmp/defs-pm-after.txt
pm_ptr macro 475
pm_sleep_ptr macro 476

Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
2025-02-25 09:28:52 +01:00
Franciszek Stachura
fc8106d520 web: Unify _link and _url variable suffixes 2025-02-14 12:50:29 +01:00
Franciszek Stachura
0f0695e09c web: Stop quoting query('latest') multiple times 2025-02-14 12:49:20 +01:00
Franciszek Stachura
531529a182 web: Make "Go to home page" link to current version
If project and version is valid. Otherwise, redirect to latest or /.
2025-02-14 12:49:16 +01:00
Franciszek Stachura
6edaafb2f3 web: Handle project/version details in invalid URL
Examples:
/musl/v1.2.5/sourc
/musl/v1.2.5/sourc/
/musl/v1.2.5/sourc/asd
/musl/v1.2.5/sourc/asd/
/musl/v1.2.5/sourc/asd/zxc
/musl/v1.2.5/sourc/asd/zxc/
/musl/v1.2.5/sourc/asd/zxc/...

Falcon requires field names on one level to be the same on all
(matching?) paths.
2025-02-14 12:48:20 +01:00
Franciszek Stachura
f6b2d46a0c web: Redirect on incomplete URLs
Examples:
/linux          -> /linux/{latest_tag}/source
/linux/{tag}    -> /linux/{tag}/source
2025-02-14 12:48:20 +01:00
Théo Lebrun
e8823db052 query: query('latest'): return string 2025-02-14 12:48:11 +01:00
Franciszek Stachura
7d09affd5b Dockerfile: Build and use ctags v6.1.0 (upgrade from v5.9)
Changelogs: https://github.com/universal-ctags/ctags/releases

There are some function definitions that are not found by ctags v5.9.
We must upgrade to the latest release but it isn't packaged by Debian.

We only copy the ctags executable. Debian's package files are:
https://packages.debian.org/sid/amd64/universal-ctags/filelist
We drop:
 - The optscript and readtags executables,
 - The changelog and copyright files and,
 - All manpages.
2025-02-14 09:58:00 +01:00