Browse Source

sde pkg new now automatically updates cksum - ticket #252 closed

git-svn-id: svn://svn.opensde.net/opensde/opensde/trunk@21201 10447126-35f2-4685-b0cf-6dd780d3921f
misl/sde-wrapper
Oliver Winston 17 years ago
parent
commit
60c8f0e2e4
4 changed files with 240 additions and 8 deletions
  1. +10
    -4
      lib/sde-package/new-debian.py
  2. +223
    -1
      lib/sde-package/new-freshmeat.sh
  3. +1
    -2
      lib/sde-package/new.in
  4. +6
    -1
      lib/sde-package/new.sh

+ 10
- 4
lib/sde-package/new-debian.py

@ -15,6 +15,7 @@ cParse=cParseHTML()
parse=cParse.parse
repo=None
pkg=None
bdescd=False
parser = optparse.OptionParser(usage)
parser.add_option("-b", "--base", dest="base",
help="""Change base i.e from
@ -82,6 +83,7 @@ for link in soup("a"):
re.search('("|\').*("|\')',link).group())
descd+=" " + buf.split("/").pop()
descd+=" " + re.sub(buf.split("/").pop()+"$","",buf)
bdescd=True
try:
descv="[V] " + re.sub("^.|.$","",re.search("\(.*\)",
str(soup("h1"))).group())
@ -165,9 +167,6 @@ if options.outpkg:
sys.exit(1)
else:
os.mkdir(dir)
#outf=open(out,"w")
#outf.write(formatteddesc)
#outf.close()
elif optcnt==2:
repository="package/" + output[0]
if not os.path.isdir(repository):
@ -184,12 +183,19 @@ if options.outpkg:
os.mkdir(dir)
else:parser.error("Inavlid Option for --outpkg (-o)")
try:
os.system("echo -n 'Writing desc to file...'")
outf=open(out,"w")
outf.write(formatteddesc)
outf.close()
os.system("echo 'ok'")
except:
print"Error writing to file " + out
todo=""
if bdescd:
os.system("echo -n 'Patching cksum...'")
if os.popen("sde pkg up " + output[len(output)-1]+"&>/dev/null"):
os.system("echo 'ok'")
else:os.system("echo 'failed'")
todo=""
for line in formatteddesc.split("\n"):
if re.search("^\[.\] TODO:",line):todo+="\n" + line
if not todo == "":

+ 223
- 1
lib/sde-package/new-freshmeat.sh

@ -170,6 +170,220 @@ Where
fi
dir=${1#package/} ; shift
package=${dir##*/}
if [ "$package" = "$dir" ]; then
echo "failed"
echo -e "\t$dir must be <rep>/<pkg>!\n"
exit
fi
rep="$( echo package/*/$package | cut -d'/' -f 2 )"
if [ "$rep" != "*" ]; then
echo "failed"
echo -e "\tpackage $package belongs to $rep!\n"
exit
fi
rep=${dir/\/$package/}
maintainer='The OpenSDE Community <list@opensde.org>'
echo -n "Creating package/$dir ... "
if [ -e package/$dir ] ; then
echo "failed"
echo -e "\tpackage/$dir already exists!\n"
exit
fi
if mkdir -p package/$dir ; then
echo "ok"
else
echo "failed"
exit
fi
cd package/$dir
rc="ROCK-COPYRIGHT"
download_file=
download_url=
if ! read_fm_config $1; then
echo "Error or wrong freshmeat package name"
exit 1
fi
echo -n "Creating $package.desc ... "
cat > $package.desc <<EOF
[COPY] --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: lib/sde-package/new-freshmeat.sh
# Copyright (C) 2007 The OpenSDE Project
# Copyright (C) 2004 - 2006 The T2 SDE Project
# Copyright (C) 1998 - 2003 Clifford Wolf
# Copyright (C) 2007 The OpenSDE Project
#
# More information can be found in the files COPYING and README.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License. A copy of the
# GNU General Public License can be found in the file COPYING.
# --- SDE-COPYRIGHT-NOTE-END ---
#
# Written by Benjamin Schieder <blindcoder@scavenger.homeip.net>
#
# Modified by Juergen Sawinski <jsaw@gmx.net> to create
# a package based on freshmeat info.
#
# And Rene Rebe <rene@exactcode.de> to fix I/T sentences to begin with
# capitals as well as no trailing . in the I tag.
#
# newpackage.sh [-main] <rep>/<pkg> <freshmeat package name>
#
extract_xml_name() {
local tmp="`tr -d "\012" < $2 | grep $3 |
sed -e "s|.*<$3>\([^<]*\)<.*|\1|" -e 's| |\n|g'`"
eval "$1=\"\$tmp\""
}
get_download() {
local location
for arg; do
if curl -s -I -f "$arg" -o "header.log"; then
location="`sed -n 's/\r// ; s/Location: *//p' header.log`"
download_file="`basename $location`"
download_url="`dirname $location`/"
rm -f header.log
return
fi
done
rm -f header.log
}
read_fm_config() {
local fmname=$1
curl_options="" #--disable-epsv -#
if curl -s -f $resume $curl_options "http://freshmeat.net/projects-xml/$fmname/$fmname.xml" -o "$fmname.xml"; then
extract_xml_name project $fmname.xml projectname_full
extract_xml_name title $fmname.xml desc_short
extract_xml_name desc $fmname.xml desc_full
extract_xml_name urlh $fmname.xml url_homepage
extract_xml_name license $fmname.xml license
extract_xml_name version $fmname.xml latest_release_version
extract_xml_name url_tbz $fmname.xml url_bz2
extract_xml_name url_tgz $fmname.xml url_tgz
extract_xml_name url_zip $fmname.xml url_zip
extract_xml_name url_cvs $fmname.xml url_cvs
url="$(curl -I $urlh 2>/dev/null | grep "^Location:" | sed -e 's,^Location: \(.*\)$,\1,' | tr -d '\015' )"
get_download $url_tbz $url_tgz $url_zip #@FIXME $url_cvs
# grep trove categories for status IDs
for trove_id in `grep '<trove_id>' $fmname.xml | sed 's,.*<trove_id>\(.*\)</trove_id>,\1,g'` ; do
case $trove_id in
9) status="Alpha"
;;
10) status="Beta"
;;
11,12) status="Stable"
;;
# there is no default
esac
done
# download package fm-page and grep for the author
html="http://freshmeat.net/projects/$fmname/"
curl -I -s "$html" -o "header.log"
html_new="`grep Location: header.log | sed 's,Location:[ ]\([.0-9A-Za-z:/%?_= -]*\).*,\1,'`"
[ ! -z "$html_new" ] && html="$html_new"
unset html_new
rm -f header.log
curl -s "$html" -o "$fmname.html"
dev_name="`grep 'contact developer' "$fmname.html" | sed 's,^[[:blank:]]*\(.*\)[[:blank:]]<a.*$,\1,' | sed 's, *$,,g'`"
dev_mail="`grep 'contact developer' "$fmname.html" | sed 's,^.*<a href=\"mailto:\(.*\)\">.*$,\1,'`"
echo "__at__ @" >subst
echo "__dot__ ." >>subst
echo "|at| @" >>subst
echo "|dot| ." >>subst
echo "\\[at\\] @" >>subst
echo "\\[dot\\] ." >>subst
echo "(at) @" >>subst
echo "(dot) ." >>subst
echo -n "$dev_mail" >dev_mail
# for some strange reason, this doesn't work:
# cat subst | while read from to ; do
# export dev_mail="${dev_mail// $from /$to}"
# done
# dev_mail will have the same value as before
cat subst | while read from to ; do
dev_mail="`cat dev_mail`"
dev_mail="${dev_mail// $from /$to}"
echo -n "$dev_mail" >dev_mail
done
dev_mail="`cat dev_mail`"
rm -f subst $fmname.html dev_mail
if [ -z "$dev_name" ]; then
dev_name="TODO:"
dev_mail="Author"
elif [ -z "$dev_mail" ]; then
dev_name="TODO: $dev_name"
dev_mail="Mail Address"
else
dev_mail="<$dev_mail>"
fi
#cleanup license
case "$license" in
*GPL*Library*)
license=LGPL
;;
*GPL*Documentation*)
license=FDL
;;
*GPL*)
license=GPL
;;
*Mozilla*Public*)
license=MPL
;;
*MIT*)
license=MIT
;;
*BSD*)
license=BSD
;;
*Artistic*)
license=Artistic
;;
esac
rm -f $fmname.xml
else
return 1
fi
}
if [ "$1" == "-main" ] ; then
create_main=1
shift
fi
if [ $# -lt 2 -o $# -gt 2 ] ; then
cat <<-EEE
Usage:
$0 <option> package/repository/packagename freshmeat-package-name
Where <option> may be:
-main Create a package.conf file with main-function
EEE
exit 1
fi
dir=${1#package/} ; shift
package=${dir##*/}
if [ "$package" = "$dir" ]; then
@ -260,9 +474,17 @@ if [ "$download_file" ]; then
[D] 0 $download_file $download_url
EOF
echo "ok"
cd $SDEROOT
echo -n "Updating cksum... "
if ./bin/sde pkg up $package &> /dev/null;then
echo "ok"
else
echo "failed"
fi
cd package/$dir
fi
echo "ok"
echo -n "Creating $package.conf ... "
if [ "$create_main" == "1" ] ; then

+ 1
- 2
lib/sde-package/new.in

@ -11,7 +11,7 @@
# the Free Software Foundation; version 2 of the License. A copy of the
# GNU General Public License can be found in the file COPYING.
# --- SDE-COPYRIGHT-NOTE-END ---
#set -x
package_new() {
local method=
if [ "$1" = "-fm" ]; then
@ -21,7 +21,6 @@ package_new() {
shift
exec python ./lib/sde-package/new-debian.py "$@"
fi
# new package
new_package="$1"; shift
if [ "$new_package" != "${new_package//\//}" ]; then

+ 6
- 1
lib/sde-package/new.sh

@ -137,8 +137,13 @@ ${package}_main() {
custmain="${package}_main"
EEE
fi
echo "ok"
echo -n "Updating cksum... "
if ./bin/sde pkg up $package &> /dev/null;then
echo "ok"
else
echo "failed"
fi
echo "Remember to fill in the TODO's:"
grep TODO $confdir/$package.*
echo

Loading…
Cancel
Save