fix(rpm): copy files to BUILD dir instead of source archive
Simplified rpmbuild process:
- Copy files directly to BUILD directory (no tar archive)
- Use --noclean flag to preserve BUILD contents
- Use %{_builddir} macro in spec file instead of %{_sourcedir}
This avoids the complexity of source archive creation/extraction
and fixes the 'No such file or directory' error.
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
@ -32,18 +32,18 @@ mkdir -p /root/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
|
||||
# Copy spec file
|
||||
cp /build/packaging/rpm/logcorrelator.spec /root/rpmbuild/SPECS/
|
||||
|
||||
# Create source archive (required by rpmbuild)
|
||||
# Archive contains the pre-built binary and all config files
|
||||
tar -czf /root/rpmbuild/SOURCES/logcorrelator-${VERSION}.tar.gz \
|
||||
-C /tmp/pkgroot \
|
||||
usr etc var
|
||||
# Copy files directly to BUILD directory (no archive needed)
|
||||
# This is simpler than creating/extracting a source archive
|
||||
cp -r /tmp/pkgroot/* /root/rpmbuild/BUILD/
|
||||
|
||||
# Build RPM using rpmbuild
|
||||
# Use --noclean to keep BUILD directory contents
|
||||
rpmbuild -bb /root/rpmbuild/SPECS/logcorrelator.spec \
|
||||
--define "version ${VERSION}" \
|
||||
--define "dist .${DIST_NAME}" \
|
||||
--define "_topdir /root/rpmbuild" \
|
||||
--define "_rpmdir /packages/rpm/${DIST_NAME}"
|
||||
--define "_rpmdir /packages/rpm/${DIST_NAME}" \
|
||||
--noclean
|
||||
|
||||
# Ensure output directory exists and copy RPM
|
||||
mkdir -p /packages/rpm/${DIST_NAME}
|
||||
|
||||
Reference in New Issue
Block a user