phytronFilterIpPortLog.pl: Fix match condition --> to head
Warning, cannot access the index:
_darcs/index: opening of '_darcs/index' failed: permission denied (Permission denied)
diff -rN -u old-bii_scripts/Makefile new-bii_scripts/Makefile
--- old-bii_scripts/Makefile 2022-11-28 21:49:27.534672803 +0100
+++ new-bii_scripts/Makefile 2022-11-28 21:49:27.542673000 +0100
@@ -310,6 +310,8 @@
# scripts with no embedded documentation
# create online help by executing "(script.sh -h 2>&1; true)
PLAINTXT_H_SH_SCRIPT_LIST= \
+ git-repo-merge.sh \
+ repo-hash.sh \
repo-mirror.sh
# scripts with no embedded documentation
@@ -705,6 +707,7 @@
echo "PYTHON2LIB_INSTALL_DIR=$(PYTHON2LIB_INSTALL_DIR)" >> $@
echo "PYTHON3LIB_INSTALL_DIR=$(PYTHON3LIB_INSTALL_DIR)" >> $@
echo "HTML_INSTALL_DIR=$(HTML_INSTALL_DIR)" >> $@
+ echo "IDDB_SOURCE=$(IDDB_SOURCE)" >> $@
$(SCRIPT_BUILD_DIR)/%: $(SCRIPT_SRC_DIR)/% | $(SCRIPT_BUILD_DIR)
cp $< $(@D)
diff -rN -u old-bii_scripts/README new-bii_scripts/README
--- old-bii_scripts/README 2022-11-28 21:49:27.534672803 +0100
+++ new-bii_scripts/README 2022-11-28 21:49:27.542673000 +0100
@@ -21,13 +21,11 @@
INSTALL_PREFIX=[DIR] make -sj install
-Call for an installation at BESSY development hosts::
+Call for an installation at BESSY development hosts or the bessy control
+system fileserver (HOST is the full qualified hostname e.g.
+'stretch.acc.bessy.de')::
- BII_CONFIG=config.acc make -sj install
-
-Call for an installation at BESSY controlsystem hosts::
-
- BII_CONFIG=config.ctl make -sj install
+ BII_CONFIG=config.HOST.acc make -sj install
Installation with install.sh
----------------------------
diff -rN -u old-bii_scripts/bin/browsedb.pl new-bii_scripts/bin/browsedb.pl
--- old-bii_scripts/bin/browsedb.pl 2022-11-28 21:49:27.538672901 +0100
+++ new-bii_scripts/bin/browsedb.pl 2022-11-28 21:49:27.546673098 +0100
@@ -7354,15 +7354,18 @@
}
open(my $fh, '<:encoding(UTF-8)', $filename)
or die "Could not open file '$filename' $!";
- my $TOP= dirname("$FindBin::RealBin");
while (my $line = <$fh>)
{
chomp $line;
+ if ($Line=~/^\s*#/)
+ { next; }
if ($line!~/([^=]+)=(.*)/)
{ next; }
my $name= $1;
my $val= $2;
- $val=~ s/\$TOP\b/$TOP/g;
+ # recipe for environment replacement from:
+ # https://unix.stackexchange.com/questions/294835/replace-environment-variables-in-a-file-with-their-actual-values
+ $val=~ s{\$(\{)?(\w+)(?(1)\})}{$ENV{$2} // $&}ge;
$bii_config{$name}= $val;
}
close $fh;
diff -rN -u old-bii_scripts/bin/camonitor_sort.pl new-bii_scripts/bin/camonitor_sort.pl
--- old-bii_scripts/bin/camonitor_sort.pl 2022-11-28 21:49:27.538672901 +0100
+++ new-bii_scripts/bin/camonitor_sort.pl 2022-11-28 21:49:27.546673098 +0100
@@ -94,14 +94,28 @@
sub mk_regexp
{ my($funcname,$regexp)= @_;
+ my $invert= 0;
return if (!defined $regexp);
+ if ($regexp =~ /^!(.*)/)
+ {
+ $regexp= $1;
+ $invert= 1;
+ }
+
if ($regexp !~ /^\//)
{ $regexp= '/' . $regexp . '/'; };
#die "eval:\"sub n_regexp { return(\$_[0]=~ $regexp); }\"";
- eval("sub $funcname { return(\$_[0]=~ $regexp); }");
+ if (!$invert)
+ {
+ eval("sub $funcname { return(\$_[0]=~ $regexp); }");
+ }
+ else
+ {
+ eval("sub $funcname { return(\$_[0]!~ $regexp); }");
+ }
if ($@)
{ die "error: eval() failed, error-message:\n" . $@ . " " };
}
@@ -214,6 +228,9 @@
Syntax:
$sc_name {options}
+ Note: every regexp that starts with '!' is a "do not match" regexp. In this
+ case theresults are the ones that DO NOT match.
+
options:
-h: help
--summary: give a summary of the script
diff -rN -u old-bii_scripts/bin/console-get new-bii_scripts/bin/console-get
--- old-bii_scripts/bin/console-get 2022-11-28 21:49:27.538672901 +0100
+++ new-bii_scripts/bin/console-get 2022-11-28 21:49:27.546673098 +0100
@@ -38,27 +38,27 @@
# version of the program:
my_version= "1.1"
-CONSERVER_URL= "http://conserver.acc.bessy.de/conserver/"
+CONSERVER_URL= "https://conserver.trs.bessy.de/"
areas= { \
"blc" : { "description": "(also via ssh)",
"directory" : "blc",
- "ssh" : "conservr@conserver.acc.bessy.de:/var/log/conserver/blc/",
+ "ssh" : "iocadm@conserver.acc.bessy.de:/var/log/conserver/blc/",
},
"id" : { "description": "insertion devices (also via ssh)",
"directory" : "id",
- "ssh" : "conservr@conserver.acc.bessy.de:/var/log/conserver/id/",
+ "ssh" : "iocadm@conserver.acc.bessy.de:/var/log/conserver/id/",
},
"il" : { "directory" : "il" },
"mono" : { "description": "monochromators (also via ssh)",
"directory" : "mono",
- "ssh" : "conservr@conserver.acc.bessy.de:/var/log/conserver/mono/",
+ "ssh" : "iocadm@conserver.acc.bessy.de:/var/log/conserver/mono/",
},
"net" : { "directory" : "net" },
"psd" : { "directory" : "psd" },
"tsc" : { "description": "control system (also via ssh)",
"directory" : "tsc",
- "ssh" : "conservr@conserver.acc.bessy.de:/var/log/conserver/tsc/",
+ "ssh" : "iocadm@conserver.acc.bessy.de:/var/log/conserver/tsc/",
},
"tsc-mls" :{ "description": "mls control system (also via ssh)",
"directory" : "conserver-mls/tsc",
@@ -129,7 +129,8 @@
if not ssh_opt:
# @@@@ subprocess.run doesn't exist on older python (elbe) !!!
for p in glob_patterns:
- syscall(["wget", "--quiet", "-r", "-l1", "--no-parent", "-nd",
+ syscall(["wget", "--no-check-certificate", "--quiet", "-r",
+ "-l1", "--no-parent", "-nd",
CONSERVER_URL + areas[area]["directory"],
"-A", p],
verbose, dry_run)
@@ -217,7 +218,8 @@
else:
mask= glob2rx(pattern) + r"\.log "
syscall(["bash", "-c",
- (r"wget %s -O - --quiet | sed -e 's/<[^>]*>/ /g' | "
+ (r"wget %s -O --no-check-certificate - --quiet | "
+ r"sed -e 's/<[^>]*>/ /g' | "
r"grep '%s' | "
r"sed -e 's/^ *\([^ ]\+\).*/\1/' | sort") % \
(CONSERVER_URL + areas[area]["directory"], mask)],
@@ -246,7 +248,7 @@
extra= "grep "+glob2rx(pattern)+" |"
# pylint: disable=line-too-long
syscall(["bash", "-c",
- (r"wget %s -O - --quiet | "
+ (r"wget %s -O --no-check-certificate - --quiet | "
r"sed -e 's/<[^>]*>/ /g;s/^ *\([^ ]\+\) \+\([^ ]\+\) \+\([^ ]\+\).*/\1 \2 \3/g' | "
r"grep : | %s"
r"column -t" ) % \
@@ -275,16 +277,16 @@
sys.exit("error: unknown area %s. Run '%s -h' for help" % \
(repr(area),script_shortname()))
if options.list:
- list_files(area, pattern, options.ssh,
+ list_files(area, pattern, not options.http,
options.verbose, options.dry_run)
elif options.list_all:
- list_all_files(area, pattern, options.ssh,
+ list_all_files(area, pattern, not options.http,
options.verbose, options.dry_run)
else:
if len(args)>2:
sys.stderr.write("warning: extra arguments ignored: %s" % \
repr(args[2:]))
- get_log_files(area, pattern, options.ssh, options.force,
+ get_log_files(area, pattern, not options.http, options.force,
options.verbose, options.dry_run, options.restrict)
def script_shortname():
@@ -340,10 +342,9 @@
"the output by providing a PATTERN. With --ssh "
"this also displays the file sizes."
)
- parser.add_option("--ssh",
+ parser.add_option("--http",
action="store_true",
- help="Use ssh instead of http. Not available "
- "for all areas.",
+ help="Use http instead of ssh.",
)
parser.add_option("--force",
action="store_true",
diff -rN -u old-bii_scripts/bin/fix-edl-no-alarm-color.py new-bii_scripts/bin/fix-edl-no-alarm-color.py
--- old-bii_scripts/bin/fix-edl-no-alarm-color.py 1970-01-01 01:00:00.000000000 +0100
+++ new-bii_scripts/bin/fix-edl-no-alarm-color.py 2022-11-28 21:49:27.546673098 +0100
@@ -0,0 +1,160 @@
+#!/usr/bin/env python3
+
+# simple script to properly set NO_ALARM-color in HZB-created edl files,
+# since aarm-rule in edm-colors-file needs to be replaced by default rule soon.
+#
+# 1. reads all elements into a list of ordered dictionaries
+# 2. sets xyzColor to index 64 in all objects where xyzAlarm is set
+# 3. writes all objects to file/stdout
+
+from collections import OrderedDict
+import sys
+
+
+class Failure:
+ def __init__(self, message):
+ print(message, file=sys.stderr)
+
+
+class Edl:
+ def __init__(self, fname=0, inplace=False):
+ self.fail = None
+ # set output file
+ self.fname = fname if inplace else 1
+
+ if type(fname) == 'str' and not fname.endswith('.edl'):
+ self.fail = Failure("filename does not end with .edl: " + fname)
+ return
+
+ with open(fname, "r", encoding="latin-1") as fin:
+ self.read_objects(fin)
+
+ # currently hard-coded no-alarm-colors
+ self.NO_ALARM_color_rgb = "rgb 0 49344 0"
+ self.NO_ALARM_color = "index 67"
+
+ def read_objects(self, fin):
+ lines = fin.readlines()
+ # a simple check first line, wheter it actually could be an edl file
+ try:
+ while len(lines[0].rstrip("\n")) == 0:
+ lines = lines[1:]
+ version = lines[0]
+ (major, minor, sub) = [int(part) for part in version.split(" ")]
+ if major != 4 or not "%d %d %s" % (major, minor,
+ sub) == version.rstrip('\n'):
+ raise Exception()
+ except Exception:
+ self.fail = Failure("file seems not to be an edl file: " +
+ str(self.fname))
+
+ self.element_dict = None
+ self.list_of_elements = []
+ in_contd_block = False
+ block = []
+
+ for line in lines:
+ line = line.rstrip('\n')
+ if len(line) == 0:
+ if self.element_dict is not None:
+ self.list_of_elements.append(self.element_dict)
+ self.element_dict = None
+ else:
+ if self.element_dict is None:
+ self.element_dict = OrderedDict()
+
+ sline = line.split(" ", 1)
+ if sline[0] == "#":
+ sline = [line]
+
+ if in_contd_block:
+ # store a block of {}-enclosed data as a list of lines
+ block.append(line)
+ if line == "}":
+ self.element_dict[key] = "\n".join(block)
+ block = []
+ in_contd_block = False
+ else:
+ key = sline[0]
+
+ if len(sline) > 1:
+ # yes...
+ # Color entries are not consistently named
+ # across widget types
+ if ( key.endswith("Color") or
+ key.endswith("Colour") ) and \
+ sline[1].startswith("rgb"):
+ self.NO_ALARM_color = self.NO_ALARM_color_rgb
+
+ if sline[1].endswith('{'):
+ # store a block of {}-enclosed data as a list of lines
+ block.append(sline[1])
+ in_contd_block = True
+ else:
+ self.element_dict[key] = sline[1]
+ else:
+ self.element_dict[key] = None
+ return self
+
+ def dump(self):
+ if not self.fail:
+ # just dash out the stored data
+ outfile = open(self.fname, 'w', encoding='latin-1')
+ for element_dict in self.list_of_elements:
+ for key in element_dict:
+ if element_dict[key] is None:
+ print(key, file=outfile)
+ else:
+ print(key + " " + element_dict[key], file=outfile)
+ if len(element_dict) > 0:
+ print(file=outfile)
+ outfile.close()
+
+ def fix_color(self):
+ if not self.fail:
+ for element_dict in self.list_of_elements:
+ for pfx in ("fg", "bg", "line", "fill", "control", "case",
+ "indicator"):
+ if pfx + "Alarm" in element_dict:
+ for clr in ["Color", "Colour"]:
+ if pfx + clr in element_dict:
+ element_dict[pfx + clr] = self.NO_ALARM_color
+ return self
+
+
+def main(args):
+ IN_PLACE = True
+ PIPE = False
+
+ if len(args) == 0:
+ args.append(0)
+
+ # args is now >= 1
+ elif len(args) > 1 and args[0] != "-i":
+ print(
+ "editing multiple files in place requires first argument to be '-i'",
+ file=sys.stderr)
+ exit(1)
+
+ mode = IN_PLACE if len(args) > 1 else PIPE
+
+ if args[0] == "-i":
+ args = args[1:]
+
+ for fname in args:
+ Edl(fname, mode).fix_color().dump()
+
+
+if __name__ == '__main__':
+ main(sys.argv[1:])
+
+# scenarios
+#
+# 1. ... | fix.py | ... OR fix.py <ifile >ofile # pipe mode
+# len(args) == 0
+# 2. fix.py file # output to stdout
+# len(args) = 1 and arg[0] ~ "*.edl"
+# 3. fix.py -i file1 ... # modify files in place
+# len(args) > 1 and arg[0] == "-i"
+# else:
+# Error
diff -rN -u old-bii_scripts/bin/git-repo-merge.sh new-bii_scripts/bin/git-repo-merge.sh
--- old-bii_scripts/bin/git-repo-merge.sh 1970-01-01 01:00:00.000000000 +0100
+++ new-bii_scripts/bin/git-repo-merge.sh 2022-11-28 21:49:27.546673098 +0100
@@ -0,0 +1,83 @@
+#!/bin/bash
+
+# Copyright 2022 Helmholtz-Zentrum Berlin für Materialien und Energie GmbH
+# <https://www.helmholtz-berlin.de>
+#
+# Author: Goetz Pfeiffer <Goetz.Pfeiffer@helmholtz-berlin.de>
+#
+# 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.
+
+SCRIPT_FULL_NAME=$(readlink -e $0)
+MYDIR=$(dirname $SCRIPT_FULL_NAME)
+MYNAME=$(basename $SCRIPT_FULL_NAME)
+
+if [ "$1" == "-h" -o "$1" == "--help" -o -z "$1" ]; then
+ echo "Usage: $MYNAME MYREPO OTHERREPO BRANCHNAME"
+ echo
+ echo "Puts all commits from OTHERREPO that are not part of MYREPO"
+ echo "into MYREPO at a new branch BRANCHNAME"
+ echo
+ echo "Note: MYREPO *must be* a working tree repository, not a bare repository."
+ exit 1
+fi
+
+MYREPO="$1"
+OTHERREPO="$2"
+BRANCHNAME="$3"
+if [ -z "$BRANCHNAME" ]; then
+ echo "error, too few parameters"
+fi
+
+if [ ! -d "$MYREPO" ]; then
+ echo "error, $MYREPO doesn't exist"
+fi
+if [ ! -d "$OTHERREPO" ]; then
+ echo "error, $OTHERREPO doesn't exist"
+fi
+
+OTHERREPO=$(readlink -e $OTHERREPO)
+
+# get the last common commit hash of the two repos:
+COMMIT=$(comm --nocheck-order -12 <(git -C "$MYREPO" log --reverse --pretty=format:"%H") <(git -C "$OTHERREPO" log --reverse --pretty=format:"%H") | tail -n 1)
+
+if [ -z "$COMMIT" ]; then
+ echo "ERROR, $MYREPO and $OTHERREPO have no common commits" >&2
+ exit 1
+fi
+
+cd $MYREPO
+# go to last common commit:
+git checkout $COMMIT
+
+# add OTHERREPO under name "other":
+git remote add other $OTHERREPO
+
+# create branch BRANCHNAME:
+git checkout -b $BRANCHNAME
+
+# fetch all commits from OTHERREPO:
+git fetch other
+
+# now set branch BRANCHNAME to track branch "master" from OTHERREPO:
+git branch --set-upstream-to=other/master $BRANCHNAME
+
+# pull all commits to new branch BRANCHNAME:
+git pull
+
+# remove entry "other", this is no longer needed:
+git remote remove other
+
+# go back to "master":
+git checkout master
+
+# garbage collection:
+git gc
+
diff -rN -u old-bii_scripts/bin/iddb new-bii_scripts/bin/iddb
--- old-bii_scripts/bin/iddb 2022-11-28 21:49:27.538672901 +0100
+++ new-bii_scripts/bin/iddb 2022-11-28 21:49:27.546673098 +0100
@@ -10,20 +10,23 @@
# 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/>.
+# pylint: disable= too-many-lines, consider-using-f-string
+
import sys
import os
import argparse
import re
import pydoc
+import configparser
import socket
import http
@@ -41,14 +44,20 @@
_pyver= (sys.version_info[0], sys.version_info[1])
-if _pyver <= (3,2):
+if _pyver <= (3,4):
HTTPEXCEPTION= http.client.HTTPException
else:
HTTPEXCEPTION= http.client.RemoteDisconnected
DBNAME="id_db"
-HOST="gwc2c.acc.bessy.de"
-PORT=7643
+
+# environment variable IDDB_SOURCE:
+# server:gwc1c.acc.bessy.de:7643
+# file:/opt/OPI/idcp/id_db.SDCyml
+ENV_VAR_NAME="IDDB_SOURCE"
+
+#HOST="gwc1c.acc.bessy.de"
+#PORT=7643
TIMEOUT=5.0 # timeout for XMLRPC
@@ -61,6 +70,175 @@
COLUMNS_STR= " ".join(sorted(COLUMNS))
# -----------------------------------------------
+# read configuration file
+
+BII_SCRIPTS_CONFIG= os.path.join(os.path.dirname(os.path.abspath(__file__)),
+ "bii_scripts.config")
+
+CONFIG_FILE= "iddb.config"
+
+rx_def=re.compile(r'([^=]+)=(.*)')
+rx_comment=re.compile(r'^\s*#')
+
+def read_config(filename):
+ """read config file."""
+ if not os.path.exists(filename):
+ raise IOError("Error, file %s not found" % filename)
+ result= {}
+ with open(filename) as fp: # pylint: disable= unspecified-encoding
+ for line in fp:
+ line= line.strip()
+ if rx_comment.match(line):
+ continue
+ m= rx_def.match(line)
+ if not m:
+ continue
+ name= m.group(1)
+ val= m.group(2).strip()
+ val= os.path.expandvars(val)
+ result[name]= val
+ return result
+
+def read_biiscripts_config():
+ """read bii_scripts.config."""
+ if not os.path.exists(BII_SCRIPTS_CONFIG):
+ sys.stderr.write("Warning: File %s not found\n" % BII_SCRIPTS_CONFIG)
+ return {}
+ return read_config(BII_SCRIPTS_CONFIG)
+
+def get_share_dir():
+ """get SHARE_INSTALL_DIR."""
+ d= read_biiscripts_config()
+ if not d:
+ return None
+ return d["SHARE_INSTALL_DIR"]
+
+# -----------------------------------------------
+# read iddb config file
+
+def iddb_config():
+ """read iddb configuration."""
+ share_dir= get_share_dir()
+ if not share_dir:
+ return None
+ filename= os.path.join(share_dir, "bii_scripts", CONFIG_FILE)
+ if not os.path.exists(filename):
+ sys.stderr.write("Warning: File '%s' not found\n" % filename)
+ return None
+ config = configparser.ConfigParser()
+ config.read(filename)
+ return config
+
+# -----------------------------------------------
+# find sourcespec from hostname
+
+def sourcespec_by_hostname():
+ """get sourcespec by current hostname."""
+ def cget(config,section,key):
+ """read something from configuration data."""
+ if key not in config[section]:
+ return None
+ v= config[section][key].strip()
+ if not v:
+ return None
+ return v
+ # get configuration data from SHARE_INSTALL_DIR/bii_scripts/iddb.config:
+ config_data= iddb_config()
+ if not config_data:
+ return None
+ # get full qualified hostname:
+ fullhostname= socket.getfqdn()
+ # try to find it in the "HOSTS" section of the configuration:
+ if "HOSTS" in config_data:
+ spec= cget(config_data, "HOSTS", fullhostname)
+ if spec:
+ return spec
+ # examine the domain:
+ if "DOMAINS" in config_data:
+ domain= fullhostname
+ while "." in domain:
+ domain= domain.split(".", 1)[1]
+ spec= cget(config_data, "DOMAINS", domain)
+ if spec:
+ return spec
+ # finally examine if there is a default "*" in HOSTS section:
+ if "HOSTS" in config_data:
+ spec= cget(config_data, "HOSTS", "*")
+ if spec:
+ return spec
+ return None
+
+# -----------------------------------------------
+# parse server specification
+
+def parse_server(spec):
+ """parse a server-spec.
+
+ returns:
+ (host, port) # port: an integer
+ raises ValueError on error.
+ """
+ errmsg= "%s has not the form 'HOST:PORT'" % spec
+ l= spec.split(":")
+ if not l:
+ raise ValueError(errmsg)
+ if len(l)!=2:
+ raise ValueError(errmsg)
+ try:
+ l[1]= int(l[1])
+ except ValueError as e:
+ raise ValueError(errmsg) from e
+ return l
+
+def parse_spec(spec):
+ """parse source spec.
+
+ spec: source specification, one of:
+ server:HOST:PORT
+ file:FILENAME
+
+ returns one of:
+ { "host": HOST, "port": PORT}
+ { "filename": FILENAME}
+
+ or raises a ValueError exception
+ """
+ l= spec.split(":", 1)
+ while True:
+ if not l:
+ break
+ if l[0] == "server":
+ try:
+ (host, port)= parse_server(l[1])
+ return {"host": host, "port": port }
+ except ValueError:
+ break
+ if l[0] == "file":
+ if len(l)==2:
+ return { "filename": l[1] }
+ break
+ break
+ raise ValueError("Error, cannot parse source spec '%s'" % spec)
+
+def parse_env():
+ """parse environment variable IDDB_SOURCE.
+
+ returns one of:
+ { "host": HOST, "port": PORT}
+ { "filename": FILENAME}
+ None
+ """
+ var= os.environ.get(ENV_VAR_NAME)
+ if var is None:
+ return None
+ try:
+ return parse_spec(var)
+ except ValueError as e:
+ st= str(e).replace("Error", "Warning")
+ sys.stderr.write(st)
+ return None
+
+# -----------------------------------------------
# Database access by file loading and StructuredData libraries
class DbFile:
@@ -89,6 +267,9 @@
def db_txt_find(self,pattern,paths=""):
"""execute StructuredData "txt.find" command."""
return self.txt.find(pattern,"aligned",paths,self.SDC)
+ def db_txt_rxfind(self,pattern,paths=""):
+ """execute StructuredData "txt.rxfind" command."""
+ return self.txt.rxfind(pattern,"aligned",paths,self.SDC)
def db_paths(self,pattern,paths=""):
"""execute StructuredData "paths" command."""
return self.fun.paths(pattern,paths,self.SDC)
@@ -127,6 +308,13 @@
except (http.client.RemoteDisconnected,
socket.gaierror, socket.timeout) as e:
sys.exit(self.errmsg(str(e)))
+ def db_txt_rxfind(self,pattern,paths=""):
+ """execute StructuredData "txt.rxfind" command."""
+ try:
+ return self.XML_OBJ.txt.rxfind(pattern,"aligned",paths,DBNAME)
+ except (http.client.RemoteDisconnected,
+ socket.gaierror, socket.timeout) as e:
+ sys.exit(self.errmsg(str(e)))
def db_paths(self,pattern,paths=""):
"""execute StructuredData "paths" command."""
try:
@@ -144,7 +332,7 @@
except xmlrpc.client.Fault as e:
if "cannot marshal None" in str(e):
# XMLRPC returned None
- # Note: Using "allow_none= True" in
+ # Note: Using "allow_none= True" in
# xmlrpc.client.ServerProxy(self.URL) doesn't seem to avoid
# raising the xmlrpc.client.Fault exception, so we have to
# handle this in a bit more complicated way.
@@ -538,6 +726,7 @@
raise AssertionError("internal error")
# calc sort keys:
+ # pylint: disable=consider-using-dict-items
for k in result:
sk= result[k][sort_column]
if sk==0:
@@ -599,6 +788,23 @@
#print("\n".join(db_txt_find(pattern, paths)))
#console_print_table(t, heading=None)
+def cmd_rxfind(db_obj, dbquery, args, rest):
+ """perform "rxfind" command."""
+ if not rest:
+ pattern=".*"
+ else:
+ pattern= rest[0]
+ paths=""
+ if len(rest)>1:
+ paths= rest[1:]
+ if args.id:
+ id_key= dbquery.find_sd_key(args.id)
+ pattern= r"id-data\.%s\.%s" % (id_key, pattern)
+
+ print(db_obj.db_txt_rxfind(pattern, paths))
+ #print("\n".join(db_txt_rxfind(pattern, paths)))
+ #console_print_table(t, heading=None)
+
def cmd_get(db_obj, dbquery, args, rest):
"""perform "find" command."""
if not rest:
@@ -626,7 +832,7 @@
#print("rest:",rest)
# pylint: disable= global-statement, too-many-return-statements
# pylint: disable= too-many-branches, too-many-statements
- global HOST, PORT
+ # pylint: disable= too-many-locals
if args.summary:
print_summary()
sys.exit(0)
@@ -635,23 +841,50 @@
pydoc.pager(helptext)
sys.exit(0)
- dbobj= None
+ source_spec= None
+
if args.file:
- dbobj= DbFile(args.file)
- else:
- if args.server:
- errmsg= "%s has not the form 'HOST:PORT'" % args.server
- if not ":" in args.server:
- sys.exit(errmsg)
- l= args.server.split(":")
- if len(l)!=2:
- sys.exit(errmsg)
- HOST= l[0]
+ source_spec= {"filename": args.file }
+ if args.server:
+ if args.file:
+ sys.exit("contradicting options: -f --server")
+ try:
+ (host, port)= parse_server(args.server)
+ except ValueError as e:
+ sys.exit(str(e)+" (option --server)")
+ source_spec= { "host": host, "port": port }
+
+ # Try to parse data source from environment variable. parse_env() may
+ # return None:
+ if not source_spec:
+ source_spec= parse_env()
+
+ if not source_spec:
+ # reads iddb configuration file:
+ sp= sourcespec_by_hostname()
+ if sp:
try:
- PORT= int(l[1])
- except ValueError:
- sys.exit(errmsg)
- dbobj= DbXML(HOST, PORT)
+ source_spec= parse_spec(sp)
+ except ValueError as e:
+ sys.exit(str(e)+" (configuration file)")
+
+ if not source_spec:
+ sys.exit(("Error, no source specified.\n"
+ "You must either:\n"
+ "- set environment variable '%s'\n"
+ "- provide a StructuredData file with option '-f'\n"
+ "- provide a server with option --server\n"
+ "- define %s in file:\n"
+ " %s") % \
+ (ENV_VAR_NAME, ENV_VAR_NAME, CONFIG_FILE))
+
+ dbobj= None
+ if "filename" in source_spec:
+ dbobj= DbFile(source_spec["filename"])
+ elif "host" in source_spec:
+ dbobj= DbXML(source_spec["host"], source_spec["port"])
+ else:
+ raise AssertionError("unexpected sourcespec: %s" % repr(source_spec))
dbquery= Query(dbobj)
@@ -705,6 +938,9 @@
if rest[0]== "find":
cmd_find(dbobj, dbquery, args, rest[1:])
return
+ if rest[0]== "rxfind":
+ cmd_rxfind(dbobj, dbquery, args, rest[1:])
+ return
if rest[0]== "get":
cmd_get(dbobj, dbquery, args, rest[1:])
return
@@ -725,7 +961,14 @@
DESC= '''
Show insertion device properties by querying the StructuredData database.
-Known commands:
+If no command is given, the program performs the "list" command.
+
+Commands
+--------
+
+Commands for undulator properties
++++++++++++++++++++++++++++++++++
+
name NAME [NAME ...]
Get the StructuredData name for the given insertion device. NAME may be
any common name that specifes an insertion device like: U49ID4R u49id4r
@@ -757,11 +1000,13 @@
%(all_columns)s
Unless option --sort-by is used, sort the results by the first column.
-Raw StructuredData access (note: most options except "--id" are ignore
-for these commands).
+Commands for raw StructuredData access
+++++++++++++++++++++++++++++++++++++++
-Option -i IDNAME causes "id_data.NAME." to be prepended to PATTERN, where
-"NAME" is the StructuredData undulator name
+Note: most options except "--id" are ignore for these commands.
+
+Note: Option -i IDNAME causes "id_data.NAME." to be prepended to PATTERN, where
+ "NAME" is the StructuredData undulator name
paths PATTERN [PATHS]
Execute StructuredData "paths" command.
@@ -769,17 +1014,54 @@
find PATTERN [PATHS]
Execute StructuredData "find" command.
Example: iddb --id ue112 find 'names.*'
+ rxfind PATTERN [PATHS]
+ Execute StructuredData "rxfind" command. PATTERN is a regular
+ expression here. Usually your pattern should start with '.*'.
+ Example: iddb --id ue112 find '.*device'
get PATTERN [PATHS]
Execute StructuredData "get" command.
Example: iddb --id ue112 get 'names.*'
+Specification of the data source
+--------------------------------
+
+The data source is specified by order of precedence by these methods:
+
+ - options '-f' or '--server'
+ - environment variable 'IDDB_SOURCE'
+ - configuration file $SHARE_INSTALL_DIR/bii_scripts/iddb.config
+
+Environment variable 'IDDB_SOURCE'
+++++++++++++++++++++++++++++++++++
+
+ One of the strings:
+ - server:HOST:PORT
+ - file:FILENAME
+
+Configuration file
+++++++++++++++++++
+
+The configuration file is located at $SHARE_INSTALL_DIR/bii_scripts/iddb.config.
+$SHARE_INSTALL_DIR is the location of the 'share' directory.
+
+This is a file in windows-ini format. Source specifications have that same
+format as for the environment variable 'IDDB_SOURCE' (see above).
+
+Section [HOSTS] contains source specifications specific host names,
+ '*' is a default for all hosts.
+Section [DOMAINS] contains source specifications specific domains. Partial
+ matches of domains are supported, e.g. 'mycompany.com' matches
+ 'subnet1.mycompany.com'
+
+Further documentation
+---------------------
+
StructuredData paths in general are described here:
https://yaml-structureddata.sourceforge.io/reference.html#paths
The Insertion device database is described here:
http://wiki.trs.bessy.de/bin/view/Controls/IdcpDb
-If no command is given, the program performs the "list" command.
''' % {"all_columns": COLUMNS_STR, "def_columns": DEFAULT_COLUMNS_STR}
def script_shortname():
@@ -844,10 +1126,8 @@
metavar="STATUS"
)
parser.add_argument("--server",
- help=("specify the StructuredData XML-RPC "
- "server in the form 'HOST:PORT'. The "
- "default is %s:%s") % \
- (HOST, PORT),
+ help="specify the StructuredData XML-RPC "
+ "server in the form 'HOST:PORT'",
metavar="SERVER"
)
parser.add_argument("-r", "--raw",
@@ -857,9 +1137,9 @@
)
parser.add_argument("-f", "--file",
help="Load STRUCTUREDDATAFILE instead of contacting "
- "the XMLRPC server. Note: For this the "
+ "an XMLRPC server. Note: For this the "
"StructuredData python modules must be "
- "installed.",
+ "installed on your system.",
metavar="STRUCTUREDDATAFILE"
)
diff -rN -u old-bii_scripts/bin/makeDocTxt.pl new-bii_scripts/bin/makeDocTxt.pl
--- old-bii_scripts/bin/makeDocTxt.pl 2022-11-28 21:49:27.538672901 +0100
+++ new-bii_scripts/bin/makeDocTxt.pl 2022-11-28 21:49:27.546673098 +0100
@@ -47,7 +47,7 @@
my $usage = "makeDocTxt.pl [OPTIONS] infile.txt [outfile.html]\n".
" Create an html-document from a .txt-file with special format style\n".
- " for details see http://www-old.bessy.de/~kuner/makeDocs/makeDocEn.html\n".
+ " for details see http://help.bessy.de/~kuner/makeDocs/makeDocEn.html\n".
"OPTIONS: \n";
diff -rN -u old-bii_scripts/bin/phytronFilterIpPortLog.pl new-bii_scripts/bin/phytronFilterIpPortLog.pl
--- old-bii_scripts/bin/phytronFilterIpPortLog.pl 2022-11-28 21:49:27.538672901 +0100
+++ new-bii_scripts/bin/phytronFilterIpPortLog.pl 2022-11-28 21:49:27.546673098 +0100
@@ -12,15 +12,57 @@
# 0M1.1P22R:XX
# 2022/02/22 16:05:47.975 mou1s05l.blc05.bessy.de:22222 read 7
# 0:0C
-
use strict;
use Getopt::Long;
-
my $usage = "phytronFilterLog.pl [OPTIONS] phytronIpPortLogFile\n\t-h: help\n\t-f: filter e.g. M1.1 for motor 1\n";
my $filter = ".*"; #default: get all
my $ignore = "___";
our($opt_h,$opt_f,$opt_i) = (undef,undef,undef);
+ # Bits set in state done are inverted by '!'
+ my @msta = ("Dir=",
+ "DONE",
+ "LS+",
+ "LS_HOME",
+ "nn",
+ "POS",
+ "SLIP_STALL",
+ "HOME!",
+ "PRESENT!",
+ "PROBLEM",
+ "MOVING",
+ "GAIN_SUPPORT",
+ "COMM_ERR",
+ "LS-",
+ "HOMEDone!",
+ "nn"
+ );
+ my @SystemStat_SE = ("busy", # 1
+ "IllegalCommand", # 2
+ "waitSync", # 4
+ "isInit", # 8 _______ 1
+ "LS+", # 10
+ "LS-", # 20
+ "LSM", # 40
+ "SwLS+", # 80 ______ 2
+ "SwLS-", # 100
+ "PwrStgReady!", # 200
+ "Ramp", # 400
+ "internErr", # 800 _____ 3
+ "LS_Err", # 1000
+ "PwrStgErr", # 2000
+ "SFI_Err", # 4000
+ "ENDAT_Err", # 8000 ____ 4
+ "RUN", # 10000
+ "calmDownTm", # 20000
+ "inBoost", # 40000
+ "DONE", # 80000 ___ 5
+ "APS_ready!", # 100000
+ "PosMode", # 200000
+ "FreeRunMode", # 400000
+ "MultiFRun", # 800000 __ 6
+ "SyncEna"); # 1000000 _
+
Getopt::Long::config(qw(no_ignore_case));
die unless GetOptions("h","f=s","i=s");
die $usage unless scalar(@ARGV) > 0;
@@ -37,17 +79,19 @@
my $timeWrite;
my $timeRead;
my $line;
- my $lineNr = 0;
+ my $lineNr;
+ my @result;
while( <IN_FILE> )
{
my $matchFilter = undef;
$line = $_;
$lineNr++;
- $timeWrite = $1;
-# check write
+ $line = checkCaMonitorData($line,\@result); # return next line, if this is a monitor, same else
if($line =~ /^.*?\s(.*?)\s.*?\s(\w+)/ && $2 eq 'write') {
+ $timeWrite = $1;
$line = <IN_FILE>;
$lineNr++;
+ $line = checkCaMonitorData($line,\@result); # return next line, if this is a monitor, same else
if($line=~/\d(M.*):../) { # Axis command
$command=$1;
}
@@ -55,41 +99,113 @@
$command=$1;
}
else {
- $command = "ILLEGAL COMMAND: '$line'\n";
+ chomp $line;
+ push @result, "$timeWrite\terr\tILLEGAL COMMAND in $lineNr: '$line'\t\n";
}
if( not ($command =~/$ignore/) ) {
- print "$lineNr\t$timeWrite\twr\t$command\n";
- $matchFilter = 1;
if( $command =~/$filter/) {
- print "$lineNr\t$timeWrite\twr\t$command\n";
+ push @result, "$timeWrite\twr\t$command\n";
$matchFilter = 1;
}
}
- }
- else {
- chomp($line);
- print "$lineNr\t$timeWrite\terr\tWRITE EXPECTED:\t'$line'\n";
- }
-
-# next should be 'read'
- $line = <IN_FILE>;
- $lineNr++;
- $timeRead = $1;
- if($line =~ /^.*?\s(.*?)\s.*?\s(\w+)/ && $2 eq 'read') {
$line = <IN_FILE>;
$lineNr++;
- if($line=~/(.*):../) {
- $reply = $1;
+ $line = checkCaMonitorData($line,\@result); # return next line, if this is a monitor, same else
+ if($line =~ /^.*?\s(.*?)\s.*?\s(\w+)/ && $2 eq 'read') {
+ $timeRead = $1;
+ $line = <IN_FILE>;
+ $lineNr++;
+ if($line=~/(.*):../) {
+ $reply = $1;
+ $reply = getStatus($reply) if($command=~/M\d+\.\dSE/)
+ }
+ else {
+ chomp($line);
+ $reply = "ILLEGAL REPLY: '$line'";
+ }
+ push @result,"$timeRead\trd\t$reply\n" if($matchFilter);
}
else {
chomp($line);
- $reply = "ILLEGAL REPLY: '$line'";
+ push @result, "$timeRead\terr\tMISS READ in $lineNr: '$line'\n";
}
- print "$lineNr\t$timeRead\trd\t$reply\n" if($matchFilter);
+
}
else {
chomp($line);
- print "$lineNr\t$timeRead\terr\tMISS READ\t'$line'\n";
+ push @result, "\n$timeWrite\terr\tWRITE EXPECTED in $lineNr:\t'$line'";
}
- }
+
+ } # end while
close IN_FILE;
+
+# print $_ foreach (@result);
+ print $_ foreach (sort(@result));
+
+# n2str($value,@bitDescriptions)
+sub n2str
+{ my $value = shift @_;
+ my $rDesc = shift @_;
+ my $hex = sprintf("%X",$value);
+ my $msg;
+ my $idx=0;
+
+ foreach my $dsc (@$rDesc){
+ my $bit = ($value >> $idx)&0x1;
+ if($dsc=~/=/) {
+ $dsc = $dsc.$bit;
+ }
+ if($dsc=~/!/) {
+ $msg .= " $dsc" if($bit == 0);
+ }
+ else {
+ $msg .= " $dsc" if($bit == 1);
+ }
+ $idx++;
+ }
+ return "0x$hex STAT:$msg";
+}
+
+# check for camonitor data:
+sub checkCaMonitorData
+{ my ($line,$rResult) = @_;
+ my $leave=undef;
+ # is pv with field
+ if($line =~ /^(.*?)\.([\w\d]+)\s+\d+-\d+-\d+\s+(.*?)\s+(.*)/) {
+ my $pv=$1;
+ my $field=$2;
+ my $time=$3;
+ my $value=$4;
+ if($field eq "MSTA") {
+ $value = "$value\t".n2str($value,\@msta);
+ }
+ push @$rResult, "$time\t$pv.$field\t$value\n";
+ }
+ # is pv without field
+ elsif($line =~ /^(.*?)\s+\d+-\d+-\d+\s+(.*?)\s+(.*)/) {
+ my $pv=$1;
+ my $time=$2;
+ my $value=$3;
+ push @$rResult, "$time\t$pv\t$value\n";
+ }
+ # is asyn driver read/write failed message
+ elsif($line =~ /^.*?\s(.*?)\s(.*reason \d+)/) {
+ my $time=$1;
+ my $value=$2;
+ push @$rResult, "$time\t$value\n";
+ }
+ # no camonitor data line
+ else {
+ return $line;
+ }
+ $line = <IN_FILE>;
+ $lineNr++;
+ checkCaMonitorData($line,$rResult);
+}
+sub getStatus
+{ my ($reply) = @_;
+ my $hex = sprintf("%X",$reply);
+
+
+ return "$reply, 0x$hex STAT:".n2str($reply,\@SystemStat_SE);
+}
diff -rN -u old-bii_scripts/bin/repo-hash.sh new-bii_scripts/bin/repo-hash.sh
--- old-bii_scripts/bin/repo-hash.sh 1970-01-01 01:00:00.000000000 +0100
+++ new-bii_scripts/bin/repo-hash.sh 2022-11-28 21:49:27.546673098 +0100
@@ -0,0 +1,265 @@
+#!/bin/bash
+
+# Copyright 2022 Helmholtz-Zentrum Berlin für Materialien und Energie GmbH
+# <https://www.helmholtz-berlin.de>
+#
+# Author: Goetz Pfeiffer <Goetz.Pfeiffer@helmholtz-berlin.de>
+#
+# 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/>.
+# activate if the script should abort on error:
+# set -e
+
+SCRIPT_FULL_NAME=$(readlink -e $0)
+MYDIR=$(dirname $SCRIPT_FULL_NAME)
+MYNAME=$(basename $SCRIPT_FULL_NAME)
+
+function print_short_help {
+ echo "$MYNAME : create a short repository hash file."
+ echo "usage: $MYNAME REPOSITORY [HASHFILE]"
+ echo
+ echo "If HASHFILE is not given, print the hash to the console."
+ echo " Returns always returncode 0."
+ echo
+ echo "If HASHFILE is given:"
+ echo " Create HASHFILE if it doesn't exist of if the hash has changed"
+ echo " with respect to the existing file."
+ echo " Returns 0 if the hash has changed and 1 if it has not changed."
+ echo
+ echo "The type of the source repository is automatically recognized,"
+ echo "supported repositories:"
+ echo " git mercurial darcs"
+ echo ""
+ #echo "For some conversions, a *.marks file in the source repository tracks"
+ #echo "which patches were already converted."
+ #echo ""
+ echo "options:"
+ echo "-h --help : this help"
+ echo "-v --verbose: Show what the script does"
+ echo "-n --dry-run: Just show what the script would do"
+ exit 0
+}
+
+REPOSITORY=""
+HASHFILE=""
+
+cmdret=""
+cmddata=""
+
+returncode=0
+
+function CMD {
+ # execute a shell command
+ # arguments:
+ # $1: command
+ # returns:
+ # cmdret (global variable): the return code of the command
+ if [ -n "$verbose" -o -n "$dryrun" ]; then
+ echo "$1"
+ fi
+ if [ -z "$dryrun" ]; then
+ bash -c "$1"
+ cmdret=$?
+ else
+ cmdret=0
+ fi
+}
+
+function CMDRET {
+ # execute a shell command and catch standard out
+ # arguments:
+ # $1: command
+ # returns:
+ # cmdret (global variable): the return code of the command
+ # cmddata (global variable): the stdout output of the command
+ if [ -n "$verbose" -o -n "$dryrun" ]; then
+ echo "$1"
+ fi
+ cmdret=0
+ # without '|| ...' the script will exit right here
+ # in case of an error:
+ cmddata=$(bash -c "$1") || cmdret=$?
+}
+
+function CD {
+ # change directory but not when dryrun is set
+ # $1: dir
+ if [ -n "$verbose" -o -n "$dryrun" ]; then
+ echo "cd $1"
+ fi
+ if [ -z "$dryrun" ]; then
+ cd "$1" > /dev/null
+ fi
+}
+
+function repotype {
+ # determine the repository type
+ # $1: directory
+ if [ -d "$1/_darcs" ]; then
+ echo "darcs"
+ elif [ -d "$1/.hg" ]; then
+ echo "mercurial"
+ elif [ -d "$1/.git" ]; then
+ echo "git"
+ elif [ -d "$1/branches" -a -d "$1/objects" -a -d "$1/refs" ]; then
+ # probably git bare repo
+ echo "git"
+ else
+ echo "error, $1 is not one of the supported repository types"
+ echo "git, mercurial or darcs."
+ exit 1
+ fi
+}
+
+function githash {
+ # create hash for git repo
+ # $1: dir
+ CMDRET "(cd $1 && git log --pretty=format:'%H' | md5sum | sed -e 's/ .*//')"
+ echo "$cmddata"
+}
+
+function darcshash {
+ # create hash for git repo
+ # $1: dir
+ CMDRET "(cd $1 && darcs log | grep patch | md5sum | sed -e 's/ .*//')"
+ echo "$cmddata"
+}
+
+function hghash {
+ # create hash for git repo
+ # $1: dir
+ CMDRET "(cd $1 && hg log --template '{node}\n' | md5sum | sed -e 's/ .*//')"
+ echo "$cmddata"
+}
+
+function repohash {
+ # hash for git repos
+ # $1: directory
+ # $2: hashfile (optional)
+ local REPODIR="$1"
+ local HASHFILE="$2"
+ REPOTYPE=$(repotype "$REPODIR")
+ if [ "$REPOTYPE" == "git" ]; then
+ HASH="$(githash "$REPODIR")"
+ elif [ "$REPOTYPE" == "mercurial" ]; then
+ HASH="$(hghash "$REPODIR")"
+ elif [ "$REPOTYPE" == "darcs" ]; then
+ HASH="$(darcshash "$REPODIR")"
+ else
+ echo "internal error, unexpected REPOTYPE $REPOTYPE" >&2
+ exit 1
+ fi
+ if [ -z "$HASHFILE" ]; then
+ echo "$HASH"
+ return
+ fi
+ OLDHASH=""
+ if [ -e $HASHFILE ]; then
+ OLDHASH=$(cat $HASHFILE)
+ fi
+ if [ "$OLDHASH" != "$HASH" ]; then
+ CMD "echo \"$HASH\" > $HASHFILE"
+ else
+ returncode=1
+ fi
+}
+
+declare -a ARGS
+skip_options=""
+
+while true; do
+ case "$1" in
+ -h | --help)
+ # if the "less" is present, use it:
+ if less -V >/dev/null 2>&1; then
+ # use less pager for help:
+ $SCRIPT_FULL_NAME --help-raw | less
+ exit 0
+ else
+ print_short_help
+ exit 0
+ fi
+ ;;
+ --help-raw)
+ print_short_help
+ exit 0
+ ;;
+ -v | --verbose)
+ verbose="yes"
+ shift
+ ;;
+ -n | --dry-run)
+ verbose="yes"
+ dryrun="yes"
+ shift
+ ;;
+ -- )
+ skip_options="yes"
+ shift;
+ break
+ ;;
+ *)
+ if [ -z "$1" ]; then
+ break;
+ fi
+ if [[ $1 =~ ^- ]]; then
+ echo "unknown option: $1"
+ exit 1
+ fi
+ ARGS+=("$1")
+ shift
+ ;;
+ esac
+done
+
+if [ -n "$skip_options" ]; then
+ while true; do
+ if [ -z "$1" ]; then
+ break;
+ fi
+ ARGS+=("$1")
+ shift
+ done
+fi
+
+for arg in "${ARGS[@]}"; do
+ # examine extra args
+ # match known args here like:
+ # if [ "§arg" == "doit" ]; then ...
+ # continue
+ # fi
+ if [ -z "$REPOSITORY" ]; then
+ REPOSITORY="$arg"
+ continue
+ fi
+ if [ -z "$HASHFILE" ]; then
+ HASHFILE="$arg"
+ continue
+ fi
+ echo "unexpeced argument: $arg"
+ exit 1
+done
+
+if [ -z "$REPOSITORY" ]; then
+ echo "error, REPOSITORY is missing"
+ exit 1
+fi
+
+if [ ! -d "$REPOSITORY" ]; then
+ echo "error, not a directory: $REPOSITORY"
+ exit 1
+fi
+
+repohash "$REPOSITORY" "$HASHFILE"
+exit $returncode
+
diff -rN -u old-bii_scripts/bin/repo-mirror.sh new-bii_scripts/bin/repo-mirror.sh
--- old-bii_scripts/bin/repo-mirror.sh 2022-11-28 21:49:27.538672901 +0100
+++ new-bii_scripts/bin/repo-mirror.sh 2022-11-28 21:49:27.546673098 +0100
@@ -186,6 +186,9 @@
echo " This may be needed to convert repositories that"
echo " are not UTF-8 encoded. Example:"
echo " iso8859-1 : ISO8850-1 encoding"
+ echo "--hgrc HGRCFILE:"
+ echo " Specify the .hgrc file. This sets the environment"
+ echo " variable HGRCPATH (see mercurial documentation)."
echo
echo "-y --yes : Create destination reposity if it doesn't exist"
echo " without prompting the user"
@@ -225,6 +228,10 @@
fi
shift 2
;;
+ --hgrc)
+ export HGRCPATH="$2"
+ shift 2
+ ;;
-y | --yes)
yes="yes"
shift
diff -rN -u old-bii_scripts/config.bullseye.acc.bessy.de new-bii_scripts/config.bullseye.acc.bessy.de
--- old-bii_scripts/config.bullseye.acc.bessy.de 1970-01-01 01:00:00.000000000 +0100
+++ new-bii_scripts/config.bullseye.acc.bessy.de 2022-11-28 21:49:27.542673000 +0100
@@ -0,0 +1,51 @@
+# Configuration of bii_scripts installation at Bessy development hosts
+# --------------------------------------------------------------------
+
+# Variables that can be used to distribute the documentation files
+# with rsync:
+
+# Rsync configuration for program, library and share files installation:
+# Rsync destination, may be "localhost", HOST or USER@HOST. If left empty
+# do not use ssh for rsync:
+INSTALL_RSYNC_HOST=
+# Rsync options, you usually don't have to change these:
+INSTALL_RSYNC_OPTS=-crlEogC --chmod=Fa+r --groupmap=*:coredev
+# Directory creation command. A make function, $(1) is the directory list:
+INSTALL_MKDIR=sg coredev -c "mkdir -m 775 -p $(1)"
+
+# Rsync configuration HTML file installation:
+# Rsync destination, may be "localhost", HOST or USER@HOST. If left empty
+# do not use ssh for rsync:
+HTML_RSYNC_HOST=wwwcsr@www-csr.bessy.de
+# Rsync options, you usually don't have to change these:
+HTML_RSYNC_OPTS=-crlEC --chmod=a+r,Da+x
+# Directory creation command. A make function, $(1) is the directory list:
+HTML_MKDIR=mkdir -m 775 -p $(1)
+
+# install directories .......................................
+
+# INSTALL_PREFIX must be defined here or on the command line:
+INSTALL_PREFIX=/opt/csr
+
+# Directory where "share" files are installed:
+SHARE_INSTALL_DIR=$(INSTALL_PREFIX)/share
+
+# Directory where scripts are installed:
+SCRIPT_INSTALL_DIR=$(INSTALL_PREFIX)/bin
+
+# Directory where perl modules are installed:
+PERLLIB_INSTALL_DIR=$(INSTALL_PREFIX)/lib/perl
+
+# Directory where python 2 modules are installed. You may use variable
+# PYTHON2VERSION here which contains the major and minor version number of
+# python 2:
+PYTHON2LIB_INSTALL_DIR=$(INSTALL_PREFIX)/lib/python$(PYTHON2VERSION)
+
+# Directory where python 3 modules are installed. You may use variable
+# PYTHON2VERSION here which contains the major and minor version number of
+# python 3:
+PYTHON3LIB_INSTALL_DIR=$(INSTALL_PREFIX)/lib/python$(PYTHON3VERSION)
+
+# Root directory where the html documentation is copied to. If empty, do
+# not install html documentation.
+HTML_INSTALL_DIR=/home/wwwcsr/www/control
diff -rN -u old-bii_scripts/config.elbe.acc new-bii_scripts/config.elbe.acc
--- old-bii_scripts/config.elbe.acc 2022-11-28 21:49:27.534672803 +0100
+++ new-bii_scripts/config.elbe.acc 1970-01-01 01:00:00.000000000 +0100
@@ -1,51 +0,0 @@
-# Configuration of bii_scripts installation at Bessy development hosts
-# --------------------------------------------------------------------
-
-# Variables that can be used to distribute the documentation files
-# with rsync:
-
-# Rsync configuration for program, library and share files installation:
-# Rsync destination, may be "localhost", HOST or USER@HOST. If left empty
-# do not use ssh for rsync:
-INSTALL_RSYNC_HOST=
-# Rsync options, you usually don't have to change these:
-INSTALL_RSYNC_OPTS=-crlEC --chmod=Fa+r
-# Directory creation command. A make function, $(1) is the directory list:
-INSTALL_MKDIR=sg scrptdev -c "mkdir -m 775 -p $(1)"
-
-# Rsync configuration HTML file installation:
-# Rsync destination, may be "localhost", HOST or USER@HOST. If left empty
-# do not use ssh for rsync:
-HTML_RSYNC_HOST=
-# Rsync options, you usually don't have to change these:
-HTML_RSYNC_OPTS=-crlEC --chmod=a+r,Da+x
-# Directory creation command. A make function, $(1) is the directory list:
-HTML_MKDIR=mkdir -m 775 -p $(1)
-
-# install directories .......................................
-
-# INSTALL_PREFIX must be defined here or on the command line:
-INSTALL_PREFIX=/opt/csr
-
-# Directory where "share" files are installed:
-SHARE_INSTALL_DIR=$(INSTALL_PREFIX)/share
-
-# Directory where scripts are installed:
-SCRIPT_INSTALL_DIR=$(INSTALL_PREFIX)/bin
-
-# Directory where perl modules are installed:
-PERLLIB_INSTALL_DIR=$(INSTALL_PREFIX)/lib/perl
-
-# Directory where python 2 modules are installed. You may use variable
-# PYTHON2VERSION here which contains the major and minor version number of
-# python 2:
-PYTHON2LIB_INSTALL_DIR=$(INSTALL_PREFIX)/lib/python$(PYTHON2VERSION)
-
-# Directory where python 3 modules are installed. You may use variable
-# PYTHON2VERSION here which contains the major and minor version number of
-# python 3:
-PYTHON3LIB_INSTALL_DIR=$(INSTALL_PREFIX)/lib/python$(PYTHON3VERSION)
-
-# Root directory where the html documentation is copied to. If empty, do
-# not install html documentation.
-HTML_INSTALL_DIR=
diff -rN -u old-bii_scripts/config.elbe.acc.bessy.de new-bii_scripts/config.elbe.acc.bessy.de
--- old-bii_scripts/config.elbe.acc.bessy.de 1970-01-01 01:00:00.000000000 +0100
+++ new-bii_scripts/config.elbe.acc.bessy.de 2022-11-28 21:49:27.542673000 +0100
@@ -0,0 +1,51 @@
+# Configuration of bii_scripts installation at Bessy development hosts
+# --------------------------------------------------------------------
+
+# Variables that can be used to distribute the documentation files
+# with rsync:
+
+# Rsync configuration for program, library and share files installation:
+# Rsync destination, may be "localhost", HOST or USER@HOST. If left empty
+# do not use ssh for rsync:
+INSTALL_RSYNC_HOST=
+# Rsync options, you usually don't have to change these:
+INSTALL_RSYNC_OPTS=-crlEC --chmod=Fa+r
+# Directory creation command. A make function, $(1) is the directory list:
+INSTALL_MKDIR=sg scrptdev -c "mkdir -m 775 -p $(1)"
+
+# Rsync configuration HTML file installation:
+# Rsync destination, may be "localhost", HOST or USER@HOST. If left empty
+# do not use ssh for rsync:
+HTML_RSYNC_HOST=
+# Rsync options, you usually don't have to change these:
+HTML_RSYNC_OPTS=-crlEC --chmod=a+r,Da+x
+# Directory creation command. A make function, $(1) is the directory list:
+HTML_MKDIR=mkdir -m 775 -p $(1)
+
+# install directories .......................................
+
+# INSTALL_PREFIX must be defined here or on the command line:
+INSTALL_PREFIX=/opt/csr
+
+# Directory where "share" files are installed:
+SHARE_INSTALL_DIR=$(INSTALL_PREFIX)/share
+
+# Directory where scripts are installed:
+SCRIPT_INSTALL_DIR=$(INSTALL_PREFIX)/bin
+
+# Directory where perl modules are installed:
+PERLLIB_INSTALL_DIR=$(INSTALL_PREFIX)/lib/perl
+
+# Directory where python 2 modules are installed. You may use variable
+# PYTHON2VERSION here which contains the major and minor version number of
+# python 2:
+PYTHON2LIB_INSTALL_DIR=$(INSTALL_PREFIX)/lib/python$(PYTHON2VERSION)
+
+# Directory where python 3 modules are installed. You may use variable
+# PYTHON2VERSION here which contains the major and minor version number of
+# python 3:
+PYTHON3LIB_INSTALL_DIR=$(INSTALL_PREFIX)/lib/python$(PYTHON3VERSION)
+
+# Root directory where the html documentation is copied to. If empty, do
+# not install html documentation.
+HTML_INSTALL_DIR=
diff -rN -u old-bii_scripts/config.nfs.ctl new-bii_scripts/config.nfs.ctl
--- old-bii_scripts/config.nfs.ctl 2022-11-28 21:49:27.534672803 +0100
+++ new-bii_scripts/config.nfs.ctl 1970-01-01 01:00:00.000000000 +0100
@@ -1,51 +0,0 @@
-# Configuration of bii_scripts installation at Bessy development hosts
-# --------------------------------------------------------------------
-
-# Variables that can be used to distribute the documentation files
-# with rsync:
-
-# Rsync configuration for program, library and share files installation:
-# Rsync destination, may be "localhost", HOST or USER@HOST. If left empty
-# do not use ssh for rsync:
-INSTALL_RSYNC_HOST=opiadm@nfs.ctl.bessy.de
-# Rsync options, you usually don't have to change these:
-INSTALL_RSYNC_OPTS=-crlEogC --chmod=a+r,Da+x
-# Directory creation command. A make function, $(1) is the directory list:
-INSTALL_MKDIR=mkdir -m 775 -p $(1)
-
-# Rsync configuration HTML file installation:
-# Rsync destination, may be "localhost", HOST or USER@HOST. If left empty
-# do not use ssh for rsync:
-HTML_RSYNC_HOST=
-# Rsync options, you usually don't have to change these:
-HTML_RSYNC_OPTS=-crlEogC --chmod=a+r,Da+x
-# Directory creation command. A make function, $(1) is the directory list:
-HTML_MKDIR=mkdir -m 775 -p $(1)
-
-# install directories .......................................
-
-# INSTALL_PREFIX must be defined here or on the command line:
-INSTALL_PREFIX=/opt/OPI/bii_scripts
-
-# Directory where "share" files are installed:
-SHARE_INSTALL_DIR=$(INSTALL_PREFIX)/share
-
-# Directory where scripts are installed:
-SCRIPT_INSTALL_DIR=$(INSTALL_PREFIX)/bin
-
-# Directory where perl modules are installed:
-PERLLIB_INSTALL_DIR=$(INSTALL_PREFIX)/lib/perl
-
-# Directory where python 2 modules are installed. You may use variable
-# PYTHON2VERSION here which contains the major and minor version number of
-# python 2:
-PYTHON2LIB_INSTALL_DIR=$(INSTALL_PREFIX)/lib/python
-
-# Directory where python 3 modules are installed. You may use variable
-# PYTHON2VERSION here which contains the major and minor version number of
-# python 3:
-PYTHON3LIB_INSTALL_DIR=$(INSTALL_PREFIX)/lib/python
-
-# Root directory where the html documentation is copied to. If empty, do
-# not install html documentation.
-HTML_INSTALL_DIR=
diff -rN -u old-bii_scripts/config.nfs.ctl.bessy.de new-bii_scripts/config.nfs.ctl.bessy.de
--- old-bii_scripts/config.nfs.ctl.bessy.de 1970-01-01 01:00:00.000000000 +0100
+++ new-bii_scripts/config.nfs.ctl.bessy.de 2022-11-28 21:49:27.542673000 +0100
@@ -0,0 +1,51 @@
+# Configuration of bii_scripts installation at Bessy development hosts
+# --------------------------------------------------------------------
+
+# Variables that can be used to distribute the documentation files
+# with rsync:
+
+# Rsync configuration for program, library and share files installation:
+# Rsync destination, may be "localhost", HOST or USER@HOST. If left empty
+# do not use ssh for rsync:
+INSTALL_RSYNC_HOST=opiadm@nfs.ctl.bessy.de
+# Rsync options, you usually don't have to change these:
+INSTALL_RSYNC_OPTS=-crlEogC --chmod=a+r,Da+x
+# Directory creation command. A make function, $(1) is the directory list:
+INSTALL_MKDIR=mkdir -m 775 -p $(1)
+
+# Rsync configuration HTML file installation:
+# Rsync destination, may be "localhost", HOST or USER@HOST. If left empty
+# do not use ssh for rsync:
+HTML_RSYNC_HOST=
+# Rsync options, you usually don't have to change these:
+HTML_RSYNC_OPTS=-crlEogC --chmod=a+r,Da+x
+# Directory creation command. A make function, $(1) is the directory list:
+HTML_MKDIR=mkdir -m 775 -p $(1)
+
+# install directories .......................................
+
+# INSTALL_PREFIX must be defined here or on the command line:
+INSTALL_PREFIX=/opt/OPI/bii_scripts
+
+# Directory where "share" files are installed:
+SHARE_INSTALL_DIR=$(INSTALL_PREFIX)/share
+
+# Directory where scripts are installed:
+SCRIPT_INSTALL_DIR=$(INSTALL_PREFIX)/bin
+
+# Directory where perl modules are installed:
+PERLLIB_INSTALL_DIR=$(INSTALL_PREFIX)/lib/perl
+
+# Directory where python 2 modules are installed. You may use variable
+# PYTHON2VERSION here which contains the major and minor version number of
+# python 2:
+PYTHON2LIB_INSTALL_DIR=$(INSTALL_PREFIX)/lib/python
+
+# Directory where python 3 modules are installed. You may use variable
+# PYTHON2VERSION here which contains the major and minor version number of
+# python 3:
+PYTHON3LIB_INSTALL_DIR=$(INSTALL_PREFIX)/lib/python
+
+# Root directory where the html documentation is copied to. If empty, do
+# not install html documentation.
+HTML_INSTALL_DIR=
diff -rN -u old-bii_scripts/config.stretch.acc new-bii_scripts/config.stretch.acc
--- old-bii_scripts/config.stretch.acc 2022-11-28 21:49:27.534672803 +0100
+++ new-bii_scripts/config.stretch.acc 1970-01-01 01:00:00.000000000 +0100
@@ -1,51 +0,0 @@
-# Configuration of bii_scripts installation at Bessy development hosts
-# --------------------------------------------------------------------
-
-# Variables that can be used to distribute the documentation files
-# with rsync:
-
-# Rsync configuration for program, library and share files installation:
-# Rsync destination, may be "localhost", HOST or USER@HOST. If left empty
-# do not use ssh for rsync:
-INSTALL_RSYNC_HOST=
-# Rsync options, you usually don't have to change these:
-INSTALL_RSYNC_OPTS=-crlEogC --chmod=Fa+r --groupmap=*:scrptdev
-# Directory creation command. A make function, $(1) is the directory list:
-INSTALL_MKDIR=sg scrptdev -c "mkdir -m 775 -p $(1)"
-
-# Rsync configuration HTML file installation:
-# Rsync destination, may be "localhost", HOST or USER@HOST. If left empty
-# do not use ssh for rsync:
-HTML_RSYNC_HOST=wwwcsr@www-csr.bessy.de
-# Rsync options, you usually don't have to change these:
-HTML_RSYNC_OPTS=-crlEC --chmod=a+r,Da+x
-# Directory creation command. A make function, $(1) is the directory list:
-HTML_MKDIR=mkdir -m 775 -p $(1)
-
-# install directories .......................................
-
-# INSTALL_PREFIX must be defined here or on the command line:
-INSTALL_PREFIX=/opt/csr
-
-# Directory where "share" files are installed:
-SHARE_INSTALL_DIR=$(INSTALL_PREFIX)/share
-
-# Directory where scripts are installed:
-SCRIPT_INSTALL_DIR=$(INSTALL_PREFIX)/bin
-
-# Directory where perl modules are installed:
-PERLLIB_INSTALL_DIR=$(INSTALL_PREFIX)/lib/perl
-
-# Directory where python 2 modules are installed. You may use variable
-# PYTHON2VERSION here which contains the major and minor version number of
-# python 2:
-PYTHON2LIB_INSTALL_DIR=$(INSTALL_PREFIX)/lib/python$(PYTHON2VERSION)
-
-# Directory where python 3 modules are installed. You may use variable
-# PYTHON2VERSION here which contains the major and minor version number of
-# python 3:
-PYTHON3LIB_INSTALL_DIR=$(INSTALL_PREFIX)/lib/python$(PYTHON3VERSION)
-
-# Root directory where the html documentation is copied to. If empty, do
-# not install html documentation.
-HTML_INSTALL_DIR=/home/wwwcsr/www/control
diff -rN -u old-bii_scripts/config.stretch.acc.bessy.de new-bii_scripts/config.stretch.acc.bessy.de
--- old-bii_scripts/config.stretch.acc.bessy.de 1970-01-01 01:00:00.000000000 +0100
+++ new-bii_scripts/config.stretch.acc.bessy.de 2022-11-28 21:49:27.542673000 +0100
@@ -0,0 +1,51 @@
+# Configuration of bii_scripts installation at Bessy development hosts
+# --------------------------------------------------------------------
+
+# Variables that can be used to distribute the documentation files
+# with rsync:
+
+# Rsync configuration for program, library and share files installation:
+# Rsync destination, may be "localhost", HOST or USER@HOST. If left empty
+# do not use ssh for rsync:
+INSTALL_RSYNC_HOST=
+# Rsync options, you usually don't have to change these:
+INSTALL_RSYNC_OPTS=-crlEogC --chmod=Fa+r --groupmap=*:scrptdev
+# Directory creation command. A make function, $(1) is the directory list:
+INSTALL_MKDIR=sg scrptdev -c "mkdir -m 775 -p $(1)"
+
+# Rsync configuration HTML file installation:
+# Rsync destination, may be "localhost", HOST or USER@HOST. If left empty
+# do not use ssh for rsync:
+HTML_RSYNC_HOST=wwwcsr@www-csr.bessy.de
+# Rsync options, you usually don't have to change these:
+HTML_RSYNC_OPTS=-crlEC --chmod=a+r,Da+x
+# Directory creation command. A make function, $(1) is the directory list:
+HTML_MKDIR=mkdir -m 775 -p $(1)
+
+# install directories .......................................
+
+# INSTALL_PREFIX must be defined here or on the command line:
+INSTALL_PREFIX=/opt/csr
+
+# Directory where "share" files are installed:
+SHARE_INSTALL_DIR=$(INSTALL_PREFIX)/share
+
+# Directory where scripts are installed:
+SCRIPT_INSTALL_DIR=$(INSTALL_PREFIX)/bin
+
+# Directory where perl modules are installed:
+PERLLIB_INSTALL_DIR=$(INSTALL_PREFIX)/lib/perl
+
+# Directory where python 2 modules are installed. You may use variable
+# PYTHON2VERSION here which contains the major and minor version number of
+# python 2:
+PYTHON2LIB_INSTALL_DIR=$(INSTALL_PREFIX)/lib/python$(PYTHON2VERSION)
+
+# Directory where python 3 modules are installed. You may use variable
+# PYTHON2VERSION here which contains the major and minor version number of
+# python 3:
+PYTHON3LIB_INSTALL_DIR=$(INSTALL_PREFIX)/lib/python$(PYTHON3VERSION)
+
+# Root directory where the html documentation is copied to. If empty, do
+# not install html documentation.
+HTML_INSTALL_DIR=/home/wwwcsr/www/control
diff -rN -u old-bii_scripts/doc/txt/CONTENTS.rst new-bii_scripts/doc/txt/CONTENTS.rst
--- old-bii_scripts/doc/txt/CONTENTS.rst 2022-11-28 21:49:27.538672901 +0100
+++ new-bii_scripts/doc/txt/CONTENTS.rst 2022-11-28 21:49:27.546673098 +0100
@@ -14,19 +14,7 @@
bii_scripts is avaliable under the terms of the
`GNU General Public License v.3 <http://www.gnu.org/licenses/gpl-3.0.html>`_.
-| If you are interested in getting the scripts or libraries you can download
- them as tar.gz or zip
-| file from the
- `repository page <http://www-csr.bessy.de/cgi-bin/hgweb.cgi/bii_scripts/file>`_
- (click on "bz2", "zip" or "gz").
-
-However, the preferred way is to clone the main darcs repository::
-
- darcs get http://www-csr.bessy.de/control/bii_scripts/repo/bii_scripts
-
-or to clone the mercurial mirror repository::
-
- hg clone http://www-csr.bessy.de/cgi-bin/hgweb.cgi/bii_scripts
+For downloading the project see `<https://www-csr.bessy.de/control/bii_scripts/>`_.
For any questions feel free to contact one of the script authors:
@@ -323,6 +311,9 @@
**git-meld**
| compares all files of two git versions with meld.
+**git-repo-merge.sh**
+ | Combines patches of two git repositories by creating a new git branch.
+
**grab_xkeys.pl**
| a little X11 utility that displays scan codes of pressed keys.
@@ -478,6 +469,10 @@
| Show what python modules a python script uses, complete with file path.
| `documentation <scripts/python-modules.html>`__
+**repo-hash.sh**
+ | Create a short hash or hash file for a repository.
+ | `documentation <scripts/repo-hash.html>`__
+
**repo-loginfo.py**
| print log summaries for darcs or mercurial repositories.
| `documentation <scripts/repo-loginfo.html>`__
diff -rN -u old-bii_scripts/doc/txt/index.rst new-bii_scripts/doc/txt/index.rst
--- old-bii_scripts/doc/txt/index.rst 2022-11-28 21:49:27.538672901 +0100
+++ new-bii_scripts/doc/txt/index.rst 2022-11-28 21:49:27.546673098 +0100
@@ -12,33 +12,19 @@
`documentation <CONTENTS.html>`_
-Distribution
-------------
+License
+-------
-Some of the scripts can be downloaded from the documentation side.
+Copyright 2022 `Helmholtz-Zentrum Berlin für Materialien und Energie GmbH
+<https://www.helmholtz-berlin.de>`_.
-However, you may want to download them from our software repositories.
+bii_scripts is avaliable under the terms of the
+`GNU General Public License v.3 <http://www.gnu.org/licenses/gpl-3.0.html>`_.
-Repository access
------------------
+Repository access and Download
+------------------------------
-You can download our primary darcs repository::
+- `bii_scripts at darcs <https://www-csr.bessy.de/cgi-bin/darcsweb.cgi?r=bii_scripts;a=summary>`_
- darcs get http://www-csr.bessy.de/control/bii_scripts/repo/bii_scripts
+- `bii_scripts at git <https://gitlab.helmholtz-berlin.de/acs/tools/bii_scripts>`_.
-and browse it at
-
- `<https://www-csr.bessy.de/cgi-bin/darcsweb.cgi?r=bii_scripts;a=summary>`_
-
-We also maintain a mercurial repository that is created by converting the darcs
-repository. You can browse it here:
-
- `<http://www-csr.bessy.de/cgi-bin/hgweb.cgi/bii_scripts>`_.
-
-or clone it::
-
- hg clone http://www-csr.bessy.de/cgi-bin/hgweb.cgi/bii_scripts
-
-Our development takes place in the darcs repository, so if you want to have
-your changes commited in our repositories, it may be easier if you use darcs.
-But we can also convert mercurial bundles back to darcs.
diff -rN -u old-bii_scripts/install.sh new-bii_scripts/install.sh
--- old-bii_scripts/install.sh 2022-11-28 21:49:27.534672803 +0100
+++ new-bii_scripts/install.sh 2022-11-28 21:49:27.542673000 +0100
@@ -1,25 +1,32 @@
#!/bin/bash
-HOSTNAME=$(hostname -f)
+FULLHOSTNAME=$(hostname -f)
+HOSTNAME=$(echo $FULLHOSTNAME | sed -e 's/\..*//')
+DOMAINNAME=$(echo $FULLHOSTNAME | sed -e 's/^[^\.]\+\.\?//')
-if [ -z "$1" ]; then
- if echo $HOSTNAME| grep '\(elbe\|stretch\)\.acc\.bessy\.de' -q ; then
- SHORTHOST=$(echo $HOSTNAME | sed -e 's/\..*//')
- echo "darcs pull is executed in order to prevent"
- echo "you from installing old program versions by accident"
- darcs pull
- # force bii_scripts.config to be remade:
- rm -f out/script/bii_scripts.config
- BII_CONFIG=config.$SHORTHOST.acc make -sj install
- exit
- fi
+if [ "$1" = "-h" -o "$1" = "--help" ]; then
echo "usage: $0 [install-directory]"
exit
fi
-if [ "$1" = "-h" -o "$1" = "--help" ]; then
- echo "usage: $0 [install-directory]"
- exit
+if [ -z "$1" ]; then
+ CONFIG="config.$FULLHOSTNAME"
+ if [ ! -e "$CONFIG" ]; then
+ if [ -n "$DOMAINNAME" ]; then
+ CONFIG="config.$DOMAINNAME"
+ fi
+ fi
+ if [ ! -e "$CONFIG" ]; then
+ echo "usage: $0 [install-directory]"
+ exit
+ fi
+ echo "darcs pull is executed in order to prevent"
+ echo "you from installing old program versions by accident"
+ darcs pull
+ # force bii_scripts.config to be remade:
+ rm -f out/script/bii_scripts.config
+ BII_CONFIG="$CONFIG" make -sj install
+ exit
fi
INSTALLDIR=$1
diff -rN -u old-bii_scripts/lib/python/bii_scripts/step.py new-bii_scripts/lib/python/bii_scripts/step.py
--- old-bii_scripts/lib/python/bii_scripts/step.py 2022-11-28 21:49:27.538672901 +0100
+++ new-bii_scripts/lib/python/bii_scripts/step.py 2022-11-28 21:49:27.546673098 +0100
@@ -944,7 +944,7 @@
return
# compile regexp once
-regPvName = re.compile('^\s*([\d\w\.:]+)(.*)$') # 'pvName EXPR, e.g 'MDIZ3T5G:lt50' '< 0.1'
+regPvName = re.compile('^\s*(.*?)([<=>!].*)') # 'pvName EXPR, e.g 'MDIZ3T5G:lt50' '< 0.1'
def parseFuncParameter(funcPar):
"""
Parse a next/break function parameter to be used by MeasThread object
diff -rN -u old-bii_scripts/lib/python/bii_scripts3/parse_subst.py new-bii_scripts/lib/python/bii_scripts3/parse_subst.py
--- old-bii_scripts/lib/python/bii_scripts3/parse_subst.py 2022-11-28 21:49:27.542673000 +0100
+++ new-bii_scripts/lib/python/bii_scripts3/parse_subst.py 2022-11-28 21:49:27.550673197 +0100
@@ -591,7 +591,6 @@
pos= m.end()
#curr_file_list_defs= dict(global_defs)
pattern_name_list= []
- pattern_value_list= []
state.append("pattern")
continue
m= rx_bracket1.match(all_, pos)
@@ -627,6 +626,8 @@
state.append("pattern names")
else:
state.append("pattern vars")
+ # initialize list of values with an empty list:
+ pattern_value_list= []
continue
m= rx_bracket2.match(all_, pos)
if m:
diff -rN -u old-bii_scripts/lib/python/bii_scripts3/rsync_dist_lib.py new-bii_scripts/lib/python/bii_scripts3/rsync_dist_lib.py
--- old-bii_scripts/lib/python/bii_scripts3/rsync_dist_lib.py 2022-11-28 21:49:27.542673000 +0100
+++ new-bii_scripts/lib/python/bii_scripts3/rsync_dist_lib.py 2022-11-28 21:49:27.550673197 +0100
@@ -1008,8 +1008,9 @@
last_date= sorted(datedict.keys())[-1]
names= sorted(datedict[last_date])
if not names:
- continue
- lines.append("%-24s %s" % (ver, " ".join(names)))
+ lines.append(ver)
+ else:
+ lines.append("%-24s %s" % (ver, " ".join(names)))
return "\n".join(lines)
lines= ["ver. date name(s)"]
first= True
diff -rN -u old-bii_scripts/share/bii_scripts/iddb.config new-bii_scripts/share/bii_scripts/iddb.config
--- old-bii_scripts/share/bii_scripts/iddb.config 1970-01-01 01:00:00.000000000 +0100
+++ new-bii_scripts/share/bii_scripts/iddb.config 2022-11-28 21:49:27.550673197 +0100
@@ -0,0 +1,16 @@
+# iddb source specifications for specific hosts or
+# domains.
+
+[HOSTS]
+# source specifications for hosts
+# '*' is a default when no other match is found
+
+* =
+orange = server:gwc2c.acc.bessy.de:7643
+
+[DOMAINS]
+# source specifications for domains
+# these may also be partial domains, e.g.
+# "mycompany.com" matches "subnet1.mycompany.com"
+
+bessy.de = server:gwc2c.acc.bessy.de:7643
patch 682779c9a37cc864496afa2e750235567398e635
Author: Goetz.Pfeiffer@helmholtz-berlin.de
Date: Tue Oct 18 10:40:59 CEST 2022
* iddb now supports the StructuredData "rxfind" command.
patch f8b4bdf4c80242a1776980473024f34f3335a4cc
Author: Bernhard.Kuner@bessy.de
Date: Wed Sep 28 11:53:20 CEST 2022
* bin/makeDocTxt.pl: Fix help link www-old.bessy.de
patch 6eefab602cfbc332d4472b6254e382d0da5a7baa
Author: Goetz.Pfeiffer@helmholtz-berlin.de
Date: Fri Sep 23 09:01:23 CEST 2022
* Bugfix in parse_subst.py: The "pattern" statement wasn't parsed correctly.
patch e41a0b29e5d713617e944781cb2a53c8b26c4a01
Author: Goetz.Pfeiffer@helmholtz-berlin.de
Date: Wed Aug 31 12:35:59 CEST 2022
* console-get: Fix http access and ssh access, make ssh access the default.
patch e61af60a04f53aaa0de7733d0ce97277c93a56ea
Author: Goetz.Pfeiffer@helmholtz-berlin.de
Date: Thu Jun 30 09:39:05 CEST 2022
* iddb: gwc2c.acc.bessy.de is now the XMLRPC server.
patch 94f4dbfb9805126be56ac12fb77c2b0698a73860
Author: Goetz.Pfeiffer@helmholtz-berlin.de
Date: Mon Jun 27 18:12:39 CEST 2022
* Bugfix in iddb: This wasn't compatible with Python 3.4.
patch ecdfdbe813212235750f236fcff9821cac9e70ad
Author: Goetz.Pfeiffer@helmholtz-berlin.de
Date: Mon Jun 27 09:36:00 CEST 2022
* Install with group "coredev" instead of group "scrptdev" on host bullseye.
patch 057cbb7fa1fc1d67087f767dc4b0275b9e391975
Author: Goetz.Pfeiffer@helmholtz-berlin.de
Date: Mon Jun 27 09:29:32 CEST 2022
* iddb: Change for compatibility with python 3.2.3 (host elbe).
patch 1b457e1b596f50c1601c267966359ae9a119e4d1
Author: Goetz Pfeiffer <Goetz.Pfeiffer@helmholtz-berlin.de>
Date: Mon Jun 27 09:25:01 CEST 2022
* iddb now has a more generic source specification.
The data source is no longer hard-coded in the progrem but can be set by
command line options, an environment variable and a configuration file in the
"share" directory.
The configuration file allows specification of the data source dependent on the
hostname or the domain name.
patch c531b66332997fbefc0b81dc7f35e3994a920b7a
Author: Goetz Pfeiffer <Goetz.Pfeiffer@helmholtz-berlin.de>
Date: Mon Jun 27 09:25:00 CEST 2022
* Bugfix: browsedb.pl didn't parse file "bii_scripts.config" correctly.
Now all environment variables in bii_scripts.config are replaced, not just
variable '$TOP'.
patch 142c1612ad7b84d4503c6aaa45f5e0a80cde8918
Author: Goetz Pfeiffer <Goetz.Pfeiffer@helmholtz-berlin.de>
Date: Mon Jun 27 09:24:58 CEST 2022
* The configuration files are now more generic.
The configuration file may have one of these names:
- config.FULLHOSTNAME
- config.DOMAINNAME
If the configuration file for the current host is not found, the
"install-directory" parameter must be given to the "install.sh" script.
patch 3d2d7e74e66a4fb5e74804c87d46f0f4e74ed72f
Author: Thomas Birke <thomas.birke@helmholtz-berlin.de>
Date: Thu Jun 16 15:04:40 CEST 2022
* added script to "fix" no-alarm-colors in edl files
Originally, we defined a no-alarm-color for edm to use, when a color is set
to be "Alarm Sensitive". This changed the defaut behavior of edm and produced
conflicts with edl files coming from external sources.
Ths script is to fix these issues by setting any color marked as
alarm sensitive to the default NO_ALARM green.
patch 15ef262ca4067247bb68e1fee23ca48a60d380bb
Author: Goetz.Pfeiffer@helmholtz-berlin.de
Date: Mon May 30 17:32:23 CEST 2022
* git-repo-merge.sh: Abort when repos have no common commits.
patch 4435fcfc1f232b518f481910876ce237c7898afa
Author: Goetz.Pfeiffer@helmholtz-berlin.de
Date: Mon May 30 11:29:23 CEST 2022
* Update of the bii_script web page.
patch cf55088ec5eefe650646da8bf6f464f3dbc7a677
Author: Goetz.Pfeiffer@helmholtz-berlin.de
Date: Sun May 29 18:23:27 CEST 2022
* Bugfix: repo-hash.sh didn't wasn't independent of the current working dir.
patch e3be573c04ba1a9d0b44fe1034f8d9f68a3f3096
Author: Goetz.Pfeiffer@helmholtz-berlin.de
Date: Sun May 29 18:01:06 CEST 2022
* repo-hash.sh creates a short hash or hash file for a repository.
patch 06f95d6051d871d94bad2cd8092f65a4fda6e824
Author: Goetz.Pfeiffer@helmholtz-berlin.de
Date: Sun May 29 16:45:33 CEST 2022
* A copyright comment was added to git-repo-merge.sh.
patch c2cd974ad72585c0f440a8705f85070363b1a2cf
Author: Goetz.Pfeiffer@helmholtz-berlin.de
Date: Sat May 28 11:59:16 CEST 2022
* git-repo-merge.sh: Combines patches of two git repositories with a new branch.
patch f394bca8b473883b607d5432375014aa2eccb43e
Author: Goetz.Pfeiffer@helmholtz-berlin.de
Date: Tue May 24 15:29:58 CEST 2022
* config.bullseye.acc was added.
patch 923ab2785a2bfa7997fe490d90f3339fae361374
Author: Goetz.Pfeiffer@helmholtz-berlin.de
Date: Tue May 24 15:23:20 CEST 2022
* iddb: Use gwc1c as XMLRPC server.
patch 5b8b5a0fc097c4fb36aecd92f9dac7848cf5f08e
Author: Ben Franksen <benjamin.franksen@helmholtz-berlin.de>
Date: Tue May 24 10:48:50 CEST 2022
* install.sh: add bullseye to the standard development machines
patch bf531c0d20e4cf2ac8af1afc848633288f31f7e2
Author: Goetz.Pfeiffer@helmholtz-berlin.de
Date: Mon May 16 12:17:56 CEST 2022
* Bugfix: "rsync-dist-info.py -v -b" didnt't print versions no longer in use.
patch c7ece21f8b198fe48a33e09a11fc375168cb2d31
Author: Bernhard.Kuner@bessy.de
Date: Mon Mar 28 14:07:14 CEST 2022
* step.py: Fix pv name parser
patch 5efecc1f633add866526b66ffba00e12e0d723fa
Author: Goetz.Pfeiffer@helmholtz-berlin.de
Date: Fri Mar 25 22:20:17 CET 2022
* camonitor_sort.pl: Support inverse regexp matches.
patch 690bc9f4a8395f530b5317b3bd87bd56f7088bcd
Author: Bernhard.Kuner@bessy.de
Date: Fri Mar 4 10:33:54 CET 2022
* phytronFilterIpPortLog.pl: Shorten message strings, add recoginition of asyn driver failed messages
patch 08ac7d3320e379b1d1cfa265d2dcb08dd3e3d903
Author: Bernhard.Kuner@bessy.de
Date: Thu Mar 3 14:04:19 CET 2022
* phytronFilterIpPortLog.pl: bugfixes, show all phyMotion axis status bits
patch 44067202088d4c19b367c5a3060c57839223222d
Author: Bernhard.Kuner@bessy.de
Date: Wed Mar 2 19:06:26 CET 2022
* phytronFilterIpPortLog.pl: show camonitor data, translate MSTA bits to strings
patch 93f8f162eab92c10e52b319799693d04a5b5a4e7
Author: Goetz.Pfeiffer@helmholtz-berlin.de
Date: Thu Feb 24 15:28:10 CET 2022
* repo-mirror.sh: Allow to specify the .hgrc file.
Since the hggit extension, which is activated in the hgrc file, breaks pulling
repositories by http, hggit is not activated in my personal hgrc file.
For now, the user of repo-mirror.sh can specify a hgrc file at some othet
location which has hggit enabled just for the purpose of mercurial --> git
conversion.
patch 33cf4e4233667525001e3874f42aedfc441d430b
Author: Bernhard.Kuner@bessy.de
Date: Thu Feb 24 10:23:53 CET 2022
* phytronFilterIpPortLog.pl: Fix status output
patch 87cea64c494fea8d1ed3ed87cde9847529d86eb2
Author: Bernhard.Kuner@bessy.de
Date: Wed Feb 23 16:47:37 CET 2022
* phytronFilterIpPoerLog.pl: Translate status to readable string
patch 5e025177314d75e6f1a420dc5c4dc7f76948329b
Author: Bernhard.Kuner@bessy.de
Date: Wed Feb 23 14:53:34 CET 2022
* phytronFilterIpPortLog.pl: Fix match conditio