[med-svn] r18721 - trunk/community/edam
Steffen Möller
moeller at moszumanska.debian.org
Sun Feb 1 18:03:45 UTC 2015
Author: moeller
Date: 2015-02-01 18:03:45 +0000 (Sun, 01 Feb 2015)
New Revision: 18721
Removed:
trunk/community/edam/debian2edam
Log:
debian2edam is superseeded by what is currently named registry-tool.py
Deleted: trunk/community/edam/debian2edam
===================================================================
--- trunk/community/edam/debian2edam 2015-02-01 15:50:38 UTC (rev 18720)
+++ trunk/community/edam/debian2edam 2015-02-01 18:03:45 UTC (rev 18721)
@@ -1,259 +0,0 @@
-#!/bin/bash -e
-
-
-# A routine to facilitate the output to STDERR instead of the default STDIN
-function STDERR () {
- cat - 1>&2
-}
-
-# echoindent outputs a series of blanks to STDOUT. An optional
-# second argument is echoed after those blanks if present.
-function echoindent () {
- for i in $(seq 1 $1)
- do
- echo -n " "
- done
- if [ "" != "$2" ]; then
- echo $2
- fi
-}
-
-level=0
-# helper to properly close an open paranthesis
-function closeParenthesis () {
- level=$(($level-1))
- echoindent $level
- echo -n "}"
- if [ -n "$1" ]; then
- echo "# $1"
- else
- echo
- fi
-}
-
-
-function echoTerm(){
- level=$(($level-1))
- echoindent $level
- echo "{\"uri\": \"$1\", \"term\": \"Pippi Langstrumpf\"}"
-}
-
-# Key argument indicating the debian directory from which to retrieve all the
-# information
-pathToDebian=$1
-#verbose="yes"
-verbose=""
-
-# Variable keeping usage information
-USAGE=<<EOUSAGE
-debian2edam [--upload] <path to 'debian' directory>
-
-server=https://
-Environment variables:
-elixir_cat_username
-elixir_cat_password
-
-EOUSAGE
-
-filename=$(basename "$pathToDebian")
-if [ "edam" = "$filename" ]; then
- pathToDebian=$(dirname "$pathToDebian") # upstream
- pathToDebian=$(dirname "$pathToDebian") # debian
-fi
-
-if [ -z "$pathToDebian" ]; then
- echo "$USAGE" | STDERR
- echo "E: Please specify debian directory in which to find EDAM annotation." | STDERR
- exit -1
-fi
-
-if [ ! -d "$pathToDebian" ]; then
- echo "$USAGE" | STDERR
- echo "E: Could not find directory '$pathToDebian'" | STDERR
- exit -1
-fi
-
-if [ ! -r "$pathToDebian/changelog" ]; then
- echo "$USAGE" | STDERR
- echo "E: Could not find a changelog file expected at '$pathToDebian/changelog'" | STDERR
- exit -1
-fi
-
-cd $(dirname "$pathToDebian")
-
-edamfile="debian/upstream/edam"
-if [ ! -r "$edamfile" ]; then
- echo "$USAGE" | STDERR
- echo "E: Could not access file '$edamfile' from $(pwd)" | STDERR
- exit -1
-fi
-
-sourcepackage=$(dpkg-parsechangelog |grep ^Source | sed -e 's/`^Source: //' )
-version=$(dpkg-parsechangelog |grep ^Version | cut -f2 -d\ | sed -e 's/-[^-][^-]*//' )
-
-declare -a descriptions
-declare -a packages
-
-if [ -n "$debug" ]; then cat debian/control; fi
-
-while read pack; do
- p=$(echo "$pack"|sed -e 's/^[^:]*: *//')
- echo Package: $p
- packages[${#packages[*]}]="$p"
-done < <(grep "^Package:" debian/control )
-
-while read desc; do
- d=$(echo "$desc"|sed -e 's/^[^:]*: *//')
- echo Description: $d
- descriptions[${#descriptions[*]}]="$d"
- #descriptions[1]="$d"
- #descriptions="$d"
-done < <(grep "^Description:" debian/control )
-
-#echo "DESCRIPTIONS: ${descriptions[*]}"
-#echo "PACKAGES: ${packages[*]}"
-#echo "DESCRIPTIONS: $descriptions}"
-#echo "PACKAGES: $packages"
-
-if [ ${#packages[*]} != ${#descriptions[*]} ]; then
- echo "E: Internal error - expected same number of packages (${#packagesp[*]}) as for their descriptions (${#descriptions[*]})" | STDERR
- exit -1
-fi
-
-(
-if [ -n "$verbose" ]; then
- for packageno in $(seq 0 ${#descriptions[*]})
- do
- echo "# $packageno"
- echo Packages[$packageno]: ${packages[$packageno]}
- echo Descriptions[$packageno]: ${descriptions[$packageno]}
- done
-fi
-) | STDERR
-
-prevstate="start";
-previndent=0
-currentscope=""
-currenttopic=""
-opentopic=0
-openfunction=0
-openscope=0
-indentlen=0
-
-# Core part of the program
-# It reads every line of the EDAM file (see end of loop for the redirection)
-# and decides what to print to STDOUT.
-
-while IFS='' read -r line
-do
- if [ -z "$line" ]; then
- echo "Read empty line"
- continue
- fi
-
- if [ -n "$verbose" ]; then
- echo "line: '$line'" | STDERR
- fi
-
- # retrieve different parts of the description
- blanks=$(echo "$line"|sed -e 's/^\( *\)\([^ :]\+\): *\([^ ]\+\).*$/\1/')
- type=$(echo "$line"|sed -e 's/^\( *\)\([^ :]\+\): *\([^ ]\+\).*$/\2/')
- val=$(echo "$line"|sed -e 's/^\( *\)\([^ :]\+\): *\([^ ]\+\).*$/\3/')
-
- if echo "$val" | grep -q : ; then
- echo "W: found colon in ID of line '$line' - transscribing to underscore" | STDERR
- val=$(echo "$val"|tr ":" "_")
- fi
-
- #echo "Indent='$blanks'"
- #echo "Indentlength='$indentlen'"
- #echo "Type='$type'"
- #echo "Val='$val'"
-
- if [ -n "$currentscope" -a "*" != "$currentscope" -a "summary" != "$currentscope" -a "scope" != "$type" ]; then
- echo "I: Wrong scope ($currentscope) - ignored '$line'" | STDERR
- continue
- fi
- indentlen=${#blanks}
-
- if [ "scope" = "$type" ]; then
- if [ $openfunction -gt 0 ]; then closeParenthesis "openfunction($openfunction) in scope"; fi
- currentscope="$val"
- resourcename=$sourcepackage
- if [ "*"!=$val -a "summary"!="$val" ];then
- resourcename=$val
- fi
-
- if [ "summary" != "$val" -a "*" != "$val" ]; then
- echo "I: treatment of multiple scopes not yet implemented" | STDERR
- else
- echo "{"
- # Some decent comparison of package names with scope is not implemented
- level=$((level+1))
- echoindent
- echo "Package $resourcename"
- echoindent
- echo "\"version\": \"$version\","
- echoindent
- echo "\"description\": \"${descriptions[0]}\","
- echoindent
- echo "\"topic\": \"{$currenttopic}\""
- openscope=1
- fi
- elif [ "topic" = "$type" ]; then
- if [ $openfunction -gt 0 ]; then closeParenthesis "openfunction($openfunction) in topic"; openfunction=0; fi
- if [ $openscope -gt 0 ]; then closeParenthesis "openscope($openscope) after loop"; openscope=0; fi
- if [ "start" != "$prevstate" ]; then
- closeParenthesis "topic with prior state - weird"
- fi
- currenttopic="$val"
- # at some laterimplementation point, bits generated here would be cached and then distributed
- # to various lower-level scopes
- elif [ "function" = "$type" ]; then
- if [ $openfunction -gt 0 ]; then
- closeParenthesis "openfunction($openfunction) in function"
- openfunction=0
- fi
- echoindent $level
- echo "{function: [ { \"functionName\": ["
- echoTerm $val
- echo "] }],"
- level=$((level+1))
- openfunction=1
- elif [ "input" = "$type" -o "output" = "$type" ]; then
- if [ $prevstate = $type ]; then
- echo "},{"
- fi
- if [ $prevstate = 'function' ]; then
- echo "\"$type\": [{"
- fi
- echoindent $level
- echo "($type $val)"
- else
- echo "W: unknown type '$type' - ignored" | STDERR
- fi
- prevstate=$type
- #echo "indentlen='$indentlen'"
-done < $edamfile
-
-if [ $openfunction -gt 0 ]; then
- closeParenthesis "openfunction($openfunction) after loop"
- openfunction=0
-fi
-
-if [ $openscope -gt 0 ]; then
- #echo "I: treatment of multiple scopes not yet implemented"|STDERR
- closeParenthesis "openscope($openscope) after loop"
- openscope=0
-fi
-
-#echo "indentlen='$indentlen'" | STDERR
-
-if [ $opentopic -gt 0 ]; then
- opentopic=0
-fi
-
-#for i in $(seq $(($indentlen-$openfunction-$openscope-$opentopic)) -1 1)
-#do
-# closeParenthesis "indent $i"
-#done
More information about the debian-med-commit
mailing list