From nobody Wed May 15 18:41:41 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1596618404; cv=none; d=zohomail.com; s=zohoarc; b=QOXFvD1KoDp+FdGE/GY6T6HrctY/fqnbPxLp9SAOHFdn2SrFot3U8lPh2jtvxQIM4g0556f5JQsJ90FJbdhI5Apx6FlTR0qT+lnF4K16Gxe5Ui5ko6HPHpsQgwn35k+gyXopQr2FBTs7r5Gh9fNKO8N7mM7HGfIqvn92yByG/L8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1596618404; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=5JYOviZZhET+GCtAgEpX9c3Lxn7AIf4+nWKCu20tOyg=; b=IIiXRSqabfGO1zq8Okjk05A7gvYvFgy2B2vFqeJBsmSPAHM7Ah30ci7hd5rZ06kiadr34s2e0Lsw06dO+PvwKY3PrPasNZcJxdhsmMPQCUfoIhVgQQN7RdqxxzhOaWBXuXeFPXXnhy0Qqs7cp7CfzCYjFZBDEIhankZAdJFaRPQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 15966184045381022.0853728776556; Wed, 5 Aug 2020 02:06:44 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-183-iJeLpa5TOHivUpEpsZ0CZA-1; Wed, 05 Aug 2020 05:06:40 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 885F018C63C1; Wed, 5 Aug 2020 09:06:35 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 660CB726A3; Wed, 5 Aug 2020 09:06:35 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 2F5EC96906; Wed, 5 Aug 2020 09:06:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 07596YlP018672 for ; Wed, 5 Aug 2020 05:06:34 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4FFD26179B; Wed, 5 Aug 2020 09:06:34 +0000 (UTC) Received: from ridgehead.redhat.com (unknown [10.40.193.164]) by smtp.corp.redhat.com (Postfix) with ESMTP id 959065C5B7; Wed, 5 Aug 2020 09:06:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1596618403; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=5JYOviZZhET+GCtAgEpX9c3Lxn7AIf4+nWKCu20tOyg=; b=UADOZN9eQsWKqO4trWI2LDVDUBXxx4+OvToE8AjM0ciDZdfk7P5aIkAHZ25DGEPN6cpAz6 xTSDvK5Ny2Jw7IBeptzxD+JpAoST66donN5mZXpMlRw1zUn5Ppv/bJdfLCPEbQTMINPgDv aFNcYOkP/3egpGoZWewgfKOxc+14ZW8= X-MC-Unique: iJeLpa5TOHivUpEpsZ0CZA-1 From: Erik Skultety To: libvir-list@redhat.com Subject: [libvirt PATCH v2] scripts: Fix meson-install-symlink.py overwriting existing links Date: Wed, 5 Aug 2020 11:06:29 +0200 Message-Id: <310fe90f2201247d1c83dd3551544afefd534d37.1596618127.git.eskultet@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Erik Skultety X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" By default, symlink re-creation fails if the link already exists, more specifically in case of meson-install-symlink.py: Traceback (most recent call last): File "//scripts/meson-install-symlink.py", line 15, in os.symlink(target, link) FileExistsError: File exists: '../default.xml' -> 'default.xml' Unfortunately, Python can't mimic "ln -sf", so we have to fix this differently - remove the existing link first and then try re-creating it. Signed-off-by: Erik Skultety Reviewed-by: Pavel Hrdina --- This version suffers from the same problem as v1, but I didn't bother putti= ng that into the commit message anymore as the consensus seems to be that we d= on't care. scripts/meson-install-symlink.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/meson-install-symlink.py b/scripts/meson-install-symli= nk.py index e38507072d..d8817fb9be 100644 --- a/scripts/meson-install-symlink.py +++ b/scripts/meson-install-symlink.py @@ -12,4 +12,8 @@ workdir =3D os.path.join(destdir, dirname.strip(os.sep)) =20 os.makedirs(workdir, exist_ok=3DTrue) os.chdir(workdir) + +if os.path.exists(link): + os.remove(link) + os.symlink(target, link) --=20 2.26.2