Generate onos_app rule

There are three genrules:
 1. Build features.xml
 2. Build app.xml
 3. Generate app.oar

Change-Id: I6adfd47fadf40ad2440998071a01894458629ac6
diff --git a/buck-tools/onos_oar.py b/buck-tools/onos_oar.py
new file mode 100755
index 0000000..99fd498
--- /dev/null
+++ b/buck-tools/onos_oar.py
@@ -0,0 +1,38 @@
+#!/usr/bin/env python
+#FIXME Add license
+
+from zipfile import ZipFile
+
+def generateOar(output, files=[]):
+    # Note this is not a compressed zip
+    with ZipFile(output, 'w') as zip:
+        for file, mvnCoords in files:
+            filename = file.split('/')[-1]
+            if mvnCoords == 'NONE':
+                dest = filename
+            else:
+                groupId, artifactId, version = mvnCoords.split(':')
+                groupId = groupId.replace('.', '/')
+                extension = filename.split('.')[-1]
+                if extension == 'jar':
+                    filename = '%s-%s.jar' % ( artifactId, version )
+                dest = 'm2/%s/%s/%s/%s' % ( groupId, artifactId, version, filename )
+            print file, '->', dest
+            zip.write(file, dest)
+
+if __name__ == '__main__':
+    import sys
+
+    if len(sys.argv) < 2:
+        print 'USAGE'
+        sys.exit(1)
+
+    output = sys.argv[1]
+    args = sys.argv[2:]
+
+    if len(args) % 2 != 0:
+        print 'There must be an even number of args: file mvn_coords'
+        sys.exit(2)
+
+    files = zip(*[iter(args)]*2)
+    generateOar(output, files)