Skip to content

Commit 5d6f4bc

Browse files
authored
Merge pull request #246 from devmobasa/fix/245-rpm-gpg-key-alias
fix: publish RPM GPG key alias for repo installs
2 parents 06b15e5 + 0937f1e commit 5d6f4bc

3 files changed

Lines changed: 53 additions & 1 deletion

File tree

tools/build-package-repos.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,10 @@ build_rpm_repo() {
160160

161161
cp "${RPM_MAIN}" "${rpm_root}/"
162162
[[ -f "${RPM_CFG}" ]] && cp "${RPM_CFG}" "${rpm_root}/"
163-
[[ -f "${OUTPUT_ROOT}/WAYSCRIBER-GPG-KEY.asc" ]] && cp "${OUTPUT_ROOT}/WAYSCRIBER-GPG-KEY.asc" "${rpm_root}/RPM-GPG-KEY-wayscriber.asc"
163+
if [[ -f "${OUTPUT_ROOT}/WAYSCRIBER-GPG-KEY.asc" ]]; then
164+
cp "${OUTPUT_ROOT}/WAYSCRIBER-GPG-KEY.asc" "${rpm_root}/RPM-GPG-KEY-wayscriber.asc"
165+
cp "${OUTPUT_ROOT}/WAYSCRIBER-GPG-KEY.asc" "${rpm_root}/RPM-GPG-KEY-wayscriber"
166+
fi
164167

165168
if [[ -n "${ACTIVE_KEY}" && "${SIGN_RPMS}" == "1" ]]; then
166169
for rpm in "${rpm_root}"/*.rpm; do

tools/lint-and-test.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ REPO_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
66
cd "$REPO_ROOT"
77

88
bash tools/check-version-consistency.sh
9+
bash tools/test-package-repo-layout.sh
910
cargo fmt --all -- --check
1011
cargo clippy --workspace --all-targets --all-features -- -D warnings
1112
cargo test --workspace --all-features

tools/test-package-repo-layout.sh

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
5+
REPO_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
6+
WORK_DIR="$(mktemp -d)"
7+
8+
cleanup() {
9+
rm -rf "${WORK_DIR}"
10+
}
11+
trap cleanup EXIT
12+
13+
ARTIFACT_ROOT="${WORK_DIR}/dist"
14+
OUTPUT_ROOT="${WORK_DIR}/repo-out"
15+
FAKE_BIN="${WORK_DIR}/bin"
16+
17+
mkdir -p "${ARTIFACT_ROOT}" "${OUTPUT_ROOT}" "${FAKE_BIN}"
18+
touch "${ARTIFACT_ROOT}/wayscriber-amd64.deb"
19+
touch "${ARTIFACT_ROOT}/wayscriber-x86_64.rpm"
20+
printf '%s\n' 'fake public key' > "${OUTPUT_ROOT}/WAYSCRIBER-GPG-KEY.asc"
21+
22+
cat > "${FAKE_BIN}/apt-ftparchive" <<'EOF'
23+
#!/usr/bin/env bash
24+
set -euo pipefail
25+
printf '%s\n' "fake apt-ftparchive output"
26+
EOF
27+
chmod +x "${FAKE_BIN}/apt-ftparchive"
28+
29+
cat > "${FAKE_BIN}/createrepo_c" <<'EOF'
30+
#!/usr/bin/env bash
31+
set -euo pipefail
32+
repo_root=""
33+
for arg in "$@"; do
34+
repo_root="${arg}"
35+
done
36+
mkdir -p "${repo_root}/repodata"
37+
printf '%s\n' '<repomd />' > "${repo_root}/repodata/repomd.xml"
38+
EOF
39+
chmod +x "${FAKE_BIN}/createrepo_c"
40+
41+
PATH="${FAKE_BIN}:${PATH}" \
42+
ARTIFACT_ROOT="${ARTIFACT_ROOT}" \
43+
OUTPUT_ROOT="${OUTPUT_ROOT}" \
44+
SIGN_RPMS=0 \
45+
bash "${REPO_ROOT}/tools/build-package-repos.sh"
46+
47+
cmp "${OUTPUT_ROOT}/WAYSCRIBER-GPG-KEY.asc" "${OUTPUT_ROOT}/rpm/RPM-GPG-KEY-wayscriber.asc"
48+
cmp "${OUTPUT_ROOT}/WAYSCRIBER-GPG-KEY.asc" "${OUTPUT_ROOT}/rpm/RPM-GPG-KEY-wayscriber"

0 commit comments

Comments
 (0)