Skip to content

Commit

Permalink
VERSION 1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kuiperzone committed Mar 30, 2023
1 parent 8170f00 commit a41f3d5
Show file tree
Hide file tree
Showing 13 changed files with 225 additions and 36 deletions.
5 changes: 5 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
+ VERSION 1.1.0; 2023-03-30
- Now ships internally with fuse run-times to allow cross-build for: x64, am64 (aarch64) and Arm (32-bit) architectures.
- Support for building AppImages on 32-bit Arm development platforms
- Tested against: appimagetool 13 (2020-12-31), rpmbuild RPM version 4.18.0, dpkg 1.21.20, flatpak-builder 1.2.3, InnoSetup 6.2.0

+ VERSION 1.0.1; 2023-03-22
- Now shows AppImageTool version only on Linux.
- Minor updates to built-in help information.
Expand Down
10 changes: 10 additions & 0 deletions Deploy/PupNet.metainfo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,16 @@
</screenshots>

<releases>
<release version="1.1.0" date="2023-03-30">
<description>
<ul>
<li>Now ships internally with fuse run-times to allow cross-build for: x64, am64 (aarch64) and Arm (32-bit) architectures</li>
<li>Support for building AppImages on 32-bit Arm development platforms</li>
<li>Tested against: appimagetool 13 (2020-12-31), rpmbuild RPM version 4.18.0, dpkg 1.21.20, flatpak-builder 1.2.3, InnoSetup 6.2.0</li>
</ul>
</description>
</release>

<release version="1.0.1" date="2023-03-22">
<description><p>Patch only</p></description>
</release>
Expand Down
46 changes: 46 additions & 0 deletions PupNet.Test/AppImageBuilderTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// -----------------------------------------------------------------------------
// PROJECT : PupNet
// COPYRIGHT : Andy Thomas (C) 2022-23
// LICENSE : GPL-3.0-or-later
// HOMEPAGE : https://github.com/kuiperzone/PupNet
//
// PupNet is free software: you can redistribute it and/or modify it under
// the terms of the GNU Affero General Public License as published by the Free Software
// Foundation, either version 3 of the License, or (at your option) any later version.
//
// PupNet is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License along
// with PupNet. If not, see <https://www.gnu.org/licenses/>.
// -----------------------------------------------------------------------------

using System.Runtime.InteropServices;
using KuiperZone.PupNet.Builders;

namespace KuiperZone.PupNet.Test;

public class AppImageBuilderTest
{
[Fact]
public void GetRuntimePath_RuntimeExistsForKnownArch()
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
// Ensure files are packaged
Assert.True(File.Exists(AppImageBuilder.GetRuntimePath(Architecture.X64)));
Assert.True(File.Exists(AppImageBuilder.GetRuntimePath(Architecture.Arm64)));
Assert.True(File.Exists(AppImageBuilder.GetRuntimePath(Architecture.Arm)));
}
else
{
// Linux files not packaged on Windows
Assert.False(File.Exists(AppImageBuilder.GetRuntimePath(Architecture.X64)));
}

// There is no RID for linux-x86, so not possible to support for X86
Assert.Throws<ArgumentException>(() => AppImageBuilder.GetRuntimePath(Architecture.X86));
}

}
19 changes: 19 additions & 0 deletions PupNet.Test/RuntimeConverterTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,23 @@ public void Constructor_Tizen_MapsLinuxUncertain()
Assert.True(r.IsArchUncertain);
}

[Fact]
public void ToArchitecture_MapsOK()
{
Assert.Equal(Architecture.X64, RuntimeConverter.ToArchitecture("x64"));
Assert.Equal(Architecture.X64, RuntimeConverter.ToArchitecture("x86_64"));

Assert.Equal(Architecture.Arm64, RuntimeConverter.ToArchitecture("arm64"));
Assert.Equal(Architecture.Arm64, RuntimeConverter.ToArchitecture("aarch64"));
Assert.Equal(Architecture.Arm64, RuntimeConverter.ToArchitecture("arm_aarch64"));

Assert.Equal(Architecture.Arm, RuntimeConverter.ToArchitecture("arm"));
Assert.Equal(Architecture.Arm, RuntimeConverter.ToArchitecture("armhf"));

Assert.Equal(Architecture.X86, RuntimeConverter.ToArchitecture("x86"));
Assert.Equal(Architecture.X86, RuntimeConverter.ToArchitecture("i686"));

Assert.Throws<ArgumentException>(() => RuntimeConverter.ToArchitecture("jdue"));
}

}
2 changes: 1 addition & 1 deletion PupNet.pupnet.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
AppBaseName = PupNet
AppFriendlyName = PupNet Deploy
AppId = zone.kuiper.pupnet
AppVersionRelease = 1.0.1[1]
AppVersionRelease = 1.1.0[1]
AppShortSummary = A cross-platform deployment utility publishes your .NET project and packages it as a ready-to-ship installation file in a single step.
AppLicenseId = AGPL-3.0-or-later
AppLicenseFile = LICENSE
Expand Down
Binary file added PupNet/Assets/appimagetool-armhf.AppImage
Binary file not shown.
Binary file added PupNet/Assets/runtime-fuse2-aarch64
Binary file not shown.
Binary file added PupNet/Assets/runtime-fuse2-armhf
Binary file not shown.
Binary file added PupNet/Assets/runtime-fuse2-x86_64
Binary file not shown.
57 changes: 52 additions & 5 deletions PupNet/Builders/AppImageBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ public AppImageBuilder(ConfigurationReader conf)
var list = new List<string>();

// Do the build
var cmd = $"{AppImageTool} {Configuration.AppImageArgs} \"{BuildRoot}\" \"{OutputPath}\"";
var arch = Arguments.Arch;
string fuse = arch != null ? GetRuntimePath(RuntimeConverter.ToArchitecture(arch)) : GetRuntimePath(Runtime.RuntimeArch);
var cmd = $"{AppImageTool} {Configuration.AppImageArgs} --runtime-file=\"{fuse}\" \"{BuildRoot}\" \"{OutputPath}\"";

if (Arguments.IsVerbose)
{
Expand Down Expand Up @@ -98,6 +100,11 @@ public override string Architecture
return "i686";
}

if (Runtime.RuntimeArch == System.Runtime.InteropServices.Architecture.Arm)
{
return "armhf";
}

return Runtime.RuntimeArch.ToString().ToLowerInvariant();
}
}
Expand Down Expand Up @@ -162,6 +169,32 @@ public override string? MetaBuildPath
/// </summary>
public override bool SupportsPostRun { get; } = true;

/// <summary>
/// Gets path to embedded fuse2 runtime, or throws.
/// </summary>
/// <exception cref="ArgumentException"/>
public static string GetRuntimePath(Architecture arch)
{
// https://github.com/AppImage/type2-runtime/releases/tag/continuous
if (arch == System.Runtime.InteropServices.Architecture.X64)
{
return Path.Combine(AssemblyDirectory, "runtime-fuse2-x86_64");
}

if (arch == System.Runtime.InteropServices.Architecture.Arm64)
{
return Path.Combine(AssemblyDirectory, "runtime-fuse2-aarch64");
}

if (arch == System.Runtime.InteropServices.Architecture.Arm)
{
return Path.Combine(AssemblyDirectory, "runtime-fuse2-armhf");
}

throw new ArgumentException($"Unsupported runtime architecture {arch} - must be one of: x64, arm64, x86, arm");
}


/// <summary>
/// Overrides and extends.
/// </summary>
Expand Down Expand Up @@ -192,11 +225,20 @@ public override void BuildPackage()
{
var arch = Architecture;

if ((arch == "aarch64" || arch == "arm64") && Arguments.Arch == null)
if (Arguments.Arch == null)
{
// Strange convention? More confusion?
// https://discourse.appimage.org/t/how-to-package-for-aarch64/2088
arch = "arm_aarch64";
if (arch == "aarch64" || arch == "arm64")
{
// Strange convention? More confusion?
// https://discourse.appimage.org/t/how-to-package-for-aarch64/2088
arch = "arm_aarch64";
}
else
if (arch == "armhf")
{
arch = "arm";
}

}

Environment.SetEnvironmentVariable("ARCH", arch);
Expand All @@ -216,6 +258,11 @@ public override void BuildPackage()
{
return Path.Combine(AssemblyDirectory, "appimagetool-aarch64.AppImage");
}

if (RuntimeInformation.OSArchitecture == System.Runtime.InteropServices.Architecture.Arm)
{
return Path.Combine(AssemblyDirectory, "appimagetool-armhf.AppImage");
}
}

// No supported
Expand Down
73 changes: 44 additions & 29 deletions PupNet/PupNet.csproj
Original file line number Diff line number Diff line change
@@ -1,41 +1,56 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
<IsPublishable>true</IsPublishable>
<PublishReadyToRun>true</PublishReadyToRun>
<ApplicationIcon>Assets/app.ico</ApplicationIcon>
<IsPackable>false</IsPackable>
<IsPublishable>true</IsPublishable>
<PublishReadyToRun>true</PublishReadyToRun>
<ApplicationIcon>Assets/app.ico</ApplicationIcon>

<PackageId>KuiperZone.PupNet</PackageId>
<Product>PupNet Deploy</Product>
<Authors>Andy Thomas</Authors>
<Copyright>© Andy Thomas 2022-23</Copyright>
<Company>KuiperZone</Company>
<Description>Publish, Package and Deploy to AppImage, Windows Setup Flatpak, Deb, RPM</Description>
<PackageTags>publish;AppImage;deb;rpm;flatpak;setup;installer;linux;</PackageTags>
<Language>en-US</Language>
<PackageProjectUrl>https://github.com/kuiperzone/PupNet-Deploy</PackageProjectUrl>
<PackageLicenseExpression>AGPL-3.0-or-later</PackageLicenseExpression>
<PackageId>KuiperZone.PupNet</PackageId>
<Product>PupNet Deploy</Product>
<Authors>Andy Thomas</Authors>
<Copyright>© Andy Thomas 2022-23</Copyright>
<Company>KuiperZone</Company>
<Description>Publish, Package and Deploy to AppImage, Windows Setup Flatpak, Deb, RPM</Description>
<PackageTags>publish;AppImage;deb;rpm;flatpak;setup;installer;linux;</PackageTags>
<Language>en-US</Language>
<PackageProjectUrl>https://github.com/kuiperzone/PupNet-Deploy</PackageProjectUrl>
<PackageLicenseExpression>AGPL-3.0-or-later</PackageLicenseExpression>

</PropertyGroup>
<ItemGroup>
<PackageReference Include="KuiperZone.Utility.Yaap" Version="2.0.0" />
</ItemGroup>
</PropertyGroup>

<ItemGroup>
<None Include="$(ProjectDir)\Assets\appimagetool-x86_64.AppImage" Link="appimagetool-x86_64.AppImage"
Condition=" '$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' ">
<ItemGroup Condition=" '$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))'">

<None Include="$(ProjectDir)\Assets\appimagetool-x86_64.AppImage" Link="appimagetool-x86_64.AppImage">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="$(ProjectDir)\Assets\appimagetool-aarch64.AppImage" Link="appimagetool-aarch64.AppImage">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="$(ProjectDir)\Assets\appimagetool-aarch64.AppImage" Link="appimagetool-aarch64.AppImage"
Condition=" '$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' ">
<None Include="$(ProjectDir)\Assets\appimagetool-armhf.AppImage" Link="appimagetool-armhf.AppImage">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>


<None Include="$(ProjectDir)\Assets\runtime-fuse2-x86_64" Link="runtime-fuse2-x86_64">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="$(ProjectDir)\Assets\runtime-fuse2-aarch64" Link="runtime-fuse2-aarch64">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="$(ProjectDir)\Assets\runtime-fuse2-armhf" Link="runtime-fuse2-armhf">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>

</ItemGroup>

<ItemGroup>
<PackageReference Include="KuiperZone.Utility.Yaap" Version="2.0.0" />

<None Include="$(ProjectDir)\Assets\generic.ico" Link="generic.ico">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
Expand Down Expand Up @@ -93,6 +108,6 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>

</ItemGroup>
</ItemGroup>

</Project>
43 changes: 42 additions & 1 deletion PupNet/RuntimeConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public RuntimeConverter(string? runtime)
public bool IsOsxRuntime { get; }

/// <summary>
/// Gets the runtime converted to architecture.
/// Gets the runtime converted to <see cref="Architecture"/>.
/// </summary>
public Architecture RuntimeArch { get; } = RuntimeInformation.OSArchitecture;

Expand All @@ -163,6 +163,47 @@ public RuntimeConverter(string? runtime)
/// </summary>
public PackageKind DefaultPackage { get; }

/// <summary>
/// Converts all known strings to <see cref="Architecture"/>, i.e. "aarch64" to <see cref="Architecture.Arm64"/>.
/// </summary>
/// <exception cref="ArgumentException"/>
public static Architecture ToArchitecture(string arch)
{
arch = arch?.Trim().ToLowerInvariant() ?? throw new ArgumentNullException(nameof(arch));

foreach (var item in Enum.GetValues<Architecture>())
{
// X86, X64, Arm, Arm64 etc.
if (arch.Equals(item.ToString(), StringComparison.OrdinalIgnoreCase))
{
return item;
}
}

// Variations
if (arch == "x86_64")
{
return Architecture.X64;
}

if (arch == "aarch64" || arch == "arm_aarch64")
{
return Architecture.Arm64;
}

if (arch == "i686")
{
return Architecture.X86;
}

if (arch == "armhf")
{
return Architecture.Arm;
}

throw new ArgumentException($"Unknown or unsupported architecture name {arch}");
}

/// <summary>
/// Returns RuntimeId.
/// </summary>
Expand Down
6 changes: 6 additions & 0 deletions TODO
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/opt/zone.kuiper.pupnet/appimagetool-x86_64.AppImage --runtime-file="/opt/zone.kuiper.pupnet/runtime-fuse2-aarch64" "/tmp/KuiperZone.PupNet/zone.kuiper.pupnet-linux-arm64-Release-AppImage/AppDir" "/mnt/DEVEL-1T/DOTNET/GITHUB/PupNet-Deploy/Deploy/OUT/PupNet-Deploy.aarch64.AppImage"
appimagetool, continuous build (commit 8bbf694), build <local dev build> built on 2020-12-31 11:48:33 UTC
More than one architectures were found of the AppDir source directory "/tmp/KuiperZone.PupNet/zone.kuiper.pupnet-linux-arm64-Release-AppImage/AppDir"
A valid architecture with the ARCH environmental variable should be provided
e.g. ARCH=x86_64 appimagetool ...

Show name/version on Windows Command Prompt
Add Setup option to install to admin
Add Setup option to uninstall on upgrade
Expand Down

0 comments on commit a41f3d5

Please sign in to comment.