All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bin Meng <bmeng.cn@gmail.com>
To: qemu-devel@nongnu.org
Cc: Bin Meng <bin.meng@windriver.com>, Cleber Rosa <crosa@redhat.com>,
	John Snow <jsnow@redhat.com>
Subject: [PATCH 2/7] scripts/nsis.py: Fix destination directory name when invoked on Windows
Date: Thu,  8 Sep 2022 21:28:12 +0800	[thread overview]
Message-ID: <20220908132817.1831008-3-bmeng.cn@gmail.com> (raw)
In-Reply-To: <20220908132817.1831008-1-bmeng.cn@gmail.com>

From: Bin Meng <bin.meng@windriver.com>

"make installer" on Windows fails with the following message:

  Traceback (most recent call last):
    File "G:\msys64\home\foo\git\qemu\scripts\nsis.py", line 89, in <module>
      main()
    File "G:\msys64\home\foo\git\qemu\scripts\nsis.py", line 34, in main
      with open(
  OSError: [Errno 22] Invalid argument:
  'R:/Temp/tmpw83xhjquG:/msys64/qemu/system-emulations.nsh'
  ninja: build stopped: subcommand failed.

Use os.path.splitdrive() to form a canonical path without the drive
letter on Windows. This works with cross-build on Linux too.

Fixes: 8adfeba953e0 ("meson: add NSIS building")
Signed-off-by: Bin Meng <bin.meng@windriver.com>
---

 scripts/nsis.py | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/scripts/nsis.py b/scripts/nsis.py
index bbb41d9386..baa6ef9594 100644
--- a/scripts/nsis.py
+++ b/scripts/nsis.py
@@ -28,16 +28,18 @@ def main():
     parser.add_argument("nsisargs", nargs="*")
     args = parser.parse_args()
 
+    # canonicalize the Windows native prefix path
+    prefix = os.path.splitdrive(args.prefix)[1]
     destdir = tempfile.mkdtemp()
     try:
         subprocess.run(["make", "install", "DESTDIR=" + destdir])
         with open(
-            os.path.join(destdir + args.prefix, "system-emulations.nsh"), "w"
+            os.path.join(destdir + prefix, "system-emulations.nsh"), "w"
         ) as nsh, open(
-            os.path.join(destdir + args.prefix, "system-mui-text.nsh"), "w"
+            os.path.join(destdir + prefix, "system-mui-text.nsh"), "w"
         ) as muinsh:
             for exe in sorted(glob.glob(
-                os.path.join(destdir + args.prefix, "qemu-system-*.exe")
+                os.path.join(destdir + prefix, "qemu-system-*.exe")
             )):
                 exe = os.path.basename(exe)
                 arch = exe[12:-4]
@@ -61,7 +63,7 @@ def main():
                 !insertmacro MUI_DESCRIPTION_TEXT ${{Section_{0}}} "{1}"
                 """.format(arch, desc))
 
-        for exe in glob.glob(os.path.join(destdir + args.prefix, "*.exe")):
+        for exe in glob.glob(os.path.join(destdir + prefix, "*.exe")):
             signcode(exe)
 
         makensis = [
@@ -69,7 +71,7 @@ def main():
             "-V2",
             "-NOCD",
             "-DSRCDIR=" + args.srcdir,
-            "-DBINDIR=" + destdir + args.prefix,
+            "-DBINDIR=" + destdir + prefix,
         ]
         dlldir = "w32"
         if args.cpu == "x86_64":
-- 
2.34.1



  parent reply	other threads:[~2022-09-08 13:31 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-08 13:28 [PATCH 0/7] nsis: gitlab-ci: Improve QEMU Windows installer packaging Bin Meng
2022-09-08 13:28 ` [PATCH 1/7] scripts/nsis.py: Drop the unnecessary path separator Bin Meng
2022-09-17 21:18   ` Philippe Mathieu-Daudé via
2022-10-29  7:44   ` Stefan Weil via
2022-09-08 13:28 ` Bin Meng [this message]
2022-09-08 13:46   ` [PATCH 2/7] scripts/nsis.py: Fix destination directory name when invoked on Windows Marc-André Lureau
2022-09-17 21:20   ` Philippe Mathieu-Daudé via
2022-10-29  7:58   ` Stefan Weil via
2022-09-08 13:28 ` [PATCH 3/7] scripts/nsis.py: Automatically package required DLLs of QEMU executables Bin Meng
2022-09-08 13:56   ` Marc-André Lureau
2022-09-09 16:49   ` Mark Cave-Ayland
2022-09-10  0:37     ` Bin Meng
2024-02-25 17:37       ` Stefan Weil via
2024-02-26  4:35         ` Bin Meng
2024-02-26  6:30           ` Stefan Weil via
2024-03-10  8:02             ` Mark Cave-Ayland
2022-10-29  9:04   ` Stefan Weil via
2022-09-08 13:28 ` [PATCH 4/7] .gitlab-ci.d/windows.yml: Drop the sed processing in the 64-bit build Bin Meng
2022-09-08 14:04   ` Marc-André Lureau
2022-09-09 16:30     ` Thomas Huth
2022-09-17 21:22   ` Philippe Mathieu-Daudé via
2022-09-08 13:28 ` [PATCH 5/7] block/nfs: Fix 32-bit Windows build Bin Meng
2022-09-17 21:32   ` Philippe Mathieu-Daudé via
2022-09-21 12:10     ` Meng, Bin
2022-09-24  1:19       ` Bin Meng
2022-10-27  2:45         ` Bin Meng
2022-10-27  7:54           ` Kevin Wolf
2022-10-27  8:16             ` Bin Meng
2022-10-29 15:57   ` Stefan Weil via
2022-09-08 13:28 ` [PATCH 6/7] .gitlab-ci.d/windows.yml: Unify the prerequisite packages Bin Meng
2022-09-09 16:32   ` Thomas Huth
2022-09-10  0:32     ` Bin Meng
2022-09-10  5:09       ` 罗勇刚(Yonggang Luo)
2022-09-24  9:20       ` Bin Meng
2022-10-29 13:06         ` Bin Meng
2022-10-29 16:19           ` Stefan Weil via
2022-10-31  6:43           ` Thomas Huth
2022-09-08 13:28 ` [PATCH 7/7] .gitlab-ci.d/windows.yml: Test 'make installer' in the CI Bin Meng
2022-09-17 21:31   ` Philippe Mathieu-Daudé via
2022-10-29 16:39   ` Stefan Weil via
2022-10-30  3:21     ` Bin Meng
2022-10-31  7:01       ` Thomas Huth
2022-09-16  0:35 ` [PATCH 0/7] nsis: gitlab-ci: Improve QEMU Windows installer packaging Bin Meng
2022-09-21 12:18 ` Bin Meng
2022-09-21 12:24   ` Thomas Huth
2022-09-23  2:28     ` Bin Meng
2022-10-29 13:45     ` Bin Meng
2022-10-31  6:52       ` Thomas Huth
2022-10-31  9:26         ` Stefan Weil via
2022-10-31  9:29           ` Marc-André Lureau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220908132817.1831008-3-bmeng.cn@gmail.com \
    --to=bmeng.cn@gmail.com \
    --cc=bin.meng@windriver.com \
    --cc=crosa@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.