Issue.pm 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. # $OpenBSD: Issue.pm,v 1.4 2011/12/03 09:29:41 espie Exp $
  2. # Copyright (c) 2004-2010 Marc Espie <espie@openbsd.org>
  3. #
  4. # Permission to use, copy, modify, and distribute this software for any
  5. # purpose with or without fee is hereby granted, provided that the above
  6. # copyright notice and this permission notice appear in all copies.
  7. #
  8. # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  9. # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  10. # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  11. # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  13. # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  14. # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. use strict;
  16. use warnings;
  17. # part of check-lib-depends
  18. # Issue: intermediate objects that record problems with libraries
  19. package OpenBSD::Issue;
  20. sub new
  21. {
  22. my ($class, $lib, $binary, @packages) = @_;
  23. bless { lib => $lib, binary => $binary, packages => \@packages },
  24. $class;
  25. }
  26. sub stringize
  27. {
  28. my $self = shift;
  29. my $string = $self->{lib};
  30. if (@{$self->{packages}} > 0) {
  31. $string.=" from ".join(',', @{$self->{packages}});
  32. }
  33. return $string." ($self->{binary})";
  34. }
  35. sub do_record_wantlib
  36. {
  37. my ($self, $h) = @_;
  38. my $want = $self->{lib};
  39. $want =~ s/\.\d+$//;
  40. $h->{$want} = 1;
  41. }
  42. sub record_wantlib
  43. {
  44. }
  45. sub not_reachable
  46. {
  47. return 0;
  48. }
  49. sub print
  50. {
  51. my $self = shift;
  52. print $self->message, "\n";
  53. }
  54. package OpenBSD::Issue::SystemLib;
  55. our @ISA = qw(OpenBSD::Issue);
  56. sub message
  57. {
  58. my $self = shift;
  59. return "Missing: ". $self->stringize. " (system lib)";
  60. }
  61. sub record_wantlib
  62. {
  63. &OpenBSD::Issue::do_record_wantlib;
  64. }
  65. package OpenBSD::Issue::DirectDependency;
  66. our @ISA = qw(OpenBSD::Issue);
  67. sub message
  68. {
  69. my $self = shift;
  70. return "Missing: ". $self->stringize;
  71. }
  72. sub record_wantlib
  73. {
  74. &OpenBSD::Issue::do_record_wantlib;
  75. }
  76. package OpenBSD::Issue::IndirectDependency;
  77. our @ISA = qw(OpenBSD::Issue);
  78. sub message
  79. {
  80. my $self = shift;
  81. return "Missing: ". $self->stringize;
  82. }
  83. sub record_wantlib
  84. {
  85. &OpenBSD::Issue::do_record_wantlib;
  86. }
  87. package OpenBSD::Issue::NotReachable;
  88. our @ISA = qw(OpenBSD::Issue);
  89. sub message
  90. {
  91. my $self = shift;
  92. return "Missing lib: ". $self->stringize. " (NOT REACHABLE)";
  93. }
  94. sub not_reachable
  95. {
  96. my $self = shift;
  97. return "Bogus WANTLIB: ". $self->stringize. " (NOT REACHABLE)";
  98. }
  99. 1;