Revision: 334 http://opencsw.svn.sourceforge.net/opencsw/?rev=334&view=rev Author: wahwah Date: 2011-02-26 00:34:20 +0000 (Sat, 26 Feb 2011)
Log Message: ----------- Renaming .sh to .py before rewrite Added Paths: ----------- utilities/mk_core_list.py Removed Paths: ------------- utilities/mk_core_list.sh Copied: utilities/mk_core_list.py (from rev 332, utilities/mk_core_list.sh) =================================================================== --- utilities/mk_core_list.py (rev 0) +++ utilities/mk_core_list.py 2011-02-26 00:34:20 UTC (rev 334) @@ -0,0 +1,81 @@ +#!/bin/bash + +# $Id$ +# +# This script helps creating a list of core packages, by starting with +# specific packages and adding all their dependencies. + +set -u +set -e + +# The current idea is to keep the list divided by sections, each section +# sorted alphabetically. +core_start_pkgs=( + # Servers + apache2 + bind + exim + mysql5 + postfix + # Interpreters + perl + python + ruby + # Editors + emacs + vim + # Userland + coreutils + elinks + findutils + gawk + gfile + ggrep + gsed + gtar + mc + rsync + screen + sudo + wget +) +outfile="core.txt" +rm -f "${outfile}" tmp + +for catalogname in "${core_start_pkgs[@]}"; do + pkgutil -d --parse --config ~/pkgutil.conf \ + -W "${HOME}/.pkgutil" \ + "${catalogname}" \ + | awk '{print $1}' \ + >> "${outfile}" +done + +# This is what you get when you start coding in shell first. +PY_CODE="import yaml +import logging +# Reading a yaml file is impressively slow +catalogname_by_vendor = yaml.load(open('catalogname_by_vendor.yml', 'r')) +vendor_by_catalogname = {} +for vendor in catalogname_by_vendor: + for catalogname in catalogname_by_vendor[vendor]: + vendor_by_catalogname[catalogname] = vendor +collected_catalognames = [] +with open('${outfile}', 'rb') as in_fd: + for catalogname in in_fd: + catalogname = catalogname.strip() + if not catalogname: continue + if catalogname in vendor_by_catalogname: + vendor = vendor_by_catalogname[catalogname] + collected_catalognames.extend(catalogname_by_vendor[vendor]) + else: + logging.warning('%s not found in vendor_by_catalogname', catalogname) + collected_catalognames.append(catalogname) +with open('tmp', 'w') as out_fd: + out_fd.write('\n'.join(collected_catalognames)) +" +python -c "${PY_CODE}" +mv tmp "${outfile}" + +< "${outfile}" sort | uniq > tmp +mv tmp "${outfile}" +less "${outfile}" Deleted: utilities/mk_core_list.sh =================================================================== --- utilities/mk_core_list.sh 2011-02-25 10:31:09 UTC (rev 333) +++ utilities/mk_core_list.sh 2011-02-26 00:34:20 UTC (rev 334) @@ -1,81 +0,0 @@ -#!/bin/bash - -# $Id$ -# -# This script helps creating a list of core packages, by starting with -# specific packages and adding all their dependencies. - -set -u -set -e - -# The current idea is to keep the list divided by sections, each section -# sorted alphabetically. -core_start_pkgs=( - # Servers - apache2 - bind - exim - mysql5 - postfix - # Interpreters - perl - python - ruby - # Editors - emacs - vim - # Userland - coreutils - elinks - findutils - gawk - gfile - ggrep - gsed - gtar - mc - rsync - screen - sudo - wget -) -outfile="core.txt" -rm -f "${outfile}" tmp - -for catalogname in "${core_start_pkgs[@]}"; do - pkgutil -d --parse --config ~/pkgutil.conf \ - -W "${HOME}/.pkgutil" \ - "${catalogname}" \ - | awk '{print $1}' \ - >> "${outfile}" -done - -# This is what you get when you start coding in shell first. -PY_CODE="import yaml -import logging -# Reading a yaml file is impressively slow -catalogname_by_vendor = yaml.load(open('catalogname_by_vendor.yml', 'r')) -vendor_by_catalogname = {} -for vendor in catalogname_by_vendor: - for catalogname in catalogname_by_vendor[vendor]: - vendor_by_catalogname[catalogname] = vendor -collected_catalognames = [] -with open('${outfile}', 'rb') as in_fd: - for catalogname in in_fd: - catalogname = catalogname.strip() - if not catalogname: continue - if catalogname in vendor_by_catalogname: - vendor = vendor_by_catalogname[catalogname] - collected_catalognames.extend(catalogname_by_vendor[vendor]) - else: - logging.warning('%s not found in vendor_by_catalogname', catalogname) - collected_catalognames.append(catalogname) -with open('tmp', 'w') as out_fd: - out_fd.write('\n'.join(collected_catalognames)) -" -python -c "${PY_CODE}" -mv tmp "${outfile}" - -< "${outfile}" sort | uniq > tmp -mv tmp "${outfile}" -less "${outfile}" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. _______________________________________________ devel mailing list devel@lists.opencsw.org https://lists.opencsw.org/mailman/listinfo/devel