3 # --- T2-COPYRIGHT-NOTE-BEGIN ---
4 # T2 SDE: misc/archive/fmnewpackage.sh
5 # Copyright (C) 2004 - 2022 The T2 SDE Project
6 # Copyright (C) 1998 - 2003 ROCK Linux Project
8 # This Copyright note is generated by scripts/Create-CopyPatch,
9 # more information can be found in the files COPYING and README.
11 # This program is free software; you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License version 2.
13 # --- T2-COPYRIGHT-NOTE-END ---
15 # Written by Benjamin Schieder <blindcoder@scavenger.homeip.net>
17 # Modified by Juergen Sawinski <jsaw@gmx.net> to create
18 # a package based on freshmeat info.
20 # And Rene Rebe <rene@exactcode.de> to fix I/T sentences to begin with
21 # capitals as well as no trailing . in the I tag.
23 # newpackage.sh [-main] <rep>/<pkg> <freshmeat package name>
27 local tmp
="`tr -d "\012" < $2 | grep $3 |
28 sed -e "s|.
*<$3>\
([^
<]*\
)<.
*|\
1|
" -e 's|
|\n|g'`"
35 if curl
-s -I -f "$arg" -o "header.log"; then
36 location
="`sed -n 's/\r// ; s/Location: *//p' header.log`"
37 download_file
="`basename $location`"
38 download_url
="`dirname $location`/"
48 curl_options
="" #--disable-epsv -#
49 if curl
-s -f $resume $curl_options "http://freshmeat.net/projects-xml/$fmname/$fmname.xml" -o "$fmname.xml"; then
50 extract_xml_name project
$fmname.xml projectname_full
51 extract_xml_name title
$fmname.xml desc_short
52 extract_xml_name desc
$fmname.xml desc_full
53 extract_xml_name urlh
$fmname.xml url_homepage
54 extract_xml_name license
$fmname.xml license
55 extract_xml_name version
$fmname.xml latest_release_version
57 extract_xml_name url_tbz
$fmname.xml url_bz2
58 extract_xml_name url_tgz
$fmname.xml url_tgz
59 extract_xml_name url_zip
$fmname.xml url_zip
60 extract_xml_name url_cvs
$fmname.xml url_cvs
62 url
="$(curl -I $urlh 2>/dev/null | grep "^Location
:" | sed -e 's,^Location: \(.*\)$,\1,' | tr -d '\015' )"
63 get_download
$url_tbz $url_tgz $url_zip #@FIXME $url_cvs
65 # grep trove categories for status IDs
66 for trove_id
in `grep '<trove_id>' $fmname.xml | sed 's,.*<trove_id>\(.*\)</trove_id>,\1,g'` ; do
72 11,12) status
="Stable"
78 # download package fm-page and grep for the author
79 html
="http://freshmeat.net/projects/$fmname/"
80 curl
-I -s "$html" -o "header.log"
81 html_new
="`grep Location: header.log | sed 's,Location:[ ]\([.0-9A-Za-z:/%?_= -]*\).*,\1,'`"
82 [ ! -z "$html_new" ] && html
="$html_new"
85 curl
-s "$html" -o "$fmname.html"
86 dev_name
="`grep 'contact developer' "$fmname.html
" | sed 's,^[[:blank:]]*\(.*\)[[:blank:]]<a.*$,\1,' | sed 's, *$,,g'`"
87 dev_mail
="`grep 'contact developer' "$fmname.html
" | sed 's,^.*<a href=\"mailto:\(.*\)\">.*$,\1,'`"
89 dev_mail
=`echo $dev_mail |
90 sed -e 's/ *__at__ */@/g' -e 's/ *__dot__ */./g' -e 's/ *__dash__ */-/g' \
91 -e 's/ *|at| */@/g' -e 's/ *|dot| */./g' -e 's/ *|dash| */-/g' \
92 -e 's/ *\[at\] */@/g' -e 's/ *\[dot\] */./g' -e 's/ *\[dash\] */-/g' \
93 -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' `
97 rm -f subst
$fmname.html dev_mail
99 [ "$dev_name" ] || dev_name
="TODO: Name"
100 if [ "$dev_mail" ]; then
101 dev_mail
="<$dev_mail>"
108 *GPL
*Library
*|
*Lesser
*GPL
*)
142 if [ "$1" == "-main" ] ; then
147 if [ $# -lt 2 -o $# -gt 2 ] ; then
150 $0 <option> package/repository/packagename freshmeat-package-name
152 Where <option> may be:
153 -main Create a package.conf file with main-function
160 dir
=${1#package/} ; shift
162 if [ "$package" = "$dir" ]; then
164 echo -e "\t$dir must be <rep>/<pkg>!\n"
168 rep
="$( echo package/*/$package | cut -d'/' -f 2 )"
169 if [ "$rep" != "*" ]; then
171 echo -e "\tpackage $package belongs to $rep!\n"
175 if [ -e package
/$dir ] ; then
177 echo -e "\tpackage/$dir already exists!\n"
180 rep
=${dir/\/$package/}
182 maintainer
='The T2 Project <t2@t2-project.org>'
186 if ! read_fm_config
$1; then
187 echo "Error or wrong freshmeat package name"
191 echo -n "Creating package/$dir ... "
192 if mkdir
-p package
/$dir ; then
201 echo -n "Creating $package.desc ... "
203 title
="`echo "$title" | sed 's/^\(.\)/\U\1/ ; s/\.$//'`"
204 cat >>$package.desc
<<EOF
205 [I] ${title:-TODO: Title}
209 desc
="`echo "$desc" | sed '1s/^\(.\)/\U\1/ ; s/\. *\(.\)/. \U\1/g'`"
211 echo "[T] $l" >>$package.desc
212 done < <(echo ${desc:-TODO: Description} |
fmt --width 75)
214 cat >>$package.desc
<<EOF
216 [U] ${url:-TODO: URL}
218 [A] $dev_name $dev_mail
219 [M] ${maintainer:-TODO: Maintainer}
223 [L] ${license:-TODO: License}
224 [S] ${status:-TODO: Status}
225 [V] ${version:-TODO: Version}
226 [P] X -----5---9 800.000
229 if [ "$download_file" ]; then
230 cat >>$package.desc
<<-EOF
232 [D] 0 $download_file $download_url
237 echo -n "Creating $package.conf ... "
239 if [ "$create_main" == "1" ] ; then
240 cat >>$package.conf
<<-EOF
245 custmain="${package}_main"
251 echo "Remember to fill in the TODO's:"
253 grep TODO package
/$dir/$package.
*