Skip to content

Commit 1b695f6

Browse files
author
Janez Justin
committed
FIX no passphrase gpg keys causing badsign
1 parent 9a8530e commit 1b695f6

File tree

4 files changed

+30
-2
lines changed

4 files changed

+30
-2
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
deb/requirements/
2+
deb/code.zip
3+
rpm/code.zip

rpm/.gitignore

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
__pycache__
2+
boto3*
3+
botocore*
4+
concurrent*
5+
docutils*
6+
dateutil*
7+
six*
8+
futures*
9+
pyrpm*
10+
tests*
11+
jmespath*
12+
python_gnupg*
13+
python_dateutil*
14+
15+
code.zip
16+
17+
six.py
18+
gnupg.py
19+
gnupg.pyc

rpm/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ package: ## creates zip of code
1313
zip -r code.zip $(ZIPPED_DIRS)
1414

1515
clean: ## cleans up the repository
16-
/bin/rm -rf code.zip
16+
/bin/rm -rf code.zip __pycache__ boto3* botocore* concurrent* docutils* dateutil* six* futures* pyrpm* tests* jmespath* python_gnupg* python_dateutil* six.py gnupg.py gnupg.pyc
17+
1718

1819
test: ## runs the tests
1920
python3.6 s3rpm_test.py

rpm/s3rpm.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,12 @@ def sign_md_file(repo, s3_repo_dir):
184184
print("Key import returned: ")
185185
print(str(sec.results))
186186
with open(repo.repodir + 'repodata/repomd.xml', 'rb') as stream:
187-
signed = gpg.sign_file(stream, passphrase=os.environ['GPG_PASS'], clearsign=True, detach=True, binary=False)
187+
# If gpgkey has no password set, leaving GPG_PASS empty caues badsign,
188+
# that is why we are not calling passphrase in gpg.sign_file
189+
if os.environ['GPG_PASS'] == '':
190+
signed = gpg.sign_file(stream, clearsign=True, detach=True, binary=False)
191+
else:
192+
signed = gpg.sign_file(stream, passphrase=os.environ['GPG_PASS'], clearsign=True, detach=True, binary=False)
188193

189194
s3 = boto3.resource('s3')
190195
sign_obj = s3.Object(bucket_name=os.environ['BUCKET_NAME'], key=s3_repo_dir + "/repodata/repomd.xml.asc")

0 commit comments

Comments
 (0)