
Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package opi for openSUSE:Factory checked in at 2022-05-31 17:47:43 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/opi (Old) and /work/SRC/openSUSE:Factory/.opi.new.1548 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "opi" Tue May 31 17:47:43 2022 rev:32 rq:980108 version:2.6.0 Changes: -------- --- /work/SRC/openSUSE:Factory/opi/opi.changes 2022-05-16 18:11:29.909420409 +0200 +++ /work/SRC/openSUSE:Factory/.opi.new.1548/opi.changes 2022-05-31 17:47:44.059314717 +0200 @@ -1,0 +2,8 @@ +Tue May 31 14:44:50 UTC 2022 - Dominik Heidler <dheidler@suse.de> + +- Version 2.6.0 +- Move to global config in /etc/opi.cfg +- Check if desired repo is already added instead of relying on prefix +- Add config option use_releasever_var + +------------------------------------------------------------------- Old: ---- opi-2.5.0.tar.gz New: ---- opi-2.6.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ opi.spec ++++++ --- /var/tmp/diff_new_pack.QtiILo/_old 2022-05-31 17:47:44.535314960 +0200 +++ /var/tmp/diff_new_pack.QtiILo/_new 2022-05-31 17:47:44.539314962 +0200 @@ -17,7 +17,7 @@ Name: opi -Version: 2.5.0 +Version: 2.6.0 Release: 0 Summary: OBS Package Installer (CLI) License: GPL-3.0-only @@ -49,15 +49,14 @@ %setup -q %build -help2man -s8 -N ./bin/opi > opi.8.gz +help2man -s8 -N ./bin/opi | gzip > opi.8.gz gzip opi.8.gz %install python3 setup.py install --prefix=%{_prefix} --root=%{buildroot} -mkdir -p %{buildroot}%{_datadir}/metainfo -cp org.openSUSE.opi.appdata.xml %{buildroot}%{_datadir}/metainfo -mkdir -p %{buildroot}%{_datadir}/man/man8 -cp opi.8.gz %{buildroot}%{_datadir}/man/man8 +install -m 644 -D -v org.openSUSE.opi.appdata.xml %{buildroot}%{_datadir}/metainfo/org.openSUSE.opi.appdata.xml +install -m 644 -D -v opi.8.gz %{buildroot}%{_datadir}/man/man8/opi.8.gz +install -m 644 -D -v opi.default.cfg %{buildroot}%{_sysconfdir}/opi.cfg %check python3 setup.py --version | grep %{version} @@ -69,5 +68,6 @@ %{_datadir}/metainfo/org.openSUSE.opi.appdata.xml %{_datadir}/man/man8/opi.8.gz %{python3_sitelib}/* +%config %{_sysconfdir}/opi.cfg %changelog ++++++ opi-2.5.0.tar.gz -> opi-2.6.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/opi-2.5.0/README.md new/opi-2.6.0/README.md --- old/opi-2.5.0/README.md 2022-05-16 17:08:24.000000000 +0200 +++ new/opi-2.6.0/README.md 2022-05-31 16:44:37.000000000 +0200 @@ -57,12 +57,10 @@ ### Using DNF instead of Zypper If you want to, you can use [DNF](https://en.opensuse.org/SDB:DNF) instead of Zypper. -To do this, change the content of `~/.config/opi/config.json` so that it looks like this: +To do this, change the content of `/etc/opi.cfg`: -```json -{ - "backend": "dnf" -} +```cfg +backend = dnf ``` If you want to go back to Zypper, just change the value of `backend` back to `zypp`. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/opi-2.5.0/opi/__init__.py new/opi-2.6.0/opi/__init__.py --- old/opi-2.5.0/opi/__init__.py 2022-05-16 17:08:24.000000000 +0200 +++ new/opi-2.6.0/opi/__init__.py 2022-05-31 16:44:37.000000000 +0200 @@ -4,6 +4,7 @@ import re import tempfile import math +import configparser import requests import lxml.etree @@ -15,6 +16,7 @@ from opi.backends import get_backend, BackendConstants from opi import pager +from opi import config OBS_APIROOT = { 'openSUSE': 'https://api.opensuse.org', @@ -22,6 +24,8 @@ } PROXY_URL = 'https://opi-proxy.opensuse.org/' +REPO_DIR = "/etc/zypp/repos.d/" + ################### ### System Info ### @@ -81,7 +85,7 @@ ############### def add_packman_repo(dup=False): - project = get_distribution(use_releasever_variable=True) + project = get_distribution(use_releasever_variable=config.get_key_from_config("use_releasever_var")) project = project.replace(':', '_') project = project.replace('Factory', 'Tumbleweed') @@ -107,6 +111,23 @@ ### ZYPP/DNF ### ################ +def url_normalize(url): + return re.sub(r"^https?", "", url).rstrip('/').replace('$releasever', get_version() or '$releasever') + +def get_repos(): + for repo_file in os.listdir(REPO_DIR): + cp = configparser.ConfigParser() + cp.read(os.path.join(REPO_DIR, repo_file)) + mainsec = cp.sections()[0] + if not bool(int(cp.get(mainsec, "enabled"))): + continue + yield (re.sub(r"\.repo$", "", repo_file), cp.get(mainsec, "baseurl")) + +def get_enabled_repo_by_url(url): + for repo, repo_url in get_repos(): + if url_normalize(repo_url) == url_normalize(url): + return repo + def add_repo(filename, name, url, enabled=True, gpgcheck=True, gpgkey=None, repo_type='rpm-md', auto_import_key=False, auto_refresh=False, priority=None): tf = tempfile.NamedTemporaryFile('w') tf.file.write("[%s]\n" % filename) @@ -123,8 +144,8 @@ if priority: tf.file.write("priority=%i\n" % priority) tf.file.flush() - subprocess.call(['sudo', 'cp', tf.name, '/etc/zypp/repos.d/%s.repo' % filename]) - subprocess.call(['sudo', 'chmod', '644', '/etc/zypp/repos.d/%s.repo' % filename]) + subprocess.call(['sudo', 'cp', tf.name, os.path.join(REPO_DIR, '%s.repo' % filename)]) + subprocess.call(['sudo', 'chmod', '644', os.path.join(REPO_DIR, '%s.repo' % filename)]) tf.file.close() refresh_cmd = [] if get_backend() == BackendConstants.zypp: @@ -279,26 +300,36 @@ # Install from Packman Repo add_packman_repo() install_packman_packages([name_with_arch]) - elif is_official_project(project): - # Install from official repos (don't add a repo) - install_packages([name_with_arch]) else: repo_alias = project.replace(':', '_') project_path = project.replace(':', ':/') - version = get_version() - if version: - # version is None on tw - repository = repository.replace(version, '$releasever') - add_repo( - filename = repo_alias, - name = project, - url = "https://download.opensuse.org/repositories/%s/%s/" % (project_path, repository), - gpgkey = "https://download.opensuse.org/repositories/%s/%s/repodata/repomd.xml.key" % (project_path, repository), - gpgcheck = True, - auto_refresh = True - ) - install_packages([name_with_arch], from_repo=repo_alias, allow_downgrade=True, allow_arch_change=True, allow_name_change=True, allow_vendor_change=True) - ask_keep_repo(repo_alias) + 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 = "https://download.opensuse.org/repositories/%s/%s/" % (project_path, repository) + gpgkey = "https://download.opensuse.org/repositories/%s/%s/repodata/repomd.xml.key" % (project_path, repository) + existing_repo = get_enabled_repo_by_url(url) + if existing_repo: + # Install from existing repos (don't add a repo) + install_packages([name_with_arch]) + else: + add_repo( + filename = repo_alias, + name = project, + url = url, + gpgkey = gpgkey, + gpgcheck = True, + auto_refresh = True + ) + install_packages([name_with_arch], from_repo=repo_alias, + allow_downgrade=True, + allow_arch_change=True, + allow_name_change=True, + allow_vendor_change=True + ) + ask_keep_repo(repo_alias) ######################## @@ -364,7 +395,7 @@ if get_backend() == BackendConstants.zypp: subprocess.call(['sudo', 'zypper', 'rr', repo]) if get_backend() == BackendConstants.dnf: - subprocess.call(['sudo', 'rm', '/etc/zypp/repos.d/' + repo + '.repo']) + subprocess.call(['sudo', 'rm', os.path.join(REPO_DIR, '%s.repo' % repo)]) def format_binary_option(binary, table=True): if is_official_project(binary['project']): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/opi-2.5.0/opi/config/__init__.py new/opi-2.6.0/opi/config/__init__.py --- old/opi-2.5.0/opi/config/__init__.py 2022-05-16 17:08:24.000000000 +0200 +++ new/opi-2.6.0/opi/config/__init__.py 2022-05-31 16:44:37.000000000 +0200 @@ -1,34 +1,32 @@ import os import pwd import subprocess -import json +import configparser -cache = {} +parser = configparser.ConfigParser() +parser.read("/etc/opi.cfg") + +default_config = { + "backend": "zypp", + "use_releasever_var": True +} + +config_cache = None class ConfigError(Exception): pass -def create_default_config(): - path = pwd.getpwuid(os.getuid()).pw_dir + "/.config/opi/" - subprocess.call(["mkdir", "-p", path]) - config = { - "backend": "zypp" - } - config_file = open(path + 'config.json', 'w') - json.dump(config, config_file, indent=4) - def get_key_from_config(key: str): - if not key in cache: - path = pwd.getpwuid(os.getuid()).pw_dir + "/.config/opi/config.json" - if not os.path.isfile(path): - create_default_config() - config = json.loads(open(path).read()) - cache[key] = config[key] - return cache[key] - else: - return cache[key] - -path = pwd.getpwuid(os.getuid()).pw_dir + "/.config/opi/config.json" -if not os.path.isfile(path): - create_default_config() - + global config_cache + if not config_cache: + config_cache = default_config.copy() + path = os.environ.get('OPI_CONFIG', '/etc/opi.cfg') + if os.path.exists(path): + cp = configparser.ConfigParser() + cp.read(path) + ocfg = cp['opi'] + config_cache.update({ + 'backend': ocfg.get('backend'), + 'use_releasever_var': ocfg.getboolean('use_releasever_var') + }) + return config_cache[key] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/opi-2.5.0/opi/plugins/teamviewer.py new/opi-2.6.0/opi/plugins/teamviewer.py --- old/opi-2.5.0/opi/plugins/teamviewer.py 2022-05-16 17:08:24.000000000 +0200 +++ new/opi-2.6.0/opi/plugins/teamviewer.py 2022-05-31 16:44:37.000000000 +0200 @@ -1,4 +1,5 @@ import opi +import os from opi.plugins import BasePlugin import subprocess @@ -21,5 +22,5 @@ opi.install_packages(['teamviewer-suse']) # Teamviewer packages its own repo file so our repo file got saved as rpmorig - subprocess.call(['sudo', 'rm', '-f', '/etc/zypp/repos.d/teamviewer.repo.rpmorig']) + subprocess.call(['sudo', 'rm', '-f', os.path.join(opi.REPO_DIR, 'teamviewer.repo.rpmorig')]) opi.ask_keep_repo('teamviewer') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/opi-2.5.0/opi/version.py new/opi-2.6.0/opi/version.py --- old/opi-2.5.0/opi/version.py 2022-05-16 17:08:24.000000000 +0200 +++ new/opi-2.6.0/opi/version.py 2022-05-31 16:44:37.000000000 +0200 @@ -1 +1 @@ -__version__ = '2.5.0' +__version__ = '2.6.0' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/opi-2.5.0/opi.changes new/opi-2.6.0/opi.changes --- old/opi-2.5.0/opi.changes 2022-05-16 17:08:24.000000000 +0200 +++ new/opi-2.6.0/opi.changes 2022-05-31 16:44:37.000000000 +0200 @@ -1,4 +1,12 @@ ------------------------------------------------------------------- +Tue May 31 14:44:14 UTC 2022 - Dominik Heidler <dheidler@suse.de> + +- Version 2.6.0 +- Move to global config in /etc/opi.cfg +- Check if desired repo is already added instead of relying on prefix +- Add config option use_releasever_var + +------------------------------------------------------------------- Mon May 16 15:07:53 UTC 2022 - Dominik Heidler <dheidler@suse.de> - Version 2.5.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/opi-2.5.0/opi.default.cfg new/opi-2.6.0/opi.default.cfg --- old/opi-2.5.0/opi.default.cfg 1970-01-01 01:00:00.000000000 +0100 +++ new/opi-2.6.0/opi.default.cfg 2022-05-31 16:44:37.000000000 +0200 @@ -0,0 +1,3 @@ +[opi] +backend = zypp +use_releasever_var = true diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/opi-2.5.0/release.sh new/opi-2.6.0/release.sh --- old/opi-2.5.0/release.sh 2022-05-16 17:08:24.000000000 +0200 +++ new/opi-2.6.0/release.sh 2022-05-31 16:44:37.000000000 +0200 @@ -18,6 +18,7 @@ osc up sed -i -e "s/^\(Version: *\)[^ ]*$/\1${version}/" opi.spec osc vc -m "Version ${version}\n${changes}" +vi opi.changes osc rm opi-*.tar.gz osc service dr osc add opi-*.tar.gz diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/opi-2.5.0/test/run_container_test.sh new/opi-2.6.0/test/run_container_test.sh --- old/opi-2.5.0/test/run_container_test.sh 2022-05-16 17:08:24.000000000 +0200 +++ new/opi-2.6.0/test/run_container_test.sh 2022-05-31 16:44:37.000000000 +0200 @@ -1,12 +1,12 @@ -#!/bin/bash +#!/bin/bash -x base_image="${2:-opensuse/tumbleweed}" opi_base_image="opi_base_${base_image/\//_}" # prepare container image -if ! podman images exists $opi_base_image ; then +if ! podman image exists $opi_base_image ; then echo "Preparing container" - podman run -td --dns=1.1.1.1 --name=opi_base ${2:-opensuse/tumbleweed} + podman run -td --dns=1.1.1.1 --name=opi_base $base_image podman exec -it opi_base zypper -n ref # opi dependencies podman exec -it opi_base zypper -n install sudo python3 python3-requests python3-lxml python3-termcolor python3-curses curl
participants (1)
-
Source-Sync