commit:     efbe52e8fcf98fc032df92e96e8f7d4c7c2f8a5e
Author:     Richard Freeman <rich0 <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 27 22:44:56 2018 +0000
Commit:     Richard Freeman <rich0 <AT> gentoo <DOT> org>
CommitDate: Sat Oct 27 22:45:10 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=efbe52e8

media-radio/cqrlog: backport libmysqlclient version check fix

Closes: https://bugs.gentoo.org/669712
Signed-off-by: Richard Freeman <rich0 <AT> gentoo.org>
Package-Manager: Portage-2.3.49, Repoman-2.3.11

 media-radio/cqrlog/cqrlog-2.3.0-r1.ebuild          |  41 +++++
 .../2.3.0-database-connection-refactoring.patch    | 197 +++++++++++++++++++++
 2 files changed, 238 insertions(+)

diff --git a/media-radio/cqrlog/cqrlog-2.3.0-r1.ebuild 
b/media-radio/cqrlog/cqrlog-2.3.0-r1.ebuild
new file mode 100644
index 00000000000..43d58b5490b
--- /dev/null
+++ b/media-radio/cqrlog/cqrlog-2.3.0-r1.ebuild
@@ -0,0 +1,41 @@
+# Copyright 1999-2018 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit eutils
+
+DESCRIPTION="CQRLOG is an advanced ham radio logger based on MySQL database."
+HOMEPAGE="https://www.cqrlog.com/";
+SRC_URI="https://github.com/ok2cqr/cqrlog/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+LICENSE="GPL-2"
+
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE=""
+
+DEPEND=">=dev-lang/lazarus-1.8.0
+               >=dev-lang/fpc-3.0.2"
+
+RDEPEND="${DEPEND}
+               virtual/mysql[server]
+               dev-libs/atk
+               dev-libs/glib
+               x11-libs/cairo
+               x11-libs/gdk-pixbuf
+               x11-libs/gtk+
+               x11-libs/libX11
+               x11-libs/pango"
+
+LazarusDir=/usr/share/lazarus/
+
+src_prepare() {
+       eapply_user
+       epatch "${FILESDIR}/${PV}-makefile.patch"
+       epatch "${FILESDIR}/${PV}-database-connection-refactoring.patch"
+}
+
+pkg_postist() {
+       elog "This package optionally supports media-libs/hablib"
+       elog "for monitoring radio settings."
+}

diff --git 
a/media-radio/cqrlog/files/2.3.0-database-connection-refactoring.patch 
b/media-radio/cqrlog/files/2.3.0-database-connection-refactoring.patch
new file mode 100644
index 00000000000..810bc5b5ba9
--- /dev/null
+++ b/media-radio/cqrlog/files/2.3.0-database-connection-refactoring.patch
@@ -0,0 +1,197 @@
+From b26102b097ef6353a20d18ccdaf7a3a6a30185c7 Mon Sep 17 00:00:00 2001
+From: ok2cqr <[email protected]>
+Date: Sat, 15 Sep 2018 07:12:30 +0200
+Subject: [PATCH] database connection refactoring
+
+---
+ src/dData.pas | 126 +++++++-------------------------------------------
+ 1 file changed, 17 insertions(+), 109 deletions(-)
+
+diff --git a/src/dData.pas b/src/dData.pas
+index 9d72d27..bb56598 100644
+--- a/src/dData.pas
++++ b/src/dData.pas
+@@ -162,7 +162,6 @@ type
+     function  FindLib(const Path,LibName : String) : String;
+     function  GetMysqldPath : String;
+     function  TableExists(TableName : String) : Boolean;
+-    function  GetMySQLLib : String;
+     function  GetDebugLevel : Integer;
+ 
+     procedure CreateDBConnections;
+@@ -267,6 +266,7 @@ type
+     function  RbnCallExistsInLog(callsign,band,mode,LastDate,LastTime : 
String) : Boolean;
+     function  CallNoteExists(Callsign : String) : Boolean;
+     function  GetNewLogNumber : Integer;
++    function  getNewMySQLConnectionObject : TMySQL57Connection;
+ 
+     procedure SaveQSO(date : TDateTime; time_on,time_off,call : String; freq 
: Currency;mode,rst_s,
+                       rst_r, stn_name,qth,qsl_s,qsl_r,qsl_via,iota,pwr : 
String; itu,waz : Integer;
+@@ -1092,49 +1092,6 @@ begin
+     Writeln('   ',DLLUtilName)
+   end;
+ 
+-  lib := GetMySQLLib;
+-  if fDebugLevel>=1 then Writeln('Loading libmysqlclient: ',lib);
+-  if lib <> '' then
+-    InitialiseMySQL(lib);
+-
+-  try try
+-    c := TConnectionName.Create(nil);
+-    MySQLVer := copy(c.ClientInfo,1,3);
+-
+-    if fDebugLevel>=1 then
+-    begin
+-      Writeln('**************************');
+-      Writeln('MySQL version: ',MySQLVer);
+-      Writeln('**************************')
+-    end;
+-
+-    if MySQLVer = '10.' then
+-      MySQLVer := '5.6';
+-    if MySQLVer = '10.1' then
+-      MySQLVer := '5.7'
+-
+-  except
+-    on E : Exception do
+-    begin
+-      Writeln('FATAL ERROR: Can not get MySQL client library version 
version!',LineEnding,
+-              'Setting to default version (5.1)');
+-      MySQLVer := '5.1'
+-    end
+-  end
+-  finally
+-    FreeAndNil(c)
+-  end;
+-
+-  if not TryStrToCurr(MySQLVer,fMySQLVersion) then
+-    fMySQLVersion := 5.6;
+-
+-  if fDebugLevel>=1 then
+-  begin
+-    Writeln('**********************************');
+-    Writeln('MySQL version assigned: ',FloatToStr(fMySQLVersion));
+-    Writeln('**********************************')
+-  end;
+-
+   CreateDBConnections;
+ 
+   MainCon.KeepConnection := True;
+@@ -1148,13 +1105,11 @@ begin
+   end;
+ 
+   //special connection for band map thread
+-  BandMapCon.KeepConnection := True;
+   BandMapCon.Transaction    := trBandMapFil;
+   qBandMapFil.Transaction   := trBandMapFil;
+   qBandMapFil.DataBase      := BandMapCon;
+   trBandMapFil.DataBase     := BandMapCon;
+ 
+-  RbnMonCon.KeepConnection := True;
+   RbnMonCon.Transaction    := trRbnMon;
+   qRbnMon.Transaction      := trRbnMon;
+   qRbnMon.DataBase         := RbnMonCon;
+@@ -1194,7 +1149,6 @@ begin
+     Writeln('ZIP code directory:     ',fZipCodeDir);
+     Writeln('Binary dir:             ',ExtractFilePath(Paramstr(0)));
+     Writeln('Share dir:              ',fShareDir);
+-    Writeln('TConnection to MySQL:   ',FloatToStr(fMySQLVersion));
+     Writeln('*')
+   end;
+ 
+@@ -4166,70 +4120,13 @@ end;
+ 
+ procedure TdmData.CreateDBConnections;
+ begin
+-  if fMySQLVersion < 5.5 then
+-  begin
+-    MainCon      := TMySQL51Connection.Create(self);
+-    BandMapCon   := TMySQL51Connection.Create(self);
+-    RbnMonCon    := TMySQL51Connection.Create(self);
+-    LogUploadCon := TMySQL51Connection.Create(self);
+-    dbDXC        := TMySQL51Connection.Create(self)
+-  end
+-  else  if fMySQLVersion < 5.6 then
+-  begin
+-    MainCon      := TMySQL55Connection.Create(self);
+-    BandMapCon   := TMySQL55Connection.Create(self);
+-    RbnMonCon    := TMySQL55Connection.Create(self);
+-    LogUploadCon := TMySQL55Connection.Create(self);
+-    dbDXC        := TMySQL55Connection.Create(self)
+-  end
+-  else begin
+-    if fMySQLVersion < 5.7 then
+-    begin
+-      MainCon      := TMySQL56Connection.Create(self);
+-      BandMapCon   := TMySQL56Connection.Create(self);
+-      RbnMonCon    := TMySQL56Connection.Create(self);
+-      LogUploadCon := TMySQL56Connection.Create(self);
+-      dbDXC        := TMySQL56Connection.Create(self)
+-    end
+-    else begin
+-      MainCon      := TMySQL57Connection.Create(self);
+-      BandMapCon   := TMySQL57Connection.Create(self);
+-      RbnMonCon    := TMySQL57Connection.Create(self);
+-      LogUploadCon := TMySQL57Connection.Create(self);
+-      dbDXC        := TMySQL57Connection.Create(self)
+-    end
+-  end
++  MainCon      := getNewMySQLConnectionObject();
++  BandMapCon   := getNewMySQLConnectionObject();
++  RbnMonCon    := getNewMySQLConnectionObject();
++  LogUploadCon := getNewMySQLConnectionObject();
++  dbDXC        := getNewMySQLConnectionObject();
+ end;
+ 
+-function TdmData.GetMySQLLib : String;
+-var
+-  lib : String;
+-  Paths : TStringList;
+-begin
+-  Result := '';
+-  Paths := TStringList.Create;
+-  try
+-    Paths.Add('/usr/lib64/');
+-    Paths.Add('/lib64/');
+-    Paths.Add('/usr/lib/x86_64-linux-gnu/');
+-    Paths.Add('/usr/lib64/mysql/');
+-    Paths.Add('/lib/x86_64-linux-gnu/');
+-
+-    Paths.Add('/usr/lib/i386-linux-gnu/');
+-    Paths.Add('/lib/i386-linux-gnu/');
+-    Paths.Add('/usr/lib/');
+-    Paths.Add('/lib/');
+-    Paths.Add('/usr/lib/mysql/');
+-
+-    Result := MyFindFile('libmariadbclient.so*', Paths);
+-    if (Result='') then
+-    begin
+-      Result := MyFindFile('libmysqlclient.so*', Paths)
+-    end
+-  finally
+-    FreeAndNil(Paths)
+-  end
+-end;
+ 
+ function TdmData.GetDebugLevel : Integer;
+ var
+@@ -4315,5 +4212,16 @@ begin
+     QSOColorDate := now
+ end;
+ 
++function TdmData.getNewMySQLConnectionObject : TMySQL57Connection;
++var
++  Connection : TMySQL57Connection;
++begin
++  Connection := TMySQL57Connection.Create(self);
++  Connection.SkipLibraryVersionCheck := True;
++  Connection.KeepConnection := True;
++
++  result := Connection
++end;
++
+ end.
+ 
+-- 
+2.18.1
+

Reply via email to