Compare commits

..

36 commits

Author SHA1 Message Date
Peter Oliver
dea6219cb4 Update to version 0.25.10. 2025-09-24 14:41:24 +01:00
Peter Oliver
7d52cc93f7 Update to version 0.25.9. 2025-09-09 14:15:07 +01:00
Peter Oliver
bad755410a chain-build.sh: Add an option to skip raising pull requests
The `rizin` package maintainers aren’t interested in rebuilding for every `tree-sitter` update (most of which don’t actually contain unannounced ABI changes).
2025-09-09 14:14:00 +01:00
Fedora Release Engineering
1d830d78ab Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild 2025-07-25 19:31:41 +00:00
Peter Oliver
4a6599c051 Update to version 0.25.8. 2025-07-18 12:24:57 +01:00
Peter Oliver
dd0aed24fe Update to version 0.25.6. 2025-06-13 15:19:13 +01:00
Peter Oliver
3c1e6f26b3 Virtual Provides for compatible language ABI versions
These are of the form `Provides: tree-sitter(:LANGUAGE_VERSION) = n`, where n is in the range given in `lib/include/tree_sitter/api.h`.

Parsers can Require the ABI version they use (and this will happen automatically starting with tree-sitter-srpm-macros 0.4.0).
2025-06-13 15:13:17 +01:00
Peter Oliver
4267708929 chain-build.sh: Be more quiet. 2025-05-28 14:06:35 +01:00
Peter Oliver
8216ed2589 Update to version 0.25.5. 2025-05-28 12:45:51 +01:00
Peter Oliver
387042882b chain-build.sh: Prevent error line 220: bug: unbound variable. 2025-05-12 14:33:55 +01:00
Peter Oliver
4e8c9e31bd chain-build.sh: Skip rebuilds depending on libtree-sitter only for dirs. 2025-05-12 13:45:49 +01:00
Peter Oliver
8a1208563c chain-build.sh: In Fedora 42, dnf repoquery --qf=… lacks implicit newline. 2025-05-12 13:45:35 +01:00
Peter Oliver
7496146121 Update to version 0.25.4. 2025-05-12 11:49:27 +01:00
Peter Oliver
75d1a38674 Update to version 0.25.3. 2025-04-14 12:09:24 +01:00
Peter Oliver
88cab86eb9 Own /usr/share/tree-sitter/queries/
Tree-sitter parsers will start to install .scm files here when their Makefile is generated with tree-sitter-cli 0.25 onwards.
2025-03-11 23:57:39 +00:00
Peter Oliver
fb9e77c123 chain-build.sh: Request repo be regenerated to include fresh treesitter build. 2025-02-25 16:17:13 +00:00
Peter Oliver
0f063f62bf chain-build.sh: Handle branches other than rawhide. 2025-02-25 16:16:16 +00:00
Peter Oliver
9a00f15362 chain-build.sh: Fix quoting of auth token type. 2025-02-25 16:14:54 +00:00
Peter Oliver
0d3aea09ef chain-build.sh: Wait for Tree-sitter to be side tagged before proceeding 2025-02-20 14:51:25 +00:00
Peter Oliver
2765eae9d4 chain-build.sh: Fix posting summary to Bugzilla. 2025-02-19 15:20:30 +00:00
Peter Oliver
dbb37e738a chain-build.sh: Post summary to Bugzilla. 2025-02-19 12:55:57 +00:00
Peter Oliver
fe8011622a chain-build.sh: Mention pull request URLs in closing message. 2025-02-19 12:06:05 +00:00
Peter Oliver
36aa4fe287 Update to version 0.25.2 2025-02-19 12:04:55 +00:00
Peter Oliver
b155b96c20 chain-build.sh: Link to completed builds in Koji. 2025-02-03 13:34:52 +00:00
Peter Oliver
d42ff33b96 chain-build.sh: Delete .side-tag on completion. 2025-02-03 13:20:58 +00:00
Peter Oliver
574e9696af chain-build.sh: Can’t push from a shallow clone if fork isn’t up to date. 2025-02-03 13:14:27 +00:00
Peter Oliver
dc60977b71 chain-build.sh: Ensure authorisation file is readable only by user
This shouldn’t matter, because the temporary directory that contains it already has the correct permissions, but it doesn’t hurt to make sure.
2025-02-03 13:13:58 +00:00
Peter Oliver
2b8ebf4abc chain-build.sh: Fix typo. 2025-02-03 12:22:39 +00:00
Peter Oliver
e53e01701e chain-build.sh: Fix detection of existing side tag. 2025-02-03 12:14:05 +00:00
Peter Oliver
5230da6e68 CHANGELOG.md was dropped 2025-02-03 12:08:46 +00:00
Peter Oliver
d1431b4361 Update to version 0.25.1 2025-02-03 11:54:15 +00:00
Peter Oliver
6c2338ae26 Convenience script to rebuild dependent packages
Use a side tag to build libtree-sitter and everything that depends on it.  Where we have no permission to do the build ourselves, raise a pull request instead.
2025-01-23 12:58:57 +00:00
Fedora Release Engineering
4f22cd2f68 Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild 2025-01-19 13:17:18 +00:00
Peter Oliver
849cbabf4d Update to version 0.24.7 2025-01-14 13:10:57 +00:00
Andreas Schneider
31664be758 Update to version 0.23.0
- https://github.com/tree-sitter/tree-sitter/blob/v0.23.0/CHANGELOG.md
2024-08-28 09:45:05 +02:00
Andreas Schneider
7de981f8ae Convert to %autorelease and %autochangelog
[skip changelog]
2024-08-28 09:43:48 +02:00
4 changed files with 302 additions and 5 deletions

1
.gitignore vendored
View file

@ -1 +1,2 @@
/tree-sitter-*.tar.gz
.side-tag

274
chain-build.sh Executable file
View file

@ -0,0 +1,274 @@
#!/usr/bin/bash
# Use a side tag to build libtree-sitter and everything that depends on
# it. Where we have no permission to do the build ourselves, raise a
# pull request instead.
#
# Run in place of `fedpkg build`. E.g.,
# fedpkg switch-branch rawhide
# ...
# fedpkg commit
# fedpkg push
# ./chain-build.sh <rhbz-number>
# MIT License
#
# Copyright (c) 2025 Peter Oliver
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
# TODO: Make this script idempotent, so that it can simply be re-run in
# the event of failures.
set -o errexit
set -o nounset
set -o pipefail
function usage {
echo "usage: $BASH_ARGV0 [-P] [-d|-v] [bug-number]"
exit 2
}
no_pull_requests=
quiet=-q
while getopts 'dPv' OPT; do
case "$OPT" in
d)
set -o xtrace
quiet=
;;
P)
no_pull_requests=1
;;
v)
quiet=
;;
*)
usage
;;
esac
done
shift $((OPTIND - 1))
if (( $# == 1 )); then
typeset -i bug=$1
shift;
elif (( $# > 1 )); then
usage
fi
function create_authorization_header_file {
local type="$1"
local filename="${tmp_dir}/${type}_authorization"
local auth_type
case "$type" in
bugzilla)
auth_type=Bearer
;;
distgit)
auth_type=token
;;
esac
if [[ ! -f "$filename" ]]; then
(
umask u=rwx,g=,o=
printf 'Authorization: %s ' "$auth_type" > "$filename"
if ! crudini --get ~/.config/rpkg/fedpkg.conf "fedpkg.$type" token \
>> "$filename"
then
case "$type" in
bugzilla)
echo "You can get a token from https://bugzilla.redhat.com/userprefs.cgi?tab=apikey and store it with:
( umask u=rwx,g=,o= && crudini --set ~/.config/rpkg/fedpkg.conf fedpkg.bugzilla token ... )"
;;
distgit)
echo "You can get a token from https://pagure.io/settings/token/new and store it with:
fedpkg set-pagure-token"
;;
esac
return 2;
fi
)
fi
}
# Fail ASAP if unauthenticated:
koji moshimoshi > /dev/null
# Install potential dependencies:
if [[ ! -x /usr/bin/crudini \
|| ! -x /usr/bin/jq ]]; then
sudo dnf $quiet install -y /usr/bin/crudini /usr/bin/jq
fi
branch="$(git branch --show-current)"
# Get a list of packages that require libtree-sitter:
packages=($(
dnf $quiet repoquery \
--repo=fedora --repo=updates \
--releasever="${branch#f}" \
--whatrequires='libtree-sitter.so.*' \
--qf='%{source_name}\n' \
| grep -v '^tree-sitter$'
))
# Create a new side tag (or re-use the existing one, if this script
# failed last time it was run):
if [[ -f .side-tag ]]; then
side_tag="$(cat .side-tag)"
if fedpkg list-side-tags | grep --quiet --perl-regexp "^$side_tag\s"; then
echo "Re-using side tag $side_tag"
else
echo "Side tag $side_tag no-longer exists. Will create a new one"
side_tag=''
fi
fi
if [[ -z ${side_tag:-} ]]; then
side_tag="$(
fedpkg request-side-tag \
| grep --perl-regexp --only-matching "(?<=^Side tag ').*(?=')"
)"
echo "$side_tag" > .side-tag
koji $quiet wait-repo --no-request "$side_tag"
fi
# Build tree-sitter in the side tag:
verrel="$(fedpkg verrel)"
fedpkg $quiet build --target="$side_tag"
koji $quiet wait-repo --request --build="$verrel" "$side_tag"
# Try to bump and rebuild the requiring packages:
message="Rebuild against $verrel"
tmp_dir="$(mktemp -td tree-sitter-chain-build.XXXXXX)"
declare -i i=0
for package in "${packages[@]}"; do
fedpkg $quiet clone --branch="$branch" --depth=1 "$package" \
"$tmp_dir/$package"
cd "$tmp_dir/$package"
rpmdev-bumpspec --comment="$message" "$package.spec" >/dev/null
git add "$package.spec"
git commit --allow-empty --message="$message"
if fedpkg $quiet push; then
# Build the requiring package in the side tag:
fedpkg $quiet build --target="$side_tag" --nowait
elif [[ -n $no_pull_requests ]]; then
echo "Skipping $package, which would require a pull request"
skipped_packages+=("$package")
unset packages[$i]
else
# We lack permission for the requiring package, so submit a pull
# request instead.
fedpkg $quiet fork
git fetch $quiet --unshallow
fas_login="$(
git remote -v \
| grep --perl-regexp --only-matching \
'^(\w+)(?=\s+ssh://(\1)@pkgs\.fedoraproject\.org/forks/\1/rpms/.+ \(push\)$)'
)"
git switch $quiet --create "$verrel"
git push $quiet "$fas_login" "$verrel"
create_authorization_header_file distgit
response=$(
curl \
${quiet:+--silent --show-error} \
--fail-with-body \
--header @"$tmp_dir/distgit_authorization" \
--data title="$message" \
--data branch_to="$branch" \
--data branch_from="$verrel" \
--data repo_from="$package" \
--data repo_from_username="$fas_login" \
--data repo_from_namespace=rpms \
--data initial_comment="Please build with: \`fedpkg build --target='$side_tag'\`
${bug:+
Relates to https://bugzilla.redhat.com/show_bug.cgi?id=$bug.
}" \
"https://src.fedoraproject.org/api/0/rpms/$package/pull-request/new" \
| jq '.full_url // .'
)
if [[ $response == "{*" ]]; then
echo "Could not find pull request URL in Pagure response"
echo "$response"
exit 2
else
response="${response#\"}"
response="${response%\"}"
pull_request_urls+=("$response")
fi
fi
cd - >/dev/null
rm -rf "$tmp_dir/$package"
i=$((i + 1))
done
## If we had permission to push to all of the repos ourselves, we could
## do this here, rather than raising and waiting for the pull requests.
# fedpkg chain-build --target="$side_tag" : $packages
# bodhi updates new --from-tag "$@" "$side_tag"
summary="Tree-sitter and dependent packages are being rebuilt for
$verrel in side tag $side_tag. Completed builds
will appear at:
https://koji.fedoraproject.org/koji/builds?inherited=0&tagID=${side_tag##*-}
There should be builds for each of:
tree-sitter ${packages[*]}
${pull_request_urls:+The following pull requests have been created:
${pull_request_urls[*]}
}${skipped_packages:+The following packages were skipped:
${skipped_packages[*]}
}When all ${pull_request_urls:+pull requests are merged, and }packages are built, run:
bodhi updates new --from-tag ${bug:+--bugs=$bug }... '$side_tag'"
echo "
$summary"
if [[ -n ${bug:-} ]]; then
# We could probably use Kerberos here, but
# https://bugzilla.redhat.com/docs/en/html/api/core/v1/general.html#authentication
# says it's not supported.
create_authorization_header_file bugzilla
curl \
${quiet:+--silent --show-error} \
${quiet:+--output /dev/null} \
--fail-with-body \
--header @"$tmp_dir/bugzilla_authorization" \
--variable "summary=$summary" \
--expand-json "{\"id\": \"$bug\", \"comment\": \"{{summary:json}}\"}" \
"https://bugzilla.redhat.com/rest/bug/$bug/comment"
fi
# Clean up.
rm -r .side-tag "$tmp_dir"

View file

@ -1 +1 @@
SHA512 (tree-sitter-0.23.0.tar.gz) = ab821be564ac7223cc4f9659c08922a78016af9dd3bd69166706fb6a889ac175ba2712a337a1303aceb8f44beaf58640a183e77dddc2c57e35da23079d0cd7b9
SHA512 (tree-sitter-0.25.10.tar.gz) = f0465a2fabe303c1b62f1f55ed08aa57372ac11370d229adcccd99b5e8067be53e92da281cdfbcd034e2ecefb33ac90a119eeac9035670ac8fbaa4242cb87a11

View file

@ -1,7 +1,12 @@
%global treesitter_so_version 0
%global tree_sitter_so_version 0
# Keep these up-to-date with the values in lib/include/tree_sitter/api.h:
%global tree_sitter_language_version 15
%global tree_sitter_min_compatible_language_version 13
Name: tree-sitter
Version: 0.23.0
Version: 0.25.10
Release: %autorelease
Summary: An incremental parsing system for programming tools
@ -28,6 +33,12 @@ edited. Tree-sitter aims to be:
%package -n lib%{name}
Summary: Incremental parsing library for programming tools
%{lua:
for i = rpm.expand('%tree_sitter_min_compatible_language_version'),
rpm.expand('%tree_sitter_language_version') do
print(string.format("Provides: tree-sitter(:LANGUAGE_VERSION) = %d\n", i))
end
}
%description -n lib%{name}
Tree-sitter is a parser generator tool and an incremental parsing
@ -59,11 +70,22 @@ export PREFIX='%{_prefix}' LIBDIR='%{_libdir}' INCLUDEDIR='%{_includedir}'
find %{buildroot}%{_libdir} -type f \( -name "*.la" -o -name "*.a" \) -delete -print
install -d %{buildroot}%{_datadir}/tree-sitter/queries
%check
grep -q '^#define TREE_SITTER_LANGUAGE_VERSION %tree_sitter_language_version' \
lib/include/tree_sitter/api.h
grep -q '^#define TREE_SITTER_MIN_COMPATIBLE_LANGUAGE_VERSION %tree_sitter_min_compatible_language_version' \
lib/include/tree_sitter/api.h
%files -n lib%{name}
%license LICENSE
%doc README.md CHANGELOG.md
%{_libdir}/libtree-sitter.so.%{treesitter_so_version}*
%doc README.md
%dir %{_datadir}/tree-sitter
%dir %{_datadir}/tree-sitter/queries
%{_libdir}/libtree-sitter.so.%{tree_sitter_so_version}*
%files -n lib%{name}-devel
%{_includedir}/tree_sitter