Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package osc for openSUSE:Factory checked in 
at 2023-05-10 17:38:18
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/osc (Old)
 and      /work/SRC/openSUSE:Factory/.osc.new.1533 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "osc"

Wed May 10 17:38:18 2023 rev:177 rq:1086102 version:1.1.3

Changes:
--------
--- /work/SRC/openSUSE:Factory/osc/osc.changes  2023-05-05 15:57:42.064228118 
+0200
+++ /work/SRC/openSUSE:Factory/.osc.new.1533/osc.changes        2023-05-10 
17:38:19.535278023 +0200
@@ -1,0 +2,13 @@
+Wed May 10 07:12:59 UTC 2023 - Daniel Mach <daniel.m...@suse.com>
+
+- 1.1.3
+  - Command-line:
+    - Backup edited messages and notify user about them when osc errors out
+    - Consider only open requests when listing requests with a given review 
state
+    - Fix 'diff' command when no files are specified
+  - Configuration:
+    - Add glob support to the 'trusted_prj' config option
+  - Library:
+    - Fix core.xmlindent() to work with ElementTree objects
+
+-------------------------------------------------------------------

Old:
----
  osc-1.1.2.tar.gz

New:
----
  debian.lintian-overrides
  osc-1.1.3.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ osc.spec ++++++
--- /var/tmp/diff_new_pack.Lzfg46/_old  2023-05-10 17:38:20.243282207 +0200
+++ /var/tmp/diff_new_pack.Lzfg46/_new  2023-05-10 17:38:20.247282231 +0200
@@ -49,7 +49,7 @@
 %endif
 
 Name:           osc
-Version:        1.1.2
+Version:        1.1.3
 Release:        0
 Summary:        Command-line client for the Open Build Service
 License:        GPL-2.0-or-later

++++++ PKGBUILD ++++++
--- /var/tmp/diff_new_pack.Lzfg46/_old  2023-05-10 17:38:20.279282420 +0200
+++ /var/tmp/diff_new_pack.Lzfg46/_new  2023-05-10 17:38:20.283282444 +0200
@@ -1,5 +1,5 @@
 pkgname=osc
-pkgver=1.1.2
+pkgver=1.1.3
 pkgrel=0
 pkgdesc="Command-line client for the Open Build Service"
 arch=('x86_64')

++++++ debian.changelog ++++++
--- /var/tmp/diff_new_pack.Lzfg46/_old  2023-05-10 17:38:20.327282704 +0200
+++ /var/tmp/diff_new_pack.Lzfg46/_new  2023-05-10 17:38:20.331282727 +0200
@@ -1,4 +1,4 @@
-osc (1.1.2-1) unstable; urgency=low
+osc (1.1.3-0) unstable; urgency=low
 
   * Placeholder
 

++++++ debian.lintian-overrides ++++++
osc: shell-script-fails-syntax-check *

++++++ osc-1.1.2.tar.gz -> osc-1.1.3.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/osc-1.1.2/NEWS new/osc-1.1.3/NEWS
--- old/osc-1.1.2/NEWS  2023-05-03 10:11:24.000000000 +0200
+++ new/osc-1.1.3/NEWS  2023-05-10 09:11:35.000000000 +0200
@@ -1,3 +1,13 @@
+- 1.1.3
+  - Command-line:
+    - Backup edited messages and notify user about them when osc errors out
+    - Consider only open requests when listing requests with a given review 
state
+    - Fix 'diff' command when no files are specified
+  - Configuration:
+    - Add glob support to the 'trusted_prj' config option
+  - Library:
+    - Fix core.xmlindent() to work with ElementTree objects
+
 - 1.1.2
   - Command-line:
     - Add '--buildtool-opt' option passing options to underlying rpmbuild to 
the 'build' command
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/osc-1.1.2/osc/__init__.py 
new/osc-1.1.3/osc/__init__.py
--- old/osc-1.1.2/osc/__init__.py       2023-05-03 10:11:24.000000000 +0200
+++ new/osc-1.1.3/osc/__init__.py       2023-05-10 09:11:35.000000000 +0200
@@ -13,7 +13,7 @@
 
 
 from .util import git_version
-__version__ = git_version.get_version('1.1.2')
+__version__ = git_version.get_version('1.1.3')
 
 
 # vim: sw=4 et
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/osc-1.1.2/osc/babysitter.py 
new/osc-1.1.3/osc/babysitter.py
--- old/osc-1.1.2/osc/babysitter.py     2023-05-03 10:11:24.000000000 +0200
+++ new/osc-1.1.3/osc/babysitter.py     2023-05-10 09:11:35.000000000 +0200
@@ -19,6 +19,7 @@
 from . import _private
 from . import commandline
 from . import conf as osc_conf
+from . import core as osc_core
 from . import oscerr
 from .OscConfigParser import configparser
 from .oscssl import CertVerificationError
@@ -196,6 +197,11 @@
         print(e, file=sys.stderr)
     except oscerr.OscBaseError as e:
         print('*** Error:', e, file=sys.stderr)
+    if osc_core.MESSAGE_BACKUPS:
+        print()
+        print("If you lost any edited commit messages due to an error, you may 
find them here:")
+        for path in osc_core.MESSAGE_BACKUPS:
+            print(f"  - {path}")
     return 1
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/osc-1.1.2/osc/build.py new/osc-1.1.3/osc/build.py
--- old/osc-1.1.2/osc/build.py  2023-05-03 10:11:24.000000000 +0200
+++ new/osc-1.1.3/osc/build.py  2023-05-10 09:11:35.000000000 +0200
@@ -3,6 +3,7 @@
 # and distributed under the terms of the GNU General Public Licence,
 # either version 2, or (at your option) any later version.
 
+import fnmatch
 import glob
 import os
 import re
@@ -548,14 +549,24 @@
 ? """
 
 
-def check_trusted_projects(apiurl, projects):
+def check_trusted_projects(apiurl, projects, interactive=True):
     trusted = conf.config['api_host_options'][apiurl]['trusted_prj']
     tlen = len(trusted)
     for prj in projects:
-        if prj not in trusted:
+        is_trusted = False
+        for pattern in trusted:
+            if fnmatch.fnmatch(prj, pattern):
+                is_trusted = True
+                break
+        if not is_trusted:
             print("\nThe build root needs packages from project '%s'." % prj)
             print("Note that malicious packages can compromise the build 
result or even your system.")
-            r = raw_input(trustprompt % {'project': prj})
+
+            if interactive:
+                r = raw_input(trustprompt % {'project': prj})
+            else:
+                r = "0"
+
             if r == '1':
                 print("adding '%s' to oscrc: ['%s']['trusted_prj']" % (prj, 
apiurl))
                 trusted.append(prj)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/osc-1.1.2/osc/commandline.py 
new/osc-1.1.3/osc/commandline.py
--- old/osc-1.1.2/osc/commandline.py    2023-05-03 10:11:24.000000000 +0200
+++ new/osc-1.1.3/osc/commandline.py    2023-05-10 09:11:35.000000000 +0200
@@ -4646,7 +4646,12 @@
                 for i in pac.get_diff(rev1):
                     diff += b''.join(i)
             else:
-                files = args
+                if args == ["."]:
+                    # parseargs() returns ["."] (list with workdir) if no args 
are specified
+                    # "." is illegal filename that causes server to return 400
+                    files = None
+                else:
+                    files = args
                 diff += server_diff_noex(pac.apiurl, pac.prjname, pac.name, 
rev1,
                                          pac.prjname, pac.name, rev2,
                                          not opts.plain, opts.missingok, 
opts.meta, not opts.unexpand, files=files)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/osc-1.1.2/osc/core.py new/osc-1.1.3/osc/core.py
--- old/osc-1.1.2/osc/core.py   2023-05-03 10:11:24.000000000 +0200
+++ new/osc-1.1.3/osc/core.py   2023-05-10 09:11:35.000000000 +0200
@@ -636,6 +636,8 @@
 
 def xmlindent(elem, level=0):
     i = "\n" + level * "  "
+    if isinstance(elem, ET.ElementTree):
+        elem = elem.getroot()
     if len(elem):
         if not elem.text or not elem.text.strip():
             elem.text = i + "  "
@@ -4408,6 +4410,11 @@
     return cmd
 
 
+# list of files with message backups
+# we'll show this list when osc errors out
+MESSAGE_BACKUPS = []
+
+
 def _edit_message_open_editor(filename, data, orig_mtime):
     editor = _editor_command()
     mtime = os.stat(filename).st_mtime
@@ -4428,7 +4435,34 @@
             run_editor(filename)
     else:
         run_editor(filename)
-    return os.stat(filename).st_mtime != orig_mtime
+
+    if os.stat(filename).st_mtime != orig_mtime:
+        # file has changed
+
+        cache_dir = os.path.expanduser("~/.cache/osc/edited-messages")
+        try:
+            os.makedirs(cache_dir, mode=0o700)
+        except FileExistsError:
+            pass
+
+        # remove any stored messages older than 1 day
+        now = datetime.datetime.now()
+        epoch = datetime.datetime.timestamp(now - datetime.timedelta(days=1))
+        for fn in os.listdir(cache_dir):
+            path = os.path.join(cache_dir, fn)
+            if not os.path.isfile(path):
+                continue
+            mtime = os.path.getmtime(path)
+            if mtime < epoch:
+                os.unlink(path)
+
+        # store the current message's backup to the cache dir
+        message_backup_path = os.path.join(cache_dir, str(now).replace(" ", 
"_"))
+        shutil.copyfile(filename, message_backup_path)
+        MESSAGE_BACKUPS.append(message_backup_path)
+        return True
+
+    return False
 
 
 def edit_message(footer='', template='', templatelen=30):
@@ -4688,9 +4722,11 @@
         return ''
 
     xpath = ''
+
+    # we're interested only in reviews of requests that are still open
+    xpath = xpath_join(xpath, "(state/@name='new' or state/@name='review' or 
state/@name='declined')", op="and")
+
     if states == ():
-        # default: requests which are still open and have reviews in "new" 
state
-        xpath = xpath_join('', 'state/@name=\'review\'', op='and')
         xpath = xpath_join(xpath, 'review/@state=\'new\'', op='and')
     if byuser:
         xpath = build_by(xpath, '@by_user=\'%s\'' % byuser)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/osc-1.1.2/osc/util/git_version.py 
new/osc-1.1.3/osc/util/git_version.py
--- old/osc-1.1.2/osc/util/git_version.py       2023-05-03 10:11:24.000000000 
+0200
+++ new/osc-1.1.3/osc/util/git_version.py       2023-05-10 09:11:35.000000000 
+0200
@@ -9,7 +9,7 @@
     """
     # the `version` variable contents get substituted during `git archive`
     # it requires adding this to .gitattributes: <path to this file> 
export-subst
-    version = "1.1.2"
+    version = "1.1.3"
     if version.startswith(("$", "%")):
         # "$": version hasn't been substituted during `git archive`
         # "%": "Format:" and "$" characters get removed from the version 
string (a GitHub bug?)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/osc-1.1.2/tests/test_build.py 
new/osc-1.1.3/tests/test_build.py
--- old/osc-1.1.2/tests/test_build.py   1970-01-01 01:00:00.000000000 +0100
+++ new/osc-1.1.3/tests/test_build.py   2023-05-10 09:11:35.000000000 +0200
@@ -0,0 +1,39 @@
+import importlib
+import unittest
+
+import osc.conf
+from osc.build import check_trusted_projects
+from osc.oscerr import UserAbort
+
+
+class TestTrustedProjects(unittest.TestCase):
+    def setUp(self):
+        # reset the global `config` in preparation for running the tests
+        importlib.reload(osc.conf)
+
+    def tearDown(self):
+        # reset the global `config` to avoid impacting tests from other classes
+        importlib.reload(osc.conf)
+
+    def test_name(self):
+        apiurl = "https://example.com";
+        osc.conf.config["apiurl"] = apiurl
+        osc.conf.config.setdefault("api_host_options", {}).setdefault(apiurl, 
{}).setdefault("trusted_prj", None)
+
+        osc.conf.config["api_host_options"][apiurl]["trusted_prj"] = []
+        self.assertRaises(UserAbort, check_trusted_projects, apiurl, ["foo"], 
interactive=False)
+
+        osc.conf.config["api_host_options"][apiurl]["trusted_prj"] = 
["qwerty", "foo", "asdfg"]
+        check_trusted_projects(apiurl, ["foo"], interactive=False)
+
+    def test_glob(self):
+        apiurl = "https://example.com";
+        osc.conf.config["apiurl"] = apiurl
+        osc.conf.config.setdefault("api_host_options", {}).setdefault(apiurl, 
{}).setdefault("trusted_prj", None)
+
+        osc.conf.config["api_host_options"][apiurl]["trusted_prj"] = ["f*"]
+        check_trusted_projects(apiurl, ["foo"], interactive=False)
+
+
+if __name__ == "__main__":
+    unittest.main()

++++++ osc.dsc ++++++
--- /var/tmp/diff_new_pack.Lzfg46/_old  2023-05-10 17:38:20.675284761 +0200
+++ /var/tmp/diff_new_pack.Lzfg46/_new  2023-05-10 17:38:20.679284785 +0200
@@ -1,6 +1,6 @@
 Format: 1.0
 Source: osc
-Version: 1.1.2-1
+Version: 1.1.3-0
 Binary: osc
 Maintainer: Adrian Schroeter <adr...@suse.de>
 Architecture: any

Reply via email to