2013/05/04
KAICHO: s_naray[at]yahoo[dot]co[dot]jp
¦not the plane mail address to avoid SPAM

Sanaly - Source code ANALYsis web front end for GNU Global (Japanese)

¡Abstract

Sanaly is a web front end to read/analyze/investigate source code of softwares. This is just a small front end, a back end is GNU global.

¡ScreenShot of sanaly top page

Sanaly shows 2 windows, the left one shows the control to extract source codes and the extracted codes by GNU Global, the right one shows a main page which can be customized by users.
To extract a source code, put the url of the code(ex. src.rpm, tar.gz, tar.bz2) on the left-top box, and just push "EXT" button, then sanaly kicks GNU Global and add the extracted codes on the left window.

¡download

package name SRPM package RPM package(for RHEL/CentOS/OracleLinux 6/7/8)
Sanaly sanaly-1.8-3.src.rpm sanaly-1.8-3.noarch.rpm
geturllist geturllist-0.5-2.src.rpm geturllist-0.5-2.noarch.rpm

geturllist is a small tool to update urllist, which is used by Sanaly "search" box in the right window. This is not a mandatory tool but better to install, to weekly update the urllist into the latest one.

Special GNU Global(and python-pygments) is available.

package name source code SRPM package RPM package
stable
version
GNU Global GNU global Download page global-6.5.7-20.el6.src.rpm EL6 global-6.5.7-20.el6.x86_64.rpm
EL7 global-6.5.7-20.el7.x86_64.rpm
EL8 global-6.5.7-20.el8.x86_64.rpm
python-pygments pygments get it page python-pygments-2.3.1-2.el6.src.rpm EL6 python-pygments-2.3.1-2.el6.noarch.rpm
EL7 python-pygments-2.3.1-2.el7.noarch.rpm
EL8 python-pygments-2.3.1-2.el8.noarch.rpm
# pygments is a python library which helps global lexical analysis. This feature is included into/from globa-6.3.2. If pygments is not installed, global would try to use ctags instead, however pygments is a bit wiser than ctags. Although, pygments is slower than ctags, and it should be on EL6 or later as it needs pythong-2.6 or higher, EL5 has python-2.4 actually.

This global above has following extended features which are not implemented on origial global:

  1. can parse additional languages:

  2. can parse assembler files(.asm, .S) more intelligent:
    Labels in ASM files can be recognized more intelligently with customized built-in parser.

  3. can colorize strings/literal:
    All strings are colorized by htags by default.

  4. can parse per its mimetype/filetype, which is described in /etc/gtags.conf.sanaly
    The mimetype/filetypemap feature is implemented by using "/usr/bin/file" and its output string. For example, the builtin-parser-additionals of /etc/gtags.conf.sanaly is below. See "mimetypemap" and "filetypemap" lines.

    builtin-parser-additionals:\
            :langmap=python\:.py.pyx.pxd.pxi.scons:\
            :langmap=ruby\:.rb:\
            :langmap=perl\:.pl:\
            :langmap=sh\:.sh.SH.bsh.bash.ksh.zsh:\
            :langmap=cpp\:.tjs:\
            :mimetypemap=python\:text/x-python:\
            :mimetypemap=python\:application/x-python:\
            :mimetypemap=ruby\:text/x-ruby:\
            :mimetypemap=ruby\:application/x-ruby:\
            :mimetypemap=perl\:text/x-perl:\
            :mimetypemap=perl\:application/x-perl:\
            :filetypemap=sh\:POSIX shell script text executable:\
            :filetypemap=sh\:Bourne-Again shell script text executable:\
            :filetypemap=sh\:Bourne shell script text executable:\
            :filetypemap=python\:python script text executable:\
            :filetypemap=python\:Python script text executable:\
            :filetypemap=python\:a python script text executable:\
            :filetypemap=python\:a /usr/bin/python script text executable:\
            :filetypemap=python\:a /usr/bin/env python script text executable:\
            :filetypemap=ruby\:ruby script text executable:\
            :filetypemap=ruby\:a /usr/local/bin/ruby script text executable:\
            :filetypemap=ruby\:a /usr/bin/ruby script text executable:\
            :filetypemap=ruby\:a /usr/bin/env ruby script text executable:\
            :filetypemap=perl\:perl script text executable:\
            :filetypemap=perl\:a /usr/bin/perl script text executable:\
            :filetypemap=perl\:a /usr/bin/env perl script text executable:
    

¡How to install

This is mainly for RHEL6/7/8 including CentOS6/7/8, and OracleLinux6/7/8. I have never installed this onto other distributions, so please let me know if you succeed/fail to install this onto such distributions.

Just install all packages, python-pygments 1st and others next like:
 # rpm -Uvh python-pygments-2.3.1-2.el6.noarch.rpm
 # rpm -Uvh sanaly-1.8-3.noarch.rpm global-6.5.7-20.el6.x86_64.rpm geturllist-0.5-1.noarch.rpm

as previously described, geturllist is not a mandatory utility.

Note:
  • SELinux should be disabled for Sanaly. Otherwise, you need to run "audit2allow" to generate selinux policies for Sanaly.
  • Firefox is a recommended browser, as Chrome/MS Edge does not work appropriately, especially when "back" button of the browser is pressed on.
  • To extract *.src.rpm, you may need additional packages to be installed because Sanaly runs "rpmbuild -bp *.spec" internally. For example, gcc is necessary to extract kernel-*.src.rpm.

¡How to use

just access to "http://webserver/sanaly/" by your web browser, where the webserver is the Linux box sanaly has been installed.

¡Configuration files

Sanaly configuration files are followings:

¡License

¡Support

in a support bbs or e-mail.