aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xqst55
-rwxr-xr-xqst.sh34
2 files changed, 34 insertions, 55 deletions
diff --git a/qst b/qst
deleted file mode 100755
index 7715711..0000000
--- a/qst
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/usr/bin/python3
-
-import argparse
-import glob
-import logging
-import os
-import os.path
-import subprocess
-import sys
-import tempfile
-logging.basicConfig(format='%(levelname)s:%(funcName)s:%(message)s',
- level=logging.INFO)
-log = logging.getLogger('qs')
-
-res = None
-repocd = None
-apars = argparse.ArgumentParser()
-apars.add_argument('-M', '--multibuild',
- help='Build the specified multibuild package')
-apars.add_argument('-v', '--verbose', action='count',
- help="Print quilt's stdout.")
-ares, remainder = apars.parse_known_args()
-log.debug(f'remainder = "{remainder}", ({len(remainder)})')
-if remainder and remainder[-1]:
- spec_file_name = remainder[-1]
-else:
- spec_file_name = sorted(glob.glob('*.spec'), key=lambda file: len(file))[0]
-
-if not os.path.exists(spec_file_name):
- RuntimeError("File {} doesn't exist!".format(spec_file_name))
-
-with tempfile.NamedTemporaryFile(mode='w+', suffix='.spec',
- dir=os.curdir) as tmp_spec:
- orig_spec = open(spec_file_name, 'r')
- multi_step = ares.multibuild
- for line in orig_spec:
- if line.find('@BUILD_FLAVOR@') > -1:
- if multi_step:
- line = line.replace('@BUILD_FLAVOR@', multi_step)
- tmp_spec.write(line)
- tmp_spec.flush()
- res = subprocess.run(['quilt', 'setup', '-v'] + remainder[:-2] +
- [tmp_spec.name], text=True,
- stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
- for line in res.stdout.splitlines():
- log.debug('line = %s', line)
- if line.startswith('+ rm -rf '):
- repocd = line.split()[3]
- break
-if ares.verbose:
- print(res.stdout)
-log.debug('repocd = %s', repocd)
-if repocd:
- print(repocd)
-sys.exit(res.returncode)
diff --git a/qst.sh b/qst.sh
new file mode 100755
index 0000000..eadb6a4
--- /dev/null
+++ b/qst.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+set -uex
+
+SUBDIR=""
+PRIVATE=0
+
+VERBOSITY=0
+
+# apars.add_argument('-M', '--multibuild',
+# help='Build the specified multibuild package')
+# apars.add_argument('-v', '--verbose', action='count',
+# help="Print quilt's stdout.")
+while getopts ":M:v" opt; do
+ case $opt in
+ M)
+ BUILD="${OPTARG}"
+ ;;
+ v)
+ ((VERBOSITY++))
+ ;;
+ \?)
+ echo "Invalid option: -$OPTARG"
+ exit 1
+ ;;
+ :)
+ echo "Option -$OPTARG requires an argument."
+ exit 1
+ ;;
+ esac
+done
+
+shift $(($OPTIND - 1))
+REMAINDER=($@)
+echo "Length of the remainder is ${#REMAINDER}"