From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 7707513835A for ; Sun, 11 Oct 2020 14:54:28 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id BA445E0D35; Sun, 11 Oct 2020 14:54:27 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 9338AE0D35 for ; Sun, 11 Oct 2020 14:54:27 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 773D933FD3F for ; Sun, 11 Oct 2020 14:54:25 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 2BE53332 for ; Sun, 11 Oct 2020 14:54:24 +0000 (UTC) From: "Andrew Ammerlaan" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Andrew Ammerlaan" Message-ID: <1602336808.8a9d1f129ad73daa975a56f793d65200add3d8ed.andrewammerlaan@gentoo> Subject: [gentoo-commits] repo/proj/guru:master commit in: dev-vcs/lazygit/, dev-vcs/lazygit/files/ X-VCS-Repository: repo/proj/guru X-VCS-Files: dev-vcs/lazygit/files/lazygit-0.23.1_ssh_passphrase.patch dev-vcs/lazygit/lazygit-0.23.1-r1.ebuild X-VCS-Directories: dev-vcs/lazygit/files/ dev-vcs/lazygit/ X-VCS-Committer: andrewammerlaan X-VCS-Committer-Name: Andrew Ammerlaan X-VCS-Revision: 8a9d1f129ad73daa975a56f793d65200add3d8ed X-VCS-Branch: master Date: Sun, 11 Oct 2020 14:54:24 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 760181f0-37c0-46cd-a6cc-40881240ed07 X-Archives-Hash: c22f7e791ccb76309d067b0514fc8f5f commit: 8a9d1f129ad73daa975a56f793d65200add3d8ed Author: Sergey Torokhov yandex ru> AuthorDate: Sat Oct 10 13:29:10 2020 +0000 Commit: Andrew Ammerlaan riseup net> CommitDate: Sat Oct 10 13:33:28 2020 +0000 URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=8a9d1f12 dev-vcs/lazygit: 0.23.1-r1, add SSH key passphrase prompt patch Signed-off-by: Sergey Torokhov yandex.ru> .../files/lazygit-0.23.1_ssh_passphrase.patch | 122 +++++++++++++++++++++ dev-vcs/lazygit/lazygit-0.23.1-r1.ebuild | 38 +++++++ 2 files changed, 160 insertions(+) diff --git a/dev-vcs/lazygit/files/lazygit-0.23.1_ssh_passphrase.patch b/dev-vcs/lazygit/files/lazygit-0.23.1_ssh_passphrase.patch new file mode 100644 index 00000000..11d63bdf --- /dev/null +++ b/dev-vcs/lazygit/files/lazygit-0.23.1_ssh_passphrase.patch @@ -0,0 +1,122 @@ +diff -Naur a/src/github.com/jesseduffield/lazygit/pkg/commands/oscommands/os.go b/src/github.com/jesseduffield/lazygit/pkg/commands/oscommands/os.go +--- a/src/github.com/jesseduffield/lazygit/pkg/commands/oscommands/os.go 2020-10-10 02:34:14.000000000 +0300 ++++ b/src/github.com/jesseduffield/lazygit/pkg/commands/oscommands/os.go 2020-10-10 14:00:26.000000000 +0300 +@@ -143,18 +143,19 @@ + return RunCommandWithOutputLiveWrapper(c, command, output) + } + +-// DetectUnamePass detect a username / password question in a command +-// promptUserForCredential is a function that gets executed when this function detect you need to fillin a password +-// The promptUserForCredential argument will be "username" or "password" and expects the user's password or username back ++// DetectUnamePass detect a username / password / passphrase question in a command ++// promptUserForCredential is a function that gets executed when this function detect you need to fillin a password or passphrase ++// The promptUserForCredential argument will be "username", "password" or "passphrase" and expects the user's password/passphrase or username back + func (c *OSCommand) DetectUnamePass(command string, promptUserForCredential func(string) string) error { + ttyText := "" + errMessage := c.RunCommandWithOutputLive(command, func(word string) string { + ttyText = ttyText + " " + word + + prompts := map[string]string{ +- `.+'s password:`: "password", +- `Password\s*for\s*'.+':`: "password", +- `Username\s*for\s*'.+':`: "username", ++ `.+'s password:`: "password", ++ `Password\s*for\s*'.+':`: "password", ++ `Username\s*for\s*'.+':`: "username", ++ `Enter\s*passphrase\s*for\s*key\s*'.+':`: "passphrase", + } + + for pattern, askFor := range prompts { +diff -Naur a/src/github.com/jesseduffield/lazygit/pkg/gui/credentials_panel.go b/src/github.com/jesseduffield/lazygit/pkg/gui/credentials_panel.go +--- a/src/github.com/jesseduffield/lazygit/pkg/gui/credentials_panel.go 2020-10-10 02:34:14.000000000 +0300 ++++ b/src/github.com/jesseduffield/lazygit/pkg/gui/credentials_panel.go 2020-10-10 03:17:57.000000000 +0300 +@@ -9,7 +9,7 @@ + + type credentials chan string + +-// promptUserForCredential wait for a username or password input from the credentials popup ++// promptUserForCredential wait for a username, password or passphrase input from the credentials popup + func (gui *Gui) promptUserForCredential(passOrUname string) string { + gui.credentials = make(chan string) + gui.g.Update(func(g *gocui.Gui) error { +@@ -17,9 +17,12 @@ + if passOrUname == "username" { + credentialsView.Title = gui.Tr.CredentialsUsername + credentialsView.Mask = 0 +- } else { ++ } else if passOrUname == "password" { + credentialsView.Title = gui.Tr.CredentialsPassword + credentialsView.Mask = '*' ++ } else { ++ credentialsView.Title = gui.Tr.CredentialsPassphrase ++ credentialsView.Mask = '*' + } + + if err := gui.switchContext(gui.Contexts.Credentials.Context); err != nil { +@@ -30,7 +33,7 @@ + return nil + }) + +- // wait for username/passwords input ++ // wait for username/passwords/passphrase input + userInput := <-gui.credentials + return userInput + "\n" + } +@@ -70,10 +73,10 @@ + func (gui *Gui) handleCredentialsPopup(cmdErr error) { + if cmdErr != nil { + errMessage := cmdErr.Error() +- if strings.Contains(errMessage, "Invalid username or password") { ++ if strings.Contains(errMessage, "Invalid username, password or passphrase") { + errMessage = gui.Tr.PassUnameWrong + } +- // we are not logging this error because it may contain a password ++ // we are not logging this error because it may contain a password or a passphrase + gui.createErrorPanel(errMessage) + } else { + _ = gui.closeConfirmationPrompt(false) +diff -Naur a/src/github.com/jesseduffield/lazygit/pkg/i18n/dutch.go b/src/github.com/jesseduffield/lazygit/pkg/i18n/dutch.go +--- a/src/github.com/jesseduffield/lazygit/pkg/i18n/dutch.go 2020-10-10 02:34:14.000000000 +0300 ++++ b/src/github.com/jesseduffield/lazygit/pkg/i18n/dutch.go 2020-10-10 02:57:03.000000000 +0300 +@@ -19,6 +19,7 @@ + CommitMessage: "Commit bericht", + CredentialsUsername: "Gebruikersnaam", + CredentialsPassword: "Wachtwoord", ++ CredentialsPassphrase: "Voer een wachtwoordzin in voor de SSH-sleutel", + PassUnameWrong: "Wachtwoord en/of gebruikersnaam verkeert", + CommitChanges: "Commit veranderingen", + AmendLastCommit: "wijzig laatste commit", +diff -Naur a/src/github.com/jesseduffield/lazygit/pkg/i18n/english.go b/src/github.com/jesseduffield/lazygit/pkg/i18n/english.go +--- a/src/github.com/jesseduffield/lazygit/pkg/i18n/english.go 2020-10-10 02:34:14.000000000 +0300 ++++ b/src/github.com/jesseduffield/lazygit/pkg/i18n/english.go 2020-10-10 02:56:08.000000000 +0300 +@@ -30,6 +30,7 @@ + CommitMessage string + CredentialsUsername string + CredentialsPassword string ++ CredentialsPassphrase string + PassUnameWrong string + CommitChanges string + AmendLastCommit string +@@ -519,7 +520,8 @@ + CommitMessage: "Commit message", + CredentialsUsername: "Username", + CredentialsPassword: "Password", +- PassUnameWrong: "Password and/or username wrong", ++ CredentialsPassphrase: "Enter passphrase for SSH key", ++ PassUnameWrong: "Password, passphrase and/or username wrong", + CommitChanges: "commit changes", + AmendLastCommit: "amend last commit", + SureToAmend: "Are you sure you want to amend last commit? Afterwards, you can change commit message from the commits panel.", +diff -Naur a/src/github.com/jesseduffield/lazygit/pkg/i18n/polish.go b/src/github.com/jesseduffield/lazygit/pkg/i18n/polish.go +--- a/src/github.com/jesseduffield/lazygit/pkg/i18n/polish.go 2020-10-10 02:34:14.000000000 +0300 ++++ b/src/github.com/jesseduffield/lazygit/pkg/i18n/polish.go 2020-10-10 02:49:23.000000000 +0300 +@@ -15,7 +15,8 @@ + CommitMessage: "Wiadomość commita", + CredentialsUsername: "Username", + CredentialsPassword: "Password", +- PassUnameWrong: "Password and/or username wrong", ++ CredentialsPassphrase: "Passphrase", ++ PassUnameWrong: "Password, passphrase and/or username wrong", + CommitChanges: "commituj zmiany", + AmendLastCommit: "zmień ostatnie zatwierdzenie", + SureToAmend: "Czy na pewno chcesz zmienić ostatnie zatwierdzenie? Możesz zmienić komunikat zatwierdzenia z panelu zatwierdzeń.", diff --git a/dev-vcs/lazygit/lazygit-0.23.1-r1.ebuild b/dev-vcs/lazygit/lazygit-0.23.1-r1.ebuild new file mode 100644 index 00000000..b73db124 --- /dev/null +++ b/dev-vcs/lazygit/lazygit-0.23.1-r1.ebuild @@ -0,0 +1,38 @@ +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +EGO_PN="github.com/jesseduffield/lazygit" + +inherit golang-build golang-vcs-snapshot + +DESCRIPTION="Lazygit, a simple terminal UI for git commands" +HOMEPAGE="https://github.com/jesseduffield/lazygit" +SRC_URI="https://github.com/jesseduffield/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64" +IUSE="doc" + +DEPEND=( sys-libs/glibc ) +RDEPEND=( + ${DEPEND} + dev-vcs/git +) + +DOCS=( src/${EGO_PN}/{CONTRIBUTING,README}.md ) + +PATCHES=( "${FILESDIR}/${P}_ssh_passphrase.patch" ) + +src_compile() { + GOPATH="${S}" go build -v -o bin/lazygit src/${EGO_PN}/main.go || die +} + +src_install() { + dobin bin/lazygit + + use doc && dodoc -r "src/${EGO_PN}/docs/." + einstalldocs +}