mirror of
https://github.com/chromebrew/chromebrew.git
synced 2026-01-09 15:37:56 -05:00
Refactor name mapping in tools/version.rb (#13637)
* Add get_clean_name function to PackageUtils * Use PackageUtils.get_clean_name in tools/version.rb and refactor name mapping
This commit is contained in:
@@ -4,7 +4,7 @@ require 'etc'
|
||||
require 'open3'
|
||||
|
||||
OLD_CREW_VERSION = defined?(CREW_VERSION) ? CREW_VERSION : '1.0'
|
||||
CREW_VERSION = '1.68.2' unless defined?(CREW_VERSION) && CREW_VERSION == OLD_CREW_VERSION
|
||||
CREW_VERSION = '1.68.3' unless defined?(CREW_VERSION) && CREW_VERSION == OLD_CREW_VERSION
|
||||
|
||||
# Kernel architecture.
|
||||
KERN_ARCH = Etc.uname[:machine]
|
||||
@@ -397,9 +397,6 @@ CREW_ANITYA_PACKAGE_NAME_MAPPINGS = Set[
|
||||
{ pkg_name: 'docbook_xml51', anitya_pkg: 'docbook-xml', comments: '' },
|
||||
{ pkg_name: 'doxygen', anitya_pkg: 'doxygen', comments: '' },
|
||||
{ pkg_name: 'filecmd', anitya_pkg: 'file', comments: '' },
|
||||
{ pkg_name: 'gcc_build', anitya_pkg: 'gcc', comments: '' },
|
||||
{ pkg_name: 'gcc_dev', anitya_pkg: 'gcc', comments: '' },
|
||||
{ pkg_name: 'gcc_lib', anitya_pkg: 'gcc', comments: '' },
|
||||
{ pkg_name: 'gcr_3', anitya_pkg: 'gcr~3', comments: '' },
|
||||
{ pkg_name: 'gcr_4', anitya_pkg: 'gcr', comments: '' },
|
||||
{ pkg_name: 'gemacs', anitya_pkg: 'emacs', comments: '' },
|
||||
@@ -482,8 +479,7 @@ CREW_ANITYA_PACKAGE_NAME_MAPPINGS = Set[
|
||||
{ pkg_name: 'yad', anitya_pkg: 'yad', comments: 'Prefer to GitHub' },
|
||||
{ pkg_name: 'zig13', anitya_pkg: 'zig', comments: '' },
|
||||
{ pkg_name: 'zimg', anitya_pkg: 'zimg', comments: 'Prefer to GitHub' },
|
||||
{ pkg_name: 'zoneinfo', anitya_pkg: 'tzdata', comments: '' },
|
||||
{ pkg_name: 'zstd_static', anitya_pkg: 'zstd', comments: '' }
|
||||
{ pkg_name: 'zoneinfo', anitya_pkg: 'tzdata', comments: '' }
|
||||
].to_h { |h| [h[:pkg_name], h[:anitya_pkg]] }
|
||||
|
||||
CREW_LICENSE = <<~LICENSESTRING
|
||||
|
||||
@@ -80,7 +80,7 @@ class PackageUtils
|
||||
pkg_version.gsub!(/-dfsg.*/, '')
|
||||
# Delete -gcc14, futureproofed until gcc 100
|
||||
pkg_version.gsub!(/-gcc\d{2}/, '')
|
||||
# Trim kde- suffixes in qt5 packages so nothing else gets confused.
|
||||
# Trim kde- prefixes in qt5 packages so nothing else gets confused.
|
||||
pkg_version.delete_prefix!('kde-')
|
||||
# Delete -py3.12, futureproofed until Python 4
|
||||
pkg_version.gsub!(/-py3\.\d{2}/, '')
|
||||
@@ -100,6 +100,23 @@ class PackageUtils
|
||||
return pkg_version
|
||||
end
|
||||
|
||||
# Remove our language-specific prefixes and any build splitting suffixes.
|
||||
# This is mostly for use when querying Anitya in tools/version.rb, and is not suitable for Repology.
|
||||
def self.get_clean_name(pkg_name)
|
||||
# Delete language-specific prefixes.
|
||||
pkg_name.delete_prefix!('perl_')
|
||||
pkg_name.delete_prefix!('py3_')
|
||||
pkg_name.delete_prefix!('ruby_')
|
||||
# Delete suffixes for split packages.
|
||||
pkg_name.delete_suffix!('_build')
|
||||
pkg_name.delete_suffix!('_dev')
|
||||
pkg_name.delete_suffix!('_lib')
|
||||
# Delete the _static suffix for statically built packages.
|
||||
pkg_name.delete_suffix!('_static')
|
||||
|
||||
return pkg_name
|
||||
end
|
||||
|
||||
def self.get_gitlab_pkginfo(pkg_name, pkg_version, pkg_arch, build = nil, verbose = nil)
|
||||
# This is largely rehashing self.get_binary_url(pkg) using the
|
||||
# curl and jq binaries for debugging purposes.
|
||||
|
||||
Reference in New Issue
Block a user