-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add script to upload packages to web server #1
Conversation
Signed-off-by: oreiss <oreiss@nvidia.com>
scripts/populate_file_web_server.py
Outdated
if PRINT_LEVEL_LUT[g_current_print_level] >= PRINT_LEVEL_LUT[PRINT_LEVEL_INFO]: | ||
print(msg) | ||
|
||
def info_print_in_place(msg): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use info_print with an additional optional parameter rather than writing a new function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I will change it accordingly
scripts/populate_file_web_server.py
Outdated
if PRINT_LEVEL_LUT[g_current_print_level] >= PRINT_LEVEL_LUT[PRINT_LEVEL_WARN]: | ||
print(msg) | ||
|
||
def error_print(msg): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have one API to encapsulate the logging logic and then list of APIs which call based on level? Example below. In this way in future if we want to extend how we log we can just modify in one place
def log(level, msg):
if PRINT_LEVEL_LUT[g_current_print_level] >= PRINT_LEVEL_LUT[level]:
print(msg)
def error_print(msg):
log(PRINT_LEVEL_ERROR, mst)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I will change it accordingly
|
||
for subdir, dirs, files in os.walk(serach_path): | ||
for file in files: | ||
if False == filter_out_dir(subdir) and RESOURCES_FILE_NAME == file: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How are the version-web files going to be maintained? Will it be populated manually? Can you please provide some insights?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
version-web are generated as part of the flow of first "SONiC reproducible build". Later they are being used on any compilation. The script is only parsing the existing files in the specified path
Signed-off-by: oreiss <oreiss@nvidia.com>
scripts/populate_file_web_server.py
Outdated
@@ -1,3 +1,5 @@ | |||
#!/usr/bin/python3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#!/usr/bin/env python3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
scripts/populate_file_web_server.py
Outdated
def verbose_print(msg): | ||
if PRINT_LEVEL_LUT[g_current_print_level] >= PRINT_LEVEL_LUT[PRINT_LEVEL_VERBOSE]: | ||
print(msg) | ||
def print_msg(print_level, msg, print_in_place): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can have default value for print_in_place=False. In the invocations below other than when it needs to be true, you can ignore this parameter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
scripts/populate_file_web_server.py
Outdated
def create_dir_if_not_exist(dir): | ||
if not os.path.exists(dir): | ||
try: | ||
os.mkdir(dir) | ||
except: | ||
warn_print("Cannot create directory " + dir) | ||
print_msg(PRINT_LEVEL_WARN, "Cannot create directory " + dir, False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove False after setting the default value. Applies to other changes below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Signed-off-by: oreiss <oreiss@nvidia.com>
@orenreiss The changes look good. However I wanted to understand how possible is it to add UT to the changes? |
Internal PR was approved. CI passed. Now raising external PR |
Signed-off-by: oreiss oreiss@nvidia.com
Why I did it
The flow of SONiC reproducible build assumes that web packages (retrieved by curl and wget) are located in a single web file.
server. Currently there is no way to easily download the packages from the various file servers where they are currently deployed.
In this change we offer a utility to download all relevant packages and upload them to a specific file server.
How I did it
We implemented python script that parse the various version files (generated by SONIC reproducible build compilation) and identify all relevant packages.
Later the script downloads the file and then upload them to the destination server pointed by the user.
How to verify it
Script was verified manually
Which release branch to backport (provide reason below if selected)
Feature will be added to master only
Description for the changelog
Ensure to add label/tag for the feature raised. example - PR#2174 under sonic-utilities repo. where, Generic Config and Update feature has been labelled as GCU.
Link to config_db schema for YANG module changes
no changes in DB or object module
A picture of a cute animal (not mandatory but encouraged)
:)