[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r18542 - in gnunet-update: etc gnunet_update share/gnunet-u
From: |
gnunet |
Subject: |
[GNUnet-SVN] r18542 - in gnunet-update: etc gnunet_update share/gnunet-update |
Date: |
Sat, 10 Dec 2011 13:18:20 +0100 |
Author: harsha
Date: 2011-12-10 13:18:20 +0100 (Sat, 10 Dec 2011)
New Revision: 18542
Modified:
gnunet-update/etc/gnunet-update.conf
gnunet-update/gnunet_update/config.py
gnunet-update/gnunet_update/file.py
gnunet-update/gnunet_update/install.py
gnunet-update/gnunet_update/package.py
gnunet-update/gnunet_update/update.py
gnunet-update/gnunet_update/util.py
gnunet-update/share/gnunet-update/defaults.conf
Log:
added feature for including external config files
Modified: gnunet-update/etc/gnunet-update.conf
===================================================================
--- gnunet-update/etc/gnunet-update.conf 2011-12-09 17:31:04 UTC (rev
18541)
+++ gnunet-update/etc/gnunet-update.conf 2011-12-10 12:18:20 UTC (rev
18542)
@@ -22,12 +22,6 @@
# Default configuration file
# This section is for signing
-
-[CONFIG]
-# Use this setting to additionally load configuration from user specific files
-# %(HOME)s will be expanded to the value set to the $HOME env variable
-USER_CONFIG_FILE = %(HOME)s/.gnunet-update/gnunet-update.conf
-
[SECURITY]
# Specify which GPG key to use for signing by its Fingerprint
# PGP_SIGN_KEY = 8E68 1D8A 25AB B102 AFB5 4B40 3B6F 8AF1 43C2 1F3B
Modified: gnunet-update/gnunet_update/config.py
===================================================================
--- gnunet-update/gnunet_update/config.py 2011-12-09 17:31:04 UTC (rev
18541)
+++ gnunet-update/gnunet_update/config.py 2011-12-10 12:18:20 UTC (rev
18542)
@@ -29,8 +29,12 @@
class GnunetUpdateConfig:
"""Class for holding configuration."""
- def __init__(self):
- """Constructor."""
+ def __init__(self, config_file=None):
+ """Constructor.
+ config_file :if not None then the configuration is read for this file,
+ if None the default GNUNET_UPDATE_HOME/etc/gnunet-update.conf is
+ prefered
+ """
self._set_defaults()
self._config_parser = ConfigParser.SafeConfigParser(self._defaults)
# Read the bare defaults
@@ -39,21 +43,19 @@
"rb")
self._config_parser.readfp(bare_conf_fd)
bare_conf_fd.close()
- # Read the main configuration
- self._config_parser.read(os.path.join(os.environ['GNUNET_UPDATE_HOME'],
- 'etc/gnunet-update.conf'))
+ if config_file is None:
+ # Read the main configuration
+
self._config_parser.read(os.path.join(os.environ['GNUNET_UPDATE_HOME'],
+ 'etc/gnunet-update.conf'))
+ else:
+ self._config_parser.read(config_file)
- if self._config_parser.get('CONFIG', 'USER_CONFIG_FILE') is not None:
- self._config_parser.read(self._config_parser.get('CONFIG',
-
'USER_CONFIG_FILE'))
-
def _set_defaults(self):
"""Sets the defaults. It is important to do this at run time."""
# The dictionary holding defaults. Every key which is ever used should
# have a default value here
self._defaults = {
'HOME' : os.environ['HOME'],
- 'USER_CONFIG_FILE': None,
'PGP_SIGN_KEY': None,
'PGP_SIGN_KEY_PASSWORD' : None
}
Modified: gnunet-update/gnunet_update/file.py
===================================================================
--- gnunet-update/gnunet_update/file.py 2011-12-09 17:31:04 UTC (rev 18541)
+++ gnunet-update/gnunet_update/file.py 2011-12-10 12:18:20 UTC (rev 18542)
@@ -16,10 +16,10 @@
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
#
-#File: gnunet_update/file_entity.py
+#File: gnunet_update/file.py
#Author: Sree Harsha Totakura
-"""File holdin the FileEntity Classes."""
+"""File holding the FileObject Classes."""
import re
Modified: gnunet-update/gnunet_update/install.py
===================================================================
--- gnunet-update/gnunet_update/install.py 2011-12-09 17:31:04 UTC (rev
18541)
+++ gnunet-update/gnunet_update/install.py 2011-12-10 12:18:20 UTC (rev
18542)
@@ -42,7 +42,8 @@
location.
Options:
- -h, --help : prints this message
+ -h, --help : prints this message
+ -c, --config=FILENAME : use configuration file FILENAME
"""
def shared_library_setup(shared_library_paths):
@@ -67,8 +68,12 @@
def main():
"""Execution start point."""
+ external_config_file = None
+
try:
- opts, args = getopt.getopt(sys.argv[1:], "h", ["help"])
+ opts, args = getopt.getopt(sys.argv[1:],
+ "c:h",
+ ["help", "config="])
except getopt.GetoptError, err:
print err
print "Execption occured"
@@ -78,14 +83,16 @@
for option, value in opts:
if option in ("-h", "--help"):
usage()
- sys.exit(2)
+ sys.exit(0)
+ elif option in ("-c", "--config"):
+ external_config_file = value
if len(args) != 2:
print "Incorrect number of arguments"
usage()
sys.exit(1)
- config = GnunetUpdateConfig() # Configuration
+ config = GnunetUpdateConfig(external_config_file) # Configuration
metadata = util.verify_metadata(args[0],
config.get('SECURITY', 'PGP_SIGN_KEY'))
if metadata is None:
Modified: gnunet-update/gnunet_update/package.py
===================================================================
--- gnunet-update/gnunet_update/package.py 2011-12-09 17:31:04 UTC (rev
18541)
+++ gnunet-update/gnunet_update/package.py 2011-12-10 12:18:20 UTC (rev
18542)
@@ -20,10 +20,6 @@
#File: gnunet_update/package.py
#Author: Sree Harsha Totakura
#
-#TODO: Add revision and public key argument
-#
-#Thoughts:
-#
#python script to build, install and package along with dependencies the given
#gnunet source tree
@@ -47,7 +43,8 @@
install_prefix = ""
package_file = ""
prefix_given = False
-config_options = list()
+external_config_file = None
+configure_options = list()
binary_objects = list()
other_objects = list()
#dependency cache
@@ -62,14 +59,17 @@
package-file. It also generates a metadata file named <package-file>.meta
Options:
- -h, --help : prints this message
- -i : treat the given path as a location where gnunet is
- already installed and package the objects in that path
- -c "option" : options that are to be passed to configure script in
the
- given source tree. Multiple number of such options can
- be specified. These must be enclosed in double quotes.
- E.g: -c "--prefix=/opt/gnunet"
- -c "--with-extractor=/opt/Extractor"
+ -h, --help : prints this message
+ -c, --config=FILENAME : use configuration file FILENAME
+ -i : treat the given path as a location where gnunet
+ is already installed and package the objects in
+ that path
+ -o, --option=OPTION : options that are to be passed to configure
+ script in the given source tree. Multiple
+ number of such options can be specified. These
+ must be enclosed in double quotes.
+ E.g: -c "--prefix=/opt/gnunet"
+ -c "--with-extractor=/opt/Extractor"
"""
@@ -89,12 +89,12 @@
#Ideally, by now we should have generated ./configure
if os.access("./configure", os.R_OK|os.X_OK):
- config_options.insert(0, "./configure")
+ configure_options.insert(0, "./configure")
if not prefix_given:
- config_options.insert(1 ,"--prefix=" + install_prefix)
+ configure_options.insert(1 ,"--prefix=" + install_prefix)
- proc = subprocess.Popen(config_options, bufsize = -1)
+ proc = subprocess.Popen(configure_options, bufsize = -1)
if 0 != proc.wait():
print "Configure on the given source tree failed"
sys.exit(1)
@@ -148,7 +148,8 @@
continue
#create a new ExecutableFileObject instance and collect its
dependencies
- bin_object = ExecutableFileObject(root[len(install_dir) + 1:] +
'/' + file,
+ bin_object =
ExecutableFileObject(os.path.join(root[len(install_dir) + 1:],
+ file),
file_path,
hash=util.hexdigest(file_path))
for dep_data in util.parse_ldd_output(proc_stdout):
@@ -182,7 +183,7 @@
def run(action):
"""control procedure."""
- config = GnunetUpdateConfig();
+ config = GnunetUpdateConfig(external_config_file);
#change the directory to gnunet_src
if "build" == action:
current_dir = os.getcwd()
@@ -256,12 +257,13 @@
global gnunet_src
global install_prefix
global package_file
-
+ global external_config_file
+
#first parse the command line arguments
try:
opts, args = getopt.getopt(sys.argv[1:],
- "c:hi",
- ["help", "config="])
+ "c:o:hi",
+ ["help", "config=", "option="])
except getopt.GetoptError, err:
print err
print "Exception occured"
@@ -274,7 +276,9 @@
usage()
sys.exit(2)
elif option in ("-c", "--config"):
- config_options.append(value)
+ external_config_file = value
+ elif option in ("-o", "--option"):
+ configure_options.append(value)
#check if the user has given an installation prefix
if(value.strip()[0:9] == "--prefix="):
prefix_given = True
Modified: gnunet-update/gnunet_update/update.py
===================================================================
--- gnunet-update/gnunet_update/update.py 2011-12-09 17:31:04 UTC (rev
18541)
+++ gnunet-update/gnunet_update/update.py 2011-12-10 12:18:20 UTC (rev
18542)
@@ -40,13 +40,17 @@
the new version contained in the package_file
Options:
- -h, --help : prints this message
+ -h, --help : prints this message
+ -c, --config=FILENAME : use configuration file FILENAME
"""
def main():
"""Execution start point."""
+ external_config_file = None
try:
- opts, args = getopt.getopt(sys.argv[1:], "h", ["help"])
+ opts, args = getopt.getopt(sys.argv[1:],
+ "c:h",
+ ["help", "config="])
except getopt.GetoptError, err:
print err
print "Execption occured"
@@ -56,14 +60,16 @@
for option, value in opts:
if option in ("-h", "--help"):
usage()
- sys.exit(2)
+ sys.exit(0)
+ if option in ("-c", "--config"):
+ external_config_file = value
if len(args) != 2:
print "Incorrect number of arguments"
usage()
sys.exit(1)
- config = GnunetUpdateConfig() # Configuration
+ config = GnunetUpdateConfig(external_config_file) # Configuration
metadata = util.verify_metadata(args[0],
config.get('SECURITY', 'PGP_SIGN_KEY'))
if metadata is None:
Modified: gnunet-update/gnunet_update/util.py
===================================================================
--- gnunet-update/gnunet_update/util.py 2011-12-09 17:31:04 UTC (rev 18541)
+++ gnunet-update/gnunet_update/util.py 2011-12-10 12:18:20 UTC (rev 18542)
@@ -270,9 +270,9 @@
"""
Extracts objects from tarfile into install_dir
+ objects: list of objects to be extracted
package_tarfile: the tarfile object on which extraction is done
install_dir: the directory where the extracted objects are to be placed
- objects: list of objects to be extracted
installed_files: If not None, it should be a list object. It can be used to
have a list of files extracted into the install_dir
"""
Modified: gnunet-update/share/gnunet-update/defaults.conf
===================================================================
--- gnunet-update/share/gnunet-update/defaults.conf 2011-12-09 17:31:04 UTC
(rev 18541)
+++ gnunet-update/share/gnunet-update/defaults.conf 2011-12-10 12:18:20 UTC
(rev 18542)
@@ -25,6 +25,4 @@
#
# Do NOT edit this file. For customization edit etc/gnunet-update.conf file
-[CONFIG]
-
[SECURITY]
\ No newline at end of file
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r18542 - in gnunet-update: etc gnunet_update share/gnunet-update,
gnunet <=