Gentoo Archives: gentoo-portage-dev

From: Matt Turner <mattst88@g.o>
To: Zac Medico <zmedico@g.o>
Cc: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [PATCH gentoolkit] bin: Add merge-driver-ekeyword
Date: Thu, 31 Dec 2020 19:49:16
Message-Id: CAEdQ38F9BeTdtzw4iYLG8DDEniAtL3yJAuXfJv7gKH=CF0sigg@mail.gmail.com
In Reply to: Re: [gentoo-portage-dev] [PATCH gentoolkit] bin: Add merge-driver-ekeyword by Zac Medico
1 On Mon, Dec 28, 2020 at 8:09 PM Zac Medico <zmedico@g.o> wrote:
2 >
3 > On 12/28/20 3:15 PM, Matt Turner wrote:
4 > > +def apply_keyword_changes(ebuild: str, pathname: str,
5 > > + changes: List[Tuple[Optional[str],
6 > > + Optional[str]]]) -> int:
7 > > + result: int = 0
8 > > +
9 > > + # ekeyword will only modify files named *.ebuild, so make a symlink
10 > > + ebuild_symlink: str = os.path.basename(pathname)
11 > > + os.symlink(ebuild, ebuild_symlink)
12 >
13 > Are we sure that the current working directory is an entirely safe place
14 > to create this symlink? A simple fix would be to use
15 > tempfile.TemporaryDirectory to create a temporary directory to hold the
16 > symlink. Or, we could change ekeyword to assume that an argument is an
17 > ebuild if os.path.isfile(arg) succeeds.
18
19 Thanks, this is a good question. I've sent a v3 patch using
20 tempfile.TemporaryDirectory. I think that's better than passing
21 ".merge_file_SEd3R8" to ekeyword since the filename is printed and
22 it's nice to see what file is being modified during the rebase.