[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r17154 - gnunet-update
From: |
gnunet |
Subject: |
[GNUnet-SVN] r17154 - gnunet-update |
Date: |
Mon, 3 Oct 2011 19:57:41 +0200 |
Author: harsha
Date: 2011-10-03 19:57:41 +0200 (Mon, 03 Oct 2011)
New Revision: 17154
Modified:
gnunet-update/package.py
Log:
added packaging
Modified: gnunet-update/package.py
===================================================================
--- gnunet-update/package.py 2011-10-03 17:30:18 UTC (rev 17153)
+++ gnunet-update/package.py 2011-10-03 17:57:41 UTC (rev 17154)
@@ -20,8 +20,7 @@
#File: package.py
#Author: Sree Harsha Totakura
#
-#TODO: Add packaging function which packages all objects and dependencies
-# into a bzip file
+#TODO: Include the Metadata about dependencies in the package file
#python script to build, install and package along with dependencies the given
#gnunet source tree
@@ -31,6 +30,7 @@
import os
import subprocess
import tempfile
+import tarfile
#global variables
configure = False
@@ -38,6 +38,7 @@
install = False
gnunet_src = ""
install_prefix = ""
+package_file = ""
prefix_given = False
config_options = list()
deps = set()
@@ -47,10 +48,10 @@
"""
print """
-Usage: package.py [options] /path/to/gnunet/source
+Usage: package.py [options] /path/to/gnunet/source package-file
This script compiles and builds given gnunet source tree. It then attempts to
-install it and packs the installed files along with their dependencies into an
-exportable package
+install it and packs the installed files along with their dependencies into
+package-file
Options:
-h, --help : prints this message
@@ -68,6 +69,10 @@
"""Runs configure on the given source tree
"""
+ #Clean the directory; it may fail if there is no makefile - ignore it
+ proc = subprocess.Popen(["make", "clean"])
+ proc.wait()
+
#if ./configure is not present run bootstrap
if not os.path.isfile("./configure"):
proc = subprocess.Popen("",bufsize=-1, executable="./bootstrap");
@@ -105,7 +110,7 @@
sys.exit(1)
def strip(str):
- """ helper function to strip any trailing characters"
+ """ helper function to strip any trailing characters
"""
return str.strip()
@@ -132,7 +137,7 @@
#we cannot find a library without its location
if dep[-1][0] == '(':
continue
- #print dep
+ #Add the dependency
deps.add(dep[-1])
def run(action):
@@ -140,22 +145,34 @@
"""
#change the directory to gnunet_src
if "build" == action:
+ current_dir = os.getcwd()
os.chdir(gnunet_src)
run_configure()
run_make()
run_make_install()
+ os.chdir(current_dir)
get_deps(install_prefix)
else :
get_deps(gnunet_src)
+ #package the installed files
+ tar_file = tarfile.open(package_file + ".tgz", 'w:gz')
+ tar_file.add(install_prefix, "install-prefix")
+
print "Here are the dependencies:"
for dep in deps:
print dep
+ if os.path.islink(dep):
+ dep_realpath = os.path.realpath(dep)
+ print "|--" + dep_realpath
+ tar_file.add(dep_realpath,
+ "dependencies/" + os.path.basename(dep_realpath))
if (not prefix_given) and "build" == action:
#FIXME: May be delete the temporary directory after packing?
print "gnunet has been installed into the temp dir: " + install_prefix
+ tar_file.close()
#first parse the command line arguments
@@ -183,11 +200,12 @@
install_prefix = value.strip()[9:]
elif option == "-i":
action = "extract_deps"
- if len(args) != 1:
- print "Path to gnunet source tree missing!"
+ if len(args) != 2:
+ print "Incorrect number of arguments passed"
usage()
sys.exit(1)
gnunet_src = args[0]
+ package_file = args[1]
#if the prefix is not given we need to install into a temporary directory
if not prefix_given:
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r17154 - gnunet-update,
gnunet <=