Skip to content

Commit e1e54e1

Browse files
committed
Update script to put generated package under dist/rpmbuild/ #340
Signed-off-by: Chin Yeung Li <[email protected]>
1 parent 99f38dd commit e1e54e1

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

build_rpm_docker.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
python build_rpm_docker.py
1313
1414
This script will generate the RPM package files and place them in the
15-
rpmbuild/ directory.
15+
dist/rpmbuild/ directory.
1616
"""
1717

1818
import os
@@ -58,14 +58,14 @@ def build_rpm_with_docker():
5858
RPM_VERSION="{project['version'].replace("-dev", "~dev")}"
5959
6060
# Creates the standard directory structure required by rpmbuild
61-
mkdir -p rpmbuild/{{BUILD,RPMS,SOURCES,SPECS,SRPMS}}
62-
cp "$WHEEL_FILE" rpmbuild/SOURCES/
61+
mkdir -p dist/rpmbuild/{{BUILD,RPMS,SOURCES,SPECS,SRPMS}}
62+
mv "$WHEEL_FILE" dist/rpmbuild/SOURCES/
6363
6464
# Get the changelog date
6565
CHANGELOG_DATE=$(date '+%a %b %d %Y')
6666
6767
# Generate spec file with correct deps
68-
cat > rpmbuild/SPECS/{rpm_name}.spec << EOF
68+
cat > dist/rpmbuild/SPECS/{rpm_name}.spec << EOF
6969
Name: {rpm_name}
7070
Version: $RPM_VERSION
7171
Release: 1%{{?dist}}
@@ -98,21 +98,21 @@ def build_rpm_with_docker():
9898
EOF
9999
100100
# Build the RPM
101-
rpmbuild --define "_topdir /workspace/rpmbuild" -bb rpmbuild/SPECS/{rpm_name}.spec
101+
rpmbuild --define "_topdir /workspace/dist/rpmbuild" -bb dist/rpmbuild/SPECS/{rpm_name}.spec
102102
103103
# Fix permissions for Windows host
104-
chmod -R u+rwX rpmbuild
104+
chmod -R u+rwX dist/rpmbuild
105105
"""
106106
]
107107

108108
try:
109109
subprocess.run(docker_cmd, check=True)
110110
# Verify the existance of the .rpm
111-
rpm_file = next(Path('rpmbuild/RPMS/noarch').glob('*.rpm'), None)
111+
rpm_file = next(Path('dist/rpmbuild/RPMS/noarch').glob('*.rpm'), None)
112112
if rpm_file:
113113
print(f"\nSuccess! RPM built: {rpm_file}")
114114
else:
115-
print("Error: RPM not found in rpmbuild/RPMS/noarch/", file=sys.stderr)
115+
print("Error: RPM not found in dist/rpmbuild/RPMS/noarch/", file=sys.stderr)
116116
sys.exit(1)
117117
except subprocess.CalledProcessError as e:
118118
print(f"Build failed: {e}", file=sys.stderr)

0 commit comments

Comments
 (0)