Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package klp-build for openSUSE:Factory 
checked in at 2024-07-29 21:52:48
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/klp-build (Old)
 and      /work/SRC/openSUSE:Factory/.klp-build.new.1882 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "klp-build"

Mon Jul 29 21:52:48 2024 rev:5 rq:1190166 version:0~20240725.cc0513f

Changes:
--------
--- /work/SRC/openSUSE:Factory/klp-build/klp-build.changes      2024-07-25 
15:44:49.280726726 +0200
+++ /work/SRC/openSUSE:Factory/.klp-build.new.1882/klp-build.changes    
2024-07-29 21:53:46.852104301 +0200
@@ -1,0 +2,9 @@
+Mon Jul 29 07:09:22 UTC 2024 - [email protected]
+
+- Update to version 0~20240725.cc0513f:
+  * ksrc.py: Check CVE passed in get-patches
+  * extractor: lock the same src directory on which architecture the script is 
running on
+  * Add support for tests files in directories
+  * extractor: Add filelocking support for srcdir
+
+-------------------------------------------------------------------

Old:
----
  klp-build-0~20240722.3c379d8.tar.xz

New:
----
  klp-build-0~20240725.cc0513f.tar.xz

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

Other differences:
------------------
++++++ klp-build.spec ++++++
--- /var/tmp/diff_new_pack.SMbFKi/_old  2024-07-29 21:53:47.312122930 +0200
+++ /var/tmp/diff_new_pack.SMbFKi/_new  2024-07-29 21:53:47.316123092 +0200
@@ -18,7 +18,7 @@
 
 %{!?python_sitelib: %global python_sitelib %(python -c "from 
distutils.sysconfig import get_python_lib; print(get_python_lib())")}
 Name:           klp-build
-Version:        0~20240722.3c379d8
+Version:        0~20240725.cc0513f
 Release:        0
 Summary:        The kernel livepatching creation tool
 License:        GPL-2.0-only

++++++ _service ++++++
--- /var/tmp/diff_new_pack.SMbFKi/_old  2024-07-29 21:53:47.356124712 +0200
+++ /var/tmp/diff_new_pack.SMbFKi/_new  2024-07-29 21:53:47.360124874 +0200
@@ -2,7 +2,7 @@
        <service name="tar_scm" mode="manual">
                <param name="scm">git</param>
                <param name="url">https://github.com/SUSE/klp-build</param>
-               <param 
name="revision">3c379d867b7279a79c44467f478b432bfe118049</param>
+               <param 
name="revision">cc0513fdedb78113bad1f5afc60bc37ad1c5f301</param>
                <param name="versionformat">0~%cd.%h</param>
                <param name="changesgenerate">enable</param>
         <param name="changesauthor">[email protected]</param>

++++++ klp-build-0~20240722.3c379d8.tar.xz -> 
klp-build-0~20240725.cc0513f.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/klp-build-0~20240722.3c379d8/klpbuild/config.py 
new/klp-build-0~20240725.cc0513f/klpbuild/config.py
--- old/klp-build-0~20240722.3c379d8/klpbuild/config.py 2024-07-22 
16:13:16.000000000 +0200
+++ new/klp-build-0~20240725.cc0513f/klpbuild/config.py 2024-07-25 
18:01:15.000000000 +0200
@@ -299,6 +299,26 @@
             return Path(self.get_data_dir(arch), "lib", "modules", 
f"{self.get_cs_kernel(cs)}-{self.get_ktype(cs)}")
         return self.get_data_dir(arch)
 
+    def get_tests_path(self):
+        self.kgraft_tests_path = Path(Path().home(), "kgr", 
"kgraft-patches_testscripts")
+        if not self.kgraft_tests_path.is_dir():
+            raise RuntimeError(f"Couldn't find {self.kgraft_tests_path}")
+
+        test_sh = Path(self.kgraft_tests_path, 
f"{self.lp_name}_test_script.sh")
+        test_dir_sh = Path(self.kgraft_tests_path, 
f"{self.lp_name}/test_script.sh")
+
+        if test_sh.is_file():
+            test_src = test_sh
+        elif test_dir_sh.is_file():
+            # For more complex tests we support using a directory containing
+            # as much files as needed. A `test_script.sh` is still required
+            # as an entry point.
+            test_src = Path(os.path.dirname(test_dir_sh))
+        else:
+            raise RuntimeError(f"Couldn't find {test_sh} or {test_dir_sh}")
+
+        return test_src
+
     def flush_cs_file(self):
         with open(self.cs_file, "w") as f:
             f.write(json.dumps(self.codestreams, indent=4))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/klp-build-0~20240722.3c379d8/klpbuild/extractor.py 
new/klp-build-0~20240725.cc0513f/klpbuild/extractor.py
--- old/klp-build-0~20240722.3c379d8/klpbuild/extractor.py      2024-07-22 
16:13:16.000000000 +0200
+++ new/klp-build-0~20240725.cc0513f/klpbuild/extractor.py      2024-07-25 
18:01:15.000000000 +0200
@@ -16,6 +16,7 @@
 from pathlib import Path
 from pathlib import PurePath
 from threading import Lock
+from filelock import FileLock
 
 from natsort import natsorted
 
@@ -30,6 +31,9 @@
     def __init__(self, lp_name, lp_filter, apply_patches, app, avoid_ext, 
workers=4):
         super().__init__(lp_name, lp_filter)
 
+        self.sdir_lock = FileLock(Path(self.get_data_dir(utils.ARCH), 
"sdir.lock"))
+        self.sdir_lock.acquire()
+
         if not self.lp_path.exists():
             raise ValueError(f"{self.lp_path} not created. Run the setup 
subcommand first")
 
@@ -62,6 +66,11 @@
         self.app = app
         self.tem = TemplateGen(self.lp_name, self.filter, self.app)
 
+    def __del__(self):
+        if self.sdir_lock:
+            self.sdir_lock.release()
+            os.remove(self.sdir_lock.lock_file)
+
     @staticmethod
     def unquote_output(matchobj):
         return matchobj.group(0).replace('"', "")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/klp-build-0~20240722.3c379d8/klpbuild/ibs.py 
new/klp-build-0~20240725.cc0513f/klpbuild/ibs.py
--- old/klp-build-0~20240722.3c379d8/klpbuild/ibs.py    2024-07-22 
16:13:16.000000000 +0200
+++ new/klp-build-0~20240725.cc0513f/klpbuild/ibs.py    2024-07-25 
18:01:15.000000000 +0200
@@ -314,11 +314,7 @@
         # Download all built rpms
         self.download()
 
-        self.kgraft_tests_path = Path(Path().home(), "kgr", 
"kgraft-patches_testscripts")
-        if not self.kgraft_tests_path.is_dir():
-            raise RuntimeError("Couldn't find 
~/kgr/kgraft-patches_testscripts")
-
-        test_sh = Path(self.kgraft_tests_path, 
f"{self.lp_name}_test_script.sh")
+        test_src = self.get_tests_path()
         run_test = pkg_resources.resource_filename("scripts", 
"run-kgr-test.sh")
 
         for arch in ARCHS:
@@ -361,16 +357,20 @@
 
                 build_cs.append(self.get_full_cs(cs))
 
-            # Prepare the config file used by kgr-test
-            config = Path(test_arch_path, "repro", f"{self.lp_name}_config.in")
+            # Prepare the config and test files used by kgr-test
+            test_dst = Path(test_arch_path, f"repro/{self.lp_name}")
+            if test_src.is_file():
+                shutil.copy(test_src, f"{test_dst}_test_script.sh")
+                config = f"{test_dst}_config.in"
+            else:
+                # Alternatively, we create test_dst as a directory containing
+                # at least a test_script.sh and a config.in
+                shutil.copytree(test_src, test_dst)
+                config = Path(test_dst, "config.in")
+
             with open(config, "w") as f:
                 f.write("\n".join(natsorted(build_cs)))
 
-            if test_sh.is_file():
-                shutil.copy(test_sh, Path(test_arch_path, "repro"))
-            else:
-                logging.warning(f"missing {test_sh}")
-
             subprocess.run(
                 ["tar", "-cJf", f"{self.lp_name}.tar.xz", f"{self.lp_name}"],
                 cwd=tests_path,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/klp-build-0~20240722.3c379d8/klpbuild/ksrc.py 
new/klp-build-0~20240725.cc0513f/klpbuild/ksrc.py
--- old/klp-build-0~20240722.3c379d8/klpbuild/ksrc.py   2024-07-22 
16:13:16.000000000 +0200
+++ new/klp-build-0~20240725.cc0513f/klpbuild/ksrc.py   2024-07-25 
18:01:15.000000000 +0200
@@ -121,29 +121,24 @@
         patches_dir = Path(self.lp_path, "patches")
         shutil.rmtree(patches_dir, ignore_errors=True)
 
-        # Ensure that a testfile was created before preparing the patches
-        kgraft_tests_path = Path(Path().home(), "kgr", 
"kgraft-patches_testscripts")
-        test_sh = Path(kgraft_tests_path, f"{self.lp_name}_test_script.sh")
-        if not test_sh.is_file():
-            logging.warning(f"Test file {test_sh} not created.")
-        else:
-            subprocess.check_output(
-                [
-                    "/usr/bin/git",
-                    "-C",
-                    str(kgraft_tests_path),
-                    "format-patch",
-                    "-1",
-                    f"{test_sh}",
-                    "--cover-letter",
-                    "--start-number",
-                    "1",
-                    "--subject-prefix",
-                    f"PATCH {ver}",
-                    "--output-directory",
-                    f"{patches_dir}",
-                ]
-            )
+        test_src = self.get_tests_path()
+        subprocess.check_output(
+            [
+                "/usr/bin/git",
+                "-C",
+                str(self.kgraft_tests_path),
+                "format-patch",
+                "-1",
+                f"{test_src}",
+                "--cover-letter",
+                "--start-number",
+                "1",
+                "--subject-prefix",
+                f"PATCH {ver}",
+                "--output-directory",
+                f"{patches_dir}",
+            ]
+        )
 
         # Filter only the branches related to this BSC
         for branch in self.branches:
@@ -205,6 +200,11 @@
             logging.info(f"No CVE informed, skipping the processing of getting 
the patches.")
             return {}
 
+        # Support CVEs from 2020 up to 2029
+        if not re.match(r"^202[0-9]-[0-9]{4,7}$", cve):
+            logging.info(f"Invalid CVE number {cve}, skipping the processing 
of getting the patches.")
+            return {}
+
         print("Fetching changes from all supported branches...")
 
         # Mount the command to fetch all branches for supported codestreams
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/klp-build-0~20240722.3c379d8/scripts/run-kgr-test.sh 
new/klp-build-0~20240725.cc0513f/scripts/run-kgr-test.sh
--- old/klp-build-0~20240722.3c379d8/scripts/run-kgr-test.sh    2024-07-22 
16:13:16.000000000 +0200
+++ new/klp-build-0~20240725.cc0513f/scripts/run-kgr-test.sh    2024-07-25 
18:01:15.000000000 +0200
@@ -14,20 +14,21 @@
 # directory of the current script is the bsc number
 bsc=$(basename "$(pwd)")
 
-TEST_SCRIPT="repro/${bsc}_test_script.sh"
-if [ ! -f "$TEST_SCRIPT" ]; then
-       echo "Missing $TEST_SCRIPT. Aborting."
-       exit 1
-fi
-
 # Remove any previous test output
 rm -rf tests.out/*
 
 # If the test has multiple files, it should be contained in a directory under
 # repro/$bsc, otherwise it's only one file under repro
-CONF_IN=repro/$bsc/config.in
-if [ ! -f "$CONF_IN" ]; then
-       CONF_IN=repro/${bsc}_config.in
+TEST_SCRIPT=repro/${bsc}_test_script.sh
+CONF_IN=repro/${bsc}_config.in
+if [ -d "repro/$bsc" ]; then
+       TEST_SCRIPT=repro/${bsc}/test_script.sh
+       CONF_IN=repro/$bsc/config.in
+fi
+
+if [ ! -f "$TEST_SCRIPT" ]; then
+       echo "Missing $TEST_SCRIPT. Aborting."
+       exit 1
 fi
 
 # Check multiple places where an updated version of the VMs can be found
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/klp-build-0~20240722.3c379d8/setup.py 
new/klp-build-0~20240725.cc0513f/setup.py
--- old/klp-build-0~20240722.3c379d8/setup.py   2024-07-22 16:13:16.000000000 
+0200
+++ new/klp-build-0~20240725.cc0513f/setup.py   2024-07-25 18:01:15.000000000 
+0200
@@ -32,5 +32,6 @@
         "natsort",
         "osc-tiny",
         "requests",
+        "filelock"
     ],
 )

Reply via email to