๐Ÿ“ฆ felixonmars / archlinux-futils

๐Ÿ“„ splitmove ยท 38 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38#!/usr/bin/ruby

PACKAGES_REPO = '/home/felix/projects/arch/svntogit-packages'
COMMUNITY_REPO = '/home/felix/projects/arch/svntogit-community'

$packages = []
$community = []

$failed = []

def detect(pkg, converted=false)
    if Dir.exist?("#{PACKAGES_REPO}/#{pkg}")
        $packages << pkg
    elsif Dir.exist?("#{COMMUNITY_REPO}/#{pkg}")
        $community << pkg
    elsif !converted
        $failed << pkg
    else
        puts "#{pkg} not found!"
    end
end

ARGF.each do |line|
    line.chomp!.split.each do |pkg|
        detect(pkg)
    end
end

`expac -Sv %e #{$failed.join(' ')}`.split.each do |pkg|
    detect(pkg, true)
end

puts "Packages:"
puts $packages.join(' ')

puts "Community:"
puts $community.join(' ')