Skip to content

Commit

Permalink
improving binary package installation
Browse files Browse the repository at this point in the history
  • Loading branch information
gfursin committed Apr 28, 2017
1 parent c4ee209 commit ccadbab
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 12 deletions.
1 change: 1 addition & 0 deletions module/package/.cm/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
}
},
"ck_install_file": "ck-install.json",
"ck_install_file_saved": "ck-install-saved.json",
"copyright": "See CK COPYRIGHT.txt for copyright details",
"desc": "managing software packages (installing tools, registering in CK environments)",
"developer": "Grigori Fursin",
Expand Down
7 changes: 2 additions & 5 deletions module/package/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
"PACKAGE_SKIP_CLEAN_OBJ": "YES",
"PACKAGE_SKIP_CLEAN_SRC_DIR": "YES"}

finstall='ck-install.json'
finstall_saved='ck-install-saved.json'

##############################################################################
# Initialize module

Expand Down Expand Up @@ -1693,7 +1690,7 @@ def distribute(i):
if pp1==pp:
break

ppx=os.path.join(pp1, finstall)
ppx=os.path.join(pp1, cfg['ck_install_file'])
if os.path.isfile(ppx):
found=True
break
Expand Down Expand Up @@ -1839,7 +1836,7 @@ def distribute(i):
z.write(p1, 'install'+os.sep+fn, zip_method)

# ck-install.json
z.write(ftmp, finstall_saved, zip_method)
z.write(ftmp, cfg['ck_install_file_saved'], zip_method)

z.close()
f.close()
Expand Down
6 changes: 5 additions & 1 deletion module/soft/.cm/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
"detect": {
"desc": "detect is given software is already installed and register it in the CK or install it if package exists (the same as 'check')"
},
"find_config_file": {
"desc": "find installation JSON file"
},
"get_version": {
"desc": "low-level function to get version (will be substituted)"
},
Expand All @@ -32,7 +35,8 @@
"desc": "split version"
}
},
"ck_install_file": "ck-install.json",
"ck_install_file": "ck-install.json",
"ck_install_file_saved": "ck-install-saved.json",
"copyright": "See CK COPYRIGHT.txt for copyright details",
"custom_script_name": "customize",
"default_bat_name": "env",
Expand Down
15 changes: 15 additions & 0 deletions module/soft/.cm/updates.json
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,21 @@
"3",
"2"
]
},
{
"author": "Grigori Fursin",
"author_email": "Grigori.Fursin@cTuning.org",
"author_webpage": "http://fursin.net",
"copyright": "See CK COPYRIGHT.txt for copyright details",
"engine": "CK",
"iso_datetime": "2017-04-28T14:48:21.212863",
"license": "See CK LICENSE.txt for licensing details",
"version": [
"1",
"8",
"7",
"1"
]
}
]
}
30 changes: 24 additions & 6 deletions module/soft/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -1744,15 +1744,19 @@ def check(i):
puoa=''

dname=''
xtags=''

rx=find_config_file({'full_path':pf})
if rx['return']>0: return rx
found=rx['found']
xtags=''

if found=='yes':
dx=rx['dict']

cus=dx.get('customize',{})

ev=dx.get('extra_version','')

if dx.get('env_data_uoa','')!='' and env_data_uoa=='':
env_data_uoa=dx['env_data_uoa']

Expand Down Expand Up @@ -2360,16 +2364,18 @@ def show(i):
def find_config_file(i):
"""
Input: {
full_path - where to start search
full_path - where to start search
}
Output: {
return - return code = 0, if successful
> 0, if error
(error) - error text if return > 0
found - 'yes' if found
dict - loaded dict with the configuration ...
found - 'yes' if found
dict - loaded dict with the configuration ...
filename - filename
path - path
}
"""
Expand All @@ -2383,16 +2389,28 @@ def find_config_file(i):
found='no'
d={}

fn=''
pf2=''
while pf1!=pf and pf1!='':
pf2=os.path.join(pf1,cfg['ck_install_file'])
fn=cfg['ck_install_file']
pf2=os.path.join(pf1,fn)
if os.path.isfile(pf2):
rx=ck.load_json_file({'json_file':pf2})
if rx['return']==0:
found='yes'
d=rx['dict']
break
else:
fn=cfg['ck_install_file_saved']
pf2=os.path.join(pf1,fn)
if os.path.isfile(pf2):
rx=ck.load_json_file({'json_file':pf2})
if rx['return']==0:
found='yes'
d=rx['dict']
break

pf=pf1
pf1=os.path.dirname(pf)

return {'return':0, 'found':found, 'dict':d}
return {'return':0, 'found':found, 'dict':d, 'filename':fn, 'path':pf2}

0 comments on commit ccadbab

Please sign in to comment.