lintianにn新規ルールをn追加する方法

subtitle

2.11X.0対応版

author

Kentaro Hayashi

institution

ClearCode Inc.

content-source

2021年12月 東京エリア・関西合同Debian勉強会

allotted-time

20m

theme

.

スライドはRabbit Slide Showにて公開済みです

本日の内容

lintianについて

lintianについて

lintianのしくみ

lintianの参考資料

注意事項

lintianのディレクトリ構成

lintianのルール開発

lintianで検出したいルール

+dfsgか~dfsgどっちを使うか問題

あえて~dfsgを使う理由

結論: +dfsgか~dfsgどっちを使うか問題

+dfsgのrepack countどうあるべきか問題

|repack countの付け方|パッケージ数| |–|—:| |+dfsg-1|~1400| |+dfsgN-1|~400| |+dfsg.N-1|~60|

結論: repack countはどう付与するのがよいか?

実践編

~dfsgをチェックする

--- a/lib/Lintian/Check/Fields/Version.pm                                                                                                   
+++ b/lib/Lintian/Check/Fields/Version.pm                                                                                                   
...
     } elsif ($version =~ /\.dfsg/) {
         $self->hint('dfsg-version-with-period', $version);
+                                                                                                                                           
+    } elsif ($version =~ /~dfsg/) {                                                                                                        
+        $self->hint('dfsg-version-with-tilde', $version);                                                                                  
+                                                                                                                                           
     } elsif ($version =~ /dsfg/) {
         $self->hint('dfsg-version-misspelled', $version);
     }
...

~dfsgのテストを追加する

~dfsgのテストを追加する

t/…/tilde-dfsg/build-spec/fill-valuesの例

Testname: tilde-dfsg
Skeleton: upload-non-native
Version: 1.0~dfsg-1
Description: Check for dfsg with tilde (~) prefix
See-Also:
 https://lists.debian.org/debian-devel/2021/10/msg00012.html

t/…/tilde-dfsg/eval/descの例

Testname: tilde-dfsg
Check: fields/version

t/…/tilde-dfsg/eval/hintsの例

tilde-dfsg (source): dfsg-version-with-tilde 1.0~dfsg-1

tags/d/dfsg-version-with-tilde.tagの例

Tag: dfsg-version-with-tilde
Severity: info
Check: fields/version
Explanation: The source version string contains a tilde like <code>~dfsg</code>.
 It is probably in a form like <code>1.0~dfsg-1</code>.
 ...
See-Also:
 https://lists.debian.org/debian-devel/2021/10/msg00012.html

~dfsgのhintを生成する

Building the test packages took 1 second.

# Hints do not match
# 
# --- debian/test-out/eval/checks/fields/version/tilde-dfsg/hints.specified.calibrated
# +++ debian/test-out/eval/checks/fields/version/tilde-dfsg/hints.actual.parsed
# -
# +tilde-dfsg (source): dfsg-version-with-tilde 1.0~dfsg-1
#

テストがパスすることを確認する

$ ./private/runtests --onlyrun=check:fields/version
...
All tests successful.
Files=4, Tests=4,  2 wallclock secs ( 0.41 usr  0.12 sys +  4.25 cusr  1.02 csys =  5.80 CPU)
Result: PASS

さいごに