Debian Code Search (DCS), is a freely available Debian service for searching the complete corpus of source code used to build all of the open source projects included in the Debian package archive (though only the "main" component, not "non-free", "non-free-firmware" or "contrib"). Currently, that numbers about 18,000 packages which are collectively built from 140 GiB of source code, with the index updating roughly every two hours.

The underlying search engine is based on the (Google) Code Search tools designed by Russ Cox and likewise implemented in the Go programming language, using regular expressions as input (according to the RE2 library syntax).

Screenshot of regex search mode

Search interface keywords

filetype

The filetype:lang keyword filters search results by programming language as determined by file extension. The following values for the lang argument are currently implemented:

c
*.c, *.h
c++

*.cpp, *.cxx, *.hpp, *.hxx, plus results for filetype:c (*.c and *.h)

go (golang)
*.go
java
*.java
perl
*.pl, *.pm, *.t
python
*.py
ruby
*.rb
shell
*.bash, *.sh, *.zsh

package / pkg

The package:name (or pkg:name) keyword restricts a search to only the specified Debian source package(s). The name argument accepts either a valid source package name or a regular expression that defines a set of multiple packages.

For example, to find all calls to xcb_create_window present in the i3 window manager, you could search for

xcb_create_window package:i3-wm

path

The path:pathspec keyword restricts a search to only files that match the pathspec argument, either as a substring or a regular expression.

For example, to find only matches for the string systemctl within Debian packaging files, use the search terms

systemctl path:debian/

…or to find only matches for the string i3Font within the libi3 folder of any version of the i3-wm package, search for

i3Font path:i3-wm_.*/libi3/

Testimonials

If Debian Code Search is helpful to you, please make others aware of it by posting a short testimonial to this list.

Developer

Screenshot of literal search mode Michael Stapelberg created and maintains DCS; he also authored his Bachelor of Computer Science thesis (1 MiB PDF) about the service.

Feature requests

Requests for new features are welcome, if reasonable, and can be made at the GitHub Issue Tracker.

Support

For one-on-one support with DCS, please email <stapelberg AT debian DOT org> (include DCS or Debian Code Search in the subject).

See also