Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorRodrigo Kumpera <kumpera@users.noreply.github.com>2017-03-16 22:23:10 +0300
committerGitHub <noreply@github.com>2017-03-16 22:23:10 +0300
commitddae67da8a0218d4a072c99a69a2e26150b4a3a9 (patch)
tree821499890afd0125fdc84150678a9fced94b1c6c /tools
parent15145d0554f08c6eedf821611d317c23ed90cb8a (diff)
parent59e8fa77d7abc5e279c26e56fcae7a2c6b30a108 (diff)
Merge pull request #4536 from kumpera/block-rebind-of-banned-assemblies
Reject rebinds that target one of the banned assemblies.
Diffstat (limited to 'tools')
-rw-r--r--tools/nuget-hash-extractor/Makefile13
-rwxr-xr-xtools/nuget-hash-extractor/download.sh4
-rw-r--r--tools/nuget-hash-extractor/nuget-hash-extractor.cs23
3 files changed, 34 insertions, 6 deletions
diff --git a/tools/nuget-hash-extractor/Makefile b/tools/nuget-hash-extractor/Makefile
index 1d52b77c0cf..371aca44bbf 100644
--- a/tools/nuget-hash-extractor/Makefile
+++ b/tools/nuget-hash-extractor/Makefile
@@ -4,10 +4,19 @@ SOURCES = \
nuget-hash-extractor.exe: $(SOURCES)
mcs /r:System.Xml.Linq /r:System.IO.Compression -o:nuget-hash-extractor.exe $(SOURCES)
-download:
+.download_stamp_file: Makefile download.sh
echo "Downloading all the nugets"; \
./download.sh
-run: nuget-hash-extractor.exe
+download: .download_stamp_file
+
+run: nuget-hash-extractor.exe .download_stamp_file
mono nuget-hash-extractor.exe nugets
+
+run-asm: nuget-hash-extractor.exe .download_stamp_file
+ mono nuget-hash-extractor.exe nugets asm
+
+run-ver: nuget-hash-extractor.exe .download_stamp_file
+ mono nuget-hash-extractor.exe nugets ver
+
.PHONY: download run
diff --git a/tools/nuget-hash-extractor/download.sh b/tools/nuget-hash-extractor/download.sh
index f79ee5f351c..a16a3bfac02 100755
--- a/tools/nuget-hash-extractor/download.sh
+++ b/tools/nuget-hash-extractor/download.sh
@@ -33,4 +33,6 @@ wget https://www.nuget.org/api/v2/package/System.Reflection.DispatchProxy/4.0.0
#System.ValueTuple
wget https://www.nuget.org/api/v2/package/System.ValueTuple/4.3.0 -O nugets/system.valuetuple.4.3.0.nupkg
-#System.Security.Cryptography.OpenSsl when .net 4.6.2 + 1 is out \ No newline at end of file
+#System.Security.Cryptography.OpenSsl when .net 4.6.2 + 1 is out
+
+touch .download_stamp_file \ No newline at end of file
diff --git a/tools/nuget-hash-extractor/nuget-hash-extractor.cs b/tools/nuget-hash-extractor/nuget-hash-extractor.cs
index 013097f83c8..96b4b7c8c91 100644
--- a/tools/nuget-hash-extractor/nuget-hash-extractor.cs
+++ b/tools/nuget-hash-extractor/nuget-hash-extractor.cs
@@ -33,7 +33,16 @@ class Driver {
LoadAndDump (et, version);
}
}
+
+ static bool dump_asm, dump_ver;
static void Main (string[] args) {
+
+ if (args.Length > 1) {
+ dump_asm = args [1].Equals ("asm");
+ dump_ver = args [1].Equals ("ver");
+ } else {
+ dump_asm = true;
+ }
foreach (var f in Directory.GetFiles (args [0], "*.nupkg")) {
DumpNuget (f);
}
@@ -52,12 +61,13 @@ class Driver {
var data = StreamToArray (entry.Open ());
AppDomain ad = AppDomain.CreateDomain ("parse_" + ++domain_id);
DoParse p = (DoParse)ad.CreateInstanceAndUnwrap (typeof (DoParse).Assembly.FullName, typeof (DoParse).FullName);
- p.ParseAssembly (data, version, entry.Name, entry.FullName);
+ p.ParseAssembly (data, version, entry.Name, entry.FullName, dump_asm, dump_ver);
AppDomain.Unload (ad);
}
}
class DoParse : MarshalByRefObject {
+
static int Hash (string str) {
int h = 5381;
for (int i = 0; i < str.Length; ++i)
@@ -82,7 +92,7 @@ class DoParse : MarshalByRefObject {
return parts[parts.Length - 2];
}
- public void ParseAssembly (byte[] data, string version, string name, string fullname) {
+ public void ParseAssembly (byte[] data, string version, string name, string fullname, bool dump_asm, bool dump_ver) {
var a = Assembly.ReflectionOnlyLoad (data);
var m = a.GetModules ()[0];
var id = m.ModuleVersionId.ToString ().ToUpper ();
@@ -91,6 +101,13 @@ class DoParse : MarshalByRefObject {
string ver_str = version + " " + FileToMoniker (fullname);
- Console.WriteLine ($"IGNORED_ASSEMBLY (0x{hash_code}, {str}, \"{id}\", \"{ver_str}\"),");
+ if (dump_asm)
+ Console.WriteLine ($"IGNORED_ASSEMBLY (0x{hash_code}, {str}, \"{id}\", \"{ver_str}\"),");
+
+ //IGNORED_ASM_VER (SYS_IO_COMPRESSION, 4, 1, 2, 0),
+ var ver = a.GetName ().Version;
+ if (dump_ver)
+ Console.WriteLine ($"IGNORED_ASM_VER ({str}, {ver.Major}, {ver.Minor}, {ver.Build}, {ver.Revision}),");
+
}
} \ No newline at end of file