Add Microsoft Edit (#11940)

* Add Microsoft Edit, and rust buildsystem tweaks.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Add built packages for linux/amd64 to msedit

* tweak rust options

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* lint

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

---------

Signed-off-by: Satadru Pramanik <satadru@gmail.com>
Co-authored-by: Satadru Pramanik <satadru@gmail.com>
Co-authored-by: satmandu <satmandu@users.noreply.github.com>
This commit is contained in:
github-actions[bot]
2025-05-23 16:27:55 -05:00
committed by GitHub
parent 626a53a7a7
commit 31efa32a05
7 changed files with 46 additions and 11 deletions

View File

@@ -890,7 +890,7 @@ end
def fix_interpreter_path(dir) def fix_interpreter_path(dir)
# Do not set interpreter for non-musl, as this can break apps if there # Do not set interpreter for non-musl, as this can break apps if there
# is an issue with the crew glibc. # is an issue with the crew glibc.
return if @pkg.is_musl? || %w[patchelf upx].include?(@pkg.name) return if !@pkg.nil? && (@pkg.is_musl? || %w[patchelf upx].include?(@pkg.name))
Dir.chdir dir do Dir.chdir dir do
puts 'Running upx to uncompress binaries and patchelf to patch binary interpreter paths.'.lightblue puts 'Running upx to uncompress binaries and patchelf to patch binary interpreter paths.'.lightblue
@@ -906,7 +906,7 @@ def fix_interpreter_path(dir)
next unless File.file?(execfiletopatch) next unless File.file?(execfiletopatch)
# Decompress the binary if compressed. # Decompress the binary if compressed.
system "upx -qq -d #{execfiletopatch}", %i[err] => File::NULL system "upx -qq -d #{execfiletopatch}", %i[err] => File::NULL, exception: false
# Check for existing interpreter. # Check for existing interpreter.
@interpreter, _read_interpreter_stderr_s, @read_interpreter_status = Open3.capture3("patchelf --print-interpreter #{execfiletopatch}") @interpreter, _read_interpreter_stderr_s, @read_interpreter_status = Open3.capture3("patchelf --print-interpreter #{execfiletopatch}")
# Set interpreter unless the interpreter read failed or is already # Set interpreter unless the interpreter read failed or is already

View File

@@ -3,7 +3,7 @@ require_relative '../require_gem'
require_relative '../report_buildsystem_methods' require_relative '../report_buildsystem_methods'
class RUST < Package class RUST < Package
property :rust_features, :rust_options, :rust_release_profile, :rust_targets, :pre_rust_options, :rust_build_extras, :rust_install_extras property :rust_channel, :rust_features, :rust_options, :rust_release_profile, :rust_targets, :pre_rust_options, :rust_build_extras, :rust_install_extras
def self.build def self.build
rust_env = rust_env =
@@ -13,14 +13,21 @@ class RUST < Package
PATH: "#{CREW_PREFIX}/share/cargo/bin:" + ENV.fetch('PATH', nil) PATH: "#{CREW_PREFIX}/share/cargo/bin:" + ENV.fetch('PATH', nil)
}.transform_keys(&:to_s) }.transform_keys(&:to_s)
@channel_flag = @rust_channel.to_s.empty? ? '' : "+#{@rust_channel}"
@features = @rust_features.to_s.empty? ? '' : "--features #{@rust_features}"
@profile = @rust_release_profile.to_s.empty? ? 'release' : @rust_release_profile
extend ReportBuildsystemMethods extend ReportBuildsystemMethods
print_buildsystem_methods print_buildsystem_methods
unless @rust_channel.to_s.empty?
system rust_env, "rustup install --force #{@rust_channel}"
fix_interpreter_path("#{CREW_PREFIX}/share/rustup/toolchains")
end
system rust_env, "rustup target add #{@rust_targets}" unless @rust_targets.to_s.empty? system rust_env, "rustup target add #{@rust_targets}" unless @rust_targets.to_s.empty?
system rust_env, "#{@pre_rust_options} cargo fetch" system rust_env, "#{@pre_rust_options} cargo #{@channel_flag} fetch"
system rust_env, "#{@pre_rust_options} cargo build \ system rust_env, "#{@pre_rust_options} cargo #{@channel_flag} build \
--profile=#{@rust_release_profile.to_s.empty? ? 'release' : @rust_release_profile} \ --profile=#{@profile} \
#{@rust_features.to_s.empty? ? '' : "--features #{@rust_features}"} \ #{@features} \
#{@rust_options}" #{@rust_options}"
@rust_build_extras&.call @rust_build_extras&.call
end end
@@ -33,12 +40,12 @@ class RUST < Package
PATH: "#{CREW_PREFIX}/share/cargo/bin:" + ENV.fetch('PATH', nil) PATH: "#{CREW_PREFIX}/share/cargo/bin:" + ENV.fetch('PATH', nil)
}.transform_keys(&:to_s) }.transform_keys(&:to_s)
system rust_env, "cargo install \ system rust_env, "cargo #{@channel_flag} install \
--profile=#{@rust_release_profile.to_s.empty? ? 'release' : @rust_release_profile} \ --profile=#{@profile} \
--offline \ --offline \
--no-track \ --no-track \
--path . \ --path . \
#{@rust_features.to_s.empty? ? '' : "--features #{@rust_features}"} \ #{@features} \
#{@rust_options} \ #{@rust_options} \
--root #{CREW_DEST_PREFIX}" --root #{CREW_DEST_PREFIX}"
@rust_install_extras&.call @rust_install_extras&.call

View File

@@ -3,7 +3,7 @@
require 'etc' require 'etc'
OLD_CREW_VERSION ||= defined?(CREW_VERSION) ? CREW_VERSION : '1.0' OLD_CREW_VERSION ||= defined?(CREW_VERSION) ? CREW_VERSION : '1.0'
CREW_VERSION ||= '1.61.4' unless defined?(CREW_VERSION) && CREW_VERSION == OLD_CREW_VERSION CREW_VERSION ||= '1.61.5' unless defined?(CREW_VERSION) && CREW_VERSION == OLD_CREW_VERSION
# Kernel architecture. # Kernel architecture.
KERN_ARCH ||= Etc.uname[:machine] KERN_ARCH ||= Etc.uname[:machine]

View File

@@ -0,0 +1 @@
/usr/local/bin/edit

View File

@@ -0,0 +1 @@
/usr/local/bin/edit

21
packages/edit.rb Normal file
View File

@@ -0,0 +1,21 @@
require 'buildsystems/rust'
class Edit < RUST
description 'A simple editor for simple needs.'
homepage 'https://github.com/microsoft/edit.'
version '1.0.0'
license 'MIT'
compatibility 'i686 x86_64'
source_url 'https://github.com/microsoft/edit.git'
git_hashtag "v#{version.split('-').first}"
binary_compression 'tar.zst'
binary_sha256({
i686: '8a2dc7f7872fafbe914fe2fb38312c857eb9e2adbc4c8ad4f07e9819e9dca0cd',
x86_64: '37f56b627af9e4673af20bd86df99b5e020bc2e711e98b3e06e3c6580126f77b'
})
depends_on 'gcc_lib' # R
rust_channel 'nightly'
end

View File

@@ -1645,6 +1645,11 @@ url: http://ftpmirror.gnu.org/ed
activity: low activity: low
--- ---
kind: url kind: url
name: edit
url: https://github.com/microsoft/edit/releases
activity: medium
---
kind: url
name: editoconfig_core_c name: editoconfig_core_c
url: https://github.com/editorconfig/editorconfig-core-c/releases url: https://github.com/editorconfig/editorconfig-core-c/releases
activity: medium activity: medium