-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch to building stage repository by combining production and diff …
…of Copr When the version is nightly, this will not pull from production but instead treat what is in Copr as the source of truth. At the end, the output for a versioned repository is a list of unsigned packages.
- Loading branch information
Showing
4 changed files
with
234 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#!/usr/bin/env python3 | ||
|
||
from subprocess import check_output, STDOUT, CalledProcessError | ||
import argparse | ||
import glob | ||
|
||
|
||
def find_unsigned_packages(target_dir, gpgkey): | ||
unsigned = [] | ||
packages = glob.glob(f"{target_dir}/*.rpm") | ||
|
||
for package in packages: | ||
cmd = [ | ||
'rpm', | ||
'-qpi', | ||
package | ||
] | ||
|
||
output = check_output(cmd, universal_newlines=True, stderr=STDOUT) | ||
|
||
if gpgkey.lower() not in output: | ||
unsigned.append(package) | ||
|
||
return unsigned | ||
|
||
|
||
def handle_args(): | ||
parser = argparse.ArgumentParser(description='Sign unsigned RPMs in local stage repository') | ||
parser.add_argument( | ||
'repository_path', | ||
help='Path to repository to sign unsigned RPMs' | ||
) | ||
parser.add_argument( | ||
'gpgkey', | ||
help='Short form gpgkey for the version being generated, does not apply to nightly' | ||
) | ||
|
||
args = parser.parse_args() | ||
|
||
if args.gpgkey: | ||
if len(args.gpgkey) != 8: | ||
raise SystemExit("GPG key must be in short form and 8 characters long") | ||
|
||
return args | ||
|
||
|
||
def main(): | ||
args = handle_args() | ||
|
||
repository_path = args.repository_path | ||
gpgkey = args.gpgkey | ||
|
||
unsigned_rpms = find_unsigned_packages(f"{repository_path}/x86_64", gpgkey) | ||
unsigned_srpms = find_unsigned_packages(f"{repository_path}/source", gpgkey) | ||
|
||
for rpm in unsigned_rpms: | ||
print(rpm) | ||
for srpm in unsigned_srpms: | ||
print(srpm) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash -e | ||
|
||
. settings | ||
|
||
echo "./list_unsigned_rpms $1 $GPGKEY" | ||
UNSIGNED_RPMS=($(./list_unsigned_rpms "$1" "$GPGKEY")) | ||
Check warning Code scanning / shellcheck Prefer mapfile or read -a to split command output (or quote to avoid splitting). Warning
Prefer mapfile or read -a to split command output (or quote to avoid splitting).
|
||
|
||
for rpm_path in "${UNSIGNED_RPMS[@]}" | ||
do | ||
echo "Signing $rpm_path" | ||
./sign_rpms "$rpm_path" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash -e | ||
|
||
. settings | ||
|
||
USER='yumrepostage' | ||
HOST='web01.osuosl.theforeman.org' | ||
|
||
rsync --archive --verbose --partial --one-file-system --delete-after "$PROJECT/$VERSION" "$USER@$HOST:rsync_cache/$PROJECT" |