Skip to content

Commit 5cc5c68

Browse files
committed
msys2 - delete packages from cache
1 parent ce41295 commit 5cc5c68

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

common.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def gh_upload_http
6767
def set_v3_common_headers(req, connection: nil)
6868
req['User-Agent'] = GH_NAME
6969
req['Authorization'] = "token #{TOKEN}"
70-
req['Accept'] = 'application/vnd.github.v3+json'
70+
req['Accept'] = 'application/vnd.github+json' # old 'application/vnd.github.v3+json'
7171
req['Connection'] = 'close' if connection == 'close'
7272
end
7373

create_msys2_pkg.rb

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ class << self
1818
TEMP = ENV.fetch('RUNNER_TEMP') { ENV.fetch('RUNNER_WORKSPACE') { ENV['TEMP'] } }
1919
ORIG_MSYS2 = "#{TEMP}/msys64".gsub '\\', '/'
2020

21-
SYNC = 'var/lib/pacman/sync'
21+
SYNC = 'var/lib/pacman/sync'
2222
LOCAL = 'var/lib/pacman/local'
23+
CACHE = 'var/cache/pacman/pkg'
2324

2425
def update_msys2
2526
updated_keys = pacman_syuu
@@ -70,6 +71,18 @@ def clean_database(pre)
7071
end
7172
end
7273

74+
# remove downloaded packages and their '.sig' files
75+
def clean_packages
76+
dir = "#{MSYS2_ROOT}/#{CACHE}"
77+
files = Dir.glob('*.*', base: dir)
78+
Dir.chdir(dir) do
79+
files.each do |fn|
80+
next unless File.file? fn
81+
File.delete fn
82+
end
83+
end
84+
end
85+
7386
def run
7487
current_pkgs = %x[#{PACMAN} -Q].split("\n").reject { |l| l.start_with? 'mingw-w64-' }
7588

@@ -93,6 +106,7 @@ def run
93106
remove_non_msys2
94107
remove_duplicate_files
95108
clean_database 'msys'
109+
clean_packages
96110

97111
# create 7z file
98112
STDOUT.syswrite "##[group]#{YEL}Create msys2 7z file#{RST}\n"

0 commit comments

Comments
 (0)