sbt / sbt-pgp

PGP plugin for sbt
Other
144 stars 56 forks source link

Changing gpgCommand has no effect #133

Open Katrix opened 6 years ago

Katrix commented 6 years ago

Trying to make sbt-pgp use gpg2 by changing the gpgCommand key, but it doesn't seem to have any effect.

Using useGpg := true

sbt:scammanderRoot> set com.typesafe.sbt.pgp.PgpKeys.gpgCommand := "gpg2"
[info] Defining gpgCommand
[info] The new value will be used by no settings or tasks.
[info] Reapplying settings...
[info] Set current project to scammanderRoot (in build file:/mnt/d/DevProjects/Scammander/)
sbt:scammanderRoot> show pgpSigner
[info] spongeSponge7-0-0 / pgpSigner
[info]  GPG-Command(gpg)
[info] bukkit / pgpSigner
[info]  GPG-Command(gpg)
[info] spongeSponge5-1-0 / pgpSigner
[info]  GPG-Command(gpg)
[info] common / pgpSigner
[info]  GPG-Command(gpg)
[info] spongeSponge6-0-0 / pgpSigner
[info]  GPG-Command(gpg)
[info] pgpSigner
[info]  GPG-Command(gpg)
[success] Total time: 0 s, completed Jun 14, 2018 1:22:24 PM
ajozwik commented 5 years ago

The same for me.... gpg in version 1.4.x is used by my update tool (slackpkg on slackware) and I can not override it. Instead of I have gpg2 installed. I need to point to gpg2 only for publishSigned

Work-around:

eed3si9n commented 5 years ago

Probably needs to be scoped globally.

set Global / gpgCommand := "gpg2"
softinio commented 4 years ago

I am still getting this issue. Opened a stackoverflow question in case its me doing something wrong:

https://stackoverflow.com/questions/60029812/how-do-you-use-sbt-pgp-with-a-different-command-to-call-gpg-i-have-tried-gpgcom

@eed3si9n any thoughts?

eed3si9n commented 4 years ago

Let me reopen this issue.

softinio commented 4 years ago

@eed3si9n thx ... is the fix for this simply adding to here:

https://github.com/sbt/sbt-pgp/blob/master/sbt-pgp/src/main/scala/com/jsuereth/sbtpgp/SbtPgp.scala#L30

def gpgCommand = PgpKeys.gpgCommand in Global
SethTisue commented 4 years ago

I poked at this a bit in the scala-xml repo (as an arbitrary example of a repo that uses this plugin)

sbt:scala-xml> set com.typesafe.sbt.pgp.PgpKeys.gpgCommand := "gpg2"
[info] Defining gpgCommand
[info] The new value will be used by no settings or tasks.
[info] Reapplying settings...
[info] Set current project to scala-xml (in build file:/Users/tisue/modules/scala-xml/)
sbt:scala-xml> show gpgCommand
[info] xmlJS / gpgCommand
[info]  gpg
[info] xml / gpgCommand
[info]  gpg
[info] gpgCommand
[info]  gpg2

note that the global setting changed but the value in each subproject didn't

but then:

sbt:scala-xml> set ThisBuild / com.typesafe.sbt.pgp.PgpKeys.gpgCommand := "gpg2"
[info] Defining ThisBuild / gpgCommand
[info] The new value will be used by no settings or tasks.
[info] Reapplying settings...
[info] Set current project to scala-xml (in build file:/Users/tisue/modules/scala-xml/)
sbt:scala-xml> show gpgCommand
[info] xmlJS / gpgCommand
[info]  gpg2
[info] xml / gpgCommand
[info]  gpg2
[info] gpgCommand
[info]  gpg2

this time they all changed.

so maybe you want ThisBuild rather than Global?

softinio commented 4 years ago

@SethTisue thanks for taking the time to help with this. Will give your suggestion a try.

ihostage commented 4 years ago

For changing command on Travis CI (Ubuntu) we use the next settings:

val gpgSettings = Seq(
  useGpgAgent := true,
  useGpgPinentry := true,
  usePgpKeyHex("XXXXXXX")
) ++ sys.env.get("TRAVIS").map( _ => gpgCommand in Global := "gpg2" )