Skip to content
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

Refactor config functions code #1833

Merged
merged 1 commit into from
Jun 5, 2021
Merged

Refactor config functions code #1833

merged 1 commit into from
Jun 5, 2021

Conversation

schaefi
Copy link
Collaborator

@schaefi schaefi commented Jun 1, 2021

Reorganize the code into more readable areas like methods
present as helpers, methods for customers, methods which are
distribution specific and also methods that are deprecated
and give a good reason why they are deprecated when they
get called. This is related to Issue #1828

@schaefi schaefi requested a review from dcermak June 1, 2021 09:53
@schaefi schaefi self-assigned this Jun 1, 2021
@schaefi
Copy link
Collaborator Author

schaefi commented Jun 1, 2021

@dcermak I know this is hard to review because I moved code blocks into more readable areas of the file. Most interesting is the data in the section about deprecated methods. Please see the reasons I gave with any deprecation and if you think I did something wrong just veto in :)

Other than that this is only moving existing code and fixing some long line issues

If we are ok with that (and I'm willing to take the blame from customers) I think we should apply your test suite concept on the rest of the code.

Copy link
Collaborator

@dcermak dcermak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I must confess that I did not check if anything changed in the code when you moved a lot of the functions around, so I trust you here 😉.

I am not entirely sure whether a deprecation warning is really enough though, as I think most of these functions are simply kept to rot in legacy config.sh scripts on OBS & IBS where no one looks at the logs, unless they blow up. So maybe we should add some more drastic measures here like failing the build unless you set a environment variable (or do that in a year or so…).

kiwi/config/functions.sh Outdated Show resolved Hide resolved
@schaefi
Copy link
Collaborator Author

schaefi commented Jun 1, 2021

I am not entirely sure whether a deprecation warning is really enough though, as I think most of these functions are simply kept to rot in legacy config.sh scripts on OBS & IBS where no one looks at the logs, unless they blow up. So maybe we should add some more drastic measures here like failing the build unless you set a environment variable (or do that in a year or so…).

I agree, we should be more "aggressive" and fail the script in these cases. I'll adapt

Reorganize the code into more readable areas like methods
present as helpers, methods for customers, methods which are
distribution specific and also methods that are deprecated
and give a good reason why they are deprecated when they
get called. This is related to Issue #1828
Comment on lines +190 to +191
/lib/x86_64-linux-gnu/"$libname"* \
/usr/lib/x86_64-linux-gnu/"$libname"* \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't work for non-x86_64 machines.

Comment on lines +567 to +570
if [ -f /etc/SuSE-brand ];then
prod=$(head /etc/SuSE-brand -n 1)
elif [ -f /etc/os-release ];then
prod=$(grep "^NAME" /etc/os-release | cut -d '=' -f 2 | cut -d '"' -f 2)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be flipped. Also, os-release can be sourced in a shell script, so you can simplify this.

@dcermak
Copy link
Collaborator

dcermak commented Jun 1, 2021 via email

@Conan-Kudo
Copy link
Member

@dcermak when you source them, the quotes are already stripped when you echo the variable

@schaefi
Copy link
Collaborator Author

schaefi commented Jun 1, 2021

@dcermak @Conan-Kudo thanks for the review. Please keep in mind I haven't changed the code, just re-organized by moving and dropped obsolete code. I'm sure the code has issues too, but can we first finish the refactor and look at the code in detail afterwards and create followup PRs for each issue we find ?

Thanks

@dcermak
Copy link
Collaborator

dcermak commented Jun 2, 2021 via email

@schaefi
Copy link
Collaborator Author

schaefi commented Jun 4, 2021

I'd like to move forward with this one now. My plan would be

  • merge the refactor from here, without substantial code changes from non deprecated functions
  • submit to Staging, check integration test results. If deprecated methods are used the build will now fail
  • On failed builds check why and update either the description or the methods from here
  • Continue improving the code in functions.sh which is left. Taking into account what @Conan-Kudo and @dcermak said here
  • Continue adding the changes from the other PRs from @dcermak
  • Continue adding the testsuite as suggested by @dcermak

Unless there are objections I'll go ahead now with this approach

Copy link
Collaborator

@dcermak dcermak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me @schaefi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants