Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
using System;
using System.Threading.Tasks;

namespace Xamarin.Android.Prepare
{
class GentooLinuxProgram : LinuxProgram
{
public GentooLinuxProgram (string packageName, string? executableName = null)
: base (packageName, executableName)
{}

protected override bool CheckWhetherInstalled ()
{
var output = Utilities.GetStringFromStdout ("equery", "--quiet", "list", PackageName).Replace ($"{PackageName.Split (':') [0]}-", "").Split ('-', '_');
if (output.Length >= 1 && !String.IsNullOrEmpty (output [0])) {
CurrentVersion = output [0];
return true;
}

return false;
}

#pragma warning disable CS1998
public override async Task<bool> Install ()
{
ProcessRunner runner;
if (NeedsSudoToInstall) {
runner = new ProcessRunner ("sudo", "emerge", "--oneshot", PackageName) {
EchoStandardOutput = true,
EchoStandardError = true,
ProcessTimeout = TimeSpan.FromMinutes (60), // gcc most probably will not compile in 60 minutes...
};
}
else
{
runner = new ProcessRunner ("emerge", "--oneshot", PackageName) {
EchoStandardOutput = true,
EchoStandardError = true,
ProcessTimeout = TimeSpan.FromMinutes (60), // gcc most probably will not compile in 60 minutes...
};
}

bool failed = await Task.Run (() => !runner.Run ());
if (failed) {
Log.Error ($"Installation of {PackageName} timed out");
failed = true;
}

if (runner.ExitCode != 0) {
Log.Error ($"Installation failed with error code {runner.ExitCode}");
failed = true;
}

return !failed;
}
#pragma warning restore CS1998

protected override bool DeterminePackageVersion()
{
return true;
}
}
}
2 changes: 1 addition & 1 deletion build-tools/xaprepare/xaprepare/Application/Utilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,7 @@ public static string GetStringFromStdout (ProcessRunner runner, bool throwOnErro
LogError ($"failed with exit code {runner.ExitCode}");
return String.Empty;
}

string ret = sw.ToString ();
if (trimTrailingWhitespace)
return ret.TrimEnd ();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
using System.Collections.Generic;

namespace Xamarin.Android.Prepare
{
class LinuxGentoo : Linux
{
static readonly List<GentooLinuxProgram> packages = new List<GentooLinuxProgram> {
new GentooLinuxProgram ("sys-devel/autoconf"),
new GentooLinuxProgram ("sys-devel/automake"),
new GentooLinuxProgram ("sys-devel/binutils"),
new GentooLinuxProgram ("sys-devel/bison"),
new GentooLinuxProgram ("net-misc/curl"),
new GentooLinuxProgram ("sys-apps/fakeroot"),
new GentooLinuxProgram ("sys-apps/file"),
new GentooLinuxProgram ("sys-apps/findutils"),
new GentooLinuxProgram ("sys-devel/flex"),
new GentooLinuxProgram ("sys-apps/gawk"),
new GentooLinuxProgram ("sys-devel/gcc"),
new GentooLinuxProgram ("sys-devel/gettext"),
new GentooLinuxProgram ("dev-vcs/git"),
new GentooLinuxProgram ("sys-apps/grep"),
new GentooLinuxProgram ("sys-apps/groff"),
//new GentooLinuxProgram ("gtk-sharp-2"),
new GentooLinuxProgram ("app-arch/gzip"),
new GentooLinuxProgram ("dev-java/openjdk-bin:8"),
new GentooLinuxProgram ("sys-devel/libtool"),
new GentooLinuxProgram ("dev-libs/libzip"),
new GentooLinuxProgram ("sys-devel/m4"),
new GentooLinuxProgram ("sys-devel/make"),
//new GentooLinuxProgram ("nuget"),
new GentooLinuxProgram ("sys-devel/patch"),
new GentooLinuxProgram ("dev-util/pkgconf"),
//new GentooLinuxProgram ("referenceassemblies-pcl"),
new GentooLinuxProgram ("sys-apps/sed"),
new GentooLinuxProgram ("sys-apps/texinfo"),
new GentooLinuxProgram ("app-arch/unzip"),
new GentooLinuxProgram ("sys-apps/which"),
new GentooLinuxProgram ("app-arch/zip"),
new GentooLinuxProgram ("app-arch/p7zip"),
};

public LinuxGentoo (Context context)
: base (context)
{
Dependencies.AddRange (packages);
}

protected override void InitializeDependencies ()
{}

protected override bool InitOS ()
{
if (!base.InitOS ())
return false;

return true;
}
};
}
4 changes: 3 additions & 1 deletion build-tools/xaprepare/xaprepare/OperatingSystems/Linux.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,16 @@ echo 1 > /proc/sys/fs/binfmt_misc/status
{"LinuxMint", (ctx) => new LinuxMint (ctx)},
{"Arch", (ctx) => new LinuxArch (ctx)},
{"Fedora", (ctx) => new LinuxFedora (ctx)},
{"Gentoo", (ctx) => new LinuxGentoo (ctx)},
};

static readonly Dictionary<string, string> distroIdMap = new Dictionary<string, string> (StringComparer.OrdinalIgnoreCase) {
{"debian", "Debian"},
{"ubuntu", "Ubuntu"},
{"arch", "Arch"},
{"linuxmint", "LinuxMint"},
{"fedora", "Fedora"}
{"fedora", "Fedora"},
{"gentoo", "Gentoo"},
};

bool warnBinFmt;
Expand Down