gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r18025 - gnunet-update/gnunet_update


From: gnunet
Subject: [GNUnet-SVN] r18025 - gnunet-update/gnunet_update
Date: Sat, 5 Nov 2011 18:53:16 +0100

Author: harsha
Date: 2011-11-05 18:53:16 +0100 (Sat, 05 Nov 2011)
New Revision: 18025

Modified:
   gnunet-update/gnunet_update/install.py
   gnunet-update/gnunet_update/metadata.py
   gnunet-update/gnunet_update/package.py
Log:
install script ready

Modified: gnunet-update/gnunet_update/install.py
===================================================================
--- gnunet-update/gnunet_update/install.py      2011-11-05 15:12:13 UTC (rev 
18024)
+++ gnunet-update/gnunet_update/install.py      2011-11-05 17:53:16 UTC (rev 
18025)
@@ -21,10 +21,6 @@
 #
 #Python sript for installing the packages packed using package script
 #
-#TODO: Add the library install dir and the dependency install dir to 
-#LD_LIBRARY_PATH env variable and notify user to add it to ld.so.conf
-#
-#TODO: Install only required dependencies
 #TODO: run ldconfig on the installed dependency directory
 
 import tarfile
@@ -50,6 +46,26 @@
     -h, --help        : prints this message
 """
 
+def shared_library_setup(install_path):
+    print ("Shared libraries have been installed into the following path:\n"
+           + install_path)
+    print (
+"""To continue runtime usage of these libraries or for any of the installed
+programs to work you must either do one of the following: 
+ * Add the above directory to /etc/ld.so.conf and run `ldconfig' as root so 
that the
+   libraries are stored in the dynamic linker's cache
+ * Add the above directory to LD_LIBRARY_PATH environmental variable. 
Optionally you
+   can save this setting into your ~/.profile file
+
+If you are buildling other software and would like to use the installed
+libraries, you may have to either:
+ * Add the above directory to /etc/ld.so.conf and run `ldconfig' as root
+ * Add the above directory to LD_RUN_PATH environmental variable. Optionally 
you can
+   save this setting into your ~/.profile file
+ * Include the above directory in the linker flags so that the linker can
+   search for it while linking
+ """)
+
 def get_installed_deps():
     """Finds from `ldconfig -v' the installed deps."""
     global installed_deps
@@ -114,13 +130,11 @@
 
     needed_deps = metadata.dependencies
 
-    to_be_installed_deps = [(dep) for dep in needed_deps if dep not in 
installed_deps]
+    dep_filter = ["/lib/ld-linux.so.2"]
+    to_be_installed_deps = [(dep) for dep in needed_deps 
+                            if dep not in installed_deps and 
+                            dep.name not in dep_filter]
 
-    # TODO: Find the dependencies to be installed
-
-    for dep in to_be_installed_deps:
-        print "%s -- %s" % (dep.name, dep.path)
-
     #FIXME: Security warning! Perhaps we should examin the contents of tarfile
     #before extracting
     for member in package_tarfile.getmembers():
@@ -131,8 +145,33 @@
             # Remove the `install-prefix' directory
             member.name = member.name.replace("install-prefix/","",1)
         package_tarfile.extract(member, install_dir)
-        
+    
+    # Install the needed dependencies from tarfile
+    dep_dir = install_dir + "/lib/gnunet-deps"
+    if not os.path.exists(dep_dir):
+        os.makedirs(dep_dir)
+
+    orig_working_dir = os.getcwd()
+    # Change to dep install dir
+    os.chdir(dep_dir)
+
+    for dep in to_be_installed_deps:
+        dep_tarinfo = package_tarfile.getmember("dependencies/" + dep.realname)
+        # Remove the `dependencies/' in member.name
+        dep_tarinfo.name = dep_tarinfo.name.replace("dependencies/","",1)
+        package_tarfile.extract(dep_tarinfo, "./")
+        # Generate symbolic link from dep.name to dep.realname
+        # NOTE: Available only on Unix type systems!
+        if os.path.exists(dep.name):
+            os.remove(dep.name)
+        os.symlink(dep.realname, dep.name)
+
+    os.chdir(orig_working_dir)
     package_tarfile.close()
-    
+
+    print "Installation Successful!"
+    print "GNUNET has been installed at: " + install_dir
+    shared_library_setup(dep_dir)
+
 if "__main__" == __name__:
     main()

Modified: gnunet-update/gnunet_update/metadata.py
===================================================================
--- gnunet-update/gnunet_update/metadata.py     2011-11-05 15:12:13 UTC (rev 
18024)
+++ gnunet-update/gnunet_update/metadata.py     2011-11-05 17:53:16 UTC (rev 
18025)
@@ -147,7 +147,6 @@
         # read the hashes from signatures
         for binary in self.binary_objects:
             read_line = f.readline()
-            print read_line
             if len(read_line) == 0:
                 print "Unrecognized metadata file"
                 error_exit()
@@ -166,7 +165,6 @@
         # read the dependency name, file name(real name) and its hash
         while True:
             read_line = f.readline()
-            print read_line
             if len(read_line) == 0:
                 break
             tokens = read_line.split(';')

Modified: gnunet-update/gnunet_update/package.py
===================================================================
--- gnunet-update/gnunet_update/package.py      2011-11-05 15:12:13 UTC (rev 
18024)
+++ gnunet-update/gnunet_update/package.py      2011-11-05 17:53:16 UTC (rev 
18025)
@@ -139,6 +139,9 @@
                 #we cannot find a library without its location
                 if dep_data[-1][0] == '(':
                     continue
+                # Skip over dependency which we include anyway as binary 
objects
+                if dep_data[-1].startswith(os.path.abspath(install_dir)):
+                    continue
                 #create a new dependency object and add it to the set
                 dep = Dependency(dep_data[0], dep_data[-1])
                 #check in cache if we already saw this dependency




reply via email to

[Prev in Thread] Current Thread [Next in Thread]