source: ipk/ipkg-utils-050831/ipkg-upload@ 17841

Last change on this file since 17841 was 4890, checked in by obi, 15 years ago

[ipk] fix executable rights

  • Property svn:executable set to *
File size: 1.9 KB
Line 
1#!/usr/bin/python
2
3import sys, os, os.path, re
4
5# User-configurable options
6
7url='http://handhelds.org/~familiar/cgi-bin/upload-package.cgi'
8feed='unstable'
9
10def error(*msgs):
11 for m in msgs:
12 sys.stderr.write(m)
13 sys.stderr.write('\n')
14 sys.exit(1)
15
16# The actual script
17
18if len(sys.argv) == 1:
19 error(("Usage: %s file.ipk [file2.ipk ...]\n" % sys.argv[0]) ,
20 ("Uploads packages to Familiar's %s feed at handhelds.org" % feed))
21
22if os.system('which curl >/dev/null 2>&1') != 0:
23 error("Sorry: %s requires curl which appears to not be available." % sys.argv[0])
24
25for pkg in sys.argv[1:]:
26 if not os.path.exists(pkg):
27 error("%s: No such file or directory")
28 if not os.path.exists(pkg + '.asc'):
29 os.system('gpg -sb --armor %s' % pkg)
30
31
32for pkg in sys.argv[1:]:
33 print "Uploading %s to %s feed" % (pkg, feed)
34 m = re.match('.*.batch', pkg)
35 dict = {'feed': feed, 'pkg': pkg, 'url': url}
36 if m:
37 dict['tarfile'] = ('/tmp/ipkg-upload.%d.tar' % os.getpid())
38 os.system('rm -rf %(tarfile)s' % dict)
39 os.system('tar cf %(tarfile)s `awk \'{ print $2 }\' < %(pkg)s`' % dict)
40 os.system('curl \
41 -F feedname=%(feed)s \
42 -F datafilename=@%(tarfile)s \
43 -F batchfilename=@%(pkg)s \
44 -F signaturefilename=@%(pkg)s.asc \
45 $url 2>&1 | tee %(pkg)s.upload.html | egrep "(Error|Warning):" | sed \'s:</*p>::g;s:</*b>::g\''
46 % dict)
47 os.system('rm -f %(tarfile)s' % dict)
48 os.system('grep -i signature %(pkg)s.upload.html' % dict)
49 else:
50 os.system('curl \
51 -F feedname=%(feed)s \
52 -F filename=@%(pkg)s \
53 -F signaturefilename=@%(pkg)s.asc \
54 -F sourcefilename="" \
55 %(url)s 2>&1 | tee %(pkg)s.upload.html | egrep "(Error|Warning):" | sed "s:</*p>::g;s:</*b>::g"'
56 % dict)
57 os.system('grep -i signature %(pkg)s.upload.html' % dict)
58 print ("Done. See complete results in %(pkg)s.upload.html" % dict)
59
60
Note: See TracBrowser for help on using the repository browser.