it v1.2.3'/>
<meta name='robots' content='noindex, nofollow'/>
<link rel='stylesheet' type='text/css' href='/cgit-static/cgit.css'/>
<link rel='stylesheet' type='text/css' href='/cgit-static/better-cgit-markdown-heading-color.css'/>
<link rel='shortcut icon' href='/cgit-static/favicon.ico'/>
<link rel='alternate' title='Atom feed' href='https://git.koszko.org/guix/atom/?h=koszko' type='application/atom+xml'/>
</head>
<body>
<div id='cgit'><table id='header'>
<tr>
<td class='logo' rowspan='2'><a href='/'><img src='https://git.koszko.org/cgit-static/cgit.png' alt='cgit logo'/></a></td>
<td class='main'><a href='/'>index</a> : <a href='/guix/'>guix</a></td><td class='form'><form method='get'>
<input type='hidden' name='id' value='def5129341023dc7f138f556aa4bfcbed2e8d173'/><select name='h' onchange='this.form.submit();'>
<option value='koszko' selected='selected'>koszko</option>
<option value='koszko-scripts'>koszko-scripts</option>
</select> <input type='submit' value='switch'/></form></td></tr>
<tr><td class='sub'>Wojtek's customized Guix</td><td class='sub right'></td></tr></table>
<table class='tabs'><tr><td>
<a class='active' href='/guix/about/'>about</a><a href='/guix/'>summary</a><a href='/guix/refs/?id=def5129341023dc7f138f556aa4bfcbed2e8d173'>refs</a><a href='/guix/log/'>log</a><a href='/guix/tree/?id=def5129341023dc7f138f556aa4bfcbed2e8d173'>tree</a><a href='/guix/commit/?id=def5129341023dc7f138f556aa4bfcbed2e8d173'>commit</a><a href='/guix/diff/?id=def5129341023dc7f138f556aa4bfcbed2e8d173'>diff</a></td><td class='form'><form class='right' method='get' action='/guix/log/'>
<input type='hidden' name='id' value='def5129341023dc7f138f556aa4bfcbed2e8d173'/><select name='qt'>
<option value='grep'>log msg</option>
<option value='author'>author</option>
<option value='committer'>committer</option>
<option value='range'>range</option>
</select>
<input class='txt' type='search' size='10' name='q' value=''/>
<input type='submit' value='search'/>
</form>
</td></tr></table>
<div class='content'><div id='summary'><pre>
# GNU Guix --- Functional package management for GNU
# Copyright © 2014 Cyril Roelandt &lt;tipecaml@gmail.com&gt;
#
# This file is part of GNU Guix.
#
# GNU Guix is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or (at
# your option) any later version.
#
# GNU Guix is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Guix.  If not, see &lt;http://www.gnu.org/licenses/&gt;.

#
# Test the `guix lint&apos; command-line utility.
#

guix lint --version

# Choose a module directory not below any %LOAD-PATH component.  This is
# necessary when testing &apos;-L&apos; with a relative file name.
module_dir=&quot;$(mktemp -d)&quot;

mkdir -p &quot;$module_dir&quot;
trap &quot;rm -rf $module_dir&quot; EXIT


cat &gt; &quot;$module_dir/foo.scm&quot;&lt;&lt;EOF
(define-module (foo)
  #:use-module (guix packages)
  #:use-module (gnu packages base))

(define-public dummy
  (package (inherit hello)
    (name &quot;dummy&quot;)
    (version &quot;42&quot;)
    (synopsis &quot;dummy package&quot;)
    (description &quot;dummy package. Only used for testing purposes.&quot;)))
EOF

GUIX_PACKAGE_PATH=&quot;$module_dir&quot;
export GUIX_PACKAGE_PATH

grep_warning ()
{
    res=`echo &quot;$1&quot; | grep -E -c &quot;(synopsis|description) should&quot;`
    echo $res
}

# Three issues with the dummy package:
# 1) the synopsis starts with the package name;
# 2) the synopsis starts with a lower-case letter;
# 3) the description has a single space following the end-of-sentence period.

out=`guix lint -c synopsis,description dummy 2&gt;&amp;1`
test `grep_warning &quot;$out&quot;` -eq 3

out=`guix lint -c synopsis dummy 2&gt;&amp;1`
test `grep_warning &quot;$out&quot;` -eq 2

out=`guix lint -c description dummy 2&gt;&amp;1`
test `grep_warning &quot;$out&quot;` -eq 1

out=`guix lint -c description,synopsis dummy 2&gt;&amp;1`
test `grep_warning &quot;$out&quot;` -eq 3

guix lint -c synopsis,invalid-checker dummy 2&gt;&amp;1 | \
   grep -q &apos;invalid-checker: invalid checker&apos;

# Make sure specifying multiple packages works.
guix lint -c inputs-should-be-native dummy dummy@42 dummy


# Use --load-path instead.
unset GUIX_PACKAGE_PATH

out=`guix lint -L $module_dir -c synopsis,description dummy 2&gt;&amp;1`
test `grep_warning &quot;$out&quot;` -eq 3

# Make sure specifying multiple packages works.
guix lint -L $module_dir -c inputs-should-be-native dummy dummy@42 dummy

# Test &apos;-L&apos; with a relative file name.  &apos;guix lint&apos; will see &quot;t-xyz/foo.scm&quot;
# (instead of &quot;foo.scm&quot;) and will thus fail to find it in %LOAD-PATH.  Check
# that it does find it anyway.  See &lt;https://bugs.gnu.org/42543&gt;.
(cd &quot;$module_dir&quot;/.. ; guix lint -c formatting -L &quot;$(basename &quot;$module_dir&quot;)&quot; dummy@42) 2&gt;&amp;1 &gt; &quot;$module_dir/out&quot;
test -z &quot;$(cat &quot;$module_dir/out&quot;)&quot;

# Likewise, when there&apos;s a warning, &apos;package-field-location&apos; used to crash
# because it can&apos;t find &quot;t-xyz/foo.scm&quot;.  See &lt;https://bugs.gnu.org/46390&gt;.
(cd &quot;$module_dir&quot;/.. ; guix lint -c synopsis -L &quot;$(basename &quot;$module_dir&quot;)&quot; dummy@42) 2&gt;&amp;1 &gt; &quot;$module_dir/out&quot;
grep_warning &quot;`cat &quot;$module_dir/out&quot;`&quot;
</pre>
</div></div> <!-- class=content -->
                         <div class=footer>generated by
                             <a href="https://git.zx2c4.com/cgit/about/">
                                 cgit
                             </a>
                         </div>
                        </div> <!-- id=cgit -->
</body>
</html>
