assorted_debian_utils/
excuses.rs

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
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
// Copyright 2021-2022 Sebastian Ramacher
// SPDX-License-Identifier: LGPL-3.0-or-later

//! # Helpers to handle `excuses.yaml` for testing migration
//!
//! This module provides helpers to deserialize [excuses.yaml](https://release.debian.org/britney/excuses.yaml)
//! with [serde]. Note however, that this module only handles a biased selection of fields.

use std::{collections::HashMap, fmt::Formatter, io};

use chrono::{DateTime, Utc};
use serde::{de, Deserialize, Deserializer};
use smallvec::SmallVec;

use crate::{
    architectures::Architecture, archive::Component, utils::DateTimeVisitor,
    version::PackageVersion,
};

/// Deserialize a datetime string into a `DateTime<Utc>`
fn deserialize_datetime<'de, D>(deserializer: D) -> std::result::Result<DateTime<Utc>, D::Error>
where
    D: Deserializer<'de>,
{
    deserializer.deserialize_str(DateTimeVisitor("%Y-%m-%d %H:%M:%S%.f"))
}

/// Deserialize a version or '-' as `PackageVersion` or `None`
fn deserialize_version<'de, D>(
    deserializer: D,
) -> std::result::Result<Option<PackageVersion>, D::Error>
where
    D: Deserializer<'de>,
{
    #[derive(Debug)]
    struct Visitor;

    impl de::Visitor<'_> for Visitor {
        type Value = Option<PackageVersion>;

        fn expecting(&self, formatter: &mut Formatter) -> std::fmt::Result {
            write!(formatter, "a package version or '-'")
        }

        fn visit_str<E>(self, s: &str) -> std::result::Result<Self::Value, E>
        where
            E: de::Error,
        {
            if s == "-" {
                Ok(None)
            } else {
                PackageVersion::try_from(s)
                    .map_err(|_| de::Error::invalid_value(de::Unexpected::Str(s), &self))
                    .map(Some)
            }
        }
    }

    deserializer.deserialize_str(Visitor)
}

/// The excuses.
#[derive(Debug, PartialEq, Eq, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Excuses {
    /// Date of the run that produced `excuses.yaml`
    #[serde(deserialize_with = "deserialize_datetime")]
    pub generated_date: DateTime<Utc>,
    /// All excuse items
    ///
    /// While not every excuses item relates to a source package, the field is still named that way in `excuses.yaml`
    pub sources: Vec<ExcusesItem>,
}

/// A policy's verdict
#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Eq)]
pub enum Verdict {
    /// Policy passed
    #[serde(rename = "PASS")]
    Pass,
    /// Policy passed due to a hint
    #[serde(rename = "PASS_HINTED")]
    PassHinted,
    /// Rejected due to a block hint or because the upload requires explicit approval (e.g.,
    /// uploads to proposed-updates or testing-proposed-updates)
    #[serde(rename = "REJECTED_NEEDS_APPROVAL")]
    RejectedNeedsApproval,
    /// Rejected tu to a permanent issue
    #[serde(rename = "REJECTED_PERMANENTLY")]
    RejectedPermanently,
    /// Rejected due to a transient issue
    #[serde(rename = "REJECTED_TEMPORARILY")]
    RejectedTemporarily,
    /// Rejected, but not able to determine if the issue is transient
    #[serde(rename = "REJECTED_CANNOT_DETERMINE_IF_PERMANENT")]
    RejectedCannotDetermineIfPermanent,
    /// Reject due to another blocking item.
    #[serde(rename = "REJECTED_BLOCKED_BY_ANOTHER_ITEM")]
    RejectedBlockedByAnotherItem,
    /// Reject due to another blocking item.
    #[serde(rename = "REJECTED_WAITING_FOR_ANOTHER_ITEM")]
    RejectedWaitingForAnotherItem,
}

/// Age policy info
#[derive(Debug, PartialEq, Eq, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct AgeInfo {
    /// The required age
    pub age_requirement: u32,
    /// The current age
    pub current_age: u32,
    /// The verdict
    pub verdict: Verdict,
}

/// Catch-all policy info
#[derive(Debug, PartialEq, Eq, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct UnspecfiedPolicyInfo {
    /// The verdict
    pub verdict: Verdict,
}

/// Built-on-buildd policy info
#[derive(Debug, PartialEq, Eq, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct BuiltOnBuildd {
    /// The signers for each architecture
    pub signed_by: HashMap<Architecture, Option<String>>,
    /// The verdict
    pub verdict: Verdict,
}

/// Collected policy infos
#[derive(Debug, PartialEq, Eq, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct PolicyInfo {
    /// The age policy
    pub age: Option<AgeInfo>,
    /// The buildt-on-buildd policy
    pub builtonbuildd: Option<BuiltOnBuildd>,
    /// The autopkgtest porlicy
    pub autopkgtest: Option<UnspecfiedPolicyInfo>,
    /// All remaining policies
    #[serde(flatten)]
    pub extras: HashMap<String, UnspecfiedPolicyInfo>,
    /*
        autopkgtest: Option<UnspecfiedPolicyInfo>,
        block: Option<UnspecfiedPolicyInfo>,
        build_depends: Option<UnspecfiedPolicyInfo>,
        built_using:  Option<UnspecfiedPolicyInfo>,
        depends: Option<UnspecfiedPolicyInfo>,
        piuparts: Option<UnspecfiedPolicyInfo>,
        rc_bugs: Option<UnspecfiedPolicyInfo>,
    */
}

/// List of missing builds
#[derive(Debug, PartialEq, Eq, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct MissingBuilds {
    /// Architectures where builds are missing
    // 16 is arbitrary, but is large enough to hold all current release architectures
    pub on_architectures: SmallVec<[Architecture; 16]>,
}

/// A source package's excuses
#[derive(Debug, PartialEq, Eq, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct ExcusesItem {
    /// Maintainer of the package
    pub maintainer: Option<String>,
    /// The item is a candidate for migration
    pub is_candidate: bool,
    /// Version in the source suite, i.e., the version to migrate
    ///
    /// If the value is `None`, the package is being removed.
    #[serde(deserialize_with = "deserialize_version")]
    pub new_version: Option<PackageVersion>,
    /// Version in the target suite
    ///
    /// If the value is `None`, the package is not yet available in the target suite.
    #[serde(deserialize_with = "deserialize_version")]
    pub old_version: Option<PackageVersion>,
    /// Migration item name
    pub item_name: String,
    /// Source package name
    pub source: String,
    /// Migration is blocked by another package
    pub invalidated_by_other_package: Option<bool>,
    /// Component of the source package
    pub component: Option<Component>,
    /// Missing builds
    pub missing_builds: Option<MissingBuilds>,
    /// Policy info
    #[serde(rename = "policy_info")]
    pub policy_info: Option<PolicyInfo>,
    /// The excuses
    pub excuses: Vec<String>,
    /// Combined verdict
    pub migration_policy_verdict: Verdict,
}

impl ExcusesItem {
    /// Excuses item refers to package removal
    pub fn is_removal(&self) -> bool {
        self.new_version.is_none()
    }

    /// Excuses item refers to a binNMU
    pub fn is_binnmu(&self) -> bool {
        self.new_version == self.old_version
    }

    /// Get architecture of the binNMU or `None`
    pub fn binnmu_arch(&self) -> Option<Architecture> {
        self.item_name.split_once('/').map(|(_, arch)| {
            arch.split_once('_')
                .map_or(arch, |(arch, _)| arch)
                .try_into()
                .unwrap()
        })
    }

    /// Excuses item refers to an item in (stable) proposed-updates
    pub fn is_from_pu(&self) -> bool {
        self.item_name.ends_with("_pu")
    }

    /// Excuses item refers to an item in testing-proposed-updates
    pub fn is_from_tpu(&self) -> bool {
        self.item_name.ends_with("_tpu")
    }
}

/// Result type
pub type Result<T> = serde_yaml::Result<T>;

/// Read excuses from a reader
pub fn from_reader(reader: impl io::Read) -> Result<Excuses> {
    serde_yaml::from_reader(reader)
}

/// Read excuses from a string
pub fn from_str(data: &str) -> Result<Excuses> {
    serde_yaml::from_str(data)
}

#[cfg(test)]
mod test {
    use crate::excuses::Verdict;

    #[test]
    fn deserialize() {
        let data = r##"generated-date: 2022-07-02 20:09:06.890414
sources:
- excuses:
  - 'Migration status for -kalarmcal (4:21.12.3-2 to -): Will attempt migration (Any
    information below is purely informational)'
  - 'Additional info:'
  - ∙ ∙ Package not in unstable, will try to remove
  is-candidate: true
  item-name: -kalarmcal
  maintainer: Debian Qt/KDE Maintainers
  migration-policy-verdict: PASS
  new-version: '-'
  old-version: 4:21.12.3-2
  reason: []
  source: kalarmcal
- detailed-info:
  - Checking build-dependency on amd64
  - Checking build-dependency (indep) on amd64
  excuses:
  - 'Migration status for libmoosex-types-path-class-perl (0.09-1.1 to 0.09-2): Will
    attempt migration (Any information below is purely informational)'
  - 'Additional info:'
  - ∙ ∙ Piuparts tested OK - <a href="https://piuparts.debian.org/sid/source/libm/libmoosex-types-path-class-perl.html">https://piuparts.debian.org/sid/source/libm/libmoosex-types-path-class-perl.html</a>
  - '∙ ∙ autopkgtest for <a href="#libmoosex-types-path-class-perl">libmoosex-types-path-class-perl</a>/0.09-2:
    <a href="https://ci.debian.net/packages/libm/libmoosex-types-path-class-perl/testing/amd64">amd64</a>:
    <a href="https://ci.debian.net/data/autopkgtest/testing/amd64/libm/libmoosex-types-path-class-perl/23220832/log.gz"><span
    style="background:#87d96c">Pass</span></a>, <a href="https://ci.debian.net/packages/libm/libmoosex-types-path-class-perl/testing/arm64">arm64</a>:
    <a href="https://ci.debian.net/data/autopkgtest/testing/arm64/libm/libmoosex-types-path-class-perl/23221438/log.gz"><span
    style="background:#87d96c">Pass</span></a>, <a href="https://ci.debian.net/packages/libm/libmoosex-types-path-class-perl/testing/armhf">armhf</a>:
    <a href="https://ci.debian.net/data/autopkgtest/testing/armhf/libm/libmoosex-types-path-class-perl/23222108/log.gz"><span
    style="background:#87d96c">Pass</span></a>, <a href="https://ci.debian.net/packages/libm/libmoosex-types-path-class-perl/testing/i386">i386</a>:
    <a href="https://ci.debian.net/data/autopkgtest/testing/i386/libm/libmoosex-types-path-class-perl/23222731/log.gz"><span
    style="background:#87d96c">Pass</span></a>, <a href="https://ci.debian.net/packages/libm/libmoosex-types-path-class-perl/testing/ppc64el">ppc64el</a>:
    <a href="https://ci.debian.net/data/autopkgtest/testing/ppc64el/libm/libmoosex-types-path-class-perl/23223345/log.gz"><span
    style="background:#87d96c">Pass</span></a>, <a href="https://ci.debian.net/packages/libm/libmoosex-types-path-class-perl/testing/s390x">s390x</a>:
    <a href="https://ci.debian.net/data/autopkgtest/testing/s390x/libm/libmoosex-types-path-class-perl/23224981/log.gz"><span
    style="background:#87d96c">Pass</span></a>'
  - ∙ ∙ Required age reduced by 3 days because of autopkgtest
  - ∙ ∙ 2 days old (needed 2 days)
  is-candidate: true
  item-name: libmoosex-types-path-class-perl
  maintainer: Debian Perl Group
  migration-policy-verdict: PASS
  new-version: 0.09-2
  old-version: 0.09-1.1
  policy_info:
    age:
      age-requirement: 2
      current-age: 2
      verdict: PASS
    autopkgtest:
      libfcgi-engine-perl/0.22-1.1:
        amd64:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/amd64/libf/libfcgi-engine-perl/23220825/log.gz
        - https://ci.debian.net/packages/libf/libfcgi-engine-perl/testing/amd64
        - null
        - null
        arm64:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/arm64/libf/libfcgi-engine-perl/23221431/log.gz
        - https://ci.debian.net/packages/libf/libfcgi-engine-perl/testing/arm64
        - null
        - null
        armhf:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/armhf/libf/libfcgi-engine-perl/23222101/log.gz
        - https://ci.debian.net/packages/libf/libfcgi-engine-perl/testing/armhf
        - null
        - null
        i386:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/i386/libf/libfcgi-engine-perl/23222724/log.gz
        - https://ci.debian.net/packages/libf/libfcgi-engine-perl/testing/i386
        - null
        - null
        ppc64el:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/ppc64el/libf/libfcgi-engine-perl/23223338/log.gz
        - https://ci.debian.net/packages/libf/libfcgi-engine-perl/testing/ppc64el
        - null
        - null
        s390x:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/s390x/libf/libfcgi-engine-perl/23224974/log.gz
        - https://ci.debian.net/packages/libf/libfcgi-engine-perl/testing/s390x
        - null
        - null
      libgit-pureperl-perl/0.53-2:
        amd64:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/amd64/libg/libgit-pureperl-perl/23220826/log.gz
        - https://ci.debian.net/packages/libg/libgit-pureperl-perl/testing/amd64
        - null
        - null
        arm64:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/arm64/libg/libgit-pureperl-perl/23221432/log.gz
        - https://ci.debian.net/packages/libg/libgit-pureperl-perl/testing/arm64
        - null
        - null
        armhf:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/armhf/libg/libgit-pureperl-perl/23222102/log.gz
        - https://ci.debian.net/packages/libg/libgit-pureperl-perl/testing/armhf
        - null
        - null
        i386:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/i386/libg/libgit-pureperl-perl/23222725/log.gz
        - https://ci.debian.net/packages/libg/libgit-pureperl-perl/testing/i386
        - null
        - null
        ppc64el:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/ppc64el/libg/libgit-pureperl-perl/23223339/log.gz
        - https://ci.debian.net/packages/libg/libgit-pureperl-perl/testing/ppc64el
        - null
        - null
        s390x:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/s390x/libg/libgit-pureperl-perl/23224975/log.gz
        - https://ci.debian.net/packages/libg/libgit-pureperl-perl/testing/s390x
        - null
        - null
      libmagpie-perl/1.163200-3:
        amd64:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/amd64/libm/libmagpie-perl/23220827/log.gz
        - https://ci.debian.net/packages/libm/libmagpie-perl/testing/amd64
        - null
        - null
        arm64:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/arm64/libm/libmagpie-perl/23221433/log.gz
        - https://ci.debian.net/packages/libm/libmagpie-perl/testing/arm64
        - null
        - null
        armhf:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/armhf/libm/libmagpie-perl/23222103/log.gz
        - https://ci.debian.net/packages/libm/libmagpie-perl/testing/armhf
        - null
        - null
        i386:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/i386/libm/libmagpie-perl/23222726/log.gz
        - https://ci.debian.net/packages/libm/libmagpie-perl/testing/i386
        - null
        - null
        ppc64el:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/ppc64el/libm/libmagpie-perl/23223340/log.gz
        - https://ci.debian.net/packages/libm/libmagpie-perl/testing/ppc64el
        - null
        - null
        s390x:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/s390x/libm/libmagpie-perl/23224976/log.gz
        - https://ci.debian.net/packages/libm/libmagpie-perl/testing/s390x
        - null
        - null
      libmoosex-configfromfile-perl/0.14-2:
        amd64:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/amd64/libm/libmoosex-configfromfile-perl/23220828/log.gz
        - https://ci.debian.net/packages/libm/libmoosex-configfromfile-perl/testing/amd64
        - null
        - null
        arm64:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/arm64/libm/libmoosex-configfromfile-perl/23221434/log.gz
        - https://ci.debian.net/packages/libm/libmoosex-configfromfile-perl/testing/arm64
        - null
        - null
        armhf:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/armhf/libm/libmoosex-configfromfile-perl/23222104/log.gz
        - https://ci.debian.net/packages/libm/libmoosex-configfromfile-perl/testing/armhf
        - null
        - null
        i386:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/i386/libm/libmoosex-configfromfile-perl/23222727/log.gz
        - https://ci.debian.net/packages/libm/libmoosex-configfromfile-perl/testing/i386
        - null
        - null
        ppc64el:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/ppc64el/libm/libmoosex-configfromfile-perl/23223341/log.gz
        - https://ci.debian.net/packages/libm/libmoosex-configfromfile-perl/testing/ppc64el
        - null
        - null
        s390x:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/s390x/libm/libmoosex-configfromfile-perl/23224977/log.gz
        - https://ci.debian.net/packages/libm/libmoosex-configfromfile-perl/testing/s390x
        - null
        - null
      libmoosex-configuration-perl/0.2-2:
        amd64:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/amd64/libm/libmoosex-configuration-perl/23220829/log.gz
        - https://ci.debian.net/packages/libm/libmoosex-configuration-perl/testing/amd64
        - null
        - null
        arm64:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/arm64/libm/libmoosex-configuration-perl/23221435/log.gz
        - https://ci.debian.net/packages/libm/libmoosex-configuration-perl/testing/arm64
        - null
        - null
        armhf:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/armhf/libm/libmoosex-configuration-perl/23222105/log.gz
        - https://ci.debian.net/packages/libm/libmoosex-configuration-perl/testing/armhf
        - null
        - null
        i386:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/i386/libm/libmoosex-configuration-perl/23222728/log.gz
        - https://ci.debian.net/packages/libm/libmoosex-configuration-perl/testing/i386
        - null
        - null
        ppc64el:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/ppc64el/libm/libmoosex-configuration-perl/23223342/log.gz
        - https://ci.debian.net/packages/libm/libmoosex-configuration-perl/testing/ppc64el
        - null
        - null
        s390x:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/s390x/libm/libmoosex-configuration-perl/23224978/log.gz
        - https://ci.debian.net/packages/libm/libmoosex-configuration-perl/testing/s390x
        - null
        - null
      libmoosex-daemonize-perl/0.22-1:
        amd64:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/amd64/libm/libmoosex-daemonize-perl/23220830/log.gz
        - https://ci.debian.net/packages/libm/libmoosex-daemonize-perl/testing/amd64
        - null
        - null
        arm64:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/arm64/libm/libmoosex-daemonize-perl/23221436/log.gz
        - https://ci.debian.net/packages/libm/libmoosex-daemonize-perl/testing/arm64
        - null
        - null
        armhf:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/armhf/libm/libmoosex-daemonize-perl/23222106/log.gz
        - https://ci.debian.net/packages/libm/libmoosex-daemonize-perl/testing/armhf
        - null
        - null
        i386:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/i386/libm/libmoosex-daemonize-perl/23222729/log.gz
        - https://ci.debian.net/packages/libm/libmoosex-daemonize-perl/testing/i386
        - null
        - null
        ppc64el:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/ppc64el/libm/libmoosex-daemonize-perl/23223343/log.gz
        - https://ci.debian.net/packages/libm/libmoosex-daemonize-perl/testing/ppc64el
        - null
        - null
        s390x:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/s390x/libm/libmoosex-daemonize-perl/23224979/log.gz
        - https://ci.debian.net/packages/libm/libmoosex-daemonize-perl/testing/s390x
        - null
        - null
      libmoosex-runnable-perl/0.10-1:
        amd64:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/amd64/libm/libmoosex-runnable-perl/23220831/log.gz
        - https://ci.debian.net/packages/libm/libmoosex-runnable-perl/testing/amd64
        - null
        - null
        arm64:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/arm64/libm/libmoosex-runnable-perl/23221437/log.gz
        - https://ci.debian.net/packages/libm/libmoosex-runnable-perl/testing/arm64
        - null
        - null
        armhf:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/armhf/libm/libmoosex-runnable-perl/23222107/log.gz
        - https://ci.debian.net/packages/libm/libmoosex-runnable-perl/testing/armhf
        - null
        - null
        i386:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/i386/libm/libmoosex-runnable-perl/23222730/log.gz
        - https://ci.debian.net/packages/libm/libmoosex-runnable-perl/testing/i386
        - null
        - null
        ppc64el:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/ppc64el/libm/libmoosex-runnable-perl/23223344/log.gz
        - https://ci.debian.net/packages/libm/libmoosex-runnable-perl/testing/ppc64el
        - null
        - null
        s390x:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/s390x/libm/libmoosex-runnable-perl/23224980/log.gz
        - https://ci.debian.net/packages/libm/libmoosex-runnable-perl/testing/s390x
        - null
        - null
      libmoosex-types-path-class-perl/0.09-2:
        amd64:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/amd64/libm/libmoosex-types-path-class-perl/23220832/log.gz
        - https://ci.debian.net/packages/libm/libmoosex-types-path-class-perl/testing/amd64
        - null
        - null
        arm64:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/arm64/libm/libmoosex-types-path-class-perl/23221438/log.gz
        - https://ci.debian.net/packages/libm/libmoosex-types-path-class-perl/testing/arm64
        - null
        - null
        armhf:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/armhf/libm/libmoosex-types-path-class-perl/23222108/log.gz
        - https://ci.debian.net/packages/libm/libmoosex-types-path-class-perl/testing/armhf
        - null
        - null
        i386:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/i386/libm/libmoosex-types-path-class-perl/23222731/log.gz
        - https://ci.debian.net/packages/libm/libmoosex-types-path-class-perl/testing/i386
        - null
        - null
        ppc64el:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/ppc64el/libm/libmoosex-types-path-class-perl/23223345/log.gz
        - https://ci.debian.net/packages/libm/libmoosex-types-path-class-perl/testing/ppc64el
        - null
        - null
        s390x:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/s390x/libm/libmoosex-types-path-class-perl/23224981/log.gz
        - https://ci.debian.net/packages/libm/libmoosex-types-path-class-perl/testing/s390x
        - null
        - null
      libpackage-locator-perl/0.10-3:
        amd64:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/amd64/libp/libpackage-locator-perl/23220833/log.gz
        - https://ci.debian.net/packages/libp/libpackage-locator-perl/testing/amd64
        - null
        - null
        arm64:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/arm64/libp/libpackage-locator-perl/23221439/log.gz
        - https://ci.debian.net/packages/libp/libpackage-locator-perl/testing/arm64
        - null
        - null
        armhf:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/armhf/libp/libpackage-locator-perl/23222109/log.gz
        - https://ci.debian.net/packages/libp/libpackage-locator-perl/testing/armhf
        - null
        - null
        i386:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/i386/libp/libpackage-locator-perl/23222732/log.gz
        - https://ci.debian.net/packages/libp/libpackage-locator-perl/testing/i386
        - null
        - null
        ppc64el:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/ppc64el/libp/libpackage-locator-perl/23223346/log.gz
        - https://ci.debian.net/packages/libp/libpackage-locator-perl/testing/ppc64el
        - null
        - null
        s390x:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/s390x/libp/libpackage-locator-perl/23224982/log.gz
        - https://ci.debian.net/packages/libp/libpackage-locator-perl/testing/s390x
        - null
        - null
      libtest-tempdir-perl/0.11-1:
        amd64:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/amd64/libt/libtest-tempdir-perl/23220834/log.gz
        - https://ci.debian.net/packages/libt/libtest-tempdir-perl/testing/amd64
        - null
        - null
        arm64:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/arm64/libt/libtest-tempdir-perl/23221440/log.gz
        - https://ci.debian.net/packages/libt/libtest-tempdir-perl/testing/arm64
        - null
        - null
        armhf:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/armhf/libt/libtest-tempdir-perl/23222110/log.gz
        - https://ci.debian.net/packages/libt/libtest-tempdir-perl/testing/armhf
        - null
        - null
        i386:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/i386/libt/libtest-tempdir-perl/23222733/log.gz
        - https://ci.debian.net/packages/libt/libtest-tempdir-perl/testing/i386
        - null
        - null
        ppc64el:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/ppc64el/libt/libtest-tempdir-perl/23223347/log.gz
        - https://ci.debian.net/packages/libt/libtest-tempdir-perl/testing/ppc64el
        - null
        - null
        s390x:
        - PASS
        - https://ci.debian.net/data/autopkgtest/testing/s390x/libt/libtest-tempdir-perl/23224983/log.gz
        - https://ci.debian.net/packages/libt/libtest-tempdir-perl/testing/s390x
        - null
        - null
      verdict: PASS
    block:
      verdict: PASS
    build-depends:
      check-build-depends-indep-on-arch: amd64
      check-build-depends-on-arch: amd64
      verdict: PASS
    built-using:
      verdict: PASS
    builtonbuildd:
      signed-by:
        all: buildd_all-x86-grnet-02@buildd.debian.org
      verdict: PASS
    depends:
      verdict: PASS
    implicit-deps:
      implicit-deps:
        broken-binaries: []
      verdict: PASS
    piuparts:
      piuparts-test-url: https://piuparts.debian.org/sid/source/libm/libmoosex-types-path-class-perl.html
      test-results: pass
      verdict: PASS
    rc-bugs:
      shared-bugs: []
      unique-source-bugs: []
      unique-target-bugs: []
      verdict: PASS
  reason: []
  source: libmoosex-types-path-class-perl
        "##;

        let excuses = super::from_str(data).expect("successful parsing of excuses");
        let sources = excuses.sources;
        assert_eq!(sources.len(), 2);

        let kalarm = &sources[0];
        assert!(kalarm.is_removal());

        let moosex = &sources[1];
        assert_eq!(moosex.source, "libmoosex-types-path-class-perl");
        assert!(moosex.is_candidate);
        assert_eq!(
            moosex
                .policy_info
                .as_ref()
                .unwrap()
                .age
                .as_ref()
                .unwrap()
                .verdict,
            Verdict::Pass
        );
    }
}