This is an automated email from the ASF dual-hosted git repository. sebb pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/attic.git
The following commit(s) were added to refs/heads/main by this push: new a24e65a Fix up retire.rb a24e65a is described below commit a24e65ab732962b9ce1d45d84e5c5fa3c862fdc8 Author: Sebb <s...@apache.org> AuthorDate: Thu May 1 17:57:16 2025 +0100 Fix up retire.rb Needs updated psych to run under GHA --- .github/workflows/retire.yml | 12 +++++++++--- Gemfile | 2 ++ Gemfile.lock | 6 ++++++ retire.rb | 25 ++++++++++++++++--------- 4 files changed, 33 insertions(+), 12 deletions(-) diff --git a/.github/workflows/retire.yml b/.github/workflows/retire.yml index 51dfed0..7203570 100644 --- a/.github/workflows/retire.yml +++ b/.github/workflows/retire.yml @@ -39,11 +39,17 @@ jobs: steps: - name: Install svn package (not included by default) run: | - sudo apt-get update - sudo apt-get install subversion + sudo apt-get -q update + sudo apt-get -q install subversion - uses: actions/checkout@v3 with: token: ${{ secrets.GITHUB_TOKEN }} + - name: Set up Ruby + # Although ubuntu-latest includes ruby 3.2.2, this step is needed to set up bundler + uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.2.3 + bundler-cache: true - name: Create PR for _data/projects/pid.yaml env: GH_TOKEN: ${{ github.token }} @@ -62,7 +68,7 @@ jobs: set -v # create new branch git switch -c retire-$PID - ruby retire.rb $PID + bundle exec ruby retire.rb $PID git add -A git commit -m"Retire $PID" # This will fail if there is an existing branch and PR diff --git a/Gemfile b/Gemfile index fb982b7..c006415 100644 --- a/Gemfile +++ b/Gemfile @@ -5,3 +5,5 @@ gem "jekyll", "~> 4.4.1" # installed by `gem jekyll` gem "just-the-docs", "0.10.1" # pinned to the current release # gem "just-the-docs" # always download the latest release + +gem "psych", "~> 5.2.0" # needed for retire.rb, as the default is too old diff --git a/Gemfile.lock b/Gemfile.lock index 2052fe4..1522e7a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -8,6 +8,7 @@ GEM colorator (1.1.0) concurrent-ruby (1.3.5) csv (3.3.2) + date (3.4.1) em-websocket (0.5.3) eventmachine (>= 0.12.9) http_parser.rb (~> 0) @@ -68,6 +69,9 @@ GEM mercenary (0.4.0) pathutil (0.16.2) forwardable-extended (~> 2.6) + psych (5.2.3) + date + stringio public_suffix (6.0.1) rake (13.2.1) rb-fsevent (0.11.2) @@ -80,6 +84,7 @@ GEM google-protobuf (~> 4.29) sass-embedded (1.83.4-x86_64-linux-gnu) google-protobuf (~> 4.29) + stringio (3.1.7) terminal-table (3.0.2) unicode-display_width (>= 1.1.1, < 3) unicode-display_width (2.6.0) @@ -92,6 +97,7 @@ PLATFORMS DEPENDENCIES jekyll (~> 4.4.1) just-the-docs (= 0.10.1) + psych (~> 5.2.0) BUNDLED WITH 2.5.9 diff --git a/retire.rb b/retire.rb index 60666ae..c5bd4d3 100755 --- a/retire.rb +++ b/retire.rb @@ -29,8 +29,8 @@ # TODO: # - does not check for Bugzilla issues # - does not check for GitHub issues -# - Jira: excalibur/juddi - does not find all the entries -# - Cwiki: did not find all ODE and COCOON entries +# - Jira: juddi - does not find scout (is there an alias documented somewhere?) +# - Cwiki: did not find ODE2 # - aliases: does not check for previous names # Input: @@ -53,6 +53,7 @@ require 'open3' # Sources CTTEE_RETIRED = 'https://whimsy.apache.org/public/committee-retired.json' CWIKI_INFO = 'https://cwiki.apache.org/confluence/rest/api/space/?type=global&limit=1000' +# Note: Two Wikis are lower-case: labs, usergrid. Upper case does seem to be equivalent for display. JIRA = 'https://issues.apache.org/jira/rest/api/2/project' SVNURL = 'https://svn.apache.org/repos/asf/' GITREPOS = 'https://gitbox.apache.org/repositories.json' @@ -114,10 +115,11 @@ def find_wikis(pid) names end -# Allow for Apache prefix and (Retired) suffix etc. +# Allow for Apache prefix and (Retired) suffixes etc. +# returns first word, downcased # TODO: what about subnames? def canon_name(name) - name.downcase.sub('apache','').sub('(retired)', '').sub('(old)', '').strip + name.downcase.sub('apache','').gsub('(retired)', '').sub('(old)', '').strip.split.first end def get_jiras(pid) @@ -193,12 +195,17 @@ def main() jiras = get_jiras pid if jiras.size > 0 - data[:issue_tracker] = { + data[:issue_trackers] ||= [] + tracker = + { type: 'JIRA' } - data[:issue_tracker][:keys] = jiras if jiras.size > 1 or jiras.first != pid.upcase + tracker[:keys] = jiras if jiras.size > 1 or jiras.first != pid.upcase + data[:issue_trackers] << tracker end + # TODO: Allow for Bugzilla and GitHub + wikis = find_wikis pid if wikis.size > 0 data[:wiki] = { @@ -207,12 +214,12 @@ def main() data[:wiki][:keys] = wikis if wikis.size > 1 or wikis.first != pid.upcase end - output = "_data/projects/#{pid}.yaml" + dir = ENV['OUTPUT'] || '_data/projects' # Allow override for testing + output = File.join(dir, "#{pid}.yaml") puts "Creating #{output}" content = YAML.safe_dump(data, permitted_classes: [Date], stringify_names: true, indentation: 4) # Massage the output to look more like existing files - tmp = content.gsub(%r{^- }, ' - ').gsub(%r{^- }, ' - ') - tmp.sub!('project_description: ', "project_description: >-\n ") + tmp = content.sub('project_description: ', "project_description: >-\n ") File.write(output, tmp) end end