Skip to content

Instantly share code, notes, and snippets.

@aont
Created December 18, 2014 12:07
Show Gist options
  • Select an option

  • Save aont/a69dd9738f978746b279 to your computer and use it in GitHub Desktop.

Select an option

Save aont/a69dd9738f978746b279 to your computer and use it in GitHub Desktop.
analyze macports package list
#!/usr/bin/ruby
IO.popen("port -q installed", "r") do |port|
while line = port.gets
md_active = line.match(/\(active\)/)
is_active = md_active
if is_active
md_version = line.match(/@([^\s]+)/)
version_full = md_version[1]
version_ary = version_full.split("+")
version_num = version_ary[0]
variation_ary = version_ary[1..-1]
md_pkgname = line.match(/^\s*([^\s@]+)/)
pkgname = md_pkgname[1]
printf "%s -universal\n", pkgname
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment