mirror of
https://github.com/Prowlarr/Prowlarr
synced 2025-12-06 08:34:28 +01:00
New: .NET 5 support for FreeBSD 11+
(cherry picked from commit 760de88e7c1835affe184fed16bc3895ceca9358) (cherry picked from commit add271967f64b426fd0687c2c3209280e4a65754)
This commit is contained in:
parent
42403ac1c3
commit
f27e9f73a9
14 changed files with 209 additions and 19 deletions
|
|
@ -82,7 +82,18 @@ stages:
|
||||||
displayName: 'Install .net core'
|
displayName: 'Install .net core'
|
||||||
inputs:
|
inputs:
|
||||||
version: $(dotnetVersion)
|
version: $(dotnetVersion)
|
||||||
- bash: ./build.sh --backend
|
- bash: |
|
||||||
|
BUNDLEDVERSIONS=${AGENT_TOOLSDIRECTORY}/dotnet/sdk/${DOTNETVERSION}/Microsoft.NETCoreSdk.BundledVersions.props
|
||||||
|
echo $BUNDLEDVERSIONS
|
||||||
|
grep osx-x64 $BUNDLEDVERSIONS
|
||||||
|
if grep -q freebsd-x64 $BUNDLEDVERSIONS; then
|
||||||
|
echo "BSD already enabled"
|
||||||
|
else
|
||||||
|
echo "Enabling BSD support"
|
||||||
|
sed -i.ORI 's/osx-x64/osx-x64;freebsd-x64/' $BUNDLEDVERSIONS
|
||||||
|
fi
|
||||||
|
displayName: Enable FreeBSD Support
|
||||||
|
- bash: ./build.sh --backend --enable-bsd
|
||||||
displayName: Build Prowlarr Backend
|
displayName: Build Prowlarr Backend
|
||||||
- bash: |
|
- bash: |
|
||||||
find ${OUTPUTFOLDER} -type f ! -path "*/publish/*" -exec rm -rf {} \;
|
find ${OUTPUTFOLDER} -type f ! -path "*/publish/*" -exec rm -rf {} \;
|
||||||
|
|
@ -107,6 +118,10 @@ stages:
|
||||||
artifact: LinuxMuslCoreTests
|
artifact: LinuxMuslCoreTests
|
||||||
displayName: Publish Linux Musl Test Package
|
displayName: Publish Linux Musl Test Package
|
||||||
condition: and(succeeded(), eq(variables['osName'], 'Windows'))
|
condition: and(succeeded(), eq(variables['osName'], 'Windows'))
|
||||||
|
- publish: '$(testsFolder)/net5.0/freebsd-x64/publish'
|
||||||
|
artifact: FreebsdCoreTests
|
||||||
|
displayName: Publish FreeBSD Test Package
|
||||||
|
condition: and(succeeded(), eq(variables['osName'], 'Windows'))
|
||||||
- publish: '$(testsFolder)/net5.0/osx-x64/publish'
|
- publish: '$(testsFolder)/net5.0/osx-x64/publish'
|
||||||
artifact: MacCoreTests
|
artifact: MacCoreTests
|
||||||
displayName: Publish MacOS Test Package
|
displayName: Publish MacOS Test Package
|
||||||
|
|
@ -218,7 +233,7 @@ stages:
|
||||||
artifactName: WindowsFrontend
|
artifactName: WindowsFrontend
|
||||||
targetPath: _output
|
targetPath: _output
|
||||||
displayName: Fetch Frontend
|
displayName: Fetch Frontend
|
||||||
- bash: ./build.sh --packages
|
- bash: ./build.sh --packages --enable-bsd
|
||||||
displayName: Create Packages
|
displayName: Create Packages
|
||||||
- bash: |
|
- bash: |
|
||||||
find . -name "Prowlarr" -exec chmod a+x {} \;
|
find . -name "Prowlarr" -exec chmod a+x {} \;
|
||||||
|
|
@ -293,6 +308,14 @@ stages:
|
||||||
tarCompression: 'gz'
|
tarCompression: 'gz'
|
||||||
includeRootFolder: false
|
includeRootFolder: false
|
||||||
rootFolderOrFile: $(artifactsFolder)/linux-musl-arm64/net5.0
|
rootFolderOrFile: $(artifactsFolder)/linux-musl-arm64/net5.0
|
||||||
|
- task: ArchiveFiles@2
|
||||||
|
displayName: Create FreeBSD Core Core tar
|
||||||
|
inputs:
|
||||||
|
archiveFile: '$(Build.ArtifactStagingDirectory)/Prowlarr.$(buildName).freebsd-core-x64.tar.gz'
|
||||||
|
archiveType: 'tar'
|
||||||
|
tarCompression: 'gz'
|
||||||
|
includeRootFolder: false
|
||||||
|
rootFolderOrFile: $(artifactsFolder)/freebsd-x64/net5.0
|
||||||
- publish: $(Build.ArtifactStagingDirectory)
|
- publish: $(Build.ArtifactStagingDirectory)
|
||||||
artifact: 'Packages'
|
artifact: 'Packages'
|
||||||
displayName: Publish Packages
|
displayName: Publish Packages
|
||||||
|
|
@ -346,24 +369,34 @@ stages:
|
||||||
displayName: Unit Native
|
displayName: Unit Native
|
||||||
dependsOn: Prepare
|
dependsOn: Prepare
|
||||||
condition: and(succeeded(), eq(dependencies.Prepare.outputs['setVar.backendNotUpdated'], '0'))
|
condition: and(succeeded(), eq(dependencies.Prepare.outputs['setVar.backendNotUpdated'], '0'))
|
||||||
|
workspace:
|
||||||
|
clean: all
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
MacCore:
|
MacCore:
|
||||||
osName: 'Mac'
|
osName: 'Mac'
|
||||||
testName: 'MacCore'
|
testName: 'MacCore'
|
||||||
|
poolName: 'Azure Pipelines'
|
||||||
imageName: 'macos-10.14'
|
imageName: 'macos-10.14'
|
||||||
WindowsCore:
|
WindowsCore:
|
||||||
osName: 'Windows'
|
osName: 'Windows'
|
||||||
testName: 'WindowsCore'
|
testName: 'WindowsCore'
|
||||||
|
poolName: 'Azure Pipelines'
|
||||||
imageName: 'windows-2019'
|
imageName: 'windows-2019'
|
||||||
LinuxCore:
|
LinuxCore:
|
||||||
osName: 'Linux'
|
osName: 'Linux'
|
||||||
testName: 'LinuxCore'
|
testName: 'LinuxCore'
|
||||||
|
poolName: 'Azure Pipelines'
|
||||||
imageName: 'ubuntu-18.04'
|
imageName: 'ubuntu-18.04'
|
||||||
pattern: 'Prowlarr.**.linux-core-x64.tar.gz'
|
FreebsdCore:
|
||||||
|
osName: 'Linux'
|
||||||
|
testName: 'FreebsdCore'
|
||||||
|
poolName: 'FreeBSD'
|
||||||
|
imageName:
|
||||||
|
|
||||||
pool:
|
pool:
|
||||||
|
name: $(poolName)
|
||||||
vmImage: $(imageName)
|
vmImage: $(imageName)
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
@ -372,6 +405,7 @@ stages:
|
||||||
displayName: 'Install .net core'
|
displayName: 'Install .net core'
|
||||||
inputs:
|
inputs:
|
||||||
version: $(dotnetVersion)
|
version: $(dotnetVersion)
|
||||||
|
condition: ne(variables['poolName'], 'FreeBSD')
|
||||||
- task: DownloadPipelineArtifact@2
|
- task: DownloadPipelineArtifact@2
|
||||||
displayName: Download Test Artifact
|
displayName: Download Test Artifact
|
||||||
inputs:
|
inputs:
|
||||||
|
|
@ -472,17 +506,17 @@ stages:
|
||||||
osName: 'Mac'
|
osName: 'Mac'
|
||||||
testName: 'MacCore'
|
testName: 'MacCore'
|
||||||
imageName: 'macos-10.14'
|
imageName: 'macos-10.14'
|
||||||
pattern: 'Prowlarr.**.osx-core-x64.tar.gz'
|
pattern: 'Prowlarr.*.osx-core-x64.tar.gz'
|
||||||
WindowsCore:
|
WindowsCore:
|
||||||
osName: 'Windows'
|
osName: 'Windows'
|
||||||
testName: 'WindowsCore'
|
testName: 'WindowsCore'
|
||||||
imageName: 'windows-2019'
|
imageName: 'windows-2019'
|
||||||
pattern: 'Prowlarr.**.windows-core-x64.zip'
|
pattern: 'Prowlarr.*.windows-core-x64.zip'
|
||||||
LinuxCore:
|
LinuxCore:
|
||||||
osName: 'Linux'
|
osName: 'Linux'
|
||||||
testName: 'LinuxCore'
|
testName: 'LinuxCore'
|
||||||
imageName: 'ubuntu-18.04'
|
imageName: 'ubuntu-18.04'
|
||||||
pattern: 'Prowlarr.**.linux-core-x64.tar.gz'
|
pattern: 'Prowlarr.*.linux-core-x64.tar.gz'
|
||||||
|
|
||||||
pool:
|
pool:
|
||||||
vmImage: $(imageName)
|
vmImage: $(imageName)
|
||||||
|
|
@ -527,6 +561,52 @@ stages:
|
||||||
failTaskOnFailedTests: true
|
failTaskOnFailedTests: true
|
||||||
displayName: Publish Test Results
|
displayName: Publish Test Results
|
||||||
|
|
||||||
|
- job: Integration_FreeBSD
|
||||||
|
displayName: Integration Native FreeBSD
|
||||||
|
dependsOn: Prepare
|
||||||
|
condition: and(succeeded(), eq(dependencies.Prepare.outputs['setVar.backendNotUpdated'], '0'))
|
||||||
|
workspace:
|
||||||
|
clean: all
|
||||||
|
variables:
|
||||||
|
pattern: 'Prowlarr.*.freebsd-core-x64.tar.gz'
|
||||||
|
pool:
|
||||||
|
name: 'FreeBSD'
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- checkout: none
|
||||||
|
- task: DownloadPipelineArtifact@2
|
||||||
|
displayName: Download Test Artifact
|
||||||
|
inputs:
|
||||||
|
buildType: 'current'
|
||||||
|
artifactName: 'FreebsdCoreTests'
|
||||||
|
targetPath: $(testsFolder)
|
||||||
|
- task: DownloadPipelineArtifact@2
|
||||||
|
displayName: Download Build Artifact
|
||||||
|
inputs:
|
||||||
|
buildType: 'current'
|
||||||
|
artifactName: Packages
|
||||||
|
itemPattern: '/$(pattern)'
|
||||||
|
targetPath: $(Build.ArtifactStagingDirectory)
|
||||||
|
- bash: |
|
||||||
|
mkdir -p ${BUILD_ARTIFACTSTAGINGDIRECTORY}/bin
|
||||||
|
tar xf ${BUILD_ARTIFACTSTAGINGDIRECTORY}/$(pattern) -C ${BUILD_ARTIFACTSTAGINGDIRECTORY}/bin
|
||||||
|
displayName: Extract Package
|
||||||
|
- bash: |
|
||||||
|
mkdir -p ./bin/
|
||||||
|
cp -r -v ${BUILD_ARTIFACTSTAGINGDIRECTORY}/bin/Prowlarr/. ./bin/
|
||||||
|
displayName: Move Package Contents
|
||||||
|
- bash: |
|
||||||
|
chmod a+x ${TESTSFOLDER}/test.sh
|
||||||
|
${TESTSFOLDER}/test.sh Linux Integration Test
|
||||||
|
displayName: Run Integration Tests
|
||||||
|
- task: PublishTestResults@2
|
||||||
|
inputs:
|
||||||
|
testResultsFormat: 'NUnit'
|
||||||
|
testResultsFiles: '**/TestResult.xml'
|
||||||
|
testRunTitle: 'FreeBSD Integration Tests'
|
||||||
|
failTaskOnFailedTests: true
|
||||||
|
displayName: Publish Test Results
|
||||||
|
|
||||||
- job: Integration_Docker
|
- job: Integration_Docker
|
||||||
displayName: Integration Docker
|
displayName: Integration Docker
|
||||||
dependsOn: Prepare
|
dependsOn: Prepare
|
||||||
|
|
@ -537,7 +617,8 @@ stages:
|
||||||
testName: 'Musl Net Core'
|
testName: 'Musl Net Core'
|
||||||
artifactName: LinuxMuslCoreTests
|
artifactName: LinuxMuslCoreTests
|
||||||
containerImage: ghcr.io/servarr/testimages:alpine
|
containerImage: ghcr.io/servarr/testimages:alpine
|
||||||
pattern: 'Prowlarr.**.linux-musl-core-x64.tar.gz'
|
pattern: 'Prowlarr.*.linux-musl-core-x64.tar.gz'
|
||||||
|
|
||||||
pool:
|
pool:
|
||||||
vmImage: 'ubuntu-18.04'
|
vmImage: 'ubuntu-18.04'
|
||||||
|
|
||||||
|
|
@ -596,17 +677,17 @@ stages:
|
||||||
Linux:
|
Linux:
|
||||||
osName: 'Linux'
|
osName: 'Linux'
|
||||||
imageName: 'ubuntu-18.04'
|
imageName: 'ubuntu-18.04'
|
||||||
pattern: 'Prowlarr.**.linux-core-x64.tar.gz'
|
pattern: 'Prowlarr.*.linux-core-x64.tar.gz'
|
||||||
failBuild: false
|
failBuild: false
|
||||||
Mac:
|
Mac:
|
||||||
osName: 'Mac'
|
osName: 'Mac'
|
||||||
imageName: 'macos-10.14'
|
imageName: 'macos-10.14'
|
||||||
pattern: 'Prowlarr.**.osx-core-x64.tar.gz'
|
pattern: 'Prowlarr.*.osx-core-x64.tar.gz'
|
||||||
failBuild: false
|
failBuild: false
|
||||||
Windows:
|
Windows:
|
||||||
osName: 'Windows'
|
osName: 'Windows'
|
||||||
imageName: 'windows-2019'
|
imageName: 'windows-2019'
|
||||||
pattern: 'Prowlarr.**.windows-core-x64.zip'
|
pattern: 'Prowlarr.*.windows-core-x64.zip'
|
||||||
failBuild: false
|
failBuild: false
|
||||||
|
|
||||||
pool:
|
pool:
|
||||||
|
|
|
||||||
33
build.sh
33
build.sh
|
|
@ -1,4 +1,4 @@
|
||||||
#! /bin/bash
|
#! /usr/bin/env bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
outputFolder='_output'
|
outputFolder='_output'
|
||||||
|
|
@ -25,6 +25,18 @@ UpdateVersionNumber()
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EnableBsdSupport()
|
||||||
|
{
|
||||||
|
#todo enable sdk with
|
||||||
|
#SDK_PATH=$(dotnet --list-sdks | grep -P '5\.\d\.\d+' | head -1 | sed 's/\(5\.[0-9]*\.[0-9]*\).*\[\(.*\)\]/\2\/\1/g')
|
||||||
|
# BUNDLED_VERSIONS="${SDK_PATH}/Microsoft.NETCoreSdk.BundledVersions.props"
|
||||||
|
|
||||||
|
if grep -qv freebsd-x64 src/Directory.Build.props; then
|
||||||
|
sed -i'' -e "s^<RuntimeIdentifiers>\(.*\)</RuntimeIdentifiers>^<RuntimeIdentifiers>\1;freebsd-x64</RuntimeIdentifiers>^g" src/Directory.Build.props
|
||||||
|
sed -i'' -e "s^<ExcludedRuntimeFrameworkPairs>\(.*\)</ExcludedRuntimeFrameworkPairs>^<ExcludedRuntimeFrameworkPairs>\1;freebsd-x64:net472</ExcludedRuntimeFrameworkPairs>^g" src/Directory.Build.props
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
LintUI()
|
LintUI()
|
||||||
{
|
{
|
||||||
ProgressStart 'ESLint'
|
ProgressStart 'ESLint'
|
||||||
|
|
@ -207,7 +219,7 @@ Package()
|
||||||
IFS='-' read -ra SPLIT <<< "$runtime"
|
IFS='-' read -ra SPLIT <<< "$runtime"
|
||||||
|
|
||||||
case "${SPLIT[0]}" in
|
case "${SPLIT[0]}" in
|
||||||
linux)
|
linux|freebsd*)
|
||||||
PackageLinux "$framework" "$runtime"
|
PackageLinux "$framework" "$runtime"
|
||||||
;;
|
;;
|
||||||
win)
|
win)
|
||||||
|
|
@ -252,6 +264,7 @@ if [ $# -eq 0 ]; then
|
||||||
FRONTEND=YES
|
FRONTEND=YES
|
||||||
PACKAGES=YES
|
PACKAGES=YES
|
||||||
LINT=YES
|
LINT=YES
|
||||||
|
ENABLE_BSD=NO
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while [[ $# -gt 0 ]]
|
while [[ $# -gt 0 ]]
|
||||||
|
|
@ -263,6 +276,10 @@ case $key in
|
||||||
BACKEND=YES
|
BACKEND=YES
|
||||||
shift # past argument
|
shift # past argument
|
||||||
;;
|
;;
|
||||||
|
--enable-bsd)
|
||||||
|
ENABLE_BSD=YES
|
||||||
|
shift # past argument
|
||||||
|
;;
|
||||||
-r|--runtime)
|
-r|--runtime)
|
||||||
RID="$2"
|
RID="$2"
|
||||||
shift # past argument
|
shift # past argument
|
||||||
|
|
@ -303,6 +320,10 @@ set -- "${POSITIONAL[@]}" # restore positional parameters
|
||||||
if [ "$BACKEND" = "YES" ];
|
if [ "$BACKEND" = "YES" ];
|
||||||
then
|
then
|
||||||
UpdateVersionNumber
|
UpdateVersionNumber
|
||||||
|
if [ "$ENABLE_BSD" = "YES" ];
|
||||||
|
then
|
||||||
|
EnableBsdSupport
|
||||||
|
fi
|
||||||
Build
|
Build
|
||||||
if [[ -z "$RID" || -z "$FRAMEWORK" ]];
|
if [[ -z "$RID" || -z "$FRAMEWORK" ]];
|
||||||
then
|
then
|
||||||
|
|
@ -311,6 +332,10 @@ then
|
||||||
PackageTests "net5.0" "linux-x64"
|
PackageTests "net5.0" "linux-x64"
|
||||||
PackageTests "net5.0" "linux-musl-x64"
|
PackageTests "net5.0" "linux-musl-x64"
|
||||||
PackageTests "net5.0" "osx-x64"
|
PackageTests "net5.0" "osx-x64"
|
||||||
|
if [ "$ENABLE_BSD" = "YES" ];
|
||||||
|
then
|
||||||
|
PackageTests "net5.0" "freebsd-x64"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
PackageTests "$FRAMEWORK" "$RID"
|
PackageTests "$FRAMEWORK" "$RID"
|
||||||
fi
|
fi
|
||||||
|
|
@ -346,6 +371,10 @@ then
|
||||||
Package "net5.0" "linux-musl-arm64"
|
Package "net5.0" "linux-musl-arm64"
|
||||||
Package "net5.0" "linux-arm"
|
Package "net5.0" "linux-arm"
|
||||||
Package "net5.0" "osx-x64"
|
Package "net5.0" "osx-x64"
|
||||||
|
if [ "$ENABLE_BSD" = "YES" ];
|
||||||
|
then
|
||||||
|
Package "net5.0" "freebsd-x64"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
Package "$FRAMEWORK" "$RID"
|
Package "$FRAMEWORK" "$RID"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,11 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<configuration>
|
<configuration>
|
||||||
<packageSources>
|
<packageSources>
|
||||||
|
<clear />
|
||||||
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
|
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
|
||||||
<add key="MyFeed" value="https://pkgs.dev.azure.com/Servarr/Servarr/_packaging/SQLite/nuget/v3/index.json" />
|
|
||||||
<add key="FluentMigrator" value="https://pkgs.dev.azure.com/fluentmigrator/fluentmigrator/_packaging/fluentmigrator/nuget/v3/index.json" />
|
<add key="FluentMigrator" value="https://pkgs.dev.azure.com/fluentmigrator/fluentmigrator/_packaging/fluentmigrator/nuget/v3/index.json" />
|
||||||
|
<add key="dotnet-bsd-crossbuild" value="https://pkgs.dev.azure.com/Servarr/Servarr/_packaging/dotnet-bsd-crossbuild/nuget/v3/index.json" />
|
||||||
|
<add key="Mono.Posix.NETStandard" value="https://pkgs.dev.azure.com/Servarr/Servarr/_packaging/Mono.Posix.NETStandard/nuget/v3/index.json" />
|
||||||
|
<add key="SQLite" value="https://pkgs.dev.azure.com/Servarr/Servarr/_packaging/SQLite/nuget/v3/index.json" />
|
||||||
</packageSources>
|
</packageSources>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,6 @@ public void no_update_when_version_higher()
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
[Ignore("TODO No Updates On Server")]
|
[Ignore("TODO No Updates On Server")]
|
||||||
[Platform(Exclude = "NetCore")]
|
|
||||||
public void finds_update_when_version_lower()
|
public void finds_update_when_version_lower()
|
||||||
{
|
{
|
||||||
UseRealHttp();
|
UseRealHttp();
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
using Moq;
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Common.Disk;
|
using NzbDrone.Common.Disk;
|
||||||
|
using NzbDrone.Common.EnvironmentInfo;
|
||||||
using NzbDrone.Common.Test.DiskTests;
|
using NzbDrone.Common.Test.DiskTests;
|
||||||
using NzbDrone.Mono.Disk;
|
using NzbDrone.Mono.Disk;
|
||||||
|
|
||||||
|
|
@ -178,10 +179,14 @@ public void should_set_file_permissions()
|
||||||
Syscall.stat(tempFile, out fileStat);
|
Syscall.stat(tempFile, out fileStat);
|
||||||
NativeConvert.ToOctalPermissionString(fileStat.st_mode).Should().Be("0644");
|
NativeConvert.ToOctalPermissionString(fileStat.st_mode).Should().Be("0644");
|
||||||
|
|
||||||
|
if (OsInfo.Os != Os.Bsd)
|
||||||
|
{
|
||||||
|
// This is not allowed on BSD
|
||||||
Subject.SetPermissions(tempFile, "1664");
|
Subject.SetPermissions(tempFile, "1664");
|
||||||
Syscall.stat(tempFile, out fileStat);
|
Syscall.stat(tempFile, out fileStat);
|
||||||
NativeConvert.ToOctalPermissionString(fileStat.st_mode).Should().Be("1664");
|
NativeConvert.ToOctalPermissionString(fileStat.st_mode).Should().Be("1664");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void should_set_folder_permissions()
|
public void should_set_folder_permissions()
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
using FluentAssertions;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using NzbDrone.Common.EnvironmentInfo;
|
||||||
|
using NzbDrone.Common.Processes;
|
||||||
|
using NzbDrone.Mono.EnvironmentInfo.VersionAdapters;
|
||||||
|
using NzbDrone.Test.Common;
|
||||||
|
|
||||||
|
namespace NzbDrone.Mono.Test.EnvironmentInfo
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
[Platform("Linux")]
|
||||||
|
public class FreebsdVersionAdapterFixture : TestBase<FreebsdVersionAdapter>
|
||||||
|
{
|
||||||
|
[SetUp]
|
||||||
|
public void Setup()
|
||||||
|
{
|
||||||
|
if (OsInfo.Os != Os.Bsd)
|
||||||
|
{
|
||||||
|
throw new IgnoreException("BSD Only");
|
||||||
|
}
|
||||||
|
|
||||||
|
Mocker.SetConstant<IProcessProvider>(Mocker.Resolve<ProcessProvider>());
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void should_get_version_info()
|
||||||
|
{
|
||||||
|
var info = Subject.Read();
|
||||||
|
info.FullName.Should().NotBeNullOrWhiteSpace();
|
||||||
|
info.Name.Should().NotBeNullOrWhiteSpace();
|
||||||
|
info.Version.Should().NotBeNullOrWhiteSpace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -14,6 +14,8 @@ public class ReleaseFileVersionAdapterFixture : TestBase<ReleaseFileVersionAdapt
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void Setup()
|
public void Setup()
|
||||||
{
|
{
|
||||||
|
NotBsd();
|
||||||
|
|
||||||
Mocker.SetConstant<IDiskProvider>(Mocker.Resolve<DiskProvider>());
|
Mocker.SetConstant<IDiskProvider>(Mocker.Resolve<DiskProvider>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,8 @@ public class ReleaseFileVersionAdapterFixture : TestBase<ReleaseFileVersionAdapt
|
||||||
[Platform("Linux")]
|
[Platform("Linux")]
|
||||||
public void should_get_version_info_from_actual_linux()
|
public void should_get_version_info_from_actual_linux()
|
||||||
{
|
{
|
||||||
|
NotBsd();
|
||||||
|
|
||||||
Mocker.SetConstant<IDiskProvider>(Mocker.Resolve<DiskProvider>());
|
Mocker.SetConstant<IDiskProvider>(Mocker.Resolve<DiskProvider>());
|
||||||
var info = Subject.Read();
|
var info = Subject.Read();
|
||||||
info.FullName.Should().NotBeNullOrWhiteSpace();
|
info.FullName.Should().NotBeNullOrWhiteSpace();
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
|
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
|
||||||
<PackageReference Include="NunitXml.TestLogger" Version="3.0.97" />
|
<PackageReference Include="NunitXml.TestLogger" Version="3.0.97" />
|
||||||
<PackageReference Include="coverlet.collector" Version="1.2.1" PrivateAssets="all" />
|
<PackageReference Include="coverlet.collector" Version="1.2.1" PrivateAssets="all" />
|
||||||
<PackageReference Include="Mono.Posix.NETStandard" Version="5.20.1-preview" />
|
<PackageReference Include="Mono.Posix.NETStandard" Version="5.20.1-servarr1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\NzbDrone.Common.Test\Prowlarr.Common.Test.csproj" />
|
<ProjectReference Include="..\NzbDrone.Common.Test\Prowlarr.Common.Test.csproj" />
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
using System.Linq;
|
||||||
|
using NzbDrone.Common.EnvironmentInfo;
|
||||||
|
using NzbDrone.Common.Processes;
|
||||||
|
|
||||||
|
namespace NzbDrone.Mono.EnvironmentInfo.VersionAdapters
|
||||||
|
{
|
||||||
|
public class FreebsdVersionAdapter : IOsVersionAdapter
|
||||||
|
{
|
||||||
|
private readonly IProcessProvider _processProvider;
|
||||||
|
|
||||||
|
public FreebsdVersionAdapter(IProcessProvider processProvider)
|
||||||
|
{
|
||||||
|
_processProvider = processProvider;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OsVersionModel Read()
|
||||||
|
{
|
||||||
|
var output = _processProvider.StartAndCapture("freebsd-version");
|
||||||
|
|
||||||
|
var version = output.Standard.First().Content;
|
||||||
|
|
||||||
|
return new OsVersionModel("FreeBSD", version, $"FreeBSD {version}");
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Enabled => OsInfo.Os == Os.Bsd;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
<TargetFrameworks>net5.0</TargetFrameworks>
|
<TargetFrameworks>net5.0</TargetFrameworks>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Mono.Posix.NETStandard" Version="5.20.1-preview" />
|
<PackageReference Include="Mono.Posix.NETStandard" Version="5.20.1-servarr1" />
|
||||||
<PackageReference Include="System.IO.FileSystem.AccessControl" Version="5.0.0" />
|
<PackageReference Include="System.IO.FileSystem.AccessControl" Version="5.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -174,6 +174,14 @@ protected void MonoOnly()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void NotBsd()
|
||||||
|
{
|
||||||
|
if (OsInfo.Os == Os.Bsd)
|
||||||
|
{
|
||||||
|
throw new IgnoreException("Ignored on BSD");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected void WithTempAsAppPath()
|
protected void WithTempAsAppPath()
|
||||||
{
|
{
|
||||||
Mocker.GetMock<IAppFolderInfo>()
|
Mocker.GetMock<IAppFolderInfo>()
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
Loading…
Reference in a new issue