Skip to content

Commit

Permalink
Update package architecture.
Browse files Browse the repository at this point in the history
1. Put all files in the same dir level (remove assets/)
2. Change installation base dir from /var/lib/ to /usr/share/

Signed-off-by: Bofu Chen (bafu) <bofu@dt42.io>
  • Loading branch information
bafu committed Jul 19, 2018
1 parent fbbea18 commit 718e4fb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions bin/dlmodel2deb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def create_install(work_dirpath):

with open('debian/install', 'w') as f:
package_name = meta['name'] + '-' + meta['version']
package_dirpath = os.path.join('/var/lib/dlmodels', package_name)
package_dirpath = os.path.join('/usr/share/dlmodels', package_name)

# add meta
f.write('{meta} {pkgdir}\n'.format(
Expand All @@ -36,13 +36,13 @@ def create_install(work_dirpath):
pkgdir=package_dirpath))

# add label
f.write('{label} {pkgdir}/assets\n'.format(
f.write('{label} {pkgdir}\n'.format(
label=meta['label'],
pkgdir=package_dirpath))

# add config(s)
for k, v in meta['config'].items():
f.write('{config} {pkgdir}/assets\n'.format(
f.write('{config} {pkgdir}\n'.format(
config=v,
pkgdir=package_dirpath))

Expand Down
10 changes: 5 additions & 5 deletions bin/dlmodel_source
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,17 @@ def create_source_package(meta):
package_name = meta['name'] + '-' + meta['version']
package_dirpath = os.path.join('/tmp', package_name)
subprocess.call(
'mkdir -p {pkgdir}/assets'.format(pkgdir=package_dirpath),
'mkdir -p {pkgdir}'.format(pkgdir=package_dirpath),
shell=True)
shutil.copy2(meta['model'], package_dirpath)
shutil.copy2(meta['label'], os.path.join(package_dirpath, 'assets'))
shutil.copy2(meta['label'], package_dirpath)
for k, v in meta['config'].items():
shutil.copy2(v, os.path.join(package_dirpath, 'assets'))
shutil.copy2(v, package_dirpath)
# update full paths to relative paths in the model package directory
meta['model'] = os.path.basename(meta['model'])
meta['label'] = os.path.join('assets', os.path.basename(meta['label']))
meta['label'] = os.path.basename(meta['label'])
for k, v in meta['config'].items():
meta['config'][k] = os.path.join('assets', os.path.basename(v))
meta['config'][k] = os.path.basename(v)
# create model description file (meta.json)
create_metafile(meta, package_dirpath)
print('Model source package is at ' + package_dirpath)
Expand Down

0 comments on commit 718e4fb

Please sign in to comment.