Browse Source

Added to bin/sde-create-package code to parse the output of the hives and render a good desc file, using default for the fields unknown to the hive.

karasz/new-early
Alejandro Mery 17 years ago
parent
commit
94e5e8fc18
1 changed files with 89 additions and 1 deletions
  1. +89
    -1
      bin/sde-create-package

+ 89
- 1
bin/sde-create-package

@ -125,4 +125,92 @@ confdir=$( package_confdir "$pkg" )
echo_info "Creating package/$repo/$pkg from $hive:${hiveindex:-$pkg}"
"$SDEROOT/lib/sde-package/hives/$hive" "${hiveindex:-$pkg}" "$@"
# get info form the hive
output=$( "$SDEROOT/lib/sde-package/hives/$hive" "${hiveindex:-$pkg}" "$@" )
[ -n "$output" ] || echo_abort 1 "$hive failed to fetch ${hiveindex:-$pkg} information"
# do we have content for the $1 tag?
output_has_tag()
{
echo "$output" | grep -q "^\[$1\]"
}
# what do we know for the $1 tag?
output_tag()
{
echo "$output" | grep "^\[$1\]" | sed -e 's,^\[\([A-Z-]\+\)\][ \t]*,,' -e 's,[ \t]*\$,,'
}
# checks if output has $1, and return $2 if not
output_parse()
{
if output_has_tag "$1"; then
output_tag "$1"
else
echo "$2"
fi
}
# parse the output of the hive
#
# title
title=$( output_parse I 'TODO: Short Information' )
# desc
desc=$( output_parse T 'TODO: Long Expanation
TODO: Long Expanation
TODO: Long Expanation
TODO: Long Expanation
TODO: Long Expanation' )
# url
url=$( output_parse U 'TODO: URL' )
# author
author=$( output_parse A 'TODO: Author' )
# category
category=$( output_parse C 'TODO: Category' )
# license
license=$( output_parse L 'TODO: License' )
# status
status=$( output_parse S 'TODO: Status' )
# version
version=$( output_parse V 'TODO: Version' )
# download
download=$( output_parse D '' )
TAG=SDE-COPYRIGHT-NOTE
cat <<EOT
[COPY] --- $TAG-BEGIN ---
[COPY] This copyright note is auto-generated by ./scripts/Create-CopyPatch.
[COPY]
[COPY] Filename: package/.../$pkg/$pkg.desc
[COPY] Copyright (C) $( date +%Y ) The OpenSDE Project
[COPY]
[COPY] More information can be found in the files COPYING and README.
[COPY]
[COPY] This program is free software; you can redistribute it and/or modify
[COPY] it under the terms of the GNU General Public License as published by
[COPY] the Free Software Foundation; version 2 of the License. A copy of the
[COPY] GNU General Public License can be found in the file COPYING.
[COPY] --- $TAG-END ---
[I] $title
$( echo "$desc" | sed -e 's,^,[T] ,' )
[U] $url
[A] $author
[M] The OpenSDE Community <list@opensde.org>
[C] $category
[L] $license
[S] $status
[V] $version
[P] X -----5---9 800.000
EOT
echo "$download" | while read l; do
echo "[D] $l"
done

Loading…
Cancel
Save