3 # --- T2-COPYRIGHT-NOTE-BEGIN ---
4 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
6 # T2 SDE: misc/archive/fmnewpackage.sh
7 # Copyright (C) 2004 - 2007 The T2 SDE Project
8 # Copyright (C) 1998 - 2003 ROCK Linux Project
10 # More information can be found in the files COPYING and README.
12 # This program is free software; you can redistribute it and/or modify
13 # it under the terms of the GNU General Public License as published by
14 # the Free Software Foundation; version 2 of the License. A copy of the
15 # GNU General Public License can be found in the file COPYING.
16 # --- T2-COPYRIGHT-NOTE-END ---
18 # Written by Benjamin Schieder <blindcoder@scavenger.homeip.net>
20 # Modified by Juergen Sawinski <jsaw@gmx.net> to create
21 # a package based on freshmeat info.
23 # And Rene Rebe <rene@exactcode.de> to fix I/T sentences to begin with
24 # capitals as well as no trailing . in the I tag.
26 # newpackage.sh [-main] <rep>/<pkg> <freshmeat package name>
30 local tmp
="`tr -d "\012" < $2 | grep $3 |
31 sed -e "s|.
*<$3>\
([^
<]*\
)<.
*|\
1|
" -e 's|
|\n|g'`"
38 if curl
-s -I -f "$arg" -o "header.log"; then
39 location
="`sed -n 's/\r// ; s/Location: *//p' header.log`"
40 download_file
="`basename $location`"
41 download_url
="`dirname $location`/"
51 curl_options
="" #--disable-epsv -#
52 if curl
-s -f $resume $curl_options "http://freshmeat.net/projects-xml/$fmname/$fmname.xml" -o "$fmname.xml"; then
53 extract_xml_name project
$fmname.xml projectname_full
54 extract_xml_name title
$fmname.xml desc_short
55 extract_xml_name desc
$fmname.xml desc_full
56 extract_xml_name urlh
$fmname.xml url_homepage
57 extract_xml_name license
$fmname.xml license
58 extract_xml_name version
$fmname.xml latest_release_version
60 extract_xml_name url_tbz
$fmname.xml url_bz2
61 extract_xml_name url_tgz
$fmname.xml url_tgz
62 extract_xml_name url_zip
$fmname.xml url_zip
63 extract_xml_name url_cvs
$fmname.xml url_cvs
65 url
="$(curl -I $urlh 2>/dev/null | grep "^Location
:" | sed -e 's,^Location: \(.*\)$,\1,' | tr -d '\015' )"
66 get_download
$url_tbz $url_tgz $url_zip #@FIXME $url_cvs
68 # grep trove categories for status IDs
69 for trove_id
in `grep '<trove_id>' $fmname.xml | sed 's,.*<trove_id>\(.*\)</trove_id>,\1,g'` ; do
75 11,12) status
="Stable"
81 # download package fm-page and grep for the author
82 html
="http://freshmeat.net/projects/$fmname/"
83 curl
-I -s "$html" -o "header.log"
84 html_new
="`grep Location: header.log | sed 's,Location:[ ]\([.0-9A-Za-z:/%?_= -]*\).*,\1,'`"
85 [ ! -z "$html_new" ] && html
="$html_new"
88 curl
-s "$html" -o "$fmname.html"
89 dev_name
="`grep 'contact developer' "$fmname.html
" | sed 's,^[[:blank:]]*\(.*\)[[:blank:]]<a.*$,\1,' | sed 's, *$,,g'`"
90 dev_mail
="`grep 'contact developer' "$fmname.html
" | sed 's,^.*<a href=\"mailto:\(.*\)\">.*$,\1,'`"
92 dev_mail
=`echo $dev_mail |
93 sed -e 's/ *__at__ */@/g' -e 's/ *__dot__ */./g' -e 's/ *__dash__ */-/g' \
94 -e 's/ *|at| */@/g' -e 's/ *|dot| */./g' -e 's/ *|dash| */-/g' \
95 -e 's/ *\[at\] */@/g' -e 's/ *\[dot\] */./g' -e 's/ *\[dash\] */-/g' \
96 -e 's/ *\/at\/ */@/g' -e 's/ *\/dot\/ */./g' -e 's/ *\/dash\/ */-/g' \
97 -e 's/ *(at) */@/g' -e 's/ *(dot) */./g' -e 's/ *(dash) */-/g' \
98 -e 's/ \+at \+/@/g' -e 's/ \+dot \+/./g' -e 's/ \+dash \+/-/g' `
100 rm -f subst
$fmname.html dev_mail
102 [ "$dev_name" ] || dev_name
="TODO: Name"
103 if [ "$dev_mail" ]; then
104 dev_mail
="<$dev_mail>"
111 *GPL
*Library
*|
*Lesser
*GPL
*)
145 if [ "$1" == "-main" ] ; then
150 if [ $# -lt 2 -o $# -gt 2 ] ; then
153 $0 <option> package/repository/packagename freshmeat-package-name
155 Where <option> may be:
156 -main Create a package.conf file with main-function
163 dir
=${1#package/} ; shift
165 if [ "$package" = "$dir" ]; then
167 echo -e "\t$dir must be <rep>/<pkg>!\n"
171 rep
="$( echo package/*/$package | cut -d'/' -f 2 )"
172 if [ "$rep" != "*" ]; then
174 echo -e "\tpackage $package belongs to $rep!\n"
178 if [ -e package
/$dir ] ; then
180 echo -e "\tpackage/$dir already exists!\n"
183 rep
=${dir/\/$package/}
185 maintainer
='The T2 Project <t2@t2-project.org>'
190 if ! read_fm_config
$1; then
191 echo "Error or wrong freshmeat package name"
195 echo -n "Creating package/$dir ... "
196 if mkdir
-p package
/$dir ; then
205 echo -n "Creating $package.desc ... "
207 title
="`echo "$title" | sed 's/^\(.\)/\U\1/ ; s/\.$//'`"
208 cat >>$package.desc
<<EOF
209 [I] ${title:-TODO: Title}
213 desc
="`echo "$desc" | sed '1s/^\(.\)/\U\1/ ; s/\. *\(.\)/. \U\1/g'`"
215 echo "[T] $l" >>$package.desc
216 done < <(echo ${desc:-TODO: Description} |
fmt --width 75)
218 cat >>$package.desc
<<EOF
220 [U] ${url:-TODO: URL}
222 [A] $dev_name $dev_mail
223 [M] ${maintainer:-TODO: Maintainer}
227 [L] ${license:-TODO: License}
228 [S] ${status:-TODO: Status}
229 [V] ${version:-TODO: Version}
230 [P] X -----5---9 800.000
233 if [ "$download_file" ]; then
234 cat >>$package.desc
<<-EOF
236 [D] 0 $download_file $download_url
241 echo -n "Creating $package.conf ... "
243 if [ "$create_main" == "1" ] ; then
244 cat >>$package.conf
<<-EOF
249 custmain="${package}_main"
255 echo "Remember to fill in the TODO's:"
257 grep TODO package
/$dir/$package.
*