diff -Nru orthanc-wsi-0.5/debian/changelog orthanc-wsi-0.5/debian/changelog --- orthanc-wsi-0.5/debian/changelog 2018-04-27 12:23:59.000000000 +0000 +++ orthanc-wsi-0.5/debian/changelog 2019-01-26 00:12:46.000000000 +0000 @@ -1,3 +1,17 @@ +orthanc-wsi (0.5-2+rpi1) buster-staging; urgency=medium + + * Apply upstream patches for dcmtk 3.6.4 to the embedded orthanc. + - note: since the code in question is shipped in a tarball + that is unpacked by the upstream buildsystem we unpack the + tarball, apply the patches and repack it in debian/rules . + * Disable md5 check for orthanc tarball since it was broken + by above patch. + * Disable code to download orthanc tarball as a safety measure + given the removal of the md5 check. + * Fix clean target + + -- Peter Michael Green Sat, 26 Jan 2019 00:12:46 +0000 + orthanc-wsi (0.5-2) unstable; urgency=medium * Set -DNDEBUG to disable assertion checking diff -Nru orthanc-wsi-0.5/debian/patches/dcmtk-3.6.4-1.patch orthanc-wsi-0.5/debian/patches/dcmtk-3.6.4-1.patch --- orthanc-wsi-0.5/debian/patches/dcmtk-3.6.4-1.patch 1970-01-01 00:00:00.000000000 +0000 +++ orthanc-wsi-0.5/debian/patches/dcmtk-3.6.4-1.patch 2019-01-26 00:02:11.000000000 +0000 @@ -0,0 +1,78 @@ +# Note: this patch is applied in debian/rules not through quilt +# because it is a patch to code contained in a tarball. +# HG changeset patch +# User jodogne +# Date 1547398159 -3600 +# Node ID c8b75e207a82179a3f99a8bc60b43626f8f3c34b +# Parent 0e75026a2c02635bcc7b6904cbd463f142995105 +working on dcmtk 3.6.4 compatibility + +diff --git a/Core/DicomNetworking/DicomUserConnection.cpp b/Core/DicomNetworking/DicomUserConnection.cpp +--- a/Core/DicomNetworking/DicomUserConnection.cpp ++++ b/Core/DicomNetworking/DicomUserConnection.cpp +@@ -82,6 +82,10 @@ + #include "../PrecompiledHeaders.h" + #include "DicomUserConnection.h" + ++#if !defined(DCMTK_VERSION_NUMBER) ++# error The macro DCMTK_VERSION_NUMBER must be defined ++#endif ++ + #include "../DicomFormat/DicomArray.h" + #include "../Logging.h" + #include "../OrthancException.h" +@@ -330,7 +334,12 @@ + // Figure out which SOP class and SOP instance is encapsulated in the file + DIC_UI sopClass; + DIC_UI sopInstance; ++ ++#if DCMTK_VERSION_NUMBER >= 364 ++ if (!DU_findSOPClassAndInstanceInDataSet(dcmff.getDataset(), sopClass, sizeof(sopClass), sopInstance, sizeof(sopInstance))) ++#else + if (!DU_findSOPClassAndInstanceInDataSet(dcmff.getDataset(), sopClass, sopInstance)) ++#endif + { + throw OrthancException(ErrorCode_NoSopClassOrInstance); + } +@@ -572,7 +581,15 @@ + + T_DIMSE_C_FindRSP response; + DcmDataset* statusDetail = NULL; ++ ++#if DCMTK_VERSION_NUMBER >= 364 ++ int responseCount; ++#endif ++ + OFCondition cond = DIMSE_findUser(association, presID, &request, dataset, ++#if DCMTK_VERSION_NUMBER >= 364 ++ responseCount, ++#endif + FindCallback, &payload, + /*opt_blockMode*/ DIMSE_BLOCKING, + /*opt_dimse_timeout*/ dimseTimeout, +diff --git a/Core/DicomParsing/FromDcmtkBridge.cpp b/Core/DicomParsing/FromDcmtkBridge.cpp +--- a/Core/DicomParsing/FromDcmtkBridge.cpp ++++ b/Core/DicomParsing/FromDcmtkBridge.cpp +@@ -41,6 +41,10 @@ + # error The macro ORTHANC_SANDBOXED must be defined + #endif + ++#if !defined(DCMTK_VERSION_NUMBER) ++# error The macro DCMTK_VERSION_NUMBER must be defined ++#endif ++ + #include "FromDcmtkBridge.h" + #include "ToDcmtkBridge.h" + #include "../Logging.h" +@@ -165,7 +169,11 @@ + + ~DictionaryLocker() + { ++#if DCMTK_VERSION_NUMBER >= 364 ++ dcmDataDict.wrunlock(); ++#else + dcmDataDict.unlock(); ++#endif + } + + DcmDataDictionary& operator*() diff -Nru orthanc-wsi-0.5/debian/patches/dcmtk-3.6.4-2.patch orthanc-wsi-0.5/debian/patches/dcmtk-3.6.4-2.patch --- orthanc-wsi-0.5/debian/patches/dcmtk-3.6.4-2.patch 1970-01-01 00:00:00.000000000 +0000 +++ orthanc-wsi-0.5/debian/patches/dcmtk-3.6.4-2.patch 2019-01-26 00:09:35.000000000 +0000 @@ -0,0 +1,128 @@ +# Note: this patch is applied in debian/rules not through quilt +# because it is a patch to code contained in a tarball. +# This patch is based on the commit detailed below but with +# changes to the NEWs file stripped out. +# HG changeset patch +# User s.jodogne@gmail.com +# Date 1547407003 -3600 +# Node ID 8849677c2cbcf0b5ac990e838c72ace6453b059b +# Parent c8b75e207a82179a3f99a8bc60b43626f8f3c34b +compatibility with dcmtk 3.6.4 + +diff --git a/Core/DicomNetworking/Internals/CommandDispatcher.cpp b/Core/DicomNetworking/Internals/CommandDispatcher.cpp +--- a/Core/DicomNetworking/Internals/CommandDispatcher.cpp ++++ b/Core/DicomNetworking/Internals/CommandDispatcher.cpp +@@ -83,6 +83,10 @@ + #include "../../PrecompiledHeaders.h" + #include "CommandDispatcher.h" + ++#if !defined(DCMTK_VERSION_NUMBER) ++# error The macro DCMTK_VERSION_NUMBER must be defined ++#endif ++ + #include "FindScp.h" + #include "StoreScp.h" + #include "MoveScp.h" +@@ -364,7 +368,11 @@ + UID_RETIRED_UltrasoundImageStorage, + UID_RETIRED_UltrasoundMultiframeImageStorage, + UID_RETIRED_VLImageStorage, ++#if DCMTK_VERSION_NUMBER >= 364 ++ UID_RETIRED_VLMultiframeImageStorage, ++#else + UID_RETIRED_VLMultiFrameImageStorage, ++#endif + UID_RETIRED_XRayAngiographicBiPlaneImageStorage, + // draft + UID_DRAFT_SRAudioStorage, +@@ -469,8 +477,16 @@ + DIC_AE calledAet_C; + DIC_AE remoteIp_C; + DIC_AE calledIP_C; +- if (ASC_getAPTitles(assoc->params, remoteAet_C, calledAet_C, NULL).bad() || +- ASC_getPresentationAddresses(assoc->params, remoteIp_C, calledIP_C).bad()) ++ ++ if ( ++#if DCMTK_VERSION_NUMBER >= 364 ++ ASC_getAPTitles(assoc->params, remoteAet_C, sizeof(remoteAet_C), calledAet_C, sizeof(calledAet_C), NULL, 0).bad() || ++ ASC_getPresentationAddresses(assoc->params, remoteIp_C, sizeof(remoteIp_C), calledIP_C, sizeof(calledIP_C)).bad() ++#else ++ ASC_getAPTitles(assoc->params, remoteAet_C, calledAet_C, NULL).bad() || ++ ASC_getPresentationAddresses(assoc->params, remoteIp_C, calledIP_C).bad() ++#endif ++ ) + { + T_ASC_RejectParameters rej = + { +@@ -606,7 +622,12 @@ + ASC_setAPTitles(assoc->params, NULL, NULL, server.GetApplicationEntityTitle().c_str()); + + /* acknowledge or reject this association */ ++#if DCMTK_VERSION_NUMBER >= 364 ++ cond = ASC_getApplicationContextName(assoc->params, buf, sizeof(buf)); ++#else + cond = ASC_getApplicationContextName(assoc->params, buf); ++#endif ++ + if ((cond.bad()) || strcmp(buf, UID_StandardApplicationContext) != 0) + { + /* reject: the application context name is not supported */ +diff --git a/Core/DicomNetworking/Internals/StoreScp.cpp b/Core/DicomNetworking/Internals/StoreScp.cpp +--- a/Core/DicomNetworking/Internals/StoreScp.cpp ++++ b/Core/DicomNetworking/Internals/StoreScp.cpp +@@ -83,6 +83,10 @@ + #include "../../PrecompiledHeaders.h" + #include "StoreScp.h" + ++#if !defined(DCMTK_VERSION_NUMBER) ++# error The macro DCMTK_VERSION_NUMBER must be defined ++#endif ++ + #include "../../DicomParsing/FromDcmtkBridge.h" + #include "../../DicomParsing/ToDcmtkBridge.h" + #include "../../OrthancException.h" +@@ -188,10 +192,16 @@ + if (rsp->DimseStatus == STATUS_Success) + { + // which SOP class and SOP instance ? ++ ++#if DCMTK_VERSION_NUMBER >= 364 ++ if (!DU_findSOPClassAndInstanceInDataSet(*imageDataSet, sopClass, sizeof(sopClass), ++ sopInstance, sizeof(sopInstance), /*opt_correctUIDPadding*/ OFFalse)) ++#else + if (!DU_findSOPClassAndInstanceInDataSet(*imageDataSet, sopClass, sopInstance, /*opt_correctUIDPadding*/ OFFalse)) ++#endif + { +- //LOG4CPP_ERROR(Internals::GetLogger(), "bad DICOM file: " << fileName); +- rsp->DimseStatus = STATUS_STORE_Error_CannotUnderstand; ++ //LOG4CPP_ERROR(Internals::GetLogger(), "bad DICOM file: " << fileName); ++ rsp->DimseStatus = STATUS_STORE_Error_CannotUnderstand; + } + else if (strcmp(sopClass, req->AffectedSOPClassUID) != 0) + { +diff --git a/Plugins/Engine/OrthancPlugins.cpp b/Plugins/Engine/OrthancPlugins.cpp +--- a/Plugins/Engine/OrthancPlugins.cpp ++++ b/Plugins/Engine/OrthancPlugins.cpp +@@ -38,6 +38,10 @@ + #error The plugin support is disabled + #endif + ++#if !defined(DCMTK_VERSION_NUMBER) ++# error The macro DCMTK_VERSION_NUMBER must be defined ++#endif ++ + + #include "../../Core/ChunkedBuffer.h" + #include "../../Core/DicomFormat/DicomArray.h" +@@ -2416,7 +2420,11 @@ + + ~DictionaryReadLocker() + { ++#if DCMTK_VERSION_NUMBER >= 364 ++ dcmDataDict.rdunlock(); ++#else + dcmDataDict.unlock(); ++#endif + } + + const DcmDataDictionary* operator->() diff -Nru orthanc-wsi-0.5/debian/patches/disable-orthanc-md5-and-download.patch orthanc-wsi-0.5/debian/patches/disable-orthanc-md5-and-download.patch --- orthanc-wsi-0.5/debian/patches/disable-orthanc-md5-and-download.patch 1970-01-01 00:00:00.000000000 +0000 +++ orthanc-wsi-0.5/debian/patches/disable-orthanc-md5-and-download.patch 2019-01-26 00:12:46.000000000 +0000 @@ -0,0 +1,67 @@ +Description: + Disable md5 check for orthanc tarball since it was broke by out patching + for dcmtk-3.6 + . + Disable code to download orthanc tarball as a safety measure + given the removal of md5 check +Author: Peter Michael Green + +--- +The information above should follow the Patch Tagging Guidelines, please +checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here +are templates for supplementary fields that you might want to add: + +Origin: , +Bug: +Bug-Debian: https://bugs.debian.org/ +Bug-Ubuntu: https://launchpad.net/bugs/ +Forwarded: +Reviewed-By: +Last-Update: 2019-01-26 + +--- orthanc-wsi-0.5.orig/Resources/Orthanc/DownloadOrthancFramework.cmake ++++ orthanc-wsi-0.5/Resources/Orthanc/DownloadOrthancFramework.cmake +@@ -224,18 +224,18 @@ if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "w + set(ORTHANC_FRAMEWORK_ARCHIVE "${CMAKE_SOURCE_DIR}/ThirdPartyDownloads/${ORTHANC_FRAMEMORK_FILENAME}") + + if (NOT EXISTS "${ORTHANC_FRAMEWORK_ARCHIVE}") +- if (NOT STATIC_BUILD AND NOT ALLOW_DOWNLOADS) ++ #if (NOT STATIC_BUILD AND NOT ALLOW_DOWNLOADS) + message(FATAL_ERROR "CMake is not allowed to download from Internet. Please set the ALLOW_DOWNLOADS option to ON") +- endif() ++ #endif() + +- message("Downloading: ${ORTHANC_FRAMEWORK_URL}") ++ #message("Downloading: ${ORTHANC_FRAMEWORK_URL}") + +- file(DOWNLOAD +- "${ORTHANC_FRAMEWORK_URL}" "${ORTHANC_FRAMEWORK_ARCHIVE}" +- SHOW_PROGRESS EXPECTED_MD5 "${ORTHANC_FRAMEWORK_MD5}" +- TIMEOUT 60 +- INACTIVITY_TIMEOUT 60 +- ) ++ #file(DOWNLOAD ++ # "${ORTHANC_FRAMEWORK_URL}" "${ORTHANC_FRAMEWORK_ARCHIVE}" ++ # SHOW_PROGRESS EXPECTED_MD5 "${ORTHANC_FRAMEWORK_MD5}" ++ # TIMEOUT 60 ++ # INACTIVITY_TIMEOUT 60 ++ # ) + else() + message("Using local copy of: ${ORTHANC_FRAMEWORK_URL}") + endif() +@@ -262,11 +262,11 @@ if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "a + message(FATAL_ERROR "Unknown release of Orthanc: ${ORTHANC_FRAMEWORK_VERSION}") + endif() + +- file(MD5 ${ORTHANC_FRAMEWORK_ARCHIVE} ActualMD5) ++ #file(MD5 ${ORTHANC_FRAMEWORK_ARCHIVE} ActualMD5) + +- if (NOT "${ActualMD5}" STREQUAL "${ORTHANC_FRAMEWORK_MD5}") +- message(FATAL_ERROR "The MD5 hash of the Orthanc archive is invalid: ${ORTHANC_FRAMEWORK_ARCHIVE}") +- endif() ++ #if (NOT "${ActualMD5}" STREQUAL "${ORTHANC_FRAMEWORK_MD5}") ++ # message(FATAL_ERROR "The MD5 hash of the Orthanc archive is invalid: ${ORTHANC_FRAMEWORK_ARCHIVE}") ++ #endif() + + set(ORTHANC_ROOT "${CMAKE_BINARY_DIR}/Orthanc-${ORTHANC_FRAMEWORK_VERSION}") + diff -Nru orthanc-wsi-0.5/debian/patches/series orthanc-wsi-0.5/debian/patches/series --- orthanc-wsi-0.5/debian/patches/series 2018-04-27 12:17:51.000000000 +0000 +++ orthanc-wsi-0.5/debian/patches/series 2019-01-26 00:12:46.000000000 +0000 @@ -1 +1,2 @@ cmake +disable-orthanc-md5-and-download.patch diff -Nru orthanc-wsi-0.5/debian/rules orthanc-wsi-0.5/debian/rules --- orthanc-wsi-0.5/debian/rules 2018-04-27 12:23:59.000000000 +0000 +++ orthanc-wsi-0.5/debian/rules 2019-01-26 00:12:46.000000000 +0000 @@ -26,14 +26,22 @@ -DCMAKE_BUILD_TYPE=None # The build type must be set to None, see #711515 override_dh_auto_configure: + #patch Orthanc for dcmtk 3.6.4 + tar -zxf debian/ThirdPartyDownloads/Orthanc-1.3.2.tar.gz + cd Orthanc-1.3.2 && patch -p1 < ../debian/patches/dcmtk-3.6.4-1.patch + cd Orthanc-1.3.2 && patch -p1 < ../debian/patches/dcmtk-3.6.4-2.patch + mkdir -p debian/ThirdPartyDownloads/patched + tar -zcf debian/ThirdPartyDownloads/patched/Orthanc-1.3.2.tar.gz Orthanc-1.3.2 + rm -rf Orthanc-1.3.2 + # Put 3rd party packages where the cmake build system expects them mkdir -p Applications/ThirdPartyDownloads ( cd Applications/ThirdPartyDownloads && \ - ln -s ../../debian/ThirdPartyDownloads/Orthanc-1.3.2.tar.gz . ) + ln -s ../../debian/ThirdPartyDownloads/patched/Orthanc-1.3.2.tar.gz . ) mkdir -p ViewerPlugin/ThirdPartyDownloads ( cd ViewerPlugin/ThirdPartyDownloads && \ - ln -s ../../debian/ThirdPartyDownloads/Orthanc-1.3.2.tar.gz . ) + ln -s ../../debian/ThirdPartyDownloads/patched/Orthanc-1.3.2.tar.gz . ) # Configure the command-line tools mkdir BuildApplications @@ -63,6 +71,9 @@ --sourcedirectory=ViewerPlugin override_dh_clean: + rm -rf Orthanc-1.3.2 + rm -rf BuildApplications + rm -rf debian/ThirdPartyDownloads/patched rm -rf Applications/ThirdPartyDownloads/ rm -rf ViewerPlugin/ThirdPartyDownloads/