]> git.ipfire.org Git - people/ms/ipfire-3.x.git/blobdiff - make.sh
.gitignore: Ignore python bytecode files.
[people/ms/ipfire-3.x.git] / make.sh
diff --git a/make.sh b/make.sh
index a145af75c4ce27721444c5e39001c949e689a0f0..cddabc74d7f38adacc38690b0a2e15e14b92d43c 100755 (executable)
--- a/make.sh
+++ b/make.sh
@@ -1,98 +1,44 @@
-#!/bin/bash
-###############################################################################
-#                                                                             #
-# IPFire.org - A linux based firewall                                         #
-# Copyright (C) 2007, 2008, 2009 Michael Tremer & Christian Schmidt           #
-#                                                                             #
-# 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, either version 3 of the License, or           #
-# (at your option) any later version.                                         #
-#                                                                             #
-# This program is distributed in the hope that it will be useful,             #
-# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
-# GNU General Public License for more details.                                #
-#                                                                             #
-# You should have received a copy of the GNU General Public License           #
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
-#                                                                             #
-###############################################################################
-#
+#!/usr/bin/python
 
-BASEDIR=/ipfire-3.x
+import sys
+from optparse import OptionParser
 
-. ${BASEDIR}/tools/common-include
+import naoki
 
-while [ $# -gt 0 ]; do
-       case "${1}" in
-               --debug|-d)
-                       DEBUG=1
-                       log DEBUG "Debugging mode enabled by command line."
-                       ;;
-               --toolchain)
-                       TOOLCHAIN=1
-                       log DEBUG "Toolchain mode enabled by command line."
-                       ;;
-               *)
-                       action=${1}
-                       shift
-                       break
-                       ;;
-       esac
-       shift
-done
+op = OptionParser()
 
-export DEBUG TOOLCHAIN
+# verbosity
+op.add_option("-v", "--verbose", action="store_const", const=2,
+                               dest="verbose", default=1, help="verbose build")
+op.add_option("-q", "--quiet", action="store_const", const=0,
+                               dest="verbose", help="quiet build")
 
-function package() {
-       local action=${1}
-       shift
+# modes (basic commands)
+op.add_option("--download", action="store_const", const="download",
+                               dest="mode", help="download files")
+op.add_option("--build", "--rebuild", action="store_const",
+                               const="rebuild", dest="mode", default='rebuild',
+                               help="rebuild the specified packages")
+op.add_option("--info", action="store_const", const="info", dest="mode",
+                               help="return some info about the specified packages")
+op.add_option("--list-packages", action="store_const", const="list-packages",
+                               dest="mode", help="list all packages")
+op.add_option("--list-groups", action="store_const", const="list-groups",
+                               dest="mode", help="list all groups")
+op.add_option("--list-tree", action="store_const", const="list-tree",
+                               dest="mode", help="list the dependency tree")
 
-       case "${action}" in
-               dependencies|deps)
-                       echo -e "${BOLD}Build dependencies:${NORMAL} $(package_build_dependencies $@ | tr '\n' ' ')"
-                       echo -e "${BOLD}Dependencies:${NORMAL}       $(package_runtime_dependencies $@ | tr '\n' ' ')"
-                       ;;
-               find)
-                       find_package $@
-                       ;;
-               is_built)
-                       if package_is_built $(find_package $@); then
-                               echo "Package is built."
-                       else
-                               echo "Package is NOT built."
-                       fi
-                       ;;
-               list)
-                       package_list
-                       ;;
-               packages)
-                       package_packages $(find_package $@)
-                       ;;
-               profile|info)
-                       package_profile $(find_package $@)
-                       ;;
-               _info)
-                       package_info $(find_package $@)
-                       ;;
-       esac
-}
+n = naoki.Naoki(op)
+exitStatus = 0
 
-case "${action}" in
-       package|pkg)
-               package $@
-               ;;
-       toolchain)
-               TOOLCHAIN=1
-               ${NAOKI} --toolchain tree
-               ;;
-       toolchain_build)
-               for i in $($0 toolchain); do
-                       ${NAOKI} --toolchain toolchain ${i}
-               done
-               ;;
-       tree)
-               ${NAOKI} tree
-               ;;
-esac
+try:
+       n.action()
+
+except (SystemExit,):
+       raise
+
+except (KeyboardInterrupt,):
+       exitStatus = 7
+       n.log.error("Exiting on user interrupt, <CTRL>-C")
+
+sys.exit(exitStatus)