Subject: [bug#59765] Add Sourcetrail

From: Nicolas Goaziou <[email-masked]>
Date: Sun, 23 Apr 2023 16:27:37 +0200

Hello,

phodina via Guix-patches via <[email-masked]> writes:

> these patches add Sourcetrail code analysis tool,

Thank you.

> which unfortunately is not longer developed.

This doesn't sound too good. I notice there is a somewhat active fork at
<https://github.com/OpenSourceSourceTrail/Sourcetrail>. Would it make
sense to use it instead?

> +(define-public boost-for-sourcetrail
> +  ;; Older version for Sourcetrail 1.1.30.
> +  (package
> +    (name "boost")
> +    (version "1.67.0")
> +    (source (origin
> +              (method url-fetch)
> +              (uri (string-append
> +                    "mirror://sourceforge/boost/boost/" version "/boost_"
> +                    (string-map (lambda (x) (if (eq? x #\.) #\_ x)) version)
> +                    ".tar.bz2"))
> +              (sha256
> +               (base32
> +                "1fmdlmkzsrd46wwk834jsi2ypxj68w2by0rfcg2pzrafk5rck116"))
> +              (patches (search-patches "boost-fix-icu-build.patch"))))
> +    (build-system gnu-build-system)
> +    (inputs `(("icu4c" ,icu4c)
> +              ("zlib" ,zlib)))
> +    (native-inputs
> +     `(("perl" ,perl)
> +       ("python" ,python-2)

Guix has dropped support for Python 2, so this Boost package is not
really an option. Is it possible to use a more recent Boost library?

> +(define-public sourcetrail
> +(package
> +  (name "sourcetrail")
> +  (version "2021.1.30")
> +  (source (origin
> +            (method git-fetch)
> +            (uri (git-reference
> +             (url "https://github.com/CoatiSoftware/Sourcetrail")
> +             (commit version)))
> +            (file-name (git-file-name name version))
> +            (sha256
> +             (base32
> +              "0h0q2bfa6dv8hmc15rzj48bna1krzjwlcjm25dffbsi81xjcazb5"))))
> +  (build-system cmake-build-system)
> +  (arguments
> +    (list #:configure-flags #~(list "-DBoost_USE_STATIC_LIBS=OFF" (string-append
> +	"-DBOOST_ROOT=" #$(this-package-input "boost") "/lib"))

README mentions build process should also set Qt5_DIR configure flag.

> +      #:phases
> +      #~(modify-phases %standard-phases
> +       (replace 'install
> +        (lambda* (#:key outputs #:allow-other-keys)
> +		 (let* ((out #$output)
> +		       (prefix (string-append out "/opt/sourcetrail"))
> +			   (build (getcwd))
> +			   (share (string-append prefix "/share")))
> +		       (mkdir-p (string-append out "/bin"))
> +			   (install-file (string-append build "/app/Sourcetrail") (string-append
> +			   out "/bin"))
> +			   (install-file (string-append build
> +			   "/app/sourcetrail_indexer") (string-append
> +			   out "/bin"))))))))

Indentation is a bit off.

> +  (native-inputs (list pkg-config))
> +  (inputs (list boost-for-sourcetrail
> +            qtbase-5
> +            qtsvg-5))
> +  (synopsis "Interactive source explorer")
> +  (description "Offline source explorer that helps you get productive on unfamiliar source code with optional IDE integration.")

Description should consist of full sentences.

Although this review is a bit late, would you like to try sending an
updated patch?

Regards,
-- 
Nicolas Goaziou