[banshee] [solitary] copy and strip located items into a bundle
- From: Aaron Bockover <abock src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [banshee] [solitary] copy and strip located items into a bundle
- Date: Wed, 30 Dec 2009 01:06:41 +0000 (UTC)
commit 46c53f00c81d1dd6b66cec7f247a65182a9eaa1b
Author: Aaron Bockover <abockover novell com>
Date: Tue Dec 29 20:06:20 2009 -0500
[solitary] copy and strip located items into a bundle
build/bundle/mkbundle.osx | 4 ++++
build/bundle/solitary/Entry.cs | 18 +++++++++++-------
build/bundle/solitary/Item.cs | 3 +--
build/bundle/solitary/Solitary.cs | 34 +++++++++++++++++++++++++++++++++-
4 files changed, 49 insertions(+), 10 deletions(-)
---
diff --git a/build/bundle/mkbundle.osx b/build/bundle/mkbundle.osx
index 64d3a72..211fa10 100755
--- a/build/bundle/mkbundle.osx
+++ b/build/bundle/mkbundle.osx
@@ -10,12 +10,16 @@ source osx.env
export BANSHEE_PATH="$BUILD_PREFIX/lib/banshee-1"
export MONO_PATH="$BANSHEE_PATH:$BANSHEE_PATH/Extensions:$BANSHEE_PATH/Backends"
+OUTPUT_DIR=$PWD/bundle
+
echo "Using mono: $(which mono)"
cd solitary
make
mono --debug Solitary.exe \
--mono-prefix=$BUILD_PREFIX \
--root=$BUILD_PREFIX \
+ --out=$OUTPUT_DIR \
+ $BUILD_PREFIX/bin/mono \
$BANSHEE_PATH \
$BUILD_PREFIX/lib/gstreamer-0.10
diff --git a/build/bundle/solitary/Entry.cs b/build/bundle/solitary/Entry.cs
index b700547..5cc26c7 100644
--- a/build/bundle/solitary/Entry.cs
+++ b/build/bundle/solitary/Entry.cs
@@ -42,6 +42,7 @@ public static class Entry
var p = new OptionSet () {
{ "p|mono-prefix=", "set the mono prefix (e.g. to find etc/mono/config)", v => solitary.MonoPrefix = v },
{ "r|root=", "set the confinement root - any files outside of the root will be ignored", v => solitary.ConfinementRoot = v },
+ { "o|out=", "directory into which the bundle should be placed", v => solitary.OutputPath = v },
{ "b|blacklist=", "blacklist file to exclude native libraries from the summary", v => blacklist_file = v },
{ "h|help", "show this message and exit", v => show_help = v != null }
};
@@ -66,20 +67,23 @@ public static class Entry
solitary.LoadBlacklist (blacklist_file);
long total_size = 0;
+ Console.WriteLine ("Locating items...");
foreach (var path in paths) {
foreach (var item in solitary.Walk (path)) {
foreach (var collect_item in item.Load ()) {
solitary.Items.Add (collect_item);
total_size += collect_item.File.Length;
-
- if (solitary.ConfinementRoot != null) {
- Console.WriteLine (collect_item.File.FullName.Substring (solitary.ConfinementRoot.Length + 1));
- } else {
- Console.WriteLine (collect_item.File.FullName);
- }
+ Console.WriteLine (" + {0} ({1} KB)",
+ collect_item.File.Name,
+ collect_item.File.Length / 1024);
}
}
}
- Console.WriteLine (total_size);
+ Console.WriteLine ("Done locating items. Total size is {0} KB.",
+ total_size / 1024);
+
+ Console.WriteLine ("Creating bundle...");
+ solitary.CreateBundle (true);
+ Console.WriteLine ("Done.");
}
}
diff --git a/build/bundle/solitary/Item.cs b/build/bundle/solitary/Item.cs
index 5d69c46..9c65721 100644
--- a/build/bundle/solitary/Item.cs
+++ b/build/bundle/solitary/Item.cs
@@ -75,8 +75,7 @@ public abstract class Item
case ".exe":
item = new AssemblyItem ();
break;
- case ".so":
- case ".dylib":
+ default:
item = new NativeLibraryItem ();
break;
}
diff --git a/build/bundle/solitary/Solitary.cs b/build/bundle/solitary/Solitary.cs
index 83e737e..9ca7fd9 100644
--- a/build/bundle/solitary/Solitary.cs
+++ b/build/bundle/solitary/Solitary.cs
@@ -26,6 +26,7 @@
using System;
using System.IO;
+using System.Diagnostics;
using System.Collections.Generic;
public class Solitary
@@ -35,6 +36,7 @@ public class Solitary
public List<string> SearchPaths { get; private set; }
public string MonoPrefix { get; set; }
public string ConfinementRoot { get; set; }
+ public string OutputPath { get; set; }
private class BlacklistComparer : IEqualityComparer<string>
{
@@ -134,5 +136,35 @@ public class Solitary
yield return item;
}
}
- }
+ }
+
+ public void CreateBundle (bool strip)
+ {
+ Directory.CreateDirectory (OutputPath);
+
+ foreach (var item in Items) {
+ var path = item.File.FullName;
+ if (ConfinementRoot != null) {
+ path = path.Substring (ConfinementRoot.Length + 1);
+ }
+ path = Path.Combine (OutputPath, path);
+
+ Directory.CreateDirectory (Path.GetDirectoryName (path));
+ if (!strip || !StripBinary (item.File.FullName, path)) {
+ File.Copy (item.File.FullName, path);
+ }
+ }
+ }
+
+ private static bool StripBinary (string source, string target)
+ {
+ var proc = Process.Start (new ProcessStartInfo ("strip",
+ String.Format ("-u -r -o \"{1}\" \"{0}\"", source, target)) {
+ RedirectStandardOutput = true,
+ RedirectStandardError = true,
+ UseShellExecute = false
+ });
+ proc.WaitForExit ();
+ return proc.ExitCode == 0;
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]