Add some files missed from initial import

Add updating script and README.

Related: RHEL-48619
This commit is contained in:
Omair Majid 2024-08-18 14:24:40 -04:00
parent dc342d4a34
commit 825ebcd562
2 changed files with 227 additions and 0 deletions

74
README.md Normal file
View File

@ -0,0 +1,74 @@
# dotnet9.0
This is the .NET 9.0 package for RHEL.
Please report any issues [using Jira](https://issues.redhat.com/).
# Specification
This package follows [package naming and contents suggested by
upstream](https://docs.microsoft.com/en-us/dotnet/core/build/distribution-packaging),
with one exception. It installs dotnet to `/usr/lib64/dotnet` (aka
`%{_libdir}`).
# Contributing
1. Fork the repo.
2. Checkout the forked repository.
- `git clone git@gitlab.com:$USER/centos_rpms_dotnet9.0.git dotnet9.0`
- `cd dotnet9.0`
3. Make your changes. Don't forget to add a changelog.
If you are updating to a new upstream release: Get the new upstream source
tarball and the detached signature. Update the versions in the spec file.
Add a changelog. This is generally automated by the following.
- `./update-release <sdk-version> <runtime-version>`
If this fails because of compiler errors, you might have to figure
out a fix, then add the patch in `build-dotnet-tarball` script
rather than the spec file.
4. Do local builds.
- `centpkg local`
5. Fix any errors that come up and rebuild until it works locally. Any
patches that are needed at this point should be added to the spec file.
6. Do builds in koji.
- `centpkg scratch-build --srpm`
7. If this is a new release, upload the source archive and detached signature to
the look-aside cache.
- `centpkg new-sources dotnet-source-tarball.tar.gz dotnet-source-tarball.tar.gz.sig`
8. Commit the changes to the git repo.
- `git add` any new patches
- `git remove` any now-unnecessary patches
- `git commit -a`
- `git push`
9. Create a pull request with your changes.
10. Once the tests in the pull-request pass, and reviewers are happy, merge the
pull request and do a real build.
- `centpkg build`
# Testing
This package uses CI tests as defined in `tests/ci.yml`. You can run them using
[tmt](https://tmt.readthedocs.io/en/stable/overview.html). Creating a
pull-request or running an official build will fire off tests and flag any
issues. We have enabled gating (via `gating.yaml`) on the tests. That prevents
a build that fails any test from being released until the failures are waived.
The tests themselves are contained in this external repository:
https://github.com/redhat-developer/dotnet-regular-tests/

153
update-release Executable file
View File

@ -0,0 +1,153 @@
#!/bin/bash
# Usage:
# ./update-release [runtime-version [--bug bug-id] [--tarball tarball-name] [--larger-rpm-release]
set -euo pipefail
IFS=$'\n\t'
print_usage() {
echo " Usage:"
echo " ./update-release [runtime-version] [--bug bug-id] [--tarball tarball-name] [--release-json release-json] [--larger-rpm-release]"
}
user_provided_tarball_name=""
rpm_release=1
positional_args=()
bug_ids=()
while [[ "$#" -gt 0 ]]; do
arg="$1"
case "${arg}" in
--bug)
bug_ids+=("$2")
shift;
shift;
;;
-h|--help)
print_usage
exit 0
;;
--release-json)
release_json="$2"
shift;
shift;
;;
--tarball)
user_provided_tarball_name="$2"
shift;
shift;
;;
--larger-rpm-release)
rpm_release="2"
shift;
;;
*)
positional_args+=("$1")
shift
;;
esac
done
spec_files=( ./*.spec )
spec_file="${spec_files[0]}"
dotnet_major_minor_version=$spec_file
dotnet_major_minor_version=${dotnet_major_minor_version#./dotnet}
dotnet_major_minor_version=${dotnet_major_minor_version%.spec}
echo "Updating .NET $dotnet_major_minor_version"
runtime_version=${positional_args[1]:-}
sdk_version=""
tag=v${runtime_version}
if [[ -z ${runtime_version} ]]; then
cat > query <<EOF
[ .[] | select(.name | startswith(".NET 9")) ]
| first
| { tag_name: .tag_name,
tarball: .tarball_url,
signature: .assets[].browser_download_url | select(. | endswith("tar.gz.sig")),
release_manifest: .assets[] | select(.name == "release.json") | .browser_download_url }
EOF
curl https://api.github.com/repos/dotnet/dotnet/releases \
| jq --from-file query > release.metadata.github
tag=$(jq -r .tag_name release.metadata.github)
curl -L "$(jq -r .release_manifest release.metadata.github)" -o release.json
aspnetcore_runtime_version=$(jq -r .aspNetCoreVersion release.json)
runtime_version=$(jq -r .runtimeVersion release.json)
sdk_version=$(jq -r .sdkVersion release.json)
fi
if [[ ${sdk_version:-} = "" ]]; then
# FIXME: add preview/rc parts
sdk_version=$(echo "${runtime_version}" | awk 'BEGIN { FS="."; OFS="." } {print $1, $2, $3+100 }')
fi
echo "Updating .NET $dotnet_major_minor_version to SDK ${sdk_version} and Runtime ${runtime_version}"
sed -i -E "s|^%global runtime_version .*$|%global runtime_version ${runtime_version}|" "$spec_file"
sed -i -E "s|^%global aspnetcore_runtime_version .*$|%global aspnetcore_runtime_version ${aspnetcore_runtime_version}|" "$spec_file"
sed -i -E "s|^%global sdk_version .*$|%global sdk_version ${sdk_version}|" "$spec_file"
if [[ $runtime_version = *preview* ]] || [[ $runtime_version = *rc* ]]; then
# For Preview/RC releases, convert x.y.z-preview.a.b to x.y.z~preview.a.b (replace - with ~)
# https://docs.fedoraproject.org/en-US/packaging-guidelines/Versioning/#_handling_non_sorting_versions_with_tilde_dot_and_caret
runtime_rpm_version=${runtime_version/-/\~}
aspnetcore_runtime_rpm_version=${aspnetcore_runtime_version/-/\~}
sdk_rpm_version=${sdk_version/-/\~}
sed -i -E "s|^(%global runtime_rpm_version) .*$|\1 ${runtime_rpm_version}|" "$spec_file"
sed -i -E "s|^(%global aspnetcore_runtime_rpm_version) .*$|\1 ${aspnetcore_runtime_rpm_version}|" "$spec_file"
sed -i -E "s|^(%global sdk_rpm_version) .*$|\1 ${sdk_rpm_version}|" "$spec_file"
else
# For GA releases replace rpm versions with rpm macros for the actual version
sed -i -E "s|^(%global runtime_rpm_version) .*$|\1 %{runtime_version}|" "$spec_file"
sed -i -E "s|^(%global aspnetcore_runtime_rpm_version) .*$|\1 %{aspnetcore_runtime_version}|" "$spec_file"
sed -i -E "s|^(%global sdk_rpm_version) .*$|\1 %{sdk_version}|" "$spec_file"
fi
if [[ -f "dotnet-${tag}.tar.gz" ]]; then
echo "dotnet-${tag}.tar.gz already exists, not rebuilding tarball"
elif [[ -n ${user_provided_tarball_name} ]]; then
cp -a "${user_provided_tarball_name}" "dotnet-${tag}.tar.gz"
cp -a "${release_json}" release.json
else
rm -f release.json
spectool -g "$spec_file"
if spectool -l "$spec_file" | grep 'bootstrap.tar.gz' ; then
build-dotnet-bootstrap-tarball "$tag"
tar xf dotnet-"$tag"-x64-bootstrap.tar.gz "dotnet-$tag-x64-bootstrap/global.json"
bootstrap_sdk_version=$(jq -r .tools.dotnet "dotnet-$tag-x64-bootstrap/global.json")
sed -i -E "s|^(%global bootstrap_sdk_version) .*$|\1 ${bootstrap_sdk_version}|" "$spec_file"
spectool -g "$spec_file"
fi
fi
set -x
comment="Update to .NET SDK ${sdk_version} and Runtime ${runtime_version}"
commit_message="$comment
"
for bug_id in "${bug_ids[@]}"; do
if [[ "$bug_id" =~ ^[[:digit:]]+$ ]]; then
comment="$comment
- Resolves: RHBZ#$bug_id"
commit_message="$commit_message
Resolves: RHBZ#$bug_id"
else
comment="$comment
- Resolves: $bug_id"
commit_message="$commit_message
Resolves: $bug_id"
fi
done
echo "$commit_message" > git-commit-message
rpmdev-bumpspec --comment="$comment" "$spec_file"
# Reset release in 'Release' tag
sed -i -E 's|^Release: [[:digit:]]+%|Release: '"$rpm_release"'%|' "$spec_file"
# Reset Release in changelog comment
# See https://stackoverflow.com/questions/18620153/find-matching-text-and-replace-next-line
sed -i -E '/^%changelog$/!b;n;s/-[[:digit:]]+$/-'"$rpm_release"'/' "$spec_file"