dlech / KeeAgent

ssh agent plugin for KeePass 2.x
http://lechnology.com/software/keeagent
Other
530 stars 35 forks source link

KeeaAgent does not build with mono/xbuild anymore #279

Closed grazzolini closed 2 years ago

grazzolini commented 4 years ago

I have been trying to build 0.11.2 using xbuild and due to the recent changes on the project, keeagent does not build anymore. Also, I'm working on a patch to add the getmenuitem to the 0.10.1. But, since these changes will likely affect the building of keeagent in the future, I think we could fix the issue now.

dlech commented 4 years ago

What is the full command you are using? What is the error message? Did you run nuget restore first?

grazzolini commented 4 years ago

Sure, here are the instructions I'm using to build it. And here is the full build log.

dlech commented 4 years ago

It looks like nuget restore is not picking up the NuGet packages from KeeAgent/KeeAgent.csproj for some reason.

dlech commented 4 years ago

https://github.com/dlech/KeeAgent/blob/1d4371c14abcc026361d4c29e1e921ec6d51ddcc/KeeAgent/KeeAgent.csproj#L206-L215

grazzolini commented 4 years ago

Arch is using a very old nuget version, could that be it? I tried to use your debian build patch to use the local keepass version, but I think it would be better to make sure the build process can work as it was before.

dlech commented 4 years ago

Yes, it probably requires a fairly new NuGet.

grazzolini commented 4 years ago

I understand why changing from submodule to nuget packages makes sense. And right now, the only thing preventing the 2.43 keepass update on Arch is this keeagent issue. Because keepass + keeagent is not used only by myself, but other Arch developers use it as well, and since everything requires ssh keys, including submitting new packages, it's a vital piece of code. I'm going to try and update nuget on Arch, but if you have any other ideas, let me know.

erlanger commented 4 years ago

Any update? This broke all my logins and automated scripts. I downgraded keepass to 2.42 for now.

grazzolini commented 4 years ago

@erlanger we are creating a msbuild package for Arch, so we stop using xbuild for keeagent. I expect that in the next few days we can test it out and see if we can update keeagent. I'm also preparing a patch for keeagent, but it won't help if we can't build new versions in the future.

erlanger commented 4 years ago

Thanks, look forward to the fix, I'd be willing to test it as soon as you have it out.

axhoffmann commented 4 years ago

Hi,

I solve the problem for me. I exchanged xbuild with msbuild and used the newest available nuget version. I used the newest msbuild version from the AURs.

This is the modified PKGBUILD for keeagent.

## Maintainer: Giancarlo Razzolinit <grazzolini@gmail.com>
# Contributor: Axel Hoffmann

pkgname=keepass-plugin-keeagent
pkgver=0.11.3
pkgrel=0
pkgdesc="SSH Agent Plugin for KeePass"
license=('GPL')
makedepends=('git' 'msbuild' 'nuget>=5.3.1')
depends=('keepass')
optdepends=('openssh: For integration with ssh-agent' 'gnupg: For integration with GnuPG SSH agent')
arch=('any')
url="https://lechnology.com/software/keeagent/"
options=('!strip')
source=("${pkgname}-${pkgver}::git+https://github.com/dlech/KeeAgent.git#tag=v${pkgver}")
sha512sums=('SKIP')

prepare() {
  cd "${srcdir}/${pkgname}-${pkgver}"

  git submodule update --init --recursive

  cd "${srcdir}/${pkgname}-${pkgver}"

  nuget restore
}

build() {
  cd "${srcdir}/${pkgname}-${pkgver}"

  msbuild /property:Configuration=ReleasePlgx KeeAgent.sln
}

package() {
    cd "${srcdir}/${pkgname}-${pkgver}"
    install -Dm644 KeeAgent/bin/ReleasePlgx/KeeAgent.plgx -t "$pkgdir/usr/share/keepass/plugins/"
    install -Dm644 LICENSE.txt "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
    install -Dm644 GPL2.txt "$pkgdir/usr/share/licenses/$pkgname/GPL2.txt"
}

And this is a modified PKGBUILD for nuget.

## Maintainer: Henrik Gaßmann <henrik at gassmann dot onl>
# Contributor: Alexander Jesner <alexander at jesner dot eu>
# Contributor: Axel Hoffmann
# Forked from https://aur.archlinux.org/packages/nuget3/

pkgname="nuget"
pkgver=5.3.1
pkgrel=0
pkgdesc="Package manager for .NET."
arch=('any')
url="http://www.nuget.org"
license=('APACHE')
depends=('mono>=5.0.0' 'sh')
conflicts=('nuget' 'nuget1' 'nuget2' 'nuget3' 'nuget4' 'nuget5')
source=("https://dist.nuget.org/win-x86-commandline/v${pkgver}/nuget.exe")
sha512sums=("efc2573b774f794f2a1502477b840889e9948a39d063d0728694c147b29ea99bb50904dd0bdc3a6fcaf2b96a311d902075791a3461ad9366ae21f8a01d2d5219")

build() {
    cat <<EOT>> ${srcdir}/nuget
#!/bin/sh
exec mono /usr/lib/nuget/nuget.exe "\$@"
EOT
}

package() {
    install -d ${pkgdir}/usr/lib/nuget
    install -d ${pkgdir}/usr/bin

    install -m 0644 ${srcdir}/nuget.exe ${pkgdir}/usr/lib/nuget/nuget.exe
    install -m 0755 ${srcdir}/nuget ${pkgdir}/usr/bin/nuget
}

If you want to use my modifications, please feel free to use them for an official package or AUR.

Best regards, Axel

grazzolini commented 4 years ago

@axhoffmann

Thanks for reporting this. We're trying to get more up to date dotnet and related tools to the official repositories, you can see https://bugs.archlinux.org/task/61769#comment184589 for reference.

I'll try later as well building with msbuild again. Last time I tried this it didn't work.

axhoffmann commented 4 years ago

The reason why it didn't build on my machine was an old nuget version. If I downloaded nuget directly from Microsoft (like in the build manual of keeagent), it worked for me with msbuild.

To have a package, I "forked" the both PKGBUILDs.

grazzolini commented 4 years ago

I guess later this week we'll have a more up to date dotnet package in the official Arch repos. As well as moving the msbuild package to the official repos.

The nuget situation is trickier, because you can't build from source, and microsoft says we shouldn't build from source.

erlanger commented 4 years ago

Thanks @axhoffmann ! I used your PKGBUILDs and now I have a working key agent; thank you so much for the fix! I hope the official repo picks up your fix soon.

grazzolini commented 4 years ago

We now have recent dotnet on the repositories and we should get msbuild too. The only missing piece will be a more recent nuget.

dlech commented 2 years ago

This issue it outdated. Let's start a new one if there are similar problems.