build.centos.amd64 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #!/bin/bash
  2. #= CentOS/RHEL 9+ amd64 .rpm
  3. set -o errexit
  4. set -o xtrace
  5. # Move to source directory
  6. pushd "${SOURCE_DIR}"
  7. if [[ ${IS_DOCKER} == YES ]]; then
  8. # Remove BuildRequires for dotnet, since it's installed manually
  9. pushd centos
  10. cp -a jellyfin.spec /tmp/spec.orig
  11. sed -i 's/BuildRequires: dotnet/# BuildRequires: dotnet/' jellyfin.spec
  12. popd
  13. fi
  14. # Modify changelog to unstable configuration if IS_UNSTABLE
  15. if [[ ${IS_UNSTABLE} == 'yes' ]]; then
  16. pushd centos
  17. PR_ID=$( git log --grep 'Merge pull request' --oneline --single-worktree --first-parent | head -1 | grep --color=none -Eo '#[0-9]+' | tr -d '#' )
  18. sed -i "s/Version:.*/Version: ${BUILD_ID}/" jellyfin.spec
  19. sed -i "/%changelog/q" jellyfin.spec
  20. cat <<EOF >>jellyfin.spec
  21. * $( LANG=C date '+%a %b %d %Y' ) Jellyfin Packaging Team <packaging@jellyfin.org>
  22. - Jellyfin Server unstable build ${BUILD_ID} for merged PR #${PR_ID}
  23. EOF
  24. popd
  25. fi
  26. # Build RPM
  27. make -f centos/Makefile srpm outdir=/root/rpmbuild/SRPMS
  28. rpmbuild --rebuild -bb /root/rpmbuild/SRPMS/jellyfin-*.src.rpm
  29. # Move the artifacts out
  30. mv /root/rpmbuild/RPMS/x86_64/jellyfin-*.rpm /root/rpmbuild/SRPMS/jellyfin-*.src.rpm "${ARTIFACT_DIR}/"
  31. if [[ ${IS_DOCKER} == YES ]]; then
  32. chown -Rc "$(stat -c %u:%g "${ARTIFACT_DIR}")" "${ARTIFACT_DIR}"
  33. fi
  34. rm -f centos/jellyfin*.tar.gz
  35. if [[ ${IS_DOCKER} == YES ]]; then
  36. pushd centos
  37. cp -a /tmp/spec.orig jellyfin.spec
  38. chown -Rc "$(stat -c %u:%g "${ARTIFACT_DIR}")" "${ARTIFACT_DIR}"
  39. popd
  40. fi
  41. popd