Skip to content

Commit

Permalink
make_srpm: fallback to tar if git archive fails
Browse files Browse the repository at this point in the history
All copr builds are currently failing due to:
fedora-copr/copr#3421
  • Loading branch information
pbrezina committed Sep 27, 2024
1 parent ec0754c commit fbdd8a9
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions contrib/fedora/make_srpm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,21 @@ sed -e "s/@PACKAGE_NAME@/$PACKAGE_NAME/" \
> "$RPMBUILD/SPECS/$PACKAGE_NAME.spec"

NAME="$PACKAGE_NAME-$PACKAGE_VERSION"
TARBALL="$RPMBUILD/SOURCES/$NAME.tar.gz"

git archive --format=tar --prefix="$NAME"/ \
--remote="file://$SRC_DIR" \
HEAD \
| gzip > "$RPMBUILD/SOURCES/$NAME.tar.gz"
HEAD | gzip > "$TARBALL"

# fallback to tar if git archive failed
# tar may include more files so git archive is preferred
tar -tzf "$TARBALL" &> /dev/null
if [ $? -ne 0 ]; then
rm -f "$TARBALL"
pushd "$SRC_DIR"
tar -cvzf "$TARBALL" --transform "s,^,$NAME/," *
popd
fi

cp "$SRC_DIR"/contrib/*.patch "$RPMBUILD/SOURCES" 2>/dev/null
add_patches "$RPMBUILD/SPECS/$PACKAGE_NAME.spec" \
Expand Down

0 comments on commit fbdd8a9

Please sign in to comment.