openSUSE / opi

OBS Package Installer (CLI)
GNU General Public License v3.0
244 stars 22 forks source link

Refactor code #136

Closed nobkd closed 1 year ago

nobkd commented 1 year ago

It's probably the easiest to read the diff of the individual commits instead of comparing everything at once. The commit names should be reasonably accurate in describing what was changed.

Here is a rough summary of the changes:

asdil12 commented 1 year ago

There is a merge commit in the list of commits - maybe you can get rid if that one.

nobkd commented 1 year ago

Okay. Then I'll undo the last 3 commits and resolve your comments (in a few hours). After merging I'll do another pr to change some code pieces you've added previously

nobkd commented 1 year ago

This should resolve the merge conflicts. I've done it this way, because you didn't want to have a Merge commit.

opi/__init__.py
1. ```py 'alias': mainsec, 'filename': re.sub(r'\.repo$', '', repo_file), 'name': cp[mainsec].get('name', mainsec), 'url': cp.get(mainsec, 'baseurl'), } if cp.has_option(mainsec, 'gpgkey'): repo['gpgkey'] = cp.get(mainsec, 'gpgkey') ```
2. ```py if binary['obs_instance'] == 'LOCAL_REPO': existing_repo = repository else: repo_alias = project.replace(':', '_') project_path = project.replace(':', ':/') if config.get_key_from_config('use_releasever_var'): version = get_version() if version: # version is None on tw repository = repository.replace(version, '$releasever') url = f'https://download.opensuse.org/repositories/{project_path}/{repository}/' gpgkey = url + 'repodata/repomd.xml.key' existing_repo = get_enabled_repo_by_url(url) ```
3. ```py print('This key is still in use by the following remaining repos - removal is NOT recommended:') print(' - ' + '\n - '.join([repo['filename'] for repo in repos_using_this_key])) ```
4. ```py if not ask_yes_or_no(f"Do you want to keep the repo '{repo}'?"): repo_info = next((r for r in get_repos() if r['filename'] == repo)) ```
5. ```py if binary['obs_instance'] not in ('openSUSE', 'LOCAL_REPO'): project = f"{binary['obs_instance']} {project}" ```

opi/plugins/zoom.py
1. ```py key_url = 'https://zoom.us/linux/download/pubkey?version=5-12-6' ```
asdil12 commented 1 year ago

Could you resolve that merge conflicts by running git pull --rebase origin master to rebase onto origin/master? That way you don't need to add a merge commit.