[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r16803 - gnunet-update
From: |
gnunet |
Subject: |
[GNUnet-SVN] r16803 - gnunet-update |
Date: |
Tue, 13 Sep 2011 14:04:42 +0200 |
Author: harsha
Date: 2011-09-13 14:04:42 +0200 (Tue, 13 Sep 2011)
New Revision: 16803
Added:
gnunet-update/README
gnunet-update/package.py
Log:
initial load
Added: gnunet-update/README
===================================================================
--- gnunet-update/README (rev 0)
+++ gnunet-update/README 2011-09-13 12:04:42 UTC (rev 16803)
@@ -0,0 +1,61 @@
+What is gnunet-update?
+======================
+
+This program facilitates updates to a GNUnet installation. Updates are
+handled by the peers in GNUnet.
+
+This is an ALPHA release. There are known and significant bugs as
+well as many missing features in this release.
+
+Additional documentation about GNUnet can be found at
+https://gnunet.org/.
+
+
+How does it work?
+=================
+
+On a computer with GNUnet installation, it checks all the binaries and
+libraries of GNUnet for dependencies and identifies them. These
+dependencies may include system libraries.
+
+After determining the dependencies they are packed along with the
+binaries and libraries into a package which can be exported to other
+peers. This update package includes the host system information such
+as architecture, OS, etc. as meta-data. Meta-data also includes the
+version information of the dependencies.
+
+When a peer wants to update its installation. It searches in the
+network for a suitable update package and downloads the package's
+meta-data. From the meta-data, it determines which dependencies are
+not satisfied locally. It then downloads those dependencies from peers
+and installs them. It then proceeds to in the new GNUnet
+installation.
+
+
+Know issues and solutions
+=========================
+
+There could be some problems in the way the dependencies are
+handled. The dependencies are tracked using their version
+information. Although most of the libraries follow the version
+numbering descibed by libtool. Some, e.g: libc, may not have the
+version numbers as specified. Such libraries must be explicitly
+handled. In case of libc only one number is present in its version. We
+deem a libc library dependency compatible only if there is a libc with
+the same version number installed on the system.
+
+Another issue may be present with certain shared object files which
+may not have any version information, e.g: plugins in GNUnet. Again,
+these objects have to be explicitly defined for the software to
+consider them in the updates.
+
+The program uses ldd to find out the dependencies. However certain
+shared object files may not be included as a dynamic load object in a
+binary or libraries. For example, most of the plugins are built like
+this. These shared objects are loaded by the application
+dynamically. Their location is know/determined by the application.
+These objects differ from the shared objects which are loaded by loader
+as the loader knows where to find them. Hence, they may not show up
+in the output of ldd and so we need to explicitly include them in the
+updates.
+
Added: gnunet-update/package.py
===================================================================
--- gnunet-update/package.py (rev 0)
+++ gnunet-update/package.py 2011-09-13 12:04:42 UTC (rev 16803)
@@ -0,0 +1,185 @@
+#!/usr/bin/python
+#File: package.py
+#Author: Sree Harsha Totakura
+
+#python script to build, install and package along with dependencies the given
+#gnunet source tree
+
+import getopt
+import sys
+import os
+import subprocess
+
+#static variables
+configure = False
+build = False
+install = False
+gnunet_src = ""
+install_prefix = ""
+extractor_base = ""
+libcurl_base = ""
+microhttpd_base = ""
+deps = set()
+
+def usage():
+ """Print helpful usage information
+ """
+
+ print """
+Usage: package.py [options] [configure_options] /path/to/gnunet/source
+Without any options the source tree is configured with configure_options, built
+and installed. Without any configure_options the source tree is configured
with
+system defaults
+
+Options:
+ -c : configure the source
+ -b : Builds the source in the same directory
+ -i : Installs gnunet (into the prefix, if set)
+ -h, --help : Print this message
+
+Configure options:
+ --prefix=PREFIX : The directory into which gnunet is to be installed
+ --with-extractor=PFX : base of libextractor installation
+ --with-libcurl=PFX : base of libcurl installation
+"""
+
+def run_configure():
+ """Runs configure on the given source tree
+ """
+
+ #if ./configure is not present run bootstrap
+ if not os.path.isfile("./configure"):
+ proc = subprocess.Popen("",bufsize=-1, executable="./bootstrap");
+ if 0 != proc.wait():
+ print "Bootstrapping failed! Exiting."
+ sys.exit(1)
+
+ #Ideally, by now we should have generated ./configure
+ if os.access("./configure", os.R_OK|os.X_OK):
+ proc_args = ["./configure"]
+ if "" != install_prefix:
+ proc_args.append("--prefix=" + install_prefix);
+ if "" != extractor_base:
+ proc_args.append("--with-extractor=" + extractor_base);
+ if "" != libcurl_base:
+ proc_args.append("--with-libcurl=" + libcurl_base);
+ if "" != microhttpd_base:
+ proc_args.append("--with-microhttpd=" + microhttpd_base);
+
+ #now run the configure subprocess
+ proc = subprocess.Popen(proc_args, bufsize = -1)
+ if 0 != proc.wait():
+ print "Configure on the given source tree failed"
+ sys.exit(1)
+
+def run_make():
+ """Runs make on the given source tree
+ """
+
+ if "" != libcurl_base:
+ new_environ = os.environ.copy()
+ new_environ["CFLAGS"] = "-I"+libcurl_base
+ proc = subprocess.Popen("make", bufsize = -1)
+ if 0 != proc.wait():
+ print "Cannot build the source tree. make failed"
+ sys.exit(1)
+
+def run_make_install():
+ """Installs the compiled binaries in the given source tree by running make
+ install
+ """
+
+ proc = subprocess.Popen(["make", "install"], bufsize = -1)
+ if 0 != proc.wait():
+ print "Failed while installing the compiled binaries."
+ sys.exit(1)
+
+def strip(str):
+ """ helper function to strip any trailing characters"
+ """
+ return str.strip()
+
+def extract_deps(ldd_line):
+ """ extracts the path of the dependency from ldd's output line
+ """
+ tokens = map (strip, ldd_line.split(' => '))
+ tokens[-1] = tokens[-1].rsplit(' ', 1)[0]
+ return tokens
+
+def get_deps:
+ """Extract dependencies from ldd output
+ """
+ for root, dirs, files in os.walk(install_prefix):
+ for file in files:
+ proc = subprocess.Popen(["ldd", os.path.join(root, file)],
+ bufsize = -1, stdout = subprocess.PIPE)
+ (proc_stdout, proc_stderr) = proc.communicate()
+ if 0 != proc.returncode:
+ continue
+
+
+
+
+def run(action):
+ """main control procedure
+ """
+ #change the directory to gnunet_src
+ os.chdir(gnunet_src)
+ if configure :
+ run_configure()
+ if build:
+ run_make()
+ if install:
+ run_make_install()
+
+
+
+
+
+
+
+
+
+#first parse the command line arguments
+try:
+ opts, args = getopt.getopt(sys.argv[1:],
+ "cbih",
+ ["help", "prefix=", "with-extractor=",
+ "with-libcurl=", "with-microhttpd="])
+
+except getopt.GetoptError, err:
+ print err
+ print "Exception occured"
+ usage()
+ sys.exit(2)
+else:
+ for option, value in opts:
+ if option in ("-h", "--help"):
+ usage()
+ sys.exit(2)
+ elif option == "-c":
+ configure = True
+ elif option == "-b":
+ build = True
+ elif option == "-i":
+ install = True
+ elif option == "--prefix":
+ install_prefix = value
+ elif option == "--with-extractor":
+ extractor_base = value
+ elif option == "--with-libcurl":
+ libcurl_base = value
+ elif option == "--with-microhttpd":
+ microhttpd_base = value
+
+ if not (configure or build or install):
+ configure, build, install = True, True, True
+
+ if len(args) != 1:
+ print "Path to gnunet source tree missing!"
+ usage()
+ sys.exit(1)
+ gnunet_src = args[0];
+ run()
+
+
\ No newline at end of file
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r16803 - gnunet-update,
gnunet <=