Skip to content

Commit 6f041e9

Browse files
committed
Fixes for 1.4.1
1 parent 365b44e commit 6f041e9

File tree

7 files changed

+50
-30
lines changed

7 files changed

+50
-30
lines changed

CHANGES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
- Bugfix #15: AppImage and Flatpak builds rejected AppStream metadata if conf.AppChangeFileEmpty.
44
- Bugfix #14: AppImage failed if conf.IconPaths empty. On Linux a default icon will be used (previously worked but was broken due to change).
55
- Bugfix #13: Incorrect </description> tag in AppStream example text (may be uncommented by used)
6+
- Updated to show CHANGELOG on console only with --verbose command option
67
- Ships with: appimagetool 13 (2020-12-31)
78
- Tested against: rpmbuild RPM version 4.18.1, dpkg 1.21.21, flatpak-builder 1.2.3, InnoSetup 6.2.2
89

PupNet.Test/PackageBuilderTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ private void AssertOK(PackageBuilder builder, PackageKind kind)
122122

123123
Assert.EndsWith($"usr/share/applications/net.example.helloworld.desktop", builder.DesktopBuildPath);
124124

125-
Assert.Equal($"Assets/Icon.svg", builder.IconSource);
125+
Assert.Equal($"Assets/Icon.svg", builder.PrimaryIcon);
126126

127127
Assert.Contains($"Assets/Icon.svg", builder.IconPaths.Keys);
128128
Assert.Contains($"Assets/Icon.32x32.png", builder.IconPaths.Keys);
@@ -141,7 +141,7 @@ private void AssertOK(PackageBuilder builder, PackageKind kind)
141141
Assert.Null(builder.DesktopBuildPath);
142142

143143
// Linux sep is ok
144-
Assert.Equal($"Assets/Icon.ico", builder.IconSource);
144+
Assert.Equal($"Assets/Icon.ico", builder.PrimaryIcon);
145145
Assert.True(builder.IconPaths.Count == 0);
146146
}
147147
else

PupNet.pupnet.conf

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,17 @@ DesktopFile =
3838
StartCommand = pupnet
3939
PrimeCategory = Development
4040
MetaFile = Deploy/PupNet.metainfo.xml
41-
IconFiles =
41+
IconFiles = """
42+
Deploy/PupNet.ico
43+
Deploy/PupNet.16x16.png
44+
Deploy/PupNet.24x24.png
45+
Deploy/PupNet.32x32.png
46+
Deploy/PupNet.48x48.png
47+
Deploy/PupNet.64x64.png
48+
Deploy/PupNet.96x96.png
49+
Deploy/PupNet.128x128.png
50+
Deploy/PupNet.256x256.png
51+
"""
4252

4353
# DOTNET PUBLISH
4454
DotnetProjectPath =

PupNet/BuildHost.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -240,18 +240,18 @@ public string ToString(bool verbose)
240240
AppendPair(sb, nameof(Builder.AppVersion), Builder.AppVersion);
241241
AppendPair(sb, nameof(Builder.PackageRelease), Builder.PackageRelease);
242242

243-
if (Configuration.StartCommand != null && Builder.SupportsStartCommand)
243+
if (Builder.SupportsStartCommand)
244244
{
245-
AppendPair(sb, nameof(Configuration.StartCommand), Configuration.StartCommand);
245+
AppendPair(sb, nameof(Configuration.StartCommand), Configuration.StartCommand ?? "[None]");
246246
}
247247
else
248248
{
249-
AppendPair(sb, nameof(Configuration.StartCommand), Configuration.StartCommand + " [Not Supported]");
249+
AppendPair(sb, nameof(Configuration.StartCommand), "[Not Supported]");
250250
}
251251

252252
if (Builder.Kind == PackageKind.Setup)
253253
{
254-
AppendPair(sb, nameof(Configuration.SetupCommandPrompt), Configuration.SetupCommandPrompt);
254+
AppendPair(sb, nameof(Configuration.SetupCommandPrompt), Configuration.SetupCommandPrompt ?? "[None]");
255255
}
256256

257257
AppendHeader(sb, $"OUTPUT: {Arguments.Kind.ToString().ToUpperInvariant()}");
@@ -268,10 +268,11 @@ public string ToString(bool verbose)
268268
}
269269

270270
AppendSection(sb, $"DESKTOP: {Path.GetFileName(Configuration.DesktopFile)}", ExpandedDesktop);
271-
AppendSection(sb, $"CHANGELOG: {Path.GetFileName(Configuration.AppChangeFile)}", Builder.ChangeLog.ToString());
272271

273272
if (verbose)
274273
{
274+
AppendSection(sb, $"CHANGELOG: {Path.GetFileName(Configuration.AppChangeFile)}", Builder.ChangeLog.ToString());
275+
275276
var temp = new StringBuilder();
276277

277278
foreach (var item in Builder.IconPaths)

PupNet/Builders/AppImageBuilder.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,14 +216,14 @@ public override void Create(string? desktop, string? metainfo)
216216
Operations.WriteFile(Path.Combine(BuildRoot, Configuration.AppId + ".desktop"), desktop);
217217
Operations.WriteFile(Path.Combine(BuildRoot, Configuration.AppId + ".appdata.xml"), metainfo);
218218

219-
if (IconSource != null)
219+
if (PrimaryIcon != null)
220220
{
221-
Operations.CopyFile(IconSource, Path.Combine(BuildRoot, Configuration.AppId + Path.GetExtension(IconSource)));
221+
Operations.CopyFile(PrimaryIcon, Path.Combine(BuildRoot, Configuration.AppId + Path.GetExtension(PrimaryIcon)));
222222
}
223223
else
224224
{
225225
// Icon expected on Linux. Defaults to be provided in none in conf
226-
throw new InvalidOperationException("Expected IconSource but was null");
226+
throw new InvalidOperationException($"Expected {nameof(PrimaryIcon)} but was null");
227227
}
228228

229229
// IMPORTANT - Create AppRun link

PupNet/Builders/SetupBuilder.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ private string GetInnoFile()
176176
sb.AppendLine($"AppPublisherURL={Configuration.PublisherLinkUrl}");
177177
sb.AppendLine($"InfoBeforeFile={Configuration.AppChangeFile}");
178178
sb.AppendLine($"LicenseFile={Configuration.AppLicenseFile}");
179-
sb.AppendLine($"SetupIconFile={IconSource}");
179+
sb.AppendLine($"SetupIconFile={PrimaryIcon}");
180180

181181
sb.AppendLine($"DefaultGroupName={Configuration.AppFriendlyName}");
182182
sb.AppendLine($"DefaultDirName={{autopf}}\\{Configuration.AppBaseName}");
@@ -188,9 +188,9 @@ private string GetInnoFile()
188188

189189
sb.AppendLine($"PrivilegesRequired={(Configuration.SetupAdminInstall ? "admin" : "lowest")}");
190190

191-
if (IconSource != null)
191+
if (PrimaryIcon != null)
192192
{
193-
sb.AppendLine($"UninstallDisplayIcon={{app}}\\{Path.GetFileName(IconSource)}");
193+
sb.AppendLine($"UninstallDisplayIcon={{app}}\\{Path.GetFileName(PrimaryIcon)}");
194194
}
195195

196196
if (!string.IsNullOrEmpty(Configuration.SetupSignTool))
@@ -204,9 +204,9 @@ private string GetInnoFile()
204204
sb.AppendLine($"Source: \"{BuildAppBin}\\*.dll\"; DestDir: \"{{app}}\"; Flags: ignoreversion recursesubdirs createallsubdirs signonce;");
205205
sb.AppendLine($"Source: \"{BuildAppBin}\\*\"; Excludes: \"*.exe,*.dll\"; DestDir: \"{{app}}\"; Flags: ignoreversion recursesubdirs createallsubdirs;");
206206

207-
if (IconSource != null)
207+
if (PrimaryIcon != null)
208208
{
209-
sb.AppendLine($"Source: \"{IconSource}\"; DestDir: \"{{app}}\"; Flags: ignoreversion recursesubdirs createallsubdirs;");
209+
sb.AppendLine($"Source: \"{PrimaryIcon}\"; DestDir: \"{{app}}\"; Flags: ignoreversion recursesubdirs createallsubdirs;");
210210
}
211211

212212
if (Configuration.SetupCommandPrompt != null)

PupNet/PackageBuilder.cs

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,18 @@ public PackageBuilder(ConfigurationReader conf, PackageKind kind)
6565
if (IconPaths.Count == 0)
6666
{
6767
// Fallback to embedded icons on Linux
68+
// Should always empty on non-linux systems
6869
IconPaths = GetShareIconPaths(Configuration.DesktopTerminal ? DefaultTerminalIcons : DefaultGuiIcons);
6970
}
7071

71-
IconSource = GetSourceIcon(kind, Configuration.IconFiles);
72+
// Should be ico on Windows, or SVG or PNG on linux
73+
PrimaryIcon = GetSourceIcon(kind, Configuration.IconFiles);
7274

73-
if (IconSource == null)
75+
if (PrimaryIcon == null)
7476
{
77+
// It can be null on Windows.
7578
// Fallback to embedded icons on Linux
76-
IconSource = GetSourceIcon(kind, Configuration.DesktopTerminal ? DefaultTerminalIcons : DefaultGuiIcons);
79+
PrimaryIcon = GetSourceIcon(kind, Configuration.DesktopTerminal ? DefaultTerminalIcons : DefaultGuiIcons);
7780
}
7881

7982
// Ignore fact file might not exist if AssertPaths if false (test only)
@@ -347,7 +350,7 @@ public virtual string? MetaBuildPath
347350
/// On Linux this is the first SVG file encountered, or the largest PNG otherwise. On Windows, it is the first ICO
348351
/// file encountered. It is a full path to the source icon on build.
349352
/// </summary>
350-
public string? IconSource { get; }
353+
public string? PrimaryIcon { get; }
351354

352355
/// <summary>
353356
/// A sequence of source icon paths (key) and their install destinations (value) under
@@ -729,19 +732,24 @@ private static int GetStandardPngSize(string filename)
729732
return item;
730733
}
731734

732-
if (!kind.TargetsWindows() && ext == ".svg")
735+
if (!kind.TargetsWindows())
733736
{
734-
// Or this for non-windows
735-
return item;
736-
}
737+
// For non-windows
738+
if (ext == ".svg")
739+
{
740+
// Preferred
741+
return item;
742+
}
737743

738-
// Get biggest PNG
739-
int size = GetStandardPngSize(item);
744+
// Or biggest PNG
745+
int size = GetStandardPngSize(item);
746+
747+
if (size > max)
748+
{
749+
max = size;
750+
rslt = item;
751+
}
740752

741-
if (size > max)
742-
{
743-
max = size;
744-
rslt = item;
745753
}
746754
}
747755

0 commit comments

Comments
 (0)