summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAuke Booij (tulcod) <auke@tulcod.com>2010-08-03 22:49:17 +0200
committerAuke Booij (tulcod) <auke@tulcod.com>2010-08-03 22:49:17 +0200
commit37dcd30b6236b33d7785aabbfa94ea66539371ef (patch)
tree2da48c3dbcf1d548ee56813af013cdeed96ce529
parentWrite metadata.xml, clean repo, populate profiles/, call drivers' generate-ma... (diff)
downloadg-cran-37dcd30b6236b33d7785aabbfa94ea66539371ef.tar.gz
g-cran-37dcd30b6236b33d7785aabbfa94ea66539371ef.tar.bz2
g-cran-37dcd30b6236b33d7785aabbfa94ea66539371ef.zip
Add generate-metadata action to g-cran, small fix in generate-tree action of g-common
-rw-r--r--g_common/g_common.py4
-rw-r--r--g_cran/g_cran.py6
2 files changed, 9 insertions, 1 deletions
diff --git a/g_common/g_common.py b/g_common/g_common.py
index e7c8ca1..c1df781 100644
--- a/g_common/g_common.py
+++ b/g_common/g_common.py
@@ -139,12 +139,14 @@ def generate_tree(repo_location,generate_manifest,generate_metadata):
metadata_file.close()
#write repo metadata
if not os.path.exists(os.path.join(repo_location,'profiles','repo_name')):
+ import string
#make up a name
#as a lucky guess, use the last part of the repo_location directory location
repo_location_parts=os.path.split(repo_location)
if len(repo_location_parts): #repo might be locaten in /... unlikely, but i was in a good mood while typing this
+ #name chars must be in [a-zA-Z_-] and must not start with a -
raw_name=repo_location_parts[-1]
- name=''.join([x for x in raw_name if x.isalnum() or x=='_' or x=='-']) #hope that there won't be any utf8 issues
+ name=''.join([x for x in raw_name if x in string.ascii_letters+string.digits or x=='_' or x=='-'])
if name[0]=='-': #name may not begin with a hyphen
name=name[1:]
else:
diff --git a/g_cran/g_cran.py b/g_cran/g_cran.py
index 1847d92..3a7b3dc 100644
--- a/g_cran/g_cran.py
+++ b/g_cran/g_cran.py
@@ -91,6 +91,10 @@ def action_package(repo_location,package_name):
print 'GCOMMON_PHASES='+' '.join(defined_phases)
return 0
+def action_generate_metadata(repo_location):
+ #todo, nothing written yet.
+ return 0
+
def usage():
print __doc__
return 0
@@ -110,6 +114,8 @@ def main():
sys.exit(1)
remote_repo=arguments[2]
return action_sync(repo_location,remote_repo)
+ elif action=='generate-metadata':
+ return action_generate_metadata(repo_location)
elif action=='list-categories':
return list_categories(repo_location)
elif action=='list-packages':