mirror of
https://github.com/chromebrew/chromebrew.git
synced 2026-01-07 22:54:11 -05:00
version (#12418)
* Do not let version.rb update package files without a version variable in either the git_hashtag or source_url lines. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Adjust update workflows to use Updater-on-Demand workflow. Signed-off-by: Satadru Pramanik <satadru@gmail.com> --------- Signed-off-by: Satadru Pramanik <satadru@gmail.com> Co-authored-by: Satadru Pramanik <satadru@gmail.com>
This commit is contained in:
committed by
GitHub
parent
8d41afb4ee
commit
c9359a9590
16
.github/workflows/Updater-on-Demand.yml
vendored
16
.github/workflows/Updater-on-Demand.yml
vendored
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: Generate Updates PRs on Demand
|
||||
run-name: Generate Updates PRs on Demand using ${{ inputs.version_cmd_input }}
|
||||
run-name: Generating Updates PRs on Demand using ${{ inputs.version_cmd_input }}
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
@@ -63,10 +63,18 @@ jobs:
|
||||
else
|
||||
branch_tag="${pkg_version}"
|
||||
fi
|
||||
git checkout -b "${pkg}-${branch_tag}" || git checkout "${pkg}-${branch_tag}"
|
||||
git commit -m "Add unbuilt ${pkg} to ${pkg}-${branch_tag}"
|
||||
export updater_branch="updater-${pkg}-${branch_tag}"
|
||||
if git checkout -b "${updater_branch}"; then
|
||||
echo "${updater_branch} branch created."
|
||||
else
|
||||
echo "Updating & rebasing existing ${updater_branch} branch."
|
||||
git checkout "${updater_branch}"
|
||||
git pull --rebase origin master
|
||||
git push -f
|
||||
fi
|
||||
git commit -m "Add unbuilt ${pkg} to ${updater_branch}"
|
||||
git push
|
||||
gh workflow -R chromebrew/chromebrew run Build.yml -f branch="${pkg}-${branch_tag}"
|
||||
gh workflow -R chromebrew/chromebrew run Build.yml -f branch="${updater_branch}"
|
||||
git stash || true
|
||||
git checkout master
|
||||
done
|
||||
|
||||
72
.github/workflows/Updater.yml
vendored
72
.github/workflows/Updater.yml
vendored
@@ -16,79 +16,11 @@ jobs:
|
||||
if: ${{ github.repository_owner == 'chromebrew' }}
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: true
|
||||
- uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: '3.4.5'
|
||||
- name: Install Python pip
|
||||
run: sudo apt install -y python3-pip
|
||||
- name: Setup Git.
|
||||
id: git-setup
|
||||
run: |
|
||||
git config --global push.autoSetupRemote true
|
||||
git config user.name "${{ github.actor }}"
|
||||
git config user.email "${{ github.actor }}@users.noreply.github.com"
|
||||
- name: Install ruby-libversion # Hopefully this will get added as an Ubuntu/Debian package. https://github.com/repology/libversion/issues/35
|
||||
working-directory: ${{ runner.temp }}
|
||||
run: |
|
||||
git clone --depth 1 -b 3.0.3 https://github.com/repology/libversion
|
||||
cd libversion
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
make -j "$(nproc)"
|
||||
sudo make install
|
||||
sudo gem install ruby-libversion
|
||||
- name: Check for updates in pip packages.
|
||||
id: pip-update-checks
|
||||
run: |
|
||||
git pull
|
||||
git stash drop || true
|
||||
echo "pwd is $(pwd)"
|
||||
LD_LIBRARY_PATH=/usr/local/lib ruby tools/version.rb -u "py3_*"
|
||||
for i in $(git status --porcelain | awk '{print $2}' | grep ^packages/)
|
||||
do
|
||||
git stash pop || true
|
||||
git add $i
|
||||
pkg=${i%.rb}
|
||||
pkg=${pkg#packages/}
|
||||
pkg_version="$(LD_LIBRARY_PATH=/usr/local/lib ruby tools/version.rb -j ${pkg} | jq -r '.[]|.version')"
|
||||
if [[ -z "$pkg_version" ]]; then
|
||||
branch_tag="$(date -u +%F-%H-%M)"
|
||||
else
|
||||
branch_tag="${pkg_version}"
|
||||
fi
|
||||
git checkout -b "${pkg}-${branch_tag}" || git checkout "${pkg}-${branch_tag}"
|
||||
git commit -m "Add unbuilt ${pkg} to ${pkg}-${branch_tag}"
|
||||
git push
|
||||
gh workflow -R chromebrew/chromebrew run Build.yml -f branch="${pkg}-${branch_tag}"
|
||||
git stash || true
|
||||
git checkout master
|
||||
done
|
||||
gh workflow -R chromebrew/chromebrew run Updater-on-Demand.yml -f version_cmd_input="py3_*"
|
||||
- name: Check for updates in ruby gem packages.
|
||||
id: gem-update-checks
|
||||
run: |
|
||||
git pull
|
||||
git stash drop || true
|
||||
LD_LIBRARY_PATH=/usr/local/lib ruby tools/version.rb -u "ruby_*"
|
||||
for i in $(git status --porcelain | awk '{print $2}' | grep ^packages/)
|
||||
do
|
||||
git stash pop || true
|
||||
git add $i
|
||||
pkg=${i%.rb}
|
||||
pkg=${pkg#packages/}
|
||||
pkg_version="$(LD_LIBRARY_PATH=/usr/local/lib ruby ./tools/version.rb -j ${pkg} | jq -r '.[]|.version')"
|
||||
if [[ -z "$pkg_version" ]]; then
|
||||
branch_tag="$(date -u +%F-%H-%M)"
|
||||
else
|
||||
branch_tag="${pkg_version}"
|
||||
fi
|
||||
git checkout -b "${pkg}-${branch_tag}" || git checkout "${pkg}-${branch_tag}"
|
||||
git commit -m "Add unbuilt ${pkg} to ${pkg}-${branch_tag}"
|
||||
git push
|
||||
gh workflow -R chromebrew/chromebrew run Build.yml -f branch="${pkg}-${branch_tag}"
|
||||
git stash || true
|
||||
git checkout master
|
||||
done
|
||||
gh workflow -R chromebrew/chromebrew run Updater-on-Demand.yml -f version_cmd_input="ruby_*"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env ruby
|
||||
# version.rb version 1.5 (for Chromebrew)
|
||||
# version.rb version 1.6 (for Chromebrew)
|
||||
|
||||
OPTIONS = %w[-h --help -j --json -u --update-package-files -v --verbose]
|
||||
|
||||
@@ -39,6 +39,7 @@ UPDATE_PACKAGE_FILES = ARGV.include?('-u') || ARGV.include?('--update-package-fi
|
||||
VERBOSE = ARGV.include?('-v') || ARGV.include?('--verbose')
|
||||
bc_updated = {}
|
||||
pkg_names = {}
|
||||
updatable_pkg = {}
|
||||
version_line_string = {}
|
||||
versions_updated = {}
|
||||
versions = []
|
||||
@@ -149,6 +150,15 @@ if filelist.length.positive?
|
||||
puts "#{'-------'.ljust(package_field_length)}#{'------'.ljust(status_field_length)}#{'-------'.ljust(version_field_length)}--------" unless OUTPUT_JSON
|
||||
filelist.each do |filename|
|
||||
pkg = Package.load_package(filename)
|
||||
# Mark package file as updatable (i.e., the version field can be
|
||||
# updated in the package file) if the string "version" is on the
|
||||
# git_hashtag line or the string "#{version}" is on the source_url
|
||||
# line.
|
||||
updatable_pkg[pkg.name.to_sym] = if `grep git_hashtag #{filename} | grep version`.empty?
|
||||
!`grep source_url #{filename} | grep -v SKIP | grep -v "(" | grep "\#{version}"`.empty?
|
||||
else
|
||||
true
|
||||
end
|
||||
pkg_names[pkg.name.to_sym] = pkg.name
|
||||
version_line_string[pkg.name.to_sym] = ''
|
||||
# We annotate some packages to let us know that they won't work here.
|
||||
@@ -198,7 +208,7 @@ if filelist.length.positive?
|
||||
unless upstream_version.nil?
|
||||
versions_updated[pkg.name.to_sym] = 'Up to date.' if (Libversion.version_compare2(PackageUtils.get_clean_version(pkg.version), upstream_version) >= 0) && versions_updated[pkg.name.to_sym] != 'Not Found.'
|
||||
if Libversion.version_compare2(PackageUtils.get_clean_version(pkg.version), upstream_version) == -1
|
||||
if UPDATE_PACKAGE_FILES && !pkg.name[/#{CREW_AUTOMATIC_VERSION_UPDATE_EXCLUSION_REGEX}/]
|
||||
if UPDATE_PACKAGE_FILES && !pkg.name[/#{CREW_AUTOMATIC_VERSION_UPDATE_EXCLUSION_REGEX}/] && updatable_pkg[pkg.name.to_sym]
|
||||
file = File.read(filename)
|
||||
if file.sub!(PackageUtils.get_clean_version(pkg.version), upstream_version.chomp).nil?
|
||||
versions_updated[pkg.name.to_sym] = false
|
||||
|
||||
Reference in New Issue
Block a user