diff options
author | 2008-09-08 19:12:59 +0000 | |
---|---|---|
committer | 2008-09-08 19:12:59 +0000 | |
commit | 653339c813f9deee5423aa83a6918e8a4ba7afb6 (patch) | |
tree | 6b5bde38834783aa62728d8eaa79f67c85296507 /scripts | |
parent | Automatic update to use.local.desc (diff) | |
download | sunrise-653339c813f9deee5423aa83a6918e8a4ba7afb6.tar.gz sunrise-653339c813f9deee5423aa83a6918e8a4ba7afb6.tar.bz2 sunrise-653339c813f9deee5423aa83a6918e8a4ba7afb6.zip |
scripts/use_desc_gen: Add files for automatic use.local.desc generation
svn path=/sunrise/; revision=7028
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/use_desc_gen | 38 | ||||
-rw-r--r-- | scripts/use_desc_gen.pyc | bin | 0 -> 7187 bytes | |||
-rw-r--r-- | scripts/use_desc_gen.sh | 61 |
3 files changed, 99 insertions, 0 deletions
diff --git a/scripts/use_desc_gen b/scripts/use_desc_gen new file mode 100644 index 000000000..f1c6b8f29 --- /dev/null +++ b/scripts/use_desc_gen @@ -0,0 +1,38 @@ +#!/usr/bin/env python +# Written by Alec Warner <antarus@gentoo.org> +# This code is hereby placed in the public domain. + +"""A simple driver file for use_desc_gen.""" + +import logging +import optparse +import use_desc_gen + + +def GetOpts(): + """Simple Option Parsing.""" + + parser = optparse.OptionParser() + parser.add_option('-r', '--repo_path', help=('path to repository from ' + 'which the documentation will be generated.')) + parser.add_option('-c', '--category_file', help=('path to a category', + 'file if repo_path lacks a profile/category file')) + + opts, unused_args = parser.parse_args() + + if not opts.repo_path: + parser.error('--repo_path is a required option') + + logging.debug('REPO_PATH is %s' % opts.repo_path) + + return (opts, unused_args) + + +def Main(): + """Main.""" + opts, unused_args = GetOpts() + use_desc_gen.FindMetadataFiles(opts.repo_path, opts.category_file) + + +if __name__ == '__main__': + Main() diff --git a/scripts/use_desc_gen.pyc b/scripts/use_desc_gen.pyc Binary files differnew file mode 100644 index 000000000..8997d8ddd --- /dev/null +++ b/scripts/use_desc_gen.pyc diff --git a/scripts/use_desc_gen.sh b/scripts/use_desc_gen.sh new file mode 100644 index 000000000..f0b0bf86f --- /dev/null +++ b/scripts/use_desc_gen.sh @@ -0,0 +1,61 @@ +#!/bin/sh +# Written by Douglas Goldstein <cardoe@gentoo.org> +# This code is hereby placed into the public domain +# +# $Id: use_desc_gen.sh,v 1.6 2008/08/23 21:28:28 robbat2 Exp $ + +usage() { + prog=$(basename $1) + + echo "${prog} /path/to/portage/tree" + exit 1; +} + +if [ $# -ne 1 ]; then + usage $0; +fi + +if [ "x${1}" = "x-h" -o "x${1}" = "x--help" ]; then + usage $0; +fi + +if [ ! -f "${1}/profiles/use.local.desc" ]; then + usage $0; +fi + +pid=$(echo $$) + +# make list of categories that we want to remove from current use.local.desc +#cat "${1}/profiles/use.local.desc" | sed '1,/# The following categories/d;/# End of metadata categories/,$d;s/^../^/' > /tmp/${pid}.grep + +# we also want to remove comments and blank lines +#echo "^#" >> /tmp/${pid}.grep +#echo "^$" >> /tmp/${pid}.grep + +# make list of categories to process with use_desc_gen (same as above without grep rule) +#cat "${1}/profiles/use.local.desc" | sed '1,/# The following categories/d;/# End of metadata categories/,$d;s/^..//' > /tmp/${pid}.categories + +# take comments from existing use.local.desc +grep '^#' "${1}/profiles/use.local.desc" > /tmp/${pid}.use.local.desc +echo "" >> /tmp/${pid}.use.local.desc + +# use list from step #1 to filter current use.local.desc and add un-converted categories to new use.local.desc +#grep -v -f /tmp/${pid}.grep "${1}/profiles/use.local.desc" > /tmp/${pid}.new.use + +# the secret sauce, append to new use.local.desc +python scripts/use_desc_gen --repo_path "${1}" > /tmp/${pid}.new.use + +# let's keep it sorted: use major category, minor category, and package name +# as primary, secondary, and tertiary sort keys, respectively +sort -t: -k1,1 -k2 /tmp/${pid}.new.use | sort -s -t/ -k1,1 \ + >> /tmp/${pid}.use.local.desc + +# clean up +#rm -rf /tmp/${pid}.categories +#rm -rf /tmp/${pid}.grep +rm -rf /tmp/${pid}.new.use + +mv /tmp/${pid}.use.local.desc profiles/use.local.desc +if [[ $(svn diff profiles/use.local.desc) ]]; then + svn commit -m "Automatic update to use.local.desc" profiles/use.local.desc; +fi |