Skip to content

Commit f4bac2c

Browse files
committed
Fixes for 1.4.1
1 parent 4a9251e commit f4bac2c

File tree

8 files changed

+67
-34
lines changed

8 files changed

+67
-34
lines changed

CHANGES

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
+ VERSION 1.4.1; 2023-05-06
2+
- Bugfix #16: AppImage and Flatpak builds rejected AppStream metadata if conf.AppDescription was empty. Now defaults to AppShortSummary.
3+
- Bugfix #15: AppImage and Flatpak builds rejected AppStream metadata if conf.AppChangeFileEmpty.
4+
- Bugfix #14: AppImage failed if conf.IconPaths empty. On Linux a default icon will be used (previously worked but was broken due to change).
5+
- Bugfix #13: Incorrect </description> tag in AppStream example text (may be uncommented by used)
6+
- Ships with: appimagetool 13 (2020-12-31)
7+
- Tested against: rpmbuild RPM version 4.18.1, dpkg 1.21.21, flatpak-builder 1.2.3, InnoSetup 6.2.2
8+
19
+ VERSION 1.4.0; 2023-05-05
210

311
- Added 'AppDescription' property to configuration (IMPORTANT NEW FEATURE - see website for information)
@@ -15,6 +23,7 @@
1523
- Added MACRO section (verbose only) to console output when building a package (useful for debugging)
1624
- Extensive updates to README documentation
1725
- Other minor corrections and changes
26+
- Ships with: appimagetool 13 (2020-12-31)
1827
- Tested against: rpmbuild RPM version 4.18.1, dpkg 1.21.21, flatpak-builder 1.2.3, InnoSetup 6.2.2
1928

2029

PupNet.pupnet.conf

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# PUPNET DEPLOY: 1.4.0
1+
# PUPNET DEPLOY: 1.4.1
22

33
# APP PREAMBLE
44
AppBaseName = PupNet
55
AppFriendlyName = PupNet Deploy
66
AppId = zone.kuiper.pupnet
7-
AppVersionRelease = 1.4.0[1]
7+
AppVersionRelease = 1.4.1[1]
88
AppShortSummary = Cross-platform deployment utility which packages your .NET project as a ready-to-ship installation file in a single step.
99
AppDescription = """
1010
PupNet Deploy is a cross-platform deployment utility which packages your .NET project as a ready-to-ship
@@ -15,7 +15,7 @@ AppDescription = """
1515
Linux, Windows, MacOS and Android.
1616

1717
Now, PupNet Deploy allows you to ship your dotnet application as: AppImage for Linux, Setup File for Windows, Flatpak,
18-
Deb Package, RPM Package, Plain old Zip.
18+
Deb Package, RPM Package, and plain old Zip.
1919

2020
PupNet has good support for internationalization, desktop icons, publisher metadata and custom build operations.
2121
Although developed for .NET, it is also possible to use it to deploy C++ and other kinds of applications.
@@ -38,17 +38,7 @@ DesktopFile =
3838
StartCommand = pupnet
3939
PrimeCategory = Development
4040
MetaFile = Deploy/PupNet.metainfo.xml
41-
IconFiles = """
42-
Deploy/PupNet.16x16.png
43-
Deploy/PupNet.24x24.png
44-
Deploy/PupNet.32x32.png
45-
Deploy/PupNet.48x48.png
46-
Deploy/PupNet.64x64.png
47-
Deploy/PupNet.96x96.png
48-
Deploy/PupNet.128x128.png
49-
Deploy/PupNet.256x256.png
50-
Deploy/PupNet.ico
51-
"""
41+
IconFiles =
5242

5343
# DOTNET PUBLISH
5444
DotnetProjectPath =

PupNet/BuildHost.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@
2222
namespace KuiperZone.PupNet;
2323

2424
/// <summary>
25-
/// Handles Console interaction, publishes the dotnet application and creates and executes a concrete instance of
26-
/// <see cref="PackageBuilder"/>.
25+
/// Creates a concrete instance of <see cref="PackageBuilder"/>, and handles the Console interaction with the user.
2726
/// </summary>
2827
public class BuildHost
2928
{

PupNet/Builders/AppImageBuilder.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,11 @@ public override void Create(string? desktop, string? metainfo)
220220
{
221221
Operations.CopyFile(IconSource, Path.Combine(BuildRoot, Configuration.AppId + Path.GetExtension(IconSource)));
222222
}
223+
else
224+
{
225+
// Icon expected on Linux. Defaults to be provided in none in conf
226+
throw new InvalidOperationException("Expected IconSource but was null");
227+
}
223228

224229
// IMPORTANT - Create AppRun link
225230
// ln -s {target} {link}

PupNet/ConfigurationReader.cs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -373,11 +373,11 @@ public string ToString(DocStyles style)
373373
$"Mandatory single line application summary text in default (English) language."));
374374

375375
sb.Append(CreateHelpField(nameof(AppDescription), AppDescription, true, style,
376-
$"Optional multi-line (surround with triple \"\"\" quotes) application description which provides",
377-
$"longer explanation than {nameof(AppShortSummary)} in default language. Text separated by an empty line will be",
378-
$"treated as separate paragraphs. Avoid complex formatting and do not use HTML or markdown. This content",
379-
$"is used by package builders where supported, including RPM and DEB, and may optionally be used to",
380-
$"populate the '<description>' element in the AppStream metadata through the use of a macro variable."));
376+
$"Multi-line (surround with triple \"\"\" quotes) application description which provides longer explanation",
377+
$"than {nameof(AppShortSummary)} in default language. Optional but it is recommended to specify this. Text",
378+
$"separated by an empty line will be treated as separate paragraphs. Avoid complex formatting and do not",
379+
$"use HTML or markdown. This content is used by package builders where supported, including RPM and DEB,",
380+
$"and is used to populate the {MacroId.AppStreamDescriptionXml.ToVar()} element used in AppStream metadata."));
381381

382382
sb.Append(CreateHelpField(nameof(AppLicenseId), AppLicenseId, style,
383383
$"Mandatory application license ID. This should be one of the recognized SPDX license",
@@ -392,11 +392,9 @@ public string ToString(DocStyles style)
392392
$"Optional path to application changelog file. IMPORTANT. If given, this file should contain version",
393393
$"information in a predefined format. Namely, it should contain one or more version headings of form:",
394394
$"'+ VERSION;DATE', under which are to be listed change items of form: '- Change description'. Formatted",
395-
$"information will be parsed and used to populate AppStream metadata. Additionally, it will be packaged",
396-
$"with the application and used with package builders where supported. NOTE. Superfluous text in the file",
397-
$"is ignored, so the file may also contain README information.",
398-
$"For information: {Program.ProjectUrl}."));
399-
395+
$"information will be parsed and used to expand the {MacroId.AppStreamChangelogXml.ToVar()} macro used",
396+
$"for AppStream metadata (superfluous text is ignored, so the file may also contain README information).",
397+
$"The given file will also be packaged with the application verbatim. See: {Program.ProjectUrl}."));
400398

401399

402400
sb.Append(CreateBreaker("PUBLISHER", style));

PupNet/MacroExpander.cs

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@ public MacrosExpander(PackageBuilder builder)
6565
dict.Add(MacroId.DesktopTerminal, conf.DesktopTerminal.ToString().ToLowerInvariant());
6666
dict.Add(MacroId.PrimeCategory, conf.PrimeCategory ?? "");
6767

68-
dict.Add(MacroId.AppStreamDescriptionXml, GetXmlDescription(conf.AppDescription));
69-
dict.Add(MacroId.AppStreamChangelogXml, builder.ChangeLog.ToString(true));
7068
dict.Add(MacroId.AppVersion, builder.AppVersion);
7169
dict.Add(MacroId.PackageRelease, builder.PackageRelease);
7270
dict.Add(MacroId.DeployKind, args.Kind.ToString().ToLowerInvariant());
@@ -82,6 +80,27 @@ public MacrosExpander(PackageBuilder builder)
8280
dict.Add(MacroId.InstallBin, builder.InstallBin);
8381
dict.Add(MacroId.InstallExec, builder.InstallExec);
8482

83+
if (conf.AppDescription.Count != 0)
84+
{
85+
dict.Add(MacroId.AppStreamDescriptionXml, GetXmlDescription(conf.AppDescription));
86+
}
87+
else
88+
{
89+
// Macro cannot be empty - use mandatory AppShortSummary instead
90+
dict.Add(MacroId.AppStreamDescriptionXml, $"<p>{SecurityElement.Escape(conf.AppShortSummary)}</p>");
91+
}
92+
93+
if (builder.ChangeLog.Items.Count != 0)
94+
{
95+
dict.Add(MacroId.AppStreamChangelogXml, builder.ChangeLog.ToString(true));
96+
}
97+
else
98+
{
99+
// Macro cannot be empty - manufacture minimal change
100+
var change = $"<release version=\"{builder.AppVersion}\" date=\"{DateTime.UtcNow.ToString("yyyy-MM-dd")}\">";
101+
dict.Add(MacroId.AppStreamChangelogXml, change);
102+
}
103+
85104
Dictionary = dict;
86105
}
87106

PupNet/PackageBuilder.cs

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,12 @@ namespace KuiperZone.PupNet;
2424
/// <summary>
2525
/// A base class for package build operations. It defines a working build directory structure under which the
2626
/// application is to be published by dotnet, along with other assets such a desktop, AppStream metadata
27-
/// and icons. The subclass is to define package specific values and operations by overriding key members.
27+
/// and icons (think 'AppDir' for AppImage, or BUILDROOT for RPM). It is Linux centric, where on Windows unused
28+
/// properties are ignored. The subclass is to define package specific values and operations by overriding key
29+
/// members, and implement the build operation. The build operation is a two-stage process in which
30+
/// <see cref="Create"/> is first called and information present on the console. Note that many of properties of
31+
/// this class are public purely to make them accessible to <see cref="BuildHost"/> class so they can be presented
32+
/// to the user. When the user confirms <see cref="BuildPackage"/> is called to perform the build.
2833
/// </summary>
2934
public abstract class PackageBuilder
3035
{
@@ -59,12 +64,18 @@ public PackageBuilder(ConfigurationReader conf, PackageKind kind)
5964

6065
if (IconPaths.Count == 0)
6166
{
62-
// Always has some linux icons
67+
// Fallback to embedded icons on Linux
6368
IconPaths = GetShareIconPaths(Configuration.DesktopTerminal ? DefaultTerminalIcons : DefaultGuiIcons);
6469
}
6570

6671
IconSource = GetSourceIcon(kind, Configuration.IconFiles);
6772

73+
if (IconSource == null)
74+
{
75+
// Fallback to embedded icons on Linux
76+
IconSource = GetSourceIcon(kind, Configuration.DesktopTerminal ? DefaultTerminalIcons : DefaultGuiIcons);
77+
}
78+
6879
// Ignore fact file might not exist if AssertPaths if false (test only)
6980
if (Configuration.AssertPaths || File.Exists(Configuration.AppChangeFile))
7081
{
@@ -334,13 +345,14 @@ public virtual string? MetaBuildPath
334345
/// <summary>
335346
/// Gets the source path of the "prime" icon, i.e. the single icon considered to be the most generally suitable.
336347
/// On Linux this is the first SVG file encountered, or the largest PNG otherwise. On Windows, it is the first ICO
337-
/// file encountered.
348+
/// file encountered. It is a full path to the source icon on build.
338349
/// </summary>
339350
public string? IconSource { get; }
340351

341352
/// <summary>
342-
/// A sequence of source icon paths (key) and their destinations (value) under <see cref="PackageBuilder.BuildShareIcons"/>.
343-
/// Default generic icons are provided if the configuration supplies none. Always empty on Windows.
353+
/// A sequence of source icon paths (key) and their install destinations (value) under
354+
/// <see cref="PackageBuilder.BuildShareIcons"/>. Default generic icons are provided if the configuration supplies
355+
/// none. Always empty on Windows.
344356
/// </summary>
345357
public IReadOnlyDictionary<string, string> IconPaths { get; }
346358

@@ -655,7 +667,7 @@ private static IReadOnlyCollection<string> GetDefaultIcons(bool terminal)
655667
string name = terminal ? "terminal" : "generic";
656668

657669
// Leave windows icon out - leave InnoSetup to assign own
658-
// list.Add(Path.Combine(AssemblyDirectory, $"{name}.icon"));
670+
// list.Add(Path.Combine(AssemblyDirectory, $"{name}.ico"));
659671

660672
list.Add(Path.Combine(AssemblyDirectory, $"{name}.16x16.png"));
661673
list.Add(Path.Combine(AssemblyDirectory, $"{name}.24x24.png"));

TODO

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
Add multiple --kind values to arguments?
22
Add <ul> parsing to AppDescription
3+
Implement auto system test for maximal and minimal conf files
34

45

56
DONE

0 commit comments

Comments
 (0)