nixpkgs/pkgs/common-updater/scripts/list-git-tags

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

60 lines
1.3 KiB
Plaintext
Raw Normal View History

#!/usr/bin/env bash
common-updater-scripts: add scripts to help update packages - updateScript: A nix expression that can be used in passThrough to update a package - list-git-tags: A shell script to list available tags in a git repository - list-archive-two-level-versions: A shell script to list available versions in a web site in two levels: there is a page listing the available major.minor versions, and for each of them there is another page listings the patch level versions major.minor.patch. It is suitable for Xfce packages for instance. How the updater works: 1. collect the available versions from the source repository (using a script given as argument) 2. print the collected versions (for debugging) 3. (optionally) apply some transformation to the collected versions to make them compatible with the versions used in nixpkgs (for instance, tags in the Xfce git repository may be prefixed with the package name, and the prefix need to be removed) 4. sort the available versions in decreasing order 5. choose the first version that pass validation: - check if the version may be a development version - if the version IS unstable, skip it and give a warning about skipping a development version (for debugging) - if the version COULD BE unstable, take it and give a warning about taking a potential development version (for debugging) - if the version IS stable, take it 6. update the package version and checksum in its nix expression 7. print the git commands for adding the modified files and for committing the changes
2020-04-13 20:57:30 +00:00
# lists all available tags from a git repository
pname="" # package name
attr_path="" # package attribute path
url="" # git repository url
file="" # file for writing debugging information
while (( $# > 0 )); do
flag="$1"
shift 1
case "$flag" in
--pname=*)
pname="${flag#*=}"
;;
--attr-path=*)
attr_path="${flag#*=}"
;;
--url=*)
url="${flag#*=}"
;;
--file=*)
file="${flag#*=}"
;;
*)
echo "$0: unknown option ${flag}"
exit 1
;;
esac
done
if [[ -z "$pname" ]]; then
2022-09-30 13:04:43 +00:00
pname="$UPDATE_NIX_PNAME"
fi
if [[ -z "$attr_path" ]]; then
attr_path="$UPDATE_NIX_ATTR_PATH"
fi
# By default we set url to src.url or src.meta.homepage
if [[ -z "$url" ]]; then
url="$(nix-instantiate $systemArg --eval -E \
"with import ./. {}; $attr_path.src.meta.homepage or $attr_path.src.url" \
| tr -d '"')"
fi
common-updater-scripts: add scripts to help update packages - updateScript: A nix expression that can be used in passThrough to update a package - list-git-tags: A shell script to list available tags in a git repository - list-archive-two-level-versions: A shell script to list available versions in a web site in two levels: there is a page listing the available major.minor versions, and for each of them there is another page listings the patch level versions major.minor.patch. It is suitable for Xfce packages for instance. How the updater works: 1. collect the available versions from the source repository (using a script given as argument) 2. print the collected versions (for debugging) 3. (optionally) apply some transformation to the collected versions to make them compatible with the versions used in nixpkgs (for instance, tags in the Xfce git repository may be prefixed with the package name, and the prefix need to be removed) 4. sort the available versions in decreasing order 5. choose the first version that pass validation: - check if the version may be a development version - if the version IS unstable, skip it and give a warning about skipping a development version (for debugging) - if the version COULD BE unstable, take it and give a warning about taking a potential development version (for debugging) - if the version IS stable, take it 6. update the package version and checksum in its nix expression 7. print the git commands for adding the modified files and for committing the changes
2020-04-13 20:57:30 +00:00
# print a debugging message
if [[ -n "$file" ]]; then
echo "# Listing tags for '$pname' at $url" >> $file
common-updater-scripts: add scripts to help update packages - updateScript: A nix expression that can be used in passThrough to update a package - list-git-tags: A shell script to list available tags in a git repository - list-archive-two-level-versions: A shell script to list available versions in a web site in two levels: there is a page listing the available major.minor versions, and for each of them there is another page listings the patch level versions major.minor.patch. It is suitable for Xfce packages for instance. How the updater works: 1. collect the available versions from the source repository (using a script given as argument) 2. print the collected versions (for debugging) 3. (optionally) apply some transformation to the collected versions to make them compatible with the versions used in nixpkgs (for instance, tags in the Xfce git repository may be prefixed with the package name, and the prefix need to be removed) 4. sort the available versions in decreasing order 5. choose the first version that pass validation: - check if the version may be a development version - if the version IS unstable, skip it and give a warning about skipping a development version (for debugging) - if the version COULD BE unstable, take it and give a warning about taking a potential development version (for debugging) - if the version IS stable, take it 6. update the package version and checksum in its nix expression 7. print the git commands for adding the modified files and for committing the changes
2020-04-13 20:57:30 +00:00
fi
# list all tags from the remote repository
tags=$(git ls-remote --tags --refs "$url")
common-updater-scripts: add scripts to help update packages - updateScript: A nix expression that can be used in passThrough to update a package - list-git-tags: A shell script to list available tags in a git repository - list-archive-two-level-versions: A shell script to list available versions in a web site in two levels: there is a page listing the available major.minor versions, and for each of them there is another page listings the patch level versions major.minor.patch. It is suitable for Xfce packages for instance. How the updater works: 1. collect the available versions from the source repository (using a script given as argument) 2. print the collected versions (for debugging) 3. (optionally) apply some transformation to the collected versions to make them compatible with the versions used in nixpkgs (for instance, tags in the Xfce git repository may be prefixed with the package name, and the prefix need to be removed) 4. sort the available versions in decreasing order 5. choose the first version that pass validation: - check if the version may be a development version - if the version IS unstable, skip it and give a warning about skipping a development version (for debugging) - if the version COULD BE unstable, take it and give a warning about taking a potential development version (for debugging) - if the version IS stable, take it 6. update the package version and checksum in its nix expression 7. print the git commands for adding the modified files and for committing the changes
2020-04-13 20:57:30 +00:00
# keep only the version part of the tag
tags=$(echo "$tags" | cut --delimiter=/ --field=3-)
common-updater-scripts: add scripts to help update packages - updateScript: A nix expression that can be used in passThrough to update a package - list-git-tags: A shell script to list available tags in a git repository - list-archive-two-level-versions: A shell script to list available versions in a web site in two levels: there is a page listing the available major.minor versions, and for each of them there is another page listings the patch level versions major.minor.patch. It is suitable for Xfce packages for instance. How the updater works: 1. collect the available versions from the source repository (using a script given as argument) 2. print the collected versions (for debugging) 3. (optionally) apply some transformation to the collected versions to make them compatible with the versions used in nixpkgs (for instance, tags in the Xfce git repository may be prefixed with the package name, and the prefix need to be removed) 4. sort the available versions in decreasing order 5. choose the first version that pass validation: - check if the version may be a development version - if the version IS unstable, skip it and give a warning about skipping a development version (for debugging) - if the version COULD BE unstable, take it and give a warning about taking a potential development version (for debugging) - if the version IS stable, take it 6. update the package version and checksum in its nix expression 7. print the git commands for adding the modified files and for committing the changes
2020-04-13 20:57:30 +00:00
echo "$tags"