Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make_srpm: fallback to tar if git archive fails #7623

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading