Ensure maven option -P is set only once

When `config.gpg` was set to `true` we set the `-P` option twice which
probably confused Tycho to not use the union of all profiles specified
with these two occurrences of the option.

Bug: 581901
Change-Id: I242e4406ca85a209b8e6c59f93a09f2d617688a3
diff --git a/vars/productBuild.groovy b/vars/productBuild.groovy
index ce4da56..4698a9d 100644
--- a/vars/productBuild.groovy
+++ b/vars/productBuild.groovy
@@ -67,6 +67,9 @@
 
 			def profiles = config.noTests ? '' : 'static-checks,'
 			profiles += 'other-os,eclipse-sign'
+			if (config.gpg) {
+				profiles += ',gpg-sign'
+			}
 			def commonMvnArguments = [
 				'-P' + profiles,
 				// Needed by tycho-eclipserun for the p2 mirrors URL
@@ -112,8 +115,6 @@
 					withCredentials([
 						string(credentialsId: 'gpg-passphrase', variable: 'EGIT_KEYRING_PASSPHRASE')
 					]) {
-						arguments.add('-Pgpg-sign')
-
 						tooling.maven(arguments)
 					}
 				} else {
@@ -128,7 +129,15 @@
 					'-Dskip-ui-tests=true'
 				]
 				arguments.addAll(commonMvnArguments)
-				tooling.maven(arguments)
+				if (config.gpg) {
+					withCredentials([
+						string(credentialsId: 'gpg-passphrase', variable: 'EGIT_KEYRING_PASSPHRASE')
+					]) {
+						tooling.maven(arguments)
+					}
+				} else {
+					tooling.maven(arguments)
+				}
 				// Update site
 				def extraSource = null
 				if (config.p2zip && ownVersion.endsWith('-r')) {
diff --git a/vars/verifyBuild.groovy b/vars/verifyBuild.groovy
index 7bbdcca..bcc04a5 100644
--- a/vars/verifyBuild.groovy
+++ b/vars/verifyBuild.groovy
@@ -74,6 +74,9 @@
 			stage('Build') {
 				def profiles = config.noTests ? '' : 'static-checks,'
 				profiles += 'other-os,eclipse-sign'
+				if (config.gpg) {
+					profiles += ',gpg-sign'
+				}
 				def arguments = [
 					'clean',
 					'install',
@@ -95,8 +98,6 @@
 					withCredentials([
 						string(credentialsId: 'gpg-passphrase', variable: 'EGIT_KEYRING_PASSPHRASE')
 					]) {
-						arguments.add('-Pgpg-sign')
-
 						tooling.maven(arguments)
 					}
 				} else {