uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead

https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948
this can do it nicely.

Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
Anton Arapov 2021-04-03 12:58:10 +02:00 committed by Alan Daniels
commit 56de2bcd43
30691 changed files with 3076956 additions and 0 deletions

View file

@ -0,0 +1,120 @@
{ lib, fetchurl, buildDotnetPackage, substituteAll, makeWrapper, makeDesktopItem,
unzip, icoutils, gtk2, xorg, xdotool, xsel, coreutils, unixtools, glib, plugins ? [] }:
with builtins; buildDotnetPackage rec {
pname = "keepass";
version = "2.49";
src = fetchurl {
url = "mirror://sourceforge/keepass/KeePass-${version}-Source.zip";
sha256 = "sha256-1hg4bRuQSG+UzEQGeQcSURTmTxt5ITGQqfg0IS7RWt0=";
};
sourceRoot = ".";
nativeBuildInputs = [ makeWrapper unzip ];
buildInputs = [ icoutils ];
patches = [
(substituteAll {
src = ./fix-paths.patch;
xsel = "${xsel}/bin/xsel";
xprop = "${xorg.xprop}/bin/xprop";
xdotool = "${xdotool}/bin/xdotool";
uname = "${coreutils}/bin/uname";
whereis = "${unixtools.whereis}/bin/whereis";
gsettings = "${glib}/bin/gsettings";
})
];
# KeePass looks for plugins in under directory in which KeePass.exe is
# located. It follows symlinks where looking for that directory, so
# buildEnv is not enough to bring KeePass and plugins together.
#
# This derivation patches KeePass to search for plugins in specified
# plugin derivations in the Nix store and nowhere else.
pluginLoadPathsPatch =
let outputLc = toString (add 7 (length plugins));
patchTemplate = readFile ./keepass-plugins.patch;
loadTemplate = readFile ./keepass-plugins-load.patch;
loads =
lib.concatStrings
(map
(p: replaceStrings ["$PATH$"] [ (unsafeDiscardStringContext (toString p)) ] loadTemplate)
plugins);
in replaceStrings ["$OUTPUT_LC$" "$DO_LOADS$"] [outputLc loads] patchTemplate;
passAsFile = [ "pluginLoadPathsPatch" ];
postPatch = ''
sed -i 's/\r*$//' KeePass/Forms/MainForm.cs
patch -p1 <$pluginLoadPathsPatchPath
'';
preConfigure = ''
rm -rvf Build/*
find . -name "*.sln" -print -exec sed -i 's/Format Version 10.00/Format Version 11.00/g' {} \;
find . -name "*.csproj" -print -exec sed -i '
s#ToolsVersion="3.5"#ToolsVersion="4.0"#g
s#<TargetFrameworkVersion>.*</TargetFrameworkVersion>##g
s#<PropertyGroup>#<PropertyGroup><TargetFrameworkVersion>v4.5</TargetFrameworkVersion>#g
s#<SignAssembly>.*$#<SignAssembly>false</SignAssembly>#g
s#<PostBuildEvent>.*sgen.exe.*$##
' {} \;
'';
desktopItem = makeDesktopItem {
name = "keepass";
exec = "keepass";
comment = "Password manager";
icon = "keepass";
desktopName = "Keepass";
genericName = "Password manager";
categories = [ "Utility" ];
mimeTypes = [ "application/x-keepass2" ];
};
outputFiles = [
"Build/KeePass/Release/*"
"Build/KeePassLib/Release/*"
"Ext/KeePass.config.xml" # contains <PreferUserConfiguration>true</PreferUserConfiguration>
];
dllFiles = [ "KeePassLib.dll" ];
exeFiles = [ "KeePass.exe" ];
# plgx plugin like keefox requires mono to compile at runtime
# after loading. It is brought into plugins bin/ directory using
# buildEnv in the plugin derivation. Wrapper below makes sure it
# is found and does not pollute output path.
binPaths = lib.concatStringsSep ":" (map (x: x + "/bin") plugins);
dynlibPath = lib.makeLibraryPath [ gtk2 ];
postInstall =
let
extractFDeskIcons = ./extractWinRscIconsToStdFreeDesktopDir.sh;
in
''
mkdir -p "$out/share/applications"
cp ${desktopItem}/share/applications/* $out/share/applications
wrapProgram $out/bin/keepass \
--prefix PATH : "$binPaths" \
--prefix LD_LIBRARY_PATH : "$dynlibPath"
${extractFDeskIcons} \
"./Translation/TrlUtil/Resources/KeePass.ico" \
'[^\.]+_[0-9]+_([0-9]+x[0-9]+)x[0-9]+\.png' \
'\1' \
'([^\.]+).+' \
'keepass' \
"$out" \
"./tmp"
'';
meta = {
description = "GUI password manager with strong cryptography";
homepage = "http://www.keepass.info/";
maintainers = with lib.maintainers; [ amorsillo obadz ];
platforms = with lib.platforms; all;
license = lib.licenses.gpl2;
};
}

View file

@ -0,0 +1,61 @@
#!/bin/sh
# The file from which to extract *.ico files.
#rscFile="./KeePass.exe"
rscFile=$1
# A regexp that can extract the image size from the file name.
# sizeRegex='[^\.]+\.exe_[0-9]+_[0-9]+_[0-9]+_[0-9]+_([0-9]+x[0-9]+)x[0-9]+\.png'
sizeRegex=$2
# sizeReplaceExp='\1'
sizeReplaceExp=$3
# A regexp that can extract the name of the target image from the file name.
# nameRegex='([^\.]+)\.exe.+'
nameRegex=$4
# nameReplaceExp='\1'
nameReplaceExp=$5
# out=./myOut
out=$6
# An optional temp dir. TODO: Generate it randomly by default instead.
tmp=./tmp
if [ "" != "$4" ]; then
tmp=$7
fi
rm -rf $tmp/png $tmp/ico
mkdir -p $tmp/png $tmp/ico
# Extract the ressource file's extension.
rscFileExt=`echo "$rscFile" | sed -re 's/.+\.(.+)$/\1/'`
# Debug ressource file extension.
echo "rscFileExt=$rscFileExt"
if [ "ico" = "$rscFileExt" ]; then
cp -p $rscFile $tmp/ico
else
wrestool -x --output=$tmp/ico -t14 $rscFile
fi
icotool --icon -x --palette-size=0 -o $tmp/png $tmp/ico/*.ico
mkdir -p $out
for i in $tmp/png/*.png; do
fn=`basename "$i"`
size=$(echo $fn | sed -re 's/'${sizeRegex}'/'${sizeReplaceExp}'/')
name=$(echo $fn | sed -re 's/'${nameRegex}'/'${nameReplaceExp}'/')
targetDir=$out/share/icons/hicolor/$size/apps
targetFile=$targetDir/$name.png
mkdir -p $targetDir
mv $i $targetFile
done
rm -rf $tmp/png $tmp/ico

View file

@ -0,0 +1,144 @@
From 830d0db80f2fce09e12c117f8338b8e4b05866ff Mon Sep 17 00:00:00 2001
From: Pascal Winkelmann <pascal@wnklmnn.de>
Date: Tue, 19 May 2020 10:28:31 +0200
Subject: [PATCH] fixpaths
---
KeePass/Native/NativeMethods.Unix.cs | 2 +-
KeePass/UI/UISystemFonts.cs | 2 +-
KeePass/Util/AppLocator.cs | 2 +-
KeePass/Util/ClipboardUtil.Unix.cs | 14 +++++++-------
KeePassLib/Native/ClipboardU.cs | 2 +-
KeePassLib/Native/NativeLib.cs | 2 +-
KeePassLib/Utility/MonoWorkarounds.cs | 4 ++--
7 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/KeePass/Native/NativeMethods.Unix.cs b/KeePass/Native/NativeMethods.Unix.cs
index 4c47258..79cfdb2 100644
--- a/KeePass/Native/NativeMethods.Unix.cs
+++ b/KeePass/Native/NativeMethods.Unix.cs
@@ -130,7 +130,7 @@ namespace KeePass.Native
try
{
Application.DoEvents(); // E.g. for clipboard updates
- string strOutput = NativeLib.RunConsoleApp("xdotool", strParams);
+ string strOutput = NativeLib.RunConsoleApp("@xdotool@", strParams);
Application.DoEvents(); // E.g. for clipboard updates
return (strOutput ?? string.Empty);
}
diff --git a/KeePass/UI/UISystemFonts.cs b/KeePass/UI/UISystemFonts.cs
index 08d6134..2bfa4a2 100644
--- a/KeePass/UI/UISystemFonts.cs
+++ b/KeePass/UI/UISystemFonts.cs
@@ -188,7 +188,7 @@ namespace KeePass.UI
private static void UbuntuLoadFonts()
{
- string strDef = NativeLib.RunConsoleApp("gsettings",
+ string strDef = NativeLib.RunConsoleApp("@gsettings@",
"get org.gnome.desktop.interface font-name");
if(strDef == null) return;
diff --git a/KeePass/Util/AppLocator.cs b/KeePass/Util/AppLocator.cs
index af02803..8a32c9d 100644
--- a/KeePass/Util/AppLocator.cs
+++ b/KeePass/Util/AppLocator.cs
@@ -429,7 +429,7 @@ namespace KeePass.Util
if(NativeLib.GetPlatformID() == PlatformID.MacOSX)
strArgPrefix = string.Empty; // FR 3535696
- string str = NativeLib.RunConsoleApp("whereis", strArgPrefix + strApp);
+ string str = NativeLib.RunConsoleApp("@whereis@", strArgPrefix + strApp);
if(str == null) return null;
str = str.Trim();
diff --git a/KeePass/Util/ClipboardUtil.Unix.cs b/KeePass/Util/ClipboardUtil.Unix.cs
index ab49ee2..7f6c50f 100644
--- a/KeePass/Util/ClipboardUtil.Unix.cs
+++ b/KeePass/Util/ClipboardUtil.Unix.cs
@@ -62,7 +62,7 @@ namespace KeePass.Util
// "-out -selection clipboard");
// if(str != null) return str;
- string str = NativeLib.RunConsoleApp("xsel",
+ string str = NativeLib.RunConsoleApp("@xsel@",
"--output --clipboard", null, XSelFlags);
if(str != null) return str;
@@ -83,10 +83,10 @@ namespace KeePass.Util
if(string.IsNullOrEmpty(str))
{
// xsel with an empty input can hang, thus use --clear
- if(NativeLib.RunConsoleApp("xsel", "--clear --primary",
+ if(NativeLib.RunConsoleApp("@xsel@", "--clear --primary",
null, XSelFlags) != null)
{
- NativeLib.RunConsoleApp("xsel", "--clear --clipboard",
+ NativeLib.RunConsoleApp("@xsel@", "--clear --clipboard",
null, XSelFlags);
return;
}
@@ -97,10 +97,10 @@ namespace KeePass.Util
}
// xsel does not support --primary and --clipboard together
- if(NativeLib.RunConsoleApp("xsel", "--input --primary",
+ if(NativeLib.RunConsoleApp("@xsel@", "--input --primary",
str, XSelFlags) != null)
{
- NativeLib.RunConsoleApp("xsel", "--input --clipboard",
+ NativeLib.RunConsoleApp("@xsel@", "--input --clipboard",
str, XSelFlags);
return;
}
diff --git a/KeePassLib/Native/ClipboardU.cs b/KeePassLib/Native/ClipboardU.cs
index 291c51d..3c76380 100644
--- a/KeePassLib/Native/ClipboardU.cs
+++ b/KeePassLib/Native/ClipboardU.cs
@@ -27,7 +27,7 @@ namespace KeePassLib.Native
{
internal static class ClipboardU
{
- internal const string XSel = "xsel";
+ internal const string XSel = "@xsel@";
private const string XSelV = "--version";
private const string XSelR = "--output --clipboard";
private const string XSelC = "--clear --clipboard";
diff --git a/KeePassLib/Native/NativeLib.cs b/KeePassLib/Native/NativeLib.cs
index 2d227a3..243f4ee 100644
--- a/KeePassLib/Native/NativeLib.cs
+++ b/KeePassLib/Native/NativeLib.cs
@@ -145,7 +145,7 @@ namespace KeePassLib.Native
// Mono returns PlatformID.Unix on Mac OS X, workaround this
if(m_platID.Value == PlatformID.Unix)
{
- if((RunConsoleApp("uname", null) ?? string.Empty).Trim().Equals(
+ if((RunConsoleApp("@uname@", null) ?? string.Empty).Trim().Equals(
"Darwin", StrUtil.CaseIgnoreCmp))
m_platID = PlatformID.MacOSX;
}
diff --git a/KeePassLib/Utility/MonoWorkarounds.cs b/KeePassLib/Utility/MonoWorkarounds.cs
index e20bb3a..4fd875b 100644
--- a/KeePassLib/Utility/MonoWorkarounds.cs
+++ b/KeePassLib/Utility/MonoWorkarounds.cs
@@ -41,7 +41,7 @@ namespace KeePassLib.Utility
{
public static class MonoWorkarounds
{
- private const string AppXDoTool = "xdotool";
+ private const string AppXDoTool = "@xdotool@";
private static Dictionary<uint, bool> g_dForceReq = new Dictionary<uint, bool>();
private static Thread g_thFixClip = null;
@@ -335,7 +335,7 @@ namespace KeePassLib.Utility
// }
// else { Debug.Assert(false); }
- string strWmClass = (NativeLib.RunConsoleApp("xprop",
+ string strWmClass = (NativeLib.RunConsoleApp("@xprop@",
"-id " + strHandle + " WM_CLASS") ?? string.Empty);
if(strWmClass.IndexOf("\"" + PwDefs.ResClass + "\"",
--
2.25.4

View file

@ -0,0 +1 @@
+ m_pluginManager.LoadAllPlugins("$PATH$/lib/dotnet/keepass", System.IO.SearchOption.TopDirectoryOnly, new string[] {});

View file

@ -0,0 +1,25 @@
From 4cb0b18f5326a07927453897180289a4b254ac4f Mon Sep 17 00:00:00 2001
From: Pascal Winkelmann <pascal@wnklmnn.de>
Date: Tue, 19 May 2020 10:43:49 +0200
Subject: [PATCH] loadplugin
---
KeePass/Forms/MainForm.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/KeePass/Forms/MainForm.cs b/KeePass/Forms/MainForm.cs
index 347eaf5..b92e1e2 100644
--- a/KeePass/Forms/MainForm.cs
+++ b/KeePass/Forms/MainForm.cs
@@ -440,7 +440,$OUTPUT_LC$ @@ namespace KeePass.Forms
ToolStripItemCollection tsicT = m_ctxTray.Items;
ToolStripItem tsiPrevT = m_ctxTrayOptions;
- m_pluginManager.LoadAllPlugins();
$DO_LOADS$+
m_pluginManager.AddMenuItems(PluginMenuType.Main, tsicM, tsiPrevM);
m_pluginManager.AddMenuItems(PluginMenuType.Group, tsicGM, tsiPrevGM);
--
2.25.4