From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 149DEC54EE9 for ; Thu, 8 Sep 2022 13:51:24 +0000 (UTC) Received: from localhost ([::1]:43914 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oWHwB-0008Jp-Vf for qemu-devel@archiver.kernel.org; Thu, 08 Sep 2022 09:51:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35658) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oWHs0-0005Sq-K0 for qemu-devel@nongnu.org; Thu, 08 Sep 2022 09:47:04 -0400 Received: from mail-lj1-x230.google.com ([2a00:1450:4864:20::230]:34651) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oWHrv-00069x-96 for qemu-devel@nongnu.org; Thu, 08 Sep 2022 09:47:04 -0400 Received: by mail-lj1-x230.google.com with SMTP id z23so19995703ljk.1 for ; Thu, 08 Sep 2022 06:46:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=hPSSLwBgi64m1iQT7wmsDomTy2G7dXuexB/R9cVwK18=; b=SJk4eq0ryWle4Pg5pBjMiNS/Ga3JW5olE9NPECtx057QpsW5Q+19LEdVvxI13ICea1 jfXMBz3onYZUXN2/nikOmNjSNokKq33LFLFlZr3wxoAIcU2fKoVmYGWdlJtrEKvBBKXO cnvWfXBaQaKRssIsPe2W6TxNBWqwX21Y0YwCAAjArTxiUGEUj4aNWc4XHcmyaYACvXyx 5v5PGZ79cM8FVSJeS8J8VlxBTT7SY8DLFuiBf7HDa0g3lwJfjTGaI0fT8oEC3VobRBiK jKHd5AE3OnvCwePdywG3DJkdJSaWLgztG+ZthWuCLE406N2C2Z8d0PLszlLRgAScQ+jg PtLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=hPSSLwBgi64m1iQT7wmsDomTy2G7dXuexB/R9cVwK18=; b=5L7C6rTWX4XW7xORhNpWYAariKVoOvnhUcG1LLvogbl5EMe9aSQMMIWCUUVF0iNFz0 vEUL5jxCUj662jKL1h0xmL8zkKDJdHVH/sLCTIHDmk+DkoiAHf80fXuMjVcPTRYgboav PtfLPHE1YUz3MzoVJ4mwp4UAWPt/ToVxb3Hmh7GXomoUfF9xuKq/gFIF31Cq5BsqWG3X t/rINtK0v9Qzy1eIAVGyBbf2B24phcFcGsrXM6lBRhKmMtBkVDNkyood2vCbkZn/ATx0 b+DgfxgtbNGafDqS7y1F9MekWv5Qgr1lvJfcw4xsf+gsKlKTV6CIENKe9YS8vBaSocck WjdQ== X-Gm-Message-State: ACgBeo0LnSTtWd1bffCkB5V3XzyYvKeEAm7dwfL46suQVSyuHOehsOdp z1WbZPpDmIexLW/Vqu3GBDfkPsub4Fhk+RROA88= X-Google-Smtp-Source: AA6agR49ISc8NxbPpZBe8sBiNO0qYy39e9B8WTVMzRM9E/wTE/7SdVyxNYT4TjimK7JWWVRHKORfJV95nT3Qt25tfng= X-Received: by 2002:a05:651c:451:b0:263:7cfc:1c0b with SMTP id g17-20020a05651c045100b002637cfc1c0bmr2436928ljg.94.1662644817356; Thu, 08 Sep 2022 06:46:57 -0700 (PDT) MIME-Version: 1.0 References: <20220908132817.1831008-1-bmeng.cn@gmail.com> <20220908132817.1831008-3-bmeng.cn@gmail.com> In-Reply-To: <20220908132817.1831008-3-bmeng.cn@gmail.com> From: =?UTF-8?B?TWFyYy1BbmRyw6kgTHVyZWF1?= Date: Thu, 8 Sep 2022 17:46:45 +0400 Message-ID: Subject: Re: [PATCH 2/7] scripts/nsis.py: Fix destination directory name when invoked on Windows To: Bin Meng Cc: qemu-devel@nongnu.org, Bin Meng , Cleber Rosa , John Snow Content-Type: multipart/alternative; boundary="000000000000b9ec5305e82aa9cd" Received-SPF: pass client-ip=2a00:1450:4864:20::230; envelope-from=marcandre.lureau@gmail.com; helo=mail-lj1-x230.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" --000000000000b9ec5305e82aa9cd Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Sep 8, 2022 at 5:30 PM Bin Meng wrote: > From: Bin Meng > > "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 > > 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 > Reviewed-by: Marc-Andr=C3=A9 Lureau > --- > > 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=3D"*") > args =3D parser.parse_args() > > + # canonicalize the Windows native prefix path > + prefix =3D os.path.splitdrive(args.prefix)[1] > destdir =3D tempfile.mkdtemp() > try: > subprocess.run(["make", "install", "DESTDIR=3D" + 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 =3D os.path.basename(exe) > arch =3D 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 =3D [ > @@ -69,7 +71,7 @@ def main(): > "-V2", > "-NOCD", > "-DSRCDIR=3D" + args.srcdir, > - "-DBINDIR=3D" + destdir + args.prefix, > + "-DBINDIR=3D" + destdir + prefix, > ] > dlldir =3D "w32" > if args.cpu =3D=3D "x86_64": > -- > 2.34.1 > > > --=20 Marc-Andr=C3=A9 Lureau --000000000000b9ec5305e82aa9cd Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Thu, Sep 8, 2022 at 5:30 PM Bin Me= ng <bmeng.cn@gmail.com> wro= te:
From: Bin Me= ng <bin.meng= @windriver.com>

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

=C2=A0 Traceback (most recent call last):
=C2=A0 =C2=A0 File "G:\msys64\home\foo\git\qemu\scripts\nsis.py",= line 89, in <module>
=C2=A0 =C2=A0 =C2=A0 main()
=C2=A0 =C2=A0 File "G:\msys64\home\foo\git\qemu\scripts\nsis.py",= line 34, in main
=C2=A0 =C2=A0 =C2=A0 with open(
=C2=A0 OSError: [Errno 22] Invalid argument:
=C2=A0 'R:/Temp/tmpw83xhjquG:/msys64/qemu/system-emulations.nsh' =C2=A0 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>

=
Reviewed-by: Marc-Andr=C3=A9 Lureau <marcandre.lureau@redhat.com>
=C2=A0
---

=C2=A0scripts/nsis.py | 12 +++++++-----
=C2=A01 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():
=C2=A0 =C2=A0 =C2=A0parser.add_argument("nsisargs", nargs=3D"= ;*")
=C2=A0 =C2=A0 =C2=A0args =3D parser.parse_args()

+=C2=A0 =C2=A0 # canonicalize the Windows native prefix path
+=C2=A0 =C2=A0 prefix =3D os.path.splitdrive(args.prefix)[1]
=C2=A0 =C2=A0 =C2=A0destdir =3D tempfile.mkdtemp()
=C2=A0 =C2=A0 =C2=A0try:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0subprocess.run(["make", "i= nstall", "DESTDIR=3D" + destdir])
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0with open(
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 os.path.join(destdir + args.pref= ix, "system-emulations.nsh"), "w"
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 os.path.join(destdir + prefix, &= quot;system-emulations.nsh"), "w"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0) as nsh, open(
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 os.path.join(destdir + args.pref= ix, "system-mui-text.nsh"), "w"
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 os.path.join(destdir + prefix, &= quot;system-mui-text.nsh"), "w"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0) as muinsh:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0for exe in sorted(glob.glob= (
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 os.path.join(destd= ir + args.prefix, "qemu-system-*.exe")
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 os.path.join(destd= ir + prefix, "qemu-system-*.exe")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0)):
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0exe =3D os.pa= th.basename(exe)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0arch =3D exe[= 12:-4]
@@ -61,7 +63,7 @@ def main():
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0!insertmacro = MUI_DESCRIPTION_TEXT ${{Section_{0}}} "{1}"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0""&= quot;.format(arch, desc))

-=C2=A0 =C2=A0 =C2=A0 =C2=A0 for exe in glob.glob(os.path.join(destdir + ar= gs.prefix, "*.exe")):
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 for exe in glob.glob(os.path.join(destdir + pr= efix, "*.exe")):
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0signcode(exe)

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0makensis =3D [
@@ -69,7 +71,7 @@ def main():
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"-V2",
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"-NOCD",
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"-DSRCDIR=3D" + a= rgs.srcdir,
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "-DBINDIR=3D" + destdi= r + args.prefix,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "-DBINDIR=3D" + destdi= r + prefix,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0]
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0dlldir =3D "w32"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if args.cpu =3D=3D "x86_64": --
2.34.1




--
Marc-Andr=C3=A9 Lureau
--000000000000b9ec5305e82aa9cd--