From 37dcd30b6236b33d7785aabbfa94ea66539371ef Mon Sep 17 00:00:00 2001 From: "Auke Booij (tulcod)" Date: Tue, 3 Aug 2010 22:49:17 +0200 Subject: Add generate-metadata action to g-cran, small fix in generate-tree action of g-common --- g_common/g_common.py | 4 +++- g_cran/g_cran.py | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) 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': -- cgit v1.2.3-65-gdbad