Skip to content

Commit

Permalink
Allow to build rpm from any revision
Browse files Browse the repository at this point in the history
  • Loading branch information
InHavk committed Nov 12, 2024
1 parent 4013234 commit 136f911
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
10 changes: 8 additions & 2 deletions createrepo_c.spec
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,15 @@

%bcond_with sanitizers

%if %{defined gitrev}
%define package_version %{?gitrev}
%else
%define package_version 1.2.0
%endif

Summary: Creates a common metadata repository
Name: createrepo_c
Version: 1.2.0
Version: %{package_version}
Release: 1%{?dist}
License: GPL-2.0-or-later
URL: https://github.com/rpm-software-management/createrepo_c
Expand Down Expand Up @@ -204,6 +210,6 @@ ln -sr %{buildroot}%{_bindir}/modifyrepo_c %{buildroot}%{_bindir}/modifyrepo
%files -n python3-%{name}
%doc examples/python/*
%{python3_sitearch}/%{name}/
%{python3_sitearch}/%{name}-%{version}-py%{python3_version}.egg-info
%{python3_sitearch}/%{name}-*-py%{python3_version}.egg-info

%changelog
7 changes: 3 additions & 4 deletions utils/make_rpm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,16 @@ if [ ! $? == "0" ]; then
exit 1
fi

# Copy via sed
sed -i "s/%global gitrev .*/%global gitrev $GITREV/g" "$PREFIX/$PACKAGE.spec"
sed "s/%global gitrev .*/%global gitrev $GITREV/g" "$PREFIX/$PACKAGE.spec" > "$RPMBUILD_DIR/SPECS/$PACKAGE.spec"
cp "$PREFIX/$PACKAGE.spec" "$RPMBUILD_DIR/SPECS/"
if [ ! $? == "0" ]; then
echo "Error while: cp $PREFIX/$PACKAGE.spec $RPMBUILD_DIR/SPECS/"
exit 1
fi

echo "Copying done"

echo "> Starting rpmbuild $PACKAGE.."
rpmbuild -ba "$RPMBUILD_DIR/SPECS/$PACKAGE.spec"
rpmbuild -ba --define "gitrev $GITREV" "$RPMBUILD_DIR/SPECS/$PACKAGE.spec"
if [ ! $? == "0" ]; then
echo "Error while: rpmbuild -ba $RPMBUILD_DIR/SPECS/$PACKAGE.spec"
exit 1
Expand Down
2 changes: 1 addition & 1 deletion utils/make_tarball.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ fi

echo "Generate tarball for revision: $GITREV"

git archive "${GITREV}" --prefix="$PACKAGE"/ | gzip > "$TARGET_DIR"/"$PACKAGE"-"${GITREV}".tar.gz
git archive "${GITREV}" --prefix="${PACKAGE}-${GITREV}"/ | gzip > "$TARGET_DIR"/"$PACKAGE"-"${GITREV}".tar.gz

0 comments on commit 136f911

Please sign in to comment.