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
|
// Reconcile DEP-5 debian/copyright to licensecheck
//
// Copyright : 2024 P Blackman
// License : BSD-2-clause
//
// Test for false positive on licences; GFDL-NIV-1.3+ vs GFDL-1.3+
//
unit gfdl;
{$mode delphi}
interface
function CheckGFDL (Fname : AnsiString; Dep5, Actual : String) : Boolean;
implementation uses StrUtils, support;
function NoInvariant (Fname : AnsiString) : Boolean;
const MaxLines : Integer = 50;
var Lines : Integer;
Line : AnsiString;
Lfile : Text;
begin
result := False;
Lines := 0;
if OpenFile (FName, Lfile) then
begin
while not EOF (Lfile) and (Lines < MaxLines) do
begin
ReadLn (Lfile, Line);
if IsWordPresent ('Invariant', Line, WhiteSpace) then
begin
result := True;
Lines := MaxLines; // terminate loop
end;
end;
end;
end;
// Return true if Actual is a match for d/copyright
function CheckGFDL (Fname : AnsiString; Dep5, Actual : String) : Boolean;
const GN3 : String = 'GFDL-NIV-1.3+';
begin
result := False;
if (Dep5 = Actual) then
result := True
else
if (Dep5 = GN3 ) and (Actual = 'GFDL-1.3+') then
if NoInvariant (FName) then
result := True;
end;
end.
|