1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414
|
use Data::Dumper;
use Path::Tiny;
use Config::Model::Dpkg::Dependency;
use Carp;
use strict;
use warnings;
my $conf_file_name = "control";
my $conf_dir = 'debian';
# lintian 2.105.0, #968000
chomp( my $std_ver = qx| /usr/share/lintian/private/latest-policy-version | );
$std_ver =~ s|^(\d+\.\d+\.\d+)(?:\.\d+)?$|$1|;
croak "Failed to get last Standards-Version" unless defined $std_ver;
my $t3_description = "This is an extension of Dist::Zilla::Plugin::InlineFiles,
providing the following file:
- xt/release/pod-spell.t - a standard Test::Spelling test" ;
my $jellyfish_annotation = << 'EON';
Package: python3-dna-jellyfish
Architecture: any
Section: python
Depends: ${python3:Depends},
${misc:Depends},
${shlibs:Depends}
Description: count k-mers in DNA sequences (Python bindings of jellyfish)
JELLYFISH is a tool for fast, memory-efficient counting of k-mers in
DNA. A k-mer is a substring of length k, and counting the occurrences
of all such substrings is a central step in many analyses of DNA
sequence. JELLYFISH can count k-mers using an order of magnitude less
memory and an order of magnitude faster than other k-mer counting
packages by using an efficient encoding of a hash table and by
exploiting the "compare-and-swap" CPU instruction to increase
parallelism.
.
JELLYFISH is a command-line program that reads FASTA and multi-FASTA
files containing DNA sequences. It outputs its k-mer counts in an
binary format, which can be translated into a human-readable text
format using the "jellyfish dump" command.
.
This package contains the Python bindings of jellyfish.
EON
;
chomp $jellyfish_annotation;
my @tests = (
{
# t0
check => {
'source Source', "libdist-zilla-plugins-cjm-perl",
'source Standards-Version' => $std_ver,
'source Build-Depends:0', "debhelper (>= 7)",
'source Build-Depends-Indep:0', "libcpan-meta-perl", # fixed
'source Build-Depends-Indep:1', "libdist-zilla-perl", # fixed
'source Build-Depends-Indep:5', "libpath-class-perl",
'source Build-Depends-Indep:6', "libmodule-build-perl (>= 0.360000)", # fixed
'source Build-Depends-Indep:7', "udev [linux-any] | makedev [linux-any]",
'source X-Comment' => qr/Debian #810023/,
'source Priority' => 'optional',
'binary:libdist-zilla-plugins-cjm-perl X-Comment' => qr/Debian #810023/,
'binary:libdist-zilla-plugins-cjm-perl Depends:0' => '${misc:Depends}',
'binary:libdist-zilla-plugins-cjm-perl Conflicts:0' => undef, # removed by apply-fix
'source Vcs-Browser' ,'https://salsa.debian.org/perl-team/modules/packages/libdist-zilla-plugins-cjm-perl',
'source Vcs-Git', 'https://salsa.debian.org/perl-team/modules/packages/libdist-zilla-plugins-cjm-perl.git',
},
log4perl_load_warnings => [ [ User => map { (warn => $_ ) } (
qr/standards version/,
qr/dependency/,
(qr/unnecessary/) x 3, qr/Dual dependency/, (qr/dependency/) x 2,
qr/unnecessary/,
qr/applied on too old package/, # warning about Conflicts field
) ] ],
apply_fix => 1,
file_contents_like => {
'debian/control' => [
# check that write order is tweaked for Standards-Version
qr!Standards-Version: [\d.]+\nVcs-Browser!
]
},
file_contents_unlike => {
'debian/control' => [
# check that libuv0.10-dev conflicts was removed
qr!libuv0.10-dev!
]
},
},
{
# t1
check => { 'binary:seaview Recommends:0', 'clustalw', },
apply_fix => 1,
load => 'binary:seaview Synopsis="multiplatform interface for sequence alignment"',
},
{
# t2
check => {
'binary:xserver-xorg-video-all Architecture' => 'any',
'binary:xserver-xorg-video-all Depends:0' => '${F:XServer-Xorg-Video-Depends}',
'binary:xserver-xorg-video-all Depends:1' => '${misc:Depends}',
'binary:xserver-xorg-video-all Replaces:0' => 'xserver-xorg-driver-all',
'binary:xserver-xorg-video-all Conflicts:0' => 'xserver-xorg-driver-all',
},
apply_fix => 1,
},
{
# t3
check => {
# no longer mess up synopsis with lcfirst
'binary:libdist-zilla-plugin-podspellingtests-perl Synopsis' =>
"Release tests for POD spelling",
'binary:libdist-zilla-plugin-podspellingtests-perl Description' => $t3_description ,
},
load => 'binary:libdist-zilla-plugin-podspellingtests-perl '
. 'Description="'.$t3_description.'"',
apply_fix => 1,
},
{
# t4, also checks XS-Python-Version deprecation
check => {
'source Priority' => 'extra',
'source X-Python-Version' => ">= 2.3, << 2.5",
'source Standards-Version', "3.9.8",
},
log4perl_load_warnings => [ [
User =>
warn => qr/Standards-Version/,
warn => qr/deprecated/
] ],
},
{
# t5
check => { 'source X-Python-Version' => ">= 2.3, << 2.6" },
log4perl_load_warnings => [[ User => warn => qr/deprecated/ ]],
},
{
# t6
check => { 'source X-Python-Version' => ">= 2.3" },
log4perl_load_warnings => [[ User => warn => qr/deprecated/ ]],
},
{
name => 'sdlperl',
load => 'source Uploaders:2="Sam Hocevar (Debian packages) <sam@zoy.org>"',
load_check => 'skip',
check => {
'binary:libsdl-perl Depends:2' => '${misc:Depends}',
'binary:libsdl-perl Conflicts:2' => undef,
},
apply_fix => 1,
},
{
name => 'libpango-perl',
verify_annotation => {
'source Build-Depends' => " do NOT add libgtk2-perl to build-deps (see bug #554704)",
'source Maintainer' => " what a fine\n team this one is",
},
apply_fix => 1,
},
{
name => 'libwx-scintilla-perl',
apply_fix => 1,
},
{
# test for #683861 -- dependency version check and epochs
name => 'libmodule-metadata-perl',
apply_fix => 1,
},
{
# test for #682730 (reduces libclass-isa-perl | perl (<< 5.10.1-13) to perl)
name => 'libclass-meta-perl',
check => { 'source Build-Depends-Indep:1' => 'libclass-isa-perl' },
apply_fix => 1,
},
{
# test for #692849, must not warn about missing libfoo dependency
name => 'dbg-dep',
},
{
# test for #696768, Built-Using field
name => 'built-using',
apply_fix => 1,
},
{
# test for #719753, XS-Autobuild field
name => 'non-free',
check => {
'source Section' => 'non-free/libs',
'source XS-Autobuild' => 'yes',
},
},
{
# test for #713053, XS-Ruby-Versions and XB-Ruby-Versions fields
name => 'ruby',
apply_fix => 1, # to fix pkg-testsuite param
check => {
'source XS-Ruby-Versions' => 'all',
'binary:libfast-xs-ruby XB-Ruby-Versions' => '${ruby:Versions}',
},
file_contents_unlike => {
# XB-Ruby is now deprecated (See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1075762)
"debian/control" => qr/XB-Ruby/
},
},
{
# test for #903905, XS-Ruby-Versions in a package not maintained
# by ruby team
name => 'ruby-in-med-team',
check => {
'source XS-Ruby-Versions' => 'all',
'binary:ruby-rgfa XB-Ruby-Versions' => '${ruby:Versions}',
},
file_contents_unlike => {
# XB-Ruby is now deprecated (See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1075762)
"debian/control" => qr/XB-Ruby/
},
},
{
# test for XS-Testsuite field
name => 'xs-testsuite',
log4perl_load_warnings => [ [
User => warn => qr/source Standards-Version/,
warn => qr/deprecated/
] ],
apply_fix => 1,
check => {
'source Testsuite' => 'autopkgtest-pkg-ruby',
},
},
{
name => 'gnu-r-stuff',
# last warning is about line too long.
log4perl_load_warnings => [[
User => map { (warn => $_)} qr/standards version/ , (qr/Vcs/) x 2 , qr/Description/
]],
apply_fix => 1,
check => [
'source Section' => 'gnu-r',
'binary:gnu-r-view Section' => 'gnu-r',
]
},
{
name => 'build-profiles',
apply_fix => 1,
check => {
'binary:pkg-config Build-Profiles' => '<!stage1>',
'binary:pkg-config-stage1 Build-Profiles' => '<stage1>',
'source Build-Depends:3' => 'libglib2.0-dev <!stage1>'
},
},
{
name => 'comments-in-dep-list',
file_contents_like => {
"debian/control" => qr/# Python/,
}
},
{
name => 'tricky-comment',
verify_annotation => {
'binary:libmoosex-types-iso8601-perl Synopsis' => " not yet packaged\n Recommends",
}
},
{
name => 'med-team',
log4perl_load_warnings => [ [
User => warn => qr/source Standards-Version/,
( warn => qr/canonical/) x 2
]],
apply_fix => 1,
check => {
'source Vcs-Git' => 'https://salsa.debian.org/med-team/abacas.git',
'source Vcs-Browser' => 'https://salsa.debian.org/med-team/abacas',
},
},
{
name => 'neurodebian-team',
apply_fix => 1,
check => {
'source Vcs-Git' => 'https://salsa.debian.org/neurodebian-team/caret-data.git',
'source Vcs-Browser' => 'https://salsa.debian.org/neurodebian-team/caret-data',
},
},
{
name => 'bcftools',
apply_fix => 1,
verify_annotation => {
'binary:bcftools Suggests:0' => " These are needed for plot-vcfstats"
},
check => {
'binary:bcftools Suggests:0' => "python"
},
},
{
name => 'rules-requires-root-non-ascii',
log4perl_load_warnings => [[
User => map {(warn => $_)} (qr/Current standards version/, qr/Invalid value/)
]],
load => 'source Rules-Requires-Root="foo/bar"',
check => {
'source Rules-Requires-Root' => qr/no|binary-targets|([^\P{PosixGraph}\/]{2,}\/\p{PosixGraph}{2,}\s*)+/,
},
},
{
name => 'rules-requires-root-too-short',
log4perl_load_warnings => [[
User => map {(warn => $_)} (qr/Current standards version/,qr/Invalid value/)
]],
load => 'source Rules-Requires-Root="no"',
check => {
'source Rules-Requires-Root' => qr/no|binary-targets|([^\P{PosixGraph}\/]{2,}\/\p{PosixGraph}{2,}\s*)+/,
},
},
{
name => 'rules-requires-root-invalid-item',
log4perl_load_warnings => [[
User => map {(warn => $_)} (qr/Current standards version/,qr/Invalid value/)
]],
load => 'source Rules-Requires-Root="binary-targets"',
check => {
'source Rules-Requires-Root' => qr/no|binary-targets|([^\P{PosixGraph}\/]{2,}\/\p{PosixGraph}{2,}\s*)+/,
},
},
{
name => 'rules-requires-root-several-keywords',
log4perl_load_warnings => [[
User => map {(warn => $_)} (qr/Current standards version/,qr/Invalid value/)
]],
load => 'source Rules-Requires-Root="abc/acme xyz/debian"',
check => {
'source Rules-Requires-Root' => qr/no|binary-targets|([^\P{PosixGraph}\/]{2,}\/\p{PosixGraph}{2,}\s*)+/,
},
},
{
name => 'init-system-helpers',
check => {
'source Build-Depends:1' => 'perl:any',
}
},
{
name => 'npm2deb_package',
check => {
'source Build-Depends:0' => 'debhelper (>= 11~)',
'source Build-Depends:1' => 'nodejs',
}
},
{
# Debian
name => 'jellyfish',
verify_annotation => {
'binary:libjellyfish-perl' => $jellyfish_annotation,
'source Source' => " Dummy source comment\n that should be preserved when writing file backend",
}
},
{
name => 'libburn-with-autoreconf',
check_before_fix => {
log4perl_dump_warnings => [ ],
},
apply_fix => 1,
check => {
'source Build-Depends:0' => undef,
'source Build-Depends:1' => 'pkg-config',
'source Build-Depends:2' => 'debhelper-compat (= 13)',
'source Build-Depends:3' => qr/libcam-dev/,
}
}
);
my $cache_file = path('t/model_tests.d/dependency-cache.txt');
$Config::Model::Dpkg::Dependency::use_test_cache = 1;
untie %Config::Model::Dpkg::Dependency::cache;
%Config::Model::Dpkg::Dependency::cache = ();
foreach my $line ($cache_file->lines) {
chomp $line;
next unless $line;
my ($k,$v) = split m/ => /, $line ;
$Config::Model::Dpkg::Dependency::cache{$k} = time . ' '. $v ;
}
END {
return if $::DebianDependencyCacheWritten ;
my %h = %Config::Model::Dpkg::Dependency::cache ;
do { s/^\d+ //;} for values %h ; # remove time stamp
my $str = join ("\n", map { "$_ => $h{$_}" ;} sort keys %h) ;
my $fh = new IO::File "> $cache_file";
print "writing back cache file\n";
if ( defined $fh ) {
# not a big deal if cache cannot be written back
$fh->print($str);
$fh->close;
$::DebianDependencyCacheWritten=1;
}
}
return {
conf_file_name => $conf_file_name,
conf_dir => $conf_dir,
tests => \@tests,
};
|