2015-08-07 2 views
2

Недавно я обновил Mac OS X до Yosemite, и я хотел бы убедиться, что каждый пакет, который я установил в настоящее время, представляет собой бутылку Yosemite.Homebrew: как перечислить установленные бутылки и их версию ОС?

Как я могу перечислить установленные бутылки и их версию ОС, чтобы в конечном итоге удалить или установить их?


EDIT оглавления строки «бутылочная» не будет работать, потому что это в любом случае, если бутылка доступна для пакета, но вы все равно можете скомпилировать из исходников. Например, я только что построил Yasm из источника и brew info yasm возвращений:

yasm: stable 1.3.0 (bottled), HEAD 
Modular BSD reimplementation of NASM 
http://yasm.tortall.net/ 
/usr/local/Cellar/yasm/1.3.0 (44 files, 3.3M) * 
    Built from source 
[...] 

ответ

1

Обновлено Ответ

Там, как представляется, INSTALL_RECEIPT.json в каждом homebrew пакете внутри /usr/local/Cellar, например, это для OpenCV

/usr/local/Cellar/opencv/2.4.12/INSTALL_RECEIPT.json 

Это стандарт JSON, так что вы можете разобрать его, как это без необходимости и дополнительные инструменты:

python -mjson.tool /usr/local/Cellar/opencv/2.4.12/INSTALL_RECEIPT.json 

и вы получите это - что может помочь вашему делу ... может быть.

{ 
    "HEAD": "d60f75135ecf1a667539700ad7916cefbcc98480", 
    "built_as_bottle": false, 
    "compiler": "clang", 
    "poured_from_bottle": false, 
    "source": { 
     "path": "/usr/local/Library/Taps/homebrew/homebrew-science/opencv.rb", 
     "spec": "stable", 
     "tap": "homebrew/homebrew-science" 
    }, 
    "stdlib": "libcxx", 
    "time": 1444317226, 
    "unused_options": [ 
     "--32-bit", 
     "--with-java", 
     "--with-qt", 
     "--with-tbb", 
     "--without-tests", 
     "--without-opencl", 
     "--with-cuda", 
     "--with-quicktime", 
     "--with-opengl", 
     "--with-ximea", 
     "--without-numpy", 
     "--without-python", 
     "--c++11", 
     "--without-eigen", 
     "--with-gstreamer", 
     "--with-jasper", 
     "--with-libdc1394", 
     "--without-openexr", 
     "--with-openni", 
     "--with-ffmpeg" 
    ], 
    "used_options": [] 
} 

Вы также можете получить вывод команды brew info в формате JSON, например:

brew info imagemagick --json=v1 | jq "." 
[ 
    { 
    "name": "imagemagick", 
    "full_name": "imagemagick", 
    "desc": "Tools and libraries to manipulate images in many formats", 
    "homepage": "http://www.imagemagick.org", 
    "oldname": null, 
    "versions": { 
     "stable": "6.9.2-3", 
     "bottle": true, 
     "devel": null, 
     "head": "HEAD" 
    }, 
    "revision": 0, 
    "installed": [ 
     { 
     "version": "6.9.2-3", 
     "used_options": [ 
      "--with-x11" 
     ], 
     "built_as_bottle": null, 
     "poured_from_bottle": false 
     } 
    ], 
    "linked_keg": "6.9.2-3", 
    "keg_only": null, 
    "dependencies": [ 
     "xz", 
     "libtool", 
     "pkg-config", 
     "jpeg", 
     "libpng", 
     "libtiff", 
     "freetype", 
     "fontconfig", 
     "little-cms", 
     "little-cms2", 
     "libwmf", 
     "librsvg", 
     "liblqr", 
     "openexr", 
     "ghostscript", 
     "webp", 
     "fftw", 
     "pango" 
    ], 
    "conflicts_with": [], 
    "caveats": null, 
    "requirements": [ 
     { 
     "name": "x11", 
     "default_formula": null, 
     "cask": "xquartz", 
     "download": "https://xquartz.macosforge.org" 
     } 
    ], 
    "options": [ 
     { 
     "option": "--with-fftw", 
     "description": "Compile with FFTW support" 
     }, 
     { 
     "option": "--with-hdri", 
     "description": "Compile with HDRI support" 
     }, 
     { 
     "option": "--with-jp2", 
     "description": "Compile with Jpeg2000 support" 
     }, 
     { 
     "option": "--with-openmp", 
     "description": "Compile with OpenMP support" 
     }, 
     { 
     "option": "--with-perl", 
     "description": "enable build/install of PerlMagick" 
     }, 
     { 
     "option": "--with-quantum-depth-8", 
     "description": "Compile with a quantum depth of 8 bit" 
     }, 
     { 
     "option": "--with-quantum-depth-16", 
     "description": "Compile with a quantum depth of 16 bit" 
     }, 
     { 
     "option": "--with-quantum-depth-32", 
     "description": "Compile with a quantum depth of 32 bit" 
     }, 
     { 
     "option": "--without-opencl", 
     "description": "Disable OpenCL" 
     }, 
     { 
     "option": "--without-magick-plus-plus", 
     "description": "disable build/install of Magick++" 
     }, 
     { 
     "option": "--without-jpeg", 
     "description": "Build without jpeg support" 
     }, 
     { 
     "option": "--without-libpng", 
     "description": "Build without libpng support" 
     }, 
     { 
     "option": "--without-libtiff", 
     "description": "Build without libtiff support" 
     }, 
     { 
     "option": "--without-freetype", 
     "description": "Build without freetype support" 
     }, 
     { 
     "option": "--with-x11", 
     "description": "Build with x11 support" 
     }, 
     { 
     "option": "--with-fontconfig", 
     "description": "Build with fontconfig support" 
     }, 
     { 
     "option": "--with-little-cms", 
     "description": "Build with little-cms support" 
     }, 
     { 
     "option": "--with-little-cms2", 
     "description": "Build with little-cms2 support" 
     }, 
     { 
     "option": "--with-libwmf", 
     "description": "Build with libwmf support" 
     }, 
     { 
     "option": "--with-librsvg", 
     "description": "Build with librsvg support" 
     }, 
     { 
     "option": "--with-liblqr", 
     "description": "Build with liblqr support" 
     }, 
     { 
     "option": "--with-openexr", 
     "description": "Build with openexr support" 
     }, 
     { 
     "option": "--with-ghostscript", 
     "description": "Build with ghostscript support" 
     }, 
     { 
     "option": "--with-webp", 
     "description": "Build with webp support" 
     }, 
     { 
     "option": "--with-pango", 
     "description": "Build with pango support" 
     } 
    ], 
    "bottle": { 
     "stable": { 
     "revision": 0, 
     "cellar": "/usr/local/Cellar", 
     "prefix": "/usr/local", 
     "root_url": "https://homebrew.bintray.com/bottles", 
     "files": { 
      "el_capitan": { 
      "url": "https://homebrew.bintray.com/bottles/imagemagick-6.9.2-3.el_capitan.bottle.tar.gz", 
      "sha256": "cd5edb53eae0271771df4a77a401a50e973b200ae875a04ef6a3f4d467ca2ef4" 
      }, 
      "yosemite": { 
      "url": "https://homebrew.bintray.com/bottles/imagemagick-6.9.2-3.yosemite.bottle.tar.gz", 
      "sha256": "fbe139e4d7b540ce03fcde6a7735d9e79ed8652827cd7c877e551abcf804a494" 
      }, 
      "mavericks": { 
      "url": "https://homebrew.bintray.com/bottles/imagemagick-6.9.2-3.mavericks.bottle.tar.gz", 
      "sha256": "99f2f95739d3ee11535fea62440f1608ce0ee1ef22bda2f878353360ab45e9cc" 
      } 
     } 
     } 
    } 
    } 
] 

Оригинал ответа

Так что вы хотите, бутилированные пакеты, которые не построены из источника ,

# List all installed packages 
for p in $(brew list); do 
    # Get info about this particular one... 
    # ... if bottled and not from source, print first line 
    brew info $p | awk '/bottled/{p=$0} /Built from source/{p=""} END{if(length(p))print p}' 
done 

Если вы не установили слишком много пакетов, вы можете уйти с этим:

brew info $(brew list) | awk ... 
+0

Спасибо! Это действительно то, что я искал на странице «man brew», но пока не повезло –

+0

К сожалению, этот скрипт не будет работать, потому что строка «разливается» в любом случае, если для пакета имеется пакет, но вы все еще можете скомпилировать из источника. Например, я только что построил 'yasm' из источника и' brew info yasm' дает мне: 'yasm: stable 1.3.0 (в бутылках), HEAD' [...] '/usr/local/Cellar /yasm/1.3.0 (44 файла, 3.3M) * ' ' Построен из источника' –

+0

Можете ли вы щелкнуть 'edit' под своим вопросом и поместить дополнительную информацию из комментария выше в свой вопрос, пожалуйста, - читать легче с форматированием там. Спасибо –

Смежные вопросы