Skip to content

Commit 7e95727

Browse files
committed
build-rpm: Fall back to tar when git is unavailable (CI fix)
1 parent 29c3e40 commit 7e95727

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

build-rpm.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,16 @@ echo "==> Building mediatek-mt7927-dkms ${VERSION} .rpm"
2121
# Create rpmbuild tree
2222
mkdir -p "${TOPDIR}"/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
2323

24-
# Create source tarball from current repo
24+
# Create source tarball
2525
TARNAME="mediatek-mt7927-dkms-${VERSION}"
26-
git archive --format=tar.gz --prefix="${TARNAME}/" HEAD \
27-
-o "${TOPDIR}/SOURCES/${TARNAME}.tar.gz"
26+
TARBALL="${TOPDIR}/SOURCES/${TARNAME}.tar.gz"
27+
if command -v git &>/dev/null && git rev-parse --git-dir &>/dev/null 2>&1; then
28+
git archive --format=tar.gz --prefix="${TARNAME}/" HEAD -o "${TARBALL}"
29+
else
30+
# Fallback for non-git environments (CI containers)
31+
tar -czf "${TARBALL}" --transform "s,^\.,$TARNAME," \
32+
--exclude='.git' --exclude='rpmbuild' --exclude='*.pkg.tar*' .
33+
fi
2834

2935
# Copy spec
3036
cp "${SPEC}" "${TOPDIR}/SPECS/"

0 commit comments

Comments
 (0)