rpms/orbited/EL-5 import.log, NONE, 1.1 orbited-0.7.10-daemon.patch, NONE, 1.1 orbited-cfg.patch, NONE, 1.1 orbited-setup.patch, NONE, 1.1 orbited.init, NONE, 1.1 orbited.spec, NONE, 1.1 urlparse.py, NONE, 1.1 .cvsignore, 1.1, 1.2 sources, 1.1, 1.2
Luke Macken
lmacken at fedoraproject.org
Wed Jan 6 23:26:44 UTC 2010
Author: lmacken
Update of /cvs/pkgs/rpms/orbited/EL-5
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv19136/EL-5
Modified Files:
.cvsignore sources
Added Files:
import.log orbited-0.7.10-daemon.patch orbited-cfg.patch
orbited-setup.patch orbited.init orbited.spec urlparse.py
Log Message:
Initial commit of Orbited 0.7.10 for EL-5
--- NEW FILE import.log ---
orbited-0_7_10-3_fc11:EL-5:orbited-0.7.10-3.fc11.src.rpm:1262804770
orbited-0.7.10-daemon.patch:
start.py | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
--- NEW FILE orbited-0.7.10-daemon.patch ---
--- orbited/start.py.daemon 2009-06-16 22:24:38.000000000 -0400
+++ orbited/start.py 2009-10-07 11:23:01.112062529 -0400
@@ -81,6 +81,14 @@
default=False,
help="run Orbited on port 8000 and MorbidQ on port 61613"
)
+ parser.add_option(
+ "-d",
+ "--daemon",
+ dest="daemon",
+ action="store_true",
+ default=False,
+ help="run Orbited as a daemon"
+ )
(options, args) = parser.parse_args()
@@ -180,6 +188,15 @@
prof.runcall(reactor.run)
prof.close()
else:
+ if options.daemon:
+ try:
+ from daemon import DaemonContext
+ except ImportError:
+ print "Orbited in daemon mode requires python-daemon, which is not installed. Get it from: http://pypi.python.org/pypi/python-daemon/"
+ sys.exit(1)
+ daemon = DaemonContext()
+ daemon.open()
+
reactor.run()
def start_listening(site, config, logger):
orbited-cfg.patch:
orbited.cfg | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
--- NEW FILE orbited-cfg.patch ---
--- orbited.cfg.orig 2009-12-11 11:31:58.808184203 -0500
+++ orbited.cfg 2009-12-11 11:32:34.555066047 -0500
@@ -1,9 +1,9 @@
# Example Orbited Configuration file
[global]
-reactor=select
+# reactor=select
# reactor=kqueue
-# reactor=epoll
+reactor=epoll
session.ping_interval = 40
session.ping_timeout = 30
# once the sockets are open, orbited will drop its privileges to this user.
@@ -22,8 +22,8 @@
[static]
[access]
-localhost:8000 -> irc.freenode.net:6667
-* -> localhost:4747
+# localhost:8000 -> irc.freenode.net:6667
+# * -> localhost:4747
#* -> localhost:61613
[logging]
orbited-setup.patch:
setup.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- NEW FILE orbited-setup.patch ---
--- setup.py.orig 2010-01-05 17:40:31.607348046 -0500
+++ setup.py 2010-01-05 17:40:42.228195030 -0500
@@ -30,7 +30,7 @@
static_types ] or [] for (d, s, f) in os.walk(os.path.join('orbited', 'static'))
]) },
zip_safe = False,
- install_requires = [ "demjson", "morbid >= 0.8.7.1" ],
+ install_requires = [ "morbid >= 0.8.7.1" ],
entry_points = '''
[console_scripts]
orbited = orbited.start:main
--- NEW FILE orbited.init ---
#!/bin/bash
#
# orbited This init script runs the orbited daemon
#
# Author: Luke Macken <lmacken at redhat.com
#
# description: Enabled the orbited daemon
# processname: orbited
#
# source function library
. /etc/rc.d/init.d/functions
prog=orbited
lockfile=/var/lock/subsys/$prog
RETVAL=0
start() {
echo -n $"Starting Orbited: "
if [ -f $lockfile ]; then
echo Orbited already running
exit 2;
fi
touch $lockfile
daemon --check $prog orbited --daemon
RETVAL=$?
echo
}
stop() {
echo -n $"Stopping Orbited: "
killproc $prog
/bin/rm ${lockfile} 2> /dev/null && success || failure
RETVAL=$?
echo
}
restart() {
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|force-reload)
restart
;;
reload)
;;
condrestart)
[ -f "$lockfile" ] && restart
;;
status)
if [ -f $lockfile ]; then
echo $"Orbited is running."
RETVAL=0
else
echo $"Orbited is not running."
RETVAL=3
fi
;;
*)
echo $"Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart}"
exit 1
esac
exit $RETVAL
--- NEW FILE orbited.spec ---
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
Name: orbited
Summary: A browser(javascript)->tcp bridge
Version: 0.7.10
Release: 3%{?dist}
License: MIT and BSD
Group: System Environment/Daemons
URL: http://www.orbited.org/
Source0: http://pypi.python.org/packages/source/o/orbited/orbited-%{version}.tar.gz
Source1: urlparse.py
Source2: orbited.init
Patch0: %{name}-%{version}-daemon.patch
Patch1: %{name}-cfg.patch
Patch2: %{name}-setup.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
BuildRequires: python-setuptools, python-devel
Requires: python-twisted-web, python-morbid >= 0.8.6.1
Requires: python-setuptools, python-simplejson
Requires: python-daemon
Requires(pre): %{_sbindir}/useradd
Requires(pre): %{_sbindir}/groupadd
Requires(post): /sbin/chkconfig
Requires(preun): /sbin/chkconfig
Requires(preun): /sbin/service
Requires(postun): /sbin/service
%description
Orbited provides a pure JavaScript/HTML socket in the browser. It is a web
router and firewall that allows you to integrate web applications with
arbitrary back-end systems. You can implement any network protocol in the
browser—without resorting to plugins.
%prep
%setup -q
%patch0 -p0 -b .daemon
%patch1 -p0 -b .cfg
%patch2 -p0 -b .setup
%if 0%{?rhel} >= 5
%{__cp} %{SOURCE1} orbited/
%endif
%build
%{__python} setup.py build
%install
rm -rf %{buildroot}
%{__python} setup.py install --skip-build --root %{buildroot}
%{__mkdir} -p %{buildroot}/%{_initrddir}
%{__cp} %{SOURCE2} %{buildroot}/%{_initrddir}/orbited
%{__mkdir} -p %{buildroot}/%{_sysconfdir}
%{__cp} orbited.cfg %{buildroot}/%{_sysconfdir}/orbited.cfg
%clean
rm -rf %{buildroot}
%pre
%{_sbindir}/groupadd -r %{name} &>/dev/null || :
%{_sbindir}/useradd -r -s /sbin/nologin -d %{_datadir}/%{name} -M \
-c 'Orbited' -g %{name} %{name} &>/dev/null || :
%post
/sbin/chkconfig --add smolt
%preun
if [ $1 = 0 ]; then
/sbin/service smolt stop >/dev/null 2>&1
/sbin/chkconfig --del smolt
fi
%files
%defattr(-,root,root,-)
%{_bindir}/orbited
%{python_sitelib}/orbited/
%{python_sitelib}/orbited*.egg-info/
%{_initrddir}/%{name}
%config(noreplace) %{_sysconfdir}/%{name}.cfg
%changelog
* Tue Jan 05 2010 Luke Macken <lmacken at redhat.com> - 0.7.10-3
- Patch our setup.py to remove demjson from our requirements
- Add simplejson to our requires
- Require python-daemon
* Fri Nov 13 2009 Luke Macken <lmacken at redhat.com> - 0.7.10-2
- Add an init script
- Add the default configuration file
- Patch the default config to enable epoll and to disable access
- Remove python-demjson requirement
- Require python-setuptools
* Wed Oct 07 2009 Luke Macken <lmacken at redhat.com> - 0.7.10-1
- Update to 0.7.10
- Apply a patch to add a --daemon argument
* Sat Aug 08 2009 Luke Macken <lmacken at redhat.com> - 0.7.9-2
- Ship a working version of urlparse for Orbited on RHEL5
http://orbited.org/ticket/24
* Wed May 6 2009 Tom "spot" Callaway <tcallawa at redhat.com> - 0.7.9-1
- update to 0.7.9
* Sat Mar 15 2008 Tom "spot" Callaway <tcallawa at redhat.com> 0.3.2-1
- Initial package for Fedora
--- NEW FILE urlparse.py ---
"""Parse (absolute and relative) URLs.
See RFC 1808: "Relative Uniform Resource Locators", by R. Fielding,
UC Irvine, June 1995.
"""
__all__ = ["urlparse", "urlunparse", "urljoin", "urldefrag",
"urlsplit", "urlunsplit"]
# A classification of schemes ('' means apply by default)
uses_relative = ['ftp', 'http', 'gopher', 'nntp', 'imap',
'wais', 'file', 'https', 'shttp', 'mms',
'prospero', 'rtsp', 'rtspu', '', 'sftp']
uses_netloc = ['ftp', 'http', 'gopher', 'nntp', 'telnet',
'imap', 'wais', 'file', 'mms', 'https', 'shttp',
'snews', 'prospero', 'rtsp', 'rtspu', 'rsync', '',
'svn', 'svn+ssh', 'sftp']
non_hierarchical = ['gopher', 'hdl', 'mailto', 'news',
'telnet', 'wais', 'imap', 'snews', 'sip', 'sips']
uses_params = ['ftp', 'hdl', 'prospero', 'http', 'imap',
'https', 'shttp', 'rtsp', 'rtspu', 'sip', 'sips',
'mms', '', 'sftp']
uses_query = ['http', 'wais', 'imap', 'https', 'shttp', 'mms',
'gopher', 'rtsp', 'rtspu', 'sip', 'sips', '']
uses_fragment = ['ftp', 'hdl', 'http', 'gopher', 'news',
'nntp', 'wais', 'https', 'shttp', 'snews',
'file', 'prospero', '']
# Characters valid in scheme names
scheme_chars = ('abcdefghijklmnopqrstuvwxyz'
'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
'0123456789'
'+-.')
MAX_CACHE_SIZE = 20
_parse_cache = {}
def clear_cache():
"""Clear the parse cache."""
global _parse_cache
_parse_cache = {}
class BaseResult(tuple):
"""Base class for the parsed result objects.
This provides the attributes shared by the two derived result
objects as read-only properties. The derived classes are
responsible for checking the right number of arguments were
supplied to the constructor.
"""
__slots__ = ()
# Attributes that access the basic components of the URL:
@property
def scheme(self):
return self[0]
@property
def netloc(self):
return self[1]
@property
def path(self):
return self[2]
@property
def query(self):
return self[-2]
@property
def fragment(self):
return self[-1]
# Additional attributes that provide access to parsed-out portions
# of the netloc:
@property
def username(self):
netloc = self.netloc
if "@" in netloc:
userinfo = netloc.split("@", 1)[0]
if ":" in userinfo:
userinfo = userinfo.split(":", 1)[0]
return userinfo
return None
@property
def password(self):
netloc = self.netloc
if "@" in netloc:
userinfo = netloc.split("@", 1)[0]
if ":" in userinfo:
return userinfo.split(":", 1)[1]
return None
@property
def hostname(self):
netloc = self.netloc
if "@" in netloc:
netloc = netloc.split("@", 1)[1]
if ":" in netloc:
netloc = netloc.split(":", 1)[0]
return netloc.lower() or None
@property
def port(self):
netloc = self.netloc
if "@" in netloc:
netloc = netloc.split("@", 1)[1]
if ":" in netloc:
port = netloc.split(":", 1)[1]
return int(port, 10)
return None
class SplitResult(BaseResult):
__slots__ = ()
def __new__(cls, scheme, netloc, path, query, fragment):
return BaseResult.__new__(
cls, (scheme, netloc, path, query, fragment))
def geturl(self):
return urlunsplit(self)
class ParseResult(BaseResult):
__slots__ = ()
def __new__(cls, scheme, netloc, path, params, query, fragment):
return BaseResult.__new__(
cls, (scheme, netloc, path, params, query, fragment))
@property
def params(self):
return self[3]
def geturl(self):
return urlunparse(self)
def urlparse(url, scheme='', allow_fragments=True):
"""Parse a URL into 6 components:
<scheme>://<netloc>/<path>;<params>?<query>#<fragment>
Return a 6-tuple: (scheme, netloc, path, params, query, fragment).
Note that we don't break the components up in smaller bits
(e.g. netloc is a single string) and we don't expand % escapes."""
tuple = urlsplit(url, scheme, allow_fragments)
scheme, netloc, url, query, fragment = tuple
if scheme in uses_params and ';' in url:
url, params = _splitparams(url)
else:
params = ''
return ParseResult(scheme, netloc, url, params, query, fragment)
def _splitparams(url):
if '/' in url:
i = url.find(';', url.rfind('/'))
if i < 0:
return url, ''
else:
i = url.find(';')
return url[:i], url[i+1:]
def _splitnetloc(url, start=0):
delim = len(url) # position of end of domain part of url, default is end
for c in '/?#': # look for delimiters; the order is NOT important
wdelim = url.find(c, start) # find first of this delim
if wdelim >= 0: # if found
delim = min(delim, wdelim) # use earliest delim position
return url[start:delim], url[delim:] # return (domain, rest)
def urlsplit(url, scheme='', allow_fragments=True):
"""Parse a URL into 5 components:
<scheme>://<netloc>/<path>?<query>#<fragment>
Return a 5-tuple: (scheme, netloc, path, query, fragment).
Note that we don't break the components up in smaller bits
(e.g. netloc is a single string) and we don't expand % escapes."""
allow_fragments = bool(allow_fragments)
key = url, scheme, allow_fragments, type(url), type(scheme)
cached = _parse_cache.get(key, None)
if cached:
return cached
if len(_parse_cache) >= MAX_CACHE_SIZE: # avoid runaway growth
clear_cache()
netloc = query = fragment = ''
i = url.find(':')
if i > 0:
if url[:i] == 'http': # optimize the common case
scheme = url[:i].lower()
url = url[i+1:]
if url[:2] == '//':
netloc, url = _splitnetloc(url, 2)
if allow_fragments and '#' in url:
url, fragment = url.split('#', 1)
if '?' in url:
url, query = url.split('?', 1)
v = SplitResult(scheme, netloc, url, query, fragment)
_parse_cache[key] = v
return v
for c in url[:i]:
if c not in scheme_chars:
break
else:
scheme, url = url[:i].lower(), url[i+1:]
if scheme in uses_netloc and url[:2] == '//':
netloc, url = _splitnetloc(url, 2)
if allow_fragments and scheme in uses_fragment and '#' in url:
url, fragment = url.split('#', 1)
if scheme in uses_query and '?' in url:
url, query = url.split('?', 1)
v = SplitResult(scheme, netloc, url, query, fragment)
_parse_cache[key] = v
return v
def urlunparse((scheme, netloc, url, params, query, fragment)):
"""Put a parsed URL back together again. This may result in a
slightly different, but equivalent URL, if the URL that was parsed
originally had redundant delimiters, e.g. a ? with an empty query
(the draft states that these are equivalent)."""
if params:
url = "%s;%s" % (url, params)
return urlunsplit((scheme, netloc, url, query, fragment))
def urlunsplit((scheme, netloc, url, query, fragment)):
if netloc or (scheme and scheme in uses_netloc and url[:2] != '//'):
if url and url[:1] != '/': url = '/' + url
url = '//' + (netloc or '') + url
if scheme:
url = scheme + ':' + url
if query:
url = url + '?' + query
if fragment:
url = url + '#' + fragment
return url
def urljoin(base, url, allow_fragments=True):
"""Join a base URL and a possibly relative URL to form an absolute
interpretation of the latter."""
if not base:
return url
if not url:
return base
bscheme, bnetloc, bpath, bparams, bquery, bfragment = \
urlparse(base, '', allow_fragments)
scheme, netloc, path, params, query, fragment = \
urlparse(url, bscheme, allow_fragments)
if scheme != bscheme or scheme not in uses_relative:
return url
if scheme in uses_netloc:
if netloc:
return urlunparse((scheme, netloc, path,
params, query, fragment))
netloc = bnetloc
if path[:1] == '/':
return urlunparse((scheme, netloc, path,
params, query, fragment))
if not (path or params or query):
return urlunparse((scheme, netloc, bpath,
bparams, bquery, fragment))
segments = bpath.split('/')[:-1] + path.split('/')
# XXX The stuff below is bogus in various ways...
if segments[-1] == '.':
segments[-1] = ''
while '.' in segments:
segments.remove('.')
while 1:
i = 1
n = len(segments) - 1
while i < n:
if (segments[i] == '..'
and segments[i-1] not in ('', '..')):
del segments[i-1:i+1]
break
i = i+1
else:
break
if segments == ['', '..']:
segments[-1] = ''
elif len(segments) >= 2 and segments[-1] == '..':
segments[-2:] = ['']
return urlunparse((scheme, netloc, '/'.join(segments),
params, query, fragment))
def urldefrag(url):
"""Removes any existing fragment from URL.
Returns a tuple of the defragmented URL and the fragment. If
the URL contained no fragments, the second element is the
empty string.
"""
if '#' in url:
s, n, p, a, q, frag = urlparse(url)
defrag = urlunparse((s, n, p, a, q, ''))
return defrag, frag
else:
return url, ''
test_input = """
http://a/b/c/d
g:h = <URL:g:h>
http:g = <URL:http://a/b/c/g>
http: = <URL:http://a/b/c/d>
g = <URL:http://a/b/c/g>
./g = <URL:http://a/b/c/g>
g/ = <URL:http://a/b/c/g/>
/g = <URL:http://a/g>
//g = <URL:http://g>
?y = <URL:http://a/b/c/d?y>
g?y = <URL:http://a/b/c/g?y>
g?y/./x = <URL:http://a/b/c/g?y/./x>
. = <URL:http://a/b/c/>
./ = <URL:http://a/b/c/>
.. = <URL:http://a/b/>
../ = <URL:http://a/b/>
../g = <URL:http://a/b/g>
../.. = <URL:http://a/>
../../g = <URL:http://a/g>
../../../g = <URL:http://a/../g>
./../g = <URL:http://a/b/g>
./g/. = <URL:http://a/b/c/g/>
/./g = <URL:http://a/./g>
g/./h = <URL:http://a/b/c/g/h>
g/../h = <URL:http://a/b/c/h>
http:g = <URL:http://a/b/c/g>
http: = <URL:http://a/b/c/d>
http:?y = <URL:http://a/b/c/d?y>
http:g?y = <URL:http://a/b/c/g?y>
http:g?y/./x = <URL:http://a/b/c/g?y/./x>
"""
def test():
import sys
base = ''
if sys.argv[1:]:
fn = sys.argv[1]
if fn == '-':
fp = sys.stdin
else:
fp = open(fn)
else:
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
fp = StringIO(test_input)
while 1:
line = fp.readline()
if not line: break
words = line.split()
if not words:
continue
url = words[0]
parts = urlparse(url)
print '%-10s : %s' % (url, parts)
abs = urljoin(base, url)
if not base:
base = abs
wrapped = '<URL:%s>' % abs
print '%-10s = %s' % (url, wrapped)
if len(words) == 3 and words[1] == '=':
if wrapped != words[2]:
print 'EXPECTED', words[2], '!!!!!!!!!!'
if __name__ == '__main__':
test()
Index: .cvsignore
===================================================================
RCS file: /cvs/pkgs/rpms/orbited/EL-5/.cvsignore,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -r1.1 -r1.2
--- .cvsignore 6 Jan 2010 21:34:35 -0000 1.1
+++ .cvsignore 6 Jan 2010 23:26:43 -0000 1.2
@@ -0,0 +1 @@
+orbited-0.7.10.tar.gz
Index: sources
===================================================================
RCS file: /cvs/pkgs/rpms/orbited/EL-5/sources,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -r1.1 -r1.2
--- sources 6 Jan 2010 21:34:36 -0000 1.1
+++ sources 6 Jan 2010 23:26:43 -0000 1.2
@@ -0,0 +1 @@
+4f4e85d197466c141b1af466782445c1 orbited-0.7.10.tar.gz
More information about the fedora-extras-commits
mailing list