]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
script: fix invalid escape sequences 69687/head
authorKefu Chai <k.chai@proxmox.com>
Tue, 23 Jun 2026 23:11:24 +0000 (07:11 +0800)
committerKefu Chai <k.chai@proxmox.com>
Tue, 23 Jun 2026 23:11:26 +0000 (07:11 +0800)
Python 3.12 warns on invalid escape sequences in non-raw strings:
```
  ceph-release-notes:45: SyntaxWarning: invalid escape sequence '\d'
  cpatch.py:465: SyntaxWarning: invalid escape sequence '\;'
```

In `cpatch.py`, use raw strings for the two Dockerfile RUN lines so
their find -exec ... \; keeps the literal backslash-semicolon.

Signed-off-by: Kefu Chai <k.chai@proxmox.com>
src/script/cpatch.py

index 5e33e9b2c13cf7d7a7e68c4265eb35ac446c98d7..b891c8c70ea2622501ab4f99139ef9bfc74d5d27 100755 (executable)
@@ -462,12 +462,12 @@ class Builder:
         if os.path.isdir(self._workdir / "tmp_bin"):
             # For every binary file that was copied to the tmp_bin directory by the jobs above, search for the existing file in the container and replace it.
             dlines.append("ADD tmp_bin /tmpbin")
-            dlines.append("RUN for i in tmpbin/*; do find /usr/bin /usr/sbin -name $(basename $i) -exec mv -f $i '{}' \;; echo $(basename $i); done && rm -rf tmpbin")
+            dlines.append(r"RUN for i in tmpbin/*; do find /usr/bin /usr/sbin -name $(basename $i) -exec mv -f $i '{}' \;; echo $(basename $i); done && rm -rf tmpbin")
 
         if os.path.isdir(self._workdir / "tmp_lib"):
             # For every library file that was copied to the tmp_lib directory by the jobs above, search for the existing file in the container and replace it.
             dlines.append("ADD tmp_lib /tmplib")
-            dlines.append("RUN for i in tmplib/*; do find /usr/lib64 -name $(basename $i) -exec mv -f $i '{}' \;; echo $(basename $i); done && rm -rf tmplib")
+            dlines.append(r"RUN for i in tmplib/*; do find /usr/lib64 -name $(basename $i) -exec mv -f $i '{}' \;; echo $(basename $i); done && rm -rf tmplib")
 
         if os.path.isdir(self._workdir / "tmp_bin"):
             # by default locally built binaries assume /usr/local