This patch adds a small script that will expose the built packages and the images to ease opkg and sysupgrade use during development. Compatible with Python2 and Python3.
--- scripts/package-server.py | 50 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100755 scripts/package-server.py diff --git a/scripts/package-server.py b/scripts/package-server.py new file mode 100755 index 0000000..3954781 --- /dev/null +++ b/scripts/package-server.py @@ -0,0 +1,50 @@ +#!/usr/bin/env python +from __future__ import print_function +import operator +import os +import sys + +try: + from SimpleHTTPServer import SimpleHTTPRequestHandler as Handler +except ImportError: + from http.server import SimpleHTTPRequestHandler as Handler +try: + from SocketServer import TCPServer +except ImportError: + from socketserver import TCPServer + +PORT = 80 + + +def find_last_modification_date(path): + time = 0 + for root, dirs, files in os.walk(path): + for path in files: + _, _, _, _, _, _, _, _, last_m, _ = os.stat( + os.path.join(root, path)) + time = time if time > last_m else last_m + return time + + +(dirpath, dirnames, _) = next(os.walk(os.path.join(os.path.dirname(__file__), + '../bin'))) + +m_times = {} + +for dir in dirnames: + path = os.path.join(dirpath, dir) + m_times[path] = find_last_modification_date(path) +dir, m_path = sorted(m_times.items(), key=operator.itemgetter(1), + reverse=True)[0] +dir = os.path.relpath(dir) +print('Selecting', dir, 'as working dir for', m_path, 'modification date.') +os.chdir(dir) + +try: + httpd = TCPServer(("", PORT), Handler) +except PermissionError: + + sys.stderr.write('Permission denied for listening in port %d\n' % PORT) + sys.exit(1) +print("HTTP server started at port", PORT) +httpd.serve_forever() -- 2.3.2 resending properly formatted patch _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel