Skip to content

Commit

Permalink
Finished and tested.
Browse files Browse the repository at this point in the history
  • Loading branch information
StrahinjaJacimovic committed Oct 16, 2024
1 parent 41b823c commit 7f6d582
Showing 1 changed file with 33 additions and 14 deletions.
47 changes: 33 additions & 14 deletions scripts/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,40 +277,59 @@ def index_release_to_elasticsearch(es : Elasticsearch, index_name, release_detai
'gh_package_name': "mikrosdk.7z"
}
elif 'templates' == name_without_extension:
package_changed = True
if len(metadata_content) > 1:
package_changed = metadata_content[0]['templates']['hash'] != metadata_content[1]['templates']['hash']
templates_version = check_from_index_version(es, index_name, 'templates')
if package_changed:
templates_version = increment_version(templates_version)
package_id = name_without_extension
hash_previous = check_from_index_hash(es, index_name, 'templates')
support.extract_archive_from_url(
asset['url'],
os.path.join(os.path.dirname(__file__), 'test_package'),
token=token
)
hash_new = hash_directory_contents(os.path.join(os.path.dirname(__file__), 'test_package'))
shutil.rmtree(os.path.join(os.path.dirname(__file__), 'test_package'))
asset_version_previous = check_from_index_version(es, index_name, 'templates')
asset_version_new = asset_version_previous
if hash_previous:
if hash_previous != hash_new:
asset_version_new = increment_version(check_from_index_version(es, index_name, 'templates'))
doc = {
"name": name_without_extension,
"version" : templates_version,
"version" : asset_version_new,
"display_name" : "NECTO project templates",
"hidden" : True,
"vendor" : "MIKROE",
"type" : "application",
"download_link" : asset['url'],
"install_location" : "%APPLICATION_DATA_DIR%/templates",
"package_changed": package_changed,
"package_changed": asset_version_previous != asset_version_new,
"hash": hash_new,
"gh_package_name": "templates.7z"
}
elif 'images' == name_without_extension:
package_changed = True
package_id = name_without_extension + '_sdk'
images_version_previous = check_from_index_version(es, index_name, 'images_sdk')
if len(metadata_content) > 1:
package_changed = metadata_content[0]['images']['hash'] != metadata_content[1]['images']['hash']
hash_previous = check_from_index_hash(es, index_name, 'images_sdk')
support.extract_archive_from_url(
asset['url'],
os.path.join(os.path.dirname(__file__), 'test_package'),
token=token
)
hash_new = hash_directory_contents(os.path.join(os.path.dirname(__file__), 'test_package'))
shutil.rmtree(os.path.join(os.path.dirname(__file__), 'test_package'))
asset_version_previous = check_from_index_version(es, index_name, 'images_sdk')
asset_version_new = asset_version_previous
if hash_previous:
if hash_previous != hash_new:
asset_version_new = increment_version(check_from_index_version(es, index_name, 'images_sdk'))
doc = {
"name": 'images_sdk',
"version" : increment_version(images_version_previous),
"version" : asset_version_new,
"display_name" : "mikroSDK Setup images",
"hidden" : True,
"vendor" : "MIKROE",
"type" : "images",
"download_link" : asset['url'],
"install_location" : "%APPLICATION_DATA_DIR%/resources/images",
"package_changed": True,
"package_changed": asset_version_previous != asset_version_new,
"hash": hash_new,
"gh_package_name": "images.7z"
}
elif asset['name'].startswith('board') or \
Expand Down

0 comments on commit 7f6d582

Please sign in to comment.