nixpkgs/pkgs/tools/backup/tsm-client/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

217 lines
7.3 KiB
Nix
Raw Normal View History

{ lib
, callPackage
, nixosTests
, stdenv
, fetchurl
, autoPatchelfHook
tsm-client: use rpm source instead of deb/Ubuntu IBM publishes their IBM Spectrum Protect client for Linux in two flavors: * "Linux x86_64 client" * "Linux x86_64 Ubuntu client" Up to this commit, nixpkgs used the Ubuntu flavor to build its `tsm-client` derivation. However, the history of published archive files in * https://public.dhe.ibm.com/storage/tivoli-storage-management/maintenance/client/v8r1/Linux/ * https://public.dhe.ibm.com/storage/tivoli-storage-management/patches/client/v8r1/Linux/ suggests that updates in the fourth level of the version numbers (e.g. 8.1.13.0 -> 8.1.13.1) do not get published as Ubuntu flavor. It order to be able to always use the latest release, this commit switches to the non-Ubuntu flavor. The non-Ubuntu archive contains rpm files, so this commit switches from `ar` to `rpmextract`. Instead of unpacking all deb files, the build recipe now unpacks all _but one_ rpm file: The file `TIVsm-WEBGUI.x86_64.rpm` apparently contains a plugin that is not included in the Ubuntu version (see note below). Comparing the old and the new derivation's output indicates that this choice minimizes the difference between the results: The output of the old (Ubuntu flavor) derivation contains: * `commons-codec-1.6.jar` * `share/` with changelog and copyright information for the packages `gskssl64` and `gskcrypt64` The output of the new (non-Ubuntu flavor) derivation contains: * `lib64`, symlink to `lib` * `commons-codec-1.14.jar` * `opt/tivoli/tsm/license/{api,baclient}/sm/` with license agreement files in many languages Besides these differences, the outputs' file names are equal. Note: I don't know what functionality `TIVsm-WEBGUI.x86_64.rpm` actually provides. Unpacking it with the other rpm files makes patchelf complain about missing X11 libraries, so in order to include it here, one would likely need to add those to `buildInputs`. However, as the old (Ubuntu flavor) `tsm-client` package did not contain this functionality and as I cannot test or use it in any way, I opted to not include it now. If we want to include this with a later commit, we should add another package build option (like `enableGui`) so that the default `tsm-client` package does not pull in X11 libraries and its closure size therefore stays small.
2021-12-18 12:49:54 +00:00
, rpmextract
tsm-client: 8.1.8.0 -> 8.1.13.0 tsm-client now links against openssl; patchelf complains without it. Links to IBM's "Authorized Program Analysis Report"s (something like release notes), to READMEs, and to Security Bulletins, for all updates between 8.1.8.0 and 8.1.13.0: * 8.1.9.x * APARs: https://www.ibm.com/support/pages/node/1077159 * READMEs: https://www.ibm.com/support/pages/node/1108473 * https://www.ibm.com/support/pages/node/1107261 (CVE-2018-2025) * https://www.ibm.com/support/pages/node/1107777 (CVE-2019-4406) * 8.1.10.x * APARs: https://www.ibm.com/support/pages/node/6223098 * READMEs: https://www.ibm.com/support/pages/node/6223388 * https://www.ibm.com/support/pages/node/6221448 (CVE-2020-4494, CVE-2020-4406) * https://www.ibm.com/support/pages/node/6245356 (CVE-2020-2654) * https://www.ibm.com/support/pages/node/6245366 (CVE-2015-4000) * 8.1.11.x * APARs: https://www.ibm.com/support/pages/node/6367203 * READMEs: https://www.ibm.com/support/pages/node/6367205 * https://www.ibm.com/support/pages/node/6371646 * https://www.ibm.com/support/pages/node/6371650 * https://www.ibm.com/support/pages/node/6371652 * 8.1.12.x * APARs: https://www.ibm.com/support/pages/node/6429561 * READMEs: https://www.ibm.com/support/pages/node/6443671 * https://www.ibm.com/support/pages/node/6445503 (CVE-2021-20532) * https://www.ibm.com/support/pages/node/6445497 (CVE-2021-29672, CVE-2021-20546) * https://www.ibm.com/support/pages/node/6445489 (CVE-2020-1971, CVE-2021-23840, CVE-2021-23841) * https://www.ibm.com/support/pages/node/6445483 (CVE-2020-27221, CVE-2020-14782) * 8.1.13.x * APARs: https://www.ibm.com/support/pages/node/6524936 * READMEs: https://www.ibm.com/support/pages/node/6524938 * https://www.ibm.com/support/pages/node/6524706 (CVE-2021-39048) * https://www.ibm.com/support/pages/node/6524712 (CVE-2021-3712, CVE-2021-3711)
2021-11-30 21:07:04 +00:00
, openssl
, zlib
, lvm2 # LVM image backup and restore functions (optional)
, acl # EXT2/EXT3/XFS ACL support (optional)
, gnugrep
, procps
, jdk8 # Java GUI (needed for `enableGui`)
, buildEnv
, makeWrapper
, enableGui ? false # enables Java GUI `dsmj`
# path to `dsm.sys` configuration files
, dsmSysCli ? "/etc/tsm-client/cli.dsm.sys"
, dsmSysApi ? "/etc/tsm-client/api.dsm.sys"
}:
# For an explanation of optional packages
# (features provided by them, version limits), see
# https://www.ibm.com/support/pages/node/660813#Version%208.1
# IBM Tivoli Storage Manager Client uses a system-wide
# client system-options file `dsm.sys` and expects it
# to be located in a directory within the package.
# Note that the command line client and the API use
# different "dms.sys" files (located in different directories).
# Since these files contain settings to be altered by the
# admin user (e.g. TSM server name), we create symlinks
# in place of the files that the client attempts to open.
# Use the arguments `dsmSysCli` and `dsmSysApi` to
# provide the location of the configuration files for
# the command-line interface and the API, respectively.
#
# While the command-line interface contains wrappers
# that help the executables find the configuration file,
# packages that link against the API have to
# set the environment variable `DSMI_DIR` to
# point to this derivations `/dsmi_dir` directory symlink.
# Other environment variables might be necessary,
# depending on local configuration or usage; see:
# https://www.ibm.com/docs/en/spectrum-protect/8.1.15?topic=solaris-set-api-environment-variables
# The newest version of TSM client should be discoverable by
tsm-client: use rpm source instead of deb/Ubuntu IBM publishes their IBM Spectrum Protect client for Linux in two flavors: * "Linux x86_64 client" * "Linux x86_64 Ubuntu client" Up to this commit, nixpkgs used the Ubuntu flavor to build its `tsm-client` derivation. However, the history of published archive files in * https://public.dhe.ibm.com/storage/tivoli-storage-management/maintenance/client/v8r1/Linux/ * https://public.dhe.ibm.com/storage/tivoli-storage-management/patches/client/v8r1/Linux/ suggests that updates in the fourth level of the version numbers (e.g. 8.1.13.0 -> 8.1.13.1) do not get published as Ubuntu flavor. It order to be able to always use the latest release, this commit switches to the non-Ubuntu flavor. The non-Ubuntu archive contains rpm files, so this commit switches from `ar` to `rpmextract`. Instead of unpacking all deb files, the build recipe now unpacks all _but one_ rpm file: The file `TIVsm-WEBGUI.x86_64.rpm` apparently contains a plugin that is not included in the Ubuntu version (see note below). Comparing the old and the new derivation's output indicates that this choice minimizes the difference between the results: The output of the old (Ubuntu flavor) derivation contains: * `commons-codec-1.6.jar` * `share/` with changelog and copyright information for the packages `gskssl64` and `gskcrypt64` The output of the new (non-Ubuntu flavor) derivation contains: * `lib64`, symlink to `lib` * `commons-codec-1.14.jar` * `opt/tivoli/tsm/license/{api,baclient}/sm/` with license agreement files in many languages Besides these differences, the outputs' file names are equal. Note: I don't know what functionality `TIVsm-WEBGUI.x86_64.rpm` actually provides. Unpacking it with the other rpm files makes patchelf complain about missing X11 libraries, so in order to include it here, one would likely need to add those to `buildInputs`. However, as the old (Ubuntu flavor) `tsm-client` package did not contain this functionality and as I cannot test or use it in any way, I opted to not include it now. If we want to include this with a later commit, we should add another package build option (like `enableGui`) so that the default `tsm-client` package does not pull in X11 libraries and its closure size therefore stays small.
2021-12-18 12:49:54 +00:00
# going to the `downloadPage` (see `meta` below).
# Find the "Backup-archive client" table on that page.
# Look for "Download Documents" of the latest release.
# Here, two links must be checked:
# * "IBM Spectrum Protect Client ... Downloads and READMEs":
# In the table at the page's bottom,
# check the date of the "Linux x86_64 client"
# * "IBM Spectrum Protect BA client ... interim fix downloads"
# Look for the "Linux x86_64 client" rows
2022-08-13 06:25:45 +00:00
# in the table at the bottom of each page.
tsm-client: use rpm source instead of deb/Ubuntu IBM publishes their IBM Spectrum Protect client for Linux in two flavors: * "Linux x86_64 client" * "Linux x86_64 Ubuntu client" Up to this commit, nixpkgs used the Ubuntu flavor to build its `tsm-client` derivation. However, the history of published archive files in * https://public.dhe.ibm.com/storage/tivoli-storage-management/maintenance/client/v8r1/Linux/ * https://public.dhe.ibm.com/storage/tivoli-storage-management/patches/client/v8r1/Linux/ suggests that updates in the fourth level of the version numbers (e.g. 8.1.13.0 -> 8.1.13.1) do not get published as Ubuntu flavor. It order to be able to always use the latest release, this commit switches to the non-Ubuntu flavor. The non-Ubuntu archive contains rpm files, so this commit switches from `ar` to `rpmextract`. Instead of unpacking all deb files, the build recipe now unpacks all _but one_ rpm file: The file `TIVsm-WEBGUI.x86_64.rpm` apparently contains a plugin that is not included in the Ubuntu version (see note below). Comparing the old and the new derivation's output indicates that this choice minimizes the difference between the results: The output of the old (Ubuntu flavor) derivation contains: * `commons-codec-1.6.jar` * `share/` with changelog and copyright information for the packages `gskssl64` and `gskcrypt64` The output of the new (non-Ubuntu flavor) derivation contains: * `lib64`, symlink to `lib` * `commons-codec-1.14.jar` * `opt/tivoli/tsm/license/{api,baclient}/sm/` with license agreement files in many languages Besides these differences, the outputs' file names are equal. Note: I don't know what functionality `TIVsm-WEBGUI.x86_64.rpm` actually provides. Unpacking it with the other rpm files makes patchelf complain about missing X11 libraries, so in order to include it here, one would likely need to add those to `buildInputs`. However, as the old (Ubuntu flavor) `tsm-client` package did not contain this functionality and as I cannot test or use it in any way, I opted to not include it now. If we want to include this with a later commit, we should add another package build option (like `enableGui`) so that the default `tsm-client` package does not pull in X11 libraries and its closure size therefore stays small.
2021-12-18 12:49:54 +00:00
# Follow the "HTTPS" link of the row with the latest date stamp.
# In the directory listing to show up, pick the big `.tar` file.
#
# (as of 2022-08-13)
let
meta = {
homepage = "https://www.ibm.com/products/data-protection-and-recovery";
downloadPage = "https://www.ibm.com/support/pages/ibm-spectrum-protect-downloads-latest-fix-packs-and-interim-fixes";
platforms = [ "x86_64-linux" ];
mainProgram = "dsmc";
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
license = lib.licenses.unfree;
maintainers = [ lib.maintainers.yarny ];
description = "IBM Spectrum Protect (Tivoli Storage Manager) CLI and API";
longDescription = ''
IBM Spectrum Protect (Tivoli Storage Manager) provides
a single point of control for backup and recovery.
This package contains the client software, that is,
a command line client and linkable libraries.
Note that the software requires a system-wide
client system-options file (commonly named "dsm.sys").
This package allows to use separate files for
the command-line interface and for the linkable API.
The location of those files can
be provided as build parameters.
'';
};
passthru.tests = {
test-cli = callPackage ./test-cli.nix {};
test-gui = nixosTests.tsm-client-gui;
};
mkSrcUrl = version:
let
major = lib.versions.major version;
minor = lib.versions.minor version;
patch = lib.versions.patch version;
tsm-client: use rpm source instead of deb/Ubuntu IBM publishes their IBM Spectrum Protect client for Linux in two flavors: * "Linux x86_64 client" * "Linux x86_64 Ubuntu client" Up to this commit, nixpkgs used the Ubuntu flavor to build its `tsm-client` derivation. However, the history of published archive files in * https://public.dhe.ibm.com/storage/tivoli-storage-management/maintenance/client/v8r1/Linux/ * https://public.dhe.ibm.com/storage/tivoli-storage-management/patches/client/v8r1/Linux/ suggests that updates in the fourth level of the version numbers (e.g. 8.1.13.0 -> 8.1.13.1) do not get published as Ubuntu flavor. It order to be able to always use the latest release, this commit switches to the non-Ubuntu flavor. The non-Ubuntu archive contains rpm files, so this commit switches from `ar` to `rpmextract`. Instead of unpacking all deb files, the build recipe now unpacks all _but one_ rpm file: The file `TIVsm-WEBGUI.x86_64.rpm` apparently contains a plugin that is not included in the Ubuntu version (see note below). Comparing the old and the new derivation's output indicates that this choice minimizes the difference between the results: The output of the old (Ubuntu flavor) derivation contains: * `commons-codec-1.6.jar` * `share/` with changelog and copyright information for the packages `gskssl64` and `gskcrypt64` The output of the new (non-Ubuntu flavor) derivation contains: * `lib64`, symlink to `lib` * `commons-codec-1.14.jar` * `opt/tivoli/tsm/license/{api,baclient}/sm/` with license agreement files in many languages Besides these differences, the outputs' file names are equal. Note: I don't know what functionality `TIVsm-WEBGUI.x86_64.rpm` actually provides. Unpacking it with the other rpm files makes patchelf complain about missing X11 libraries, so in order to include it here, one would likely need to add those to `buildInputs`. However, as the old (Ubuntu flavor) `tsm-client` package did not contain this functionality and as I cannot test or use it in any way, I opted to not include it now. If we want to include this with a later commit, we should add another package build option (like `enableGui`) so that the default `tsm-client` package does not pull in X11 libraries and its closure size therefore stays small.
2021-12-18 12:49:54 +00:00
fixup = lib.lists.elemAt (lib.versions.splitVersion version) 3;
in
tsm-client: use rpm source instead of deb/Ubuntu IBM publishes their IBM Spectrum Protect client for Linux in two flavors: * "Linux x86_64 client" * "Linux x86_64 Ubuntu client" Up to this commit, nixpkgs used the Ubuntu flavor to build its `tsm-client` derivation. However, the history of published archive files in * https://public.dhe.ibm.com/storage/tivoli-storage-management/maintenance/client/v8r1/Linux/ * https://public.dhe.ibm.com/storage/tivoli-storage-management/patches/client/v8r1/Linux/ suggests that updates in the fourth level of the version numbers (e.g. 8.1.13.0 -> 8.1.13.1) do not get published as Ubuntu flavor. It order to be able to always use the latest release, this commit switches to the non-Ubuntu flavor. The non-Ubuntu archive contains rpm files, so this commit switches from `ar` to `rpmextract`. Instead of unpacking all deb files, the build recipe now unpacks all _but one_ rpm file: The file `TIVsm-WEBGUI.x86_64.rpm` apparently contains a plugin that is not included in the Ubuntu version (see note below). Comparing the old and the new derivation's output indicates that this choice minimizes the difference between the results: The output of the old (Ubuntu flavor) derivation contains: * `commons-codec-1.6.jar` * `share/` with changelog and copyright information for the packages `gskssl64` and `gskcrypt64` The output of the new (non-Ubuntu flavor) derivation contains: * `lib64`, symlink to `lib` * `commons-codec-1.14.jar` * `opt/tivoli/tsm/license/{api,baclient}/sm/` with license agreement files in many languages Besides these differences, the outputs' file names are equal. Note: I don't know what functionality `TIVsm-WEBGUI.x86_64.rpm` actually provides. Unpacking it with the other rpm files makes patchelf complain about missing X11 libraries, so in order to include it here, one would likely need to add those to `buildInputs`. However, as the old (Ubuntu flavor) `tsm-client` package did not contain this functionality and as I cannot test or use it in any way, I opted to not include it now. If we want to include this with a later commit, we should add another package build option (like `enableGui`) so that the default `tsm-client` package does not pull in X11 libraries and its closure size therefore stays small.
2021-12-18 12:49:54 +00:00
"https://public.dhe.ibm.com/storage/tivoli-storage-management/${if fixup=="0" then "maintenance" else "patches"}/client/v${major}r${minor}/Linux/LinuxX86/BA/v${major}${minor}${patch}/${version}-TIV-TSMBAC-LinuxX86.tar";
unwrapped = stdenv.mkDerivation rec {
name = "tsm-client-${version}-unwrapped";
version = "8.1.15.1";
src = fetchurl {
url = mkSrcUrl version;
hash = "sha512-DURIMlWlmu+l2UT3bAMaFPlwO+UlrfgaYCsm/JonvvC0K0WallhNKFd7sp0amPkU+4QHE2fkFrTGE3/lY+fghQ==";
};
inherit meta passthru;
nativeBuildInputs = [
autoPatchelfHook
tsm-client: use rpm source instead of deb/Ubuntu IBM publishes their IBM Spectrum Protect client for Linux in two flavors: * "Linux x86_64 client" * "Linux x86_64 Ubuntu client" Up to this commit, nixpkgs used the Ubuntu flavor to build its `tsm-client` derivation. However, the history of published archive files in * https://public.dhe.ibm.com/storage/tivoli-storage-management/maintenance/client/v8r1/Linux/ * https://public.dhe.ibm.com/storage/tivoli-storage-management/patches/client/v8r1/Linux/ suggests that updates in the fourth level of the version numbers (e.g. 8.1.13.0 -> 8.1.13.1) do not get published as Ubuntu flavor. It order to be able to always use the latest release, this commit switches to the non-Ubuntu flavor. The non-Ubuntu archive contains rpm files, so this commit switches from `ar` to `rpmextract`. Instead of unpacking all deb files, the build recipe now unpacks all _but one_ rpm file: The file `TIVsm-WEBGUI.x86_64.rpm` apparently contains a plugin that is not included in the Ubuntu version (see note below). Comparing the old and the new derivation's output indicates that this choice minimizes the difference between the results: The output of the old (Ubuntu flavor) derivation contains: * `commons-codec-1.6.jar` * `share/` with changelog and copyright information for the packages `gskssl64` and `gskcrypt64` The output of the new (non-Ubuntu flavor) derivation contains: * `lib64`, symlink to `lib` * `commons-codec-1.14.jar` * `opt/tivoli/tsm/license/{api,baclient}/sm/` with license agreement files in many languages Besides these differences, the outputs' file names are equal. Note: I don't know what functionality `TIVsm-WEBGUI.x86_64.rpm` actually provides. Unpacking it with the other rpm files makes patchelf complain about missing X11 libraries, so in order to include it here, one would likely need to add those to `buildInputs`. However, as the old (Ubuntu flavor) `tsm-client` package did not contain this functionality and as I cannot test or use it in any way, I opted to not include it now. If we want to include this with a later commit, we should add another package build option (like `enableGui`) so that the default `tsm-client` package does not pull in X11 libraries and its closure size therefore stays small.
2021-12-18 12:49:54 +00:00
rpmextract
];
buildInputs = [
tsm-client: 8.1.8.0 -> 8.1.13.0 tsm-client now links against openssl; patchelf complains without it. Links to IBM's "Authorized Program Analysis Report"s (something like release notes), to READMEs, and to Security Bulletins, for all updates between 8.1.8.0 and 8.1.13.0: * 8.1.9.x * APARs: https://www.ibm.com/support/pages/node/1077159 * READMEs: https://www.ibm.com/support/pages/node/1108473 * https://www.ibm.com/support/pages/node/1107261 (CVE-2018-2025) * https://www.ibm.com/support/pages/node/1107777 (CVE-2019-4406) * 8.1.10.x * APARs: https://www.ibm.com/support/pages/node/6223098 * READMEs: https://www.ibm.com/support/pages/node/6223388 * https://www.ibm.com/support/pages/node/6221448 (CVE-2020-4494, CVE-2020-4406) * https://www.ibm.com/support/pages/node/6245356 (CVE-2020-2654) * https://www.ibm.com/support/pages/node/6245366 (CVE-2015-4000) * 8.1.11.x * APARs: https://www.ibm.com/support/pages/node/6367203 * READMEs: https://www.ibm.com/support/pages/node/6367205 * https://www.ibm.com/support/pages/node/6371646 * https://www.ibm.com/support/pages/node/6371650 * https://www.ibm.com/support/pages/node/6371652 * 8.1.12.x * APARs: https://www.ibm.com/support/pages/node/6429561 * READMEs: https://www.ibm.com/support/pages/node/6443671 * https://www.ibm.com/support/pages/node/6445503 (CVE-2021-20532) * https://www.ibm.com/support/pages/node/6445497 (CVE-2021-29672, CVE-2021-20546) * https://www.ibm.com/support/pages/node/6445489 (CVE-2020-1971, CVE-2021-23840, CVE-2021-23841) * https://www.ibm.com/support/pages/node/6445483 (CVE-2020-27221, CVE-2020-14782) * 8.1.13.x * APARs: https://www.ibm.com/support/pages/node/6524936 * READMEs: https://www.ibm.com/support/pages/node/6524938 * https://www.ibm.com/support/pages/node/6524706 (CVE-2021-39048) * https://www.ibm.com/support/pages/node/6524712 (CVE-2021-3712, CVE-2021-3711)
2021-11-30 21:07:04 +00:00
openssl
stdenv.cc.cc
zlib
];
runtimeDependencies = [
(lib.attrsets.getLib lvm2)
];
sourceRoot = ".";
postUnpack = ''
tsm-client: use rpm source instead of deb/Ubuntu IBM publishes their IBM Spectrum Protect client for Linux in two flavors: * "Linux x86_64 client" * "Linux x86_64 Ubuntu client" Up to this commit, nixpkgs used the Ubuntu flavor to build its `tsm-client` derivation. However, the history of published archive files in * https://public.dhe.ibm.com/storage/tivoli-storage-management/maintenance/client/v8r1/Linux/ * https://public.dhe.ibm.com/storage/tivoli-storage-management/patches/client/v8r1/Linux/ suggests that updates in the fourth level of the version numbers (e.g. 8.1.13.0 -> 8.1.13.1) do not get published as Ubuntu flavor. It order to be able to always use the latest release, this commit switches to the non-Ubuntu flavor. The non-Ubuntu archive contains rpm files, so this commit switches from `ar` to `rpmextract`. Instead of unpacking all deb files, the build recipe now unpacks all _but one_ rpm file: The file `TIVsm-WEBGUI.x86_64.rpm` apparently contains a plugin that is not included in the Ubuntu version (see note below). Comparing the old and the new derivation's output indicates that this choice minimizes the difference between the results: The output of the old (Ubuntu flavor) derivation contains: * `commons-codec-1.6.jar` * `share/` with changelog and copyright information for the packages `gskssl64` and `gskcrypt64` The output of the new (non-Ubuntu flavor) derivation contains: * `lib64`, symlink to `lib` * `commons-codec-1.14.jar` * `opt/tivoli/tsm/license/{api,baclient}/sm/` with license agreement files in many languages Besides these differences, the outputs' file names are equal. Note: I don't know what functionality `TIVsm-WEBGUI.x86_64.rpm` actually provides. Unpacking it with the other rpm files makes patchelf complain about missing X11 libraries, so in order to include it here, one would likely need to add those to `buildInputs`. However, as the old (Ubuntu flavor) `tsm-client` package did not contain this functionality and as I cannot test or use it in any way, I opted to not include it now. If we want to include this with a later commit, we should add another package build option (like `enableGui`) so that the default `tsm-client` package does not pull in X11 libraries and its closure size therefore stays small.
2021-12-18 12:49:54 +00:00
rpmextract TIVsm-API64.x86_64.rpm
rpmextract TIVsm-APIcit.x86_64.rpm
rpmextract TIVsm-BA.x86_64.rpm
rpmextract TIVsm-BAcit.x86_64.rpm
rpmextract TIVsm-BAhdw.x86_64.rpm
rpmextract TIVsm-JBB.x86_64.rpm
# use globbing so that version updates don't break the build:
rpmextract gskcrypt64-*.linux.x86_64.rpm
rpmextract gskssl64-*.linux.x86_64.rpm
'';
installPhase = ''
runHook preInstall
mkdir --parents $out
mv --target-directory=$out usr/* opt
runHook postInstall
'';
# Fix relative symlinks after `/usr` was moved up one level
preFixup = ''
tsm-client: use rpm source instead of deb/Ubuntu IBM publishes their IBM Spectrum Protect client for Linux in two flavors: * "Linux x86_64 client" * "Linux x86_64 Ubuntu client" Up to this commit, nixpkgs used the Ubuntu flavor to build its `tsm-client` derivation. However, the history of published archive files in * https://public.dhe.ibm.com/storage/tivoli-storage-management/maintenance/client/v8r1/Linux/ * https://public.dhe.ibm.com/storage/tivoli-storage-management/patches/client/v8r1/Linux/ suggests that updates in the fourth level of the version numbers (e.g. 8.1.13.0 -> 8.1.13.1) do not get published as Ubuntu flavor. It order to be able to always use the latest release, this commit switches to the non-Ubuntu flavor. The non-Ubuntu archive contains rpm files, so this commit switches from `ar` to `rpmextract`. Instead of unpacking all deb files, the build recipe now unpacks all _but one_ rpm file: The file `TIVsm-WEBGUI.x86_64.rpm` apparently contains a plugin that is not included in the Ubuntu version (see note below). Comparing the old and the new derivation's output indicates that this choice minimizes the difference between the results: The output of the old (Ubuntu flavor) derivation contains: * `commons-codec-1.6.jar` * `share/` with changelog and copyright information for the packages `gskssl64` and `gskcrypt64` The output of the new (non-Ubuntu flavor) derivation contains: * `lib64`, symlink to `lib` * `commons-codec-1.14.jar` * `opt/tivoli/tsm/license/{api,baclient}/sm/` with license agreement files in many languages Besides these differences, the outputs' file names are equal. Note: I don't know what functionality `TIVsm-WEBGUI.x86_64.rpm` actually provides. Unpacking it with the other rpm files makes patchelf complain about missing X11 libraries, so in order to include it here, one would likely need to add those to `buildInputs`. However, as the old (Ubuntu flavor) `tsm-client` package did not contain this functionality and as I cannot test or use it in any way, I opted to not include it now. If we want to include this with a later commit, we should add another package build option (like `enableGui`) so that the default `tsm-client` package does not pull in X11 libraries and its closure size therefore stays small.
2021-12-18 12:49:54 +00:00
for link in $out/lib{,64}/* $out/bin/*
do
target=$(readlink "$link")
if [ "$(cut -b -6 <<< "$target")" != "../../" ]
then
echo "cannot fix this symlink: $link -> $target"
exit 1
fi
ln --symbolic --force --no-target-directory "$out/$(cut -b 7- <<< "$target")" "$link"
done
'';
tsm-client: fix patching rpath with autoPatchelf Since commit https://github.com/NixOS/nixpkgs/commit/7b9fd5d1c9802131ca0a01ff08a3ff64379d2df4 tsm-client no longer produces working binaries (discovered with bisection). Instead, calling the command line client `dsmc` just produces the error > error while loading shared libraries: libtsmxerces-depdom.so.28: cannot open shared object file: No such file or directory Output of `ldd $out/dsmc` > linux-vdso.so.1 (0x00007ffd89f70000) > libgsk8ssl_64.so => /nix/store/i21g0x44g336ag8rkx0dgndb9v4w2xhk-tsm-client-8.1.13.3-unwrapped/local/ibm/gsk8_64/lib64/libgsk8ssl_64.so (0x0000791c8eb34000) > libgsk8iccs_64.so => /nix/store/i21g0x44g336ag8rkx0dgndb9v4w2xhk-tsm-client-8.1.13.3-unwrapped/local/ibm/gsk8_64/lib64/libgsk8iccs_64.so (0x0000791c8e9b7000) > libgsk8km_64.so => /nix/store/i21g0x44g336ag8rkx0dgndb9v4w2xhk-tsm-client-8.1.13.3-unwrapped/local/ibm/gsk8_64/lib64/libgsk8km_64.so (0x0000791c8e791000) > libxmlutil-8.1.13.0.so => /nix/store/i21g0x44g336ag8rkx0dgndb9v4w2xhk-tsm-client-8.1.13.3-unwrapped/opt/tivoli/tsm/client/api/bin64/libxmlutil-8.1.13.0.so (0x0000791c8e675000) > libcrypt.so.1 => /nix/store/qjgj2642srlbr59wwdihnn66sw97ming-glibc-2.33-123/lib/libcrypt.so.1 (0x0000791c8e639000) > libpthread.so.0 => /nix/store/qjgj2642srlbr59wwdihnn66sw97ming-glibc-2.33-123/lib/libpthread.so.0 (0x0000791c8e619000) > libdl.so.2 => /nix/store/qjgj2642srlbr59wwdihnn66sw97ming-glibc-2.33-123/lib/libdl.so.2 (0x0000791c8e614000) > libstdc++.so.6 => /nix/store/ndnqiz3nnifj1blhg9q626xlmkqq1nmh-gcc-10.3.0-lib/lib/libstdc++.so.6 (0x0000791c8e43f000) > libgpfs.so => /nix/store/i21g0x44g336ag8rkx0dgndb9v4w2xhk-tsm-client-8.1.13.3-unwrapped/opt/tivoli/tsm/client/api/bin64/libgpfs.so (0x0000791c8e22a000) > libdmapi.so => /nix/store/i21g0x44g336ag8rkx0dgndb9v4w2xhk-tsm-client-8.1.13.3-unwrapped/opt/tivoli/tsm/client/api/bin64/libdmapi.so (0x0000791c8e020000) > librt.so.1 => /nix/store/qjgj2642srlbr59wwdihnn66sw97ming-glibc-2.33-123/lib/librt.so.1 (0x0000791c8e015000) > libm.so.6 => /nix/store/qjgj2642srlbr59wwdihnn66sw97ming-glibc-2.33-123/lib/libm.so.6 (0x0000791c8ded4000) > libgcc_s.so.1 => /nix/store/ndnqiz3nnifj1blhg9q626xlmkqq1nmh-gcc-10.3.0-lib/lib/libgcc_s.so.1 (0x0000791c8deba000) > libc.so.6 => /nix/store/qjgj2642srlbr59wwdihnn66sw97ming-glibc-2.33-123/lib/libc.so.6 (0x0000791c8dce5000) > libgsk8cms_64.so => /nix/store/i21g0x44g336ag8rkx0dgndb9v4w2xhk-tsm-client-8.1.13.3-unwrapped/local/ibm/gsk8_64/lib64/libgsk8cms_64.so (0x0000791c8d78d000) > /nix/store/4s21k8k7p1mfik0b33r2spq5hq7774k1-glibc-2.33-108/lib/ld-linux-x86-64.so.2 => /nix/store/qjgj2642srlbr59wwdihnn66sw97ming-glibc-2.33-123/lib64/ld-linux-x86-64.so.2 (0x0000791c8f074000) > libtsmxerces-depdom.so.28 => not found > libtsmxerces-c.so.28 => not found Output of `ldd $out/lib/libtsmxerces-depdom.so.28` > linux-vdso.so.1 (0x00007fff69388000) > libpthread.so.0 => /nix/store/qjgj2642srlbr59wwdihnn66sw97ming-glibc-2.33-123/lib/libpthread.so.0 (0x000078f150454000) > libtsmxerces-c.so.28 => not found > libstdc++.so.6 => /nix/store/ndnqiz3nnifj1blhg9q626xlmkqq1nmh-gcc-10.3.0-lib/lib/libstdc++.so.6 (0x000078f15027f000) > libm.so.6 => /nix/store/qjgj2642srlbr59wwdihnn66sw97ming-glibc-2.33-123/lib/libm.so.6 (0x000078f15013e000) > libgcc_s.so.1 => /nix/store/ndnqiz3nnifj1blhg9q626xlmkqq1nmh-gcc-10.3.0-lib/lib/libgcc_s.so.1 (0x000078f150124000) > libc.so.6 => /nix/store/qjgj2642srlbr59wwdihnn66sw97ming-glibc-2.33-123/lib/libc.so.6 (0x000078f14ff4d000) > /nix/store/qjgj2642srlbr59wwdihnn66sw97ming-glibc-2.33-123/lib64/ld-linux-x86-64.so.2 (0x000078f150601000) The commit given above rewrote the `autoPatchelfHook`. The new hook still calls `patchelf` to actually modify binary files, but the discovery of shared libraries apparently got changed. Thorough investigation of all `patchelf` calls in the old and new autoPatchelfHook showed that all files are treated equally up the the files * $out/opt/tivoli/tsm/client/api/bin64/libtsmxerces-depdom.so.28.0 * $out/opt/tivoli/tsm/client/api/bin64/libxmlutil-8.1.13.0.so where the new autoPatchelf implementation replaced `$out/lib` with `$out/opt/tivoli/tsm/client/api/bin64` in the rpath. I failed to see *why* the new algorithm does that, or if that might be considered a bug. The `tsm-client` package has some confusing symlink structure which certainly might confuse `autoPatchelfHook`. The following ideas to "restore" the old behaviour of `autoPatchelfHook` failed to produce a working package: * add "$out" or "${placeholder "out"}" to `runtimeDependencies` * use `addAutoPatchelfSearchPath` with `$out/lib` or another so-file-containing directory The commit at hand fixes the issue by directly adding `$out/lib` to the rpath of all shared libraries in that directory. This has to be done *after* `autoPatchelf` got executed. To accomplish this, we disable auto-calling `autoPatchelf` (it would run after `postFixup`) and instead call it manually in `postFixup`, just before we patch the rpath by hand.
2022-05-10 18:19:39 +00:00
# since 7b9fd5d1c9802131ca0a01ff08a3ff64379d2df4
# autopatchelf misses to add $out/lib to rpath;
# we have to call autopatchelf manually as it would
# run too late and overwrite our rpath otherwise
dontAutoPatchelf = true;
postFixup = ''
autoPatchelf $out
patchelf --add-rpath $out/lib $out/lib/*
'';
};
binPath = lib.makeBinPath ([ acl gnugrep procps ]
++ lib.optional enableGui jdk8);
in
buildEnv {
name = "tsm-client-${unwrapped.version}";
meta = meta // lib.attrsets.optionalAttrs enableGui {
mainProgram = "dsmj";
};
passthru = passthru // { inherit unwrapped; };
paths = [ unwrapped ];
nativeBuildInputs = [ makeWrapper ];
pathsToLink = [
"/"
"/bin"
"/opt/tivoli/tsm/client/ba/bin"
"/opt/tivoli/tsm/client/api/bin64"
];
# * Provide top-level symlinks `dsm_dir` and `dsmi_dir`
# to the so-called "installation directories"
# * Add symlinks to the "installation directories"
# that point to the `dsm.sys` configuration files
# * Drop the Java GUI executable unless `enableGui` is set
# * Create wrappers for the command-line interface to
# prepare `PATH` and `DSM_DIR` environment variables
postBuild = ''
ln --symbolic --no-target-directory opt/tivoli/tsm/client/ba/bin $out/dsm_dir
ln --symbolic --no-target-directory opt/tivoli/tsm/client/api/bin64 $out/dsmi_dir
ln --symbolic --no-target-directory "${dsmSysCli}" $out/dsm_dir/dsm.sys
ln --symbolic --no-target-directory "${dsmSysApi}" $out/dsmi_dir/dsm.sys
${lib.optionalString (!enableGui) "rm $out/bin/dsmj"}
for bin in $out/bin/*
do
target=$(readlink "$bin")
rm "$bin"
makeWrapper "$target" "$bin" \
--prefix PATH : "$out/dsm_dir:${binPath}" \
--set DSM_DIR $out/dsm_dir
done
'';
}