-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from Semi-ATE/29-issue
29 issue
- Loading branch information
Showing
30 changed files
with
1,344 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,8 @@ __pycache__/ | |
# C extensions | ||
*.so | ||
|
||
*~ | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
|
||
all: | ||
|
||
package: | ||
cp debian/changelog debian/changelog.org | ||
cp debian/control debian/control.org | ||
@sed s/'__DATE_TIME__'/'$(shell date +"%a, %d %b %Y %T %z")'/ debian/changelog > debian/changelog.temp | ||
@sed s/'__VERSION__'/"$(shell cat ver)"/ debian/changelog.temp > debian/changelog | ||
@sed s/'__ARCH__'/"$(shell cat arch)"/ debian/control > debian/control.temp | ||
cp debian/control.temp debian/control | ||
debuild -i -us -uc -b | ||
mv debian/changelog.org debian/changelog | ||
mv debian/control.org debian/control | ||
|
||
clean: | ||
rm -f *.so | ||
rm -f *.o | ||
rm -f *~ | ||
rm -f stil_loader | ||
rm -rf debian/metis-server | ||
rm -rf debian/metis-server.debhelper.log | ||
rm -rf debian/metis-server.substvars | ||
rm -rf debian/.debhelper | ||
rm -rf debian/changelog.temp | ||
rm -rf debian/control.temp | ||
rm -rf debian/files | ||
rm -rf debian/*~ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
amd64 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
metis-server (__VERSION__) stable; urgency=low | ||
|
||
* See changelog file in the github release page. | ||
|
||
-- Velislav-Boyanov <vboy@semi-ate.com> __DATE_TIME__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Source: metis-server | ||
Section: unknown | ||
Priority: optional | ||
Maintainer: Velislav-Boyanov <vboy@semi-ate.com> | ||
Standards-Version: 4.0.0 | ||
Homepage: https://github.com/Semi-ATE/Metis | ||
|
||
Package: metis-server | ||
Architecture: amd64 | ||
Depends: libhdf5-dev, inotify-tools | ||
Description: Metis server. | ||
Server for converting STDF files into hdf5 files. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
metis-server_0.0.1_amd64.buildinfo unknown optional | ||
metis-server_0.0.1_amd64.deb unknown optional |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/sh | ||
# postinst script for cpython | ||
# | ||
# see: dh_installdeb(1) | ||
|
||
set -e | ||
|
||
# summary of how this script can be called: | ||
# * <postinst> `configure' <most-recently-configured-version> | ||
# * <old-postinst> `abort-upgrade' <new version> | ||
# * <conflictor's-postinst> `abort-remove' `in-favour' <package> | ||
# <new-version> | ||
# * <postinst> `abort-remove' | ||
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour' | ||
# <failed-install-package> <version> `removing' | ||
# <conflicting-package> <version> | ||
# for details, see http://www.debian.org/doc/debian-policy/ or | ||
# the debian-policy package | ||
|
||
|
||
case "$1" in | ||
configure) | ||
touch /var/log/metisd.log | ||
chmod 777 /var/log/metisd.log | ||
chmod +x /usr/share/metis/start_metis.sh | ||
;; | ||
esac | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/sh | ||
# postinst script for cpython | ||
# | ||
# see: dh_installdeb(1) | ||
|
||
set -e | ||
|
||
# summary of how this script can be called: | ||
# * <postinst> `configure' <most-recently-configured-version> | ||
# * <old-postinst> `abort-upgrade' <new version> | ||
# * <conflictor's-postinst> `abort-remove' `in-favour' <package> | ||
# <new-version> | ||
# * <postinst> `abort-remove' | ||
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour' | ||
# <failed-install-package> <version> `removing' | ||
# <conflicting-package> <version> | ||
# for details, see http://www.debian.org/doc/debian-policy/ or | ||
# the debian-policy package | ||
|
||
|
||
case "$1" in | ||
upgrade) | ||
rm -rf /usr/share/metis/python/__pycache__ | ||
systemctl stop metis | ||
systemctl disable metis | ||
;; | ||
esac | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/make -f | ||
#DH_VERBOSE = 1 | ||
|
||
clean: | ||
make clean | ||
|
||
build: | ||
make all | ||
|
||
binary: | ||
mkdir -p debian/metis-server/etc/systemd/system | ||
mkdir -p debian/metis-server/usr/share/metis/python | ||
cp metisd.yaml debian/metis-server/etc | ||
cp sinotify.py debian/metis-server/usr/share/metis | ||
cp systemd/start_metis.sh debian/metis-server/usr/share/metis | ||
cp systemd/metis.service debian/metis-server/etc/systemd/system | ||
cp -a python/. debian/metis-server/usr/share/metis/python | ||
dh_gencontrol | ||
dh_installdeb | ||
dh_builddeb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
metis: | ||
paths: | ||
main-daemon-path: "/mnt/stdf" | ||
write-path: "/tmp/" | ||
pid-path: "/tmp/metisd.pid" | ||
log: | ||
logging: 1 # 0=>logging off, 1=>logging on | ||
log-path: "/var/log/metisd.log" | ||
log-level: "INFO" # "INFO" "WARNING" "ERROR" "DEBUG" "CRITICAL" "NOTSET" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import os | ||
import sys | ||
import logging | ||
from yaml import safe_load | ||
|
||
file_loc = os.path.dirname(__file__) | ||
test_loc = os.path.join(file_loc, "../../tests/test_metisd.yaml") | ||
|
||
class MetisConfig(): | ||
|
||
def __init__(self): | ||
|
||
self.config = self.load_config() | ||
|
||
if self.config['metis']['log']['logging'] == True: | ||
loglevel = self.config['metis']['log']['log-level'] | ||
numeric_level = getattr(logging, loglevel.upper(), None) | ||
log_path = self.config['metis']['log']['log-path'] | ||
logging.basicConfig(filename=log_path, filemode='a', level=numeric_level) | ||
|
||
def load_config(self): | ||
"""Loads yaml file""" | ||
try: | ||
# In the case of normal deamon mode: | ||
with open("/etc/metisd.yaml", "r") as f: | ||
config_data = safe_load(f) | ||
return config_data | ||
except: | ||
# In the case of test mode: | ||
try: | ||
with open(test_loc, "r") as f: | ||
config_data = safe_load(f) | ||
return config_data | ||
except Exception as e: | ||
error = f'Could not open config file, {e}.' | ||
sys.exit(error) | ||
os._exit | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
""" | ||
Created on Wed Jan 26 17:22:18 2022 | ||
@author: nz | ||
""" | ||
|
||
|
||
import gi | ||
|
||
gi.require_version("Gst", "1.0") | ||
gi.require_version('GstBase', '1.0') | ||
|
||
from gi.repository import Gst, GObject, GstBase | ||
Gst.init(None) | ||
|
||
|
||
class metis_process(GstBase.BaseTransform): | ||
__gstmetadata__ = ("Process plugin", | ||
"Transform", | ||
"Process stdf content if required", | ||
"vboy") | ||
|
||
__gsttemplates__ = (Gst.PadTemplate.new("src", | ||
Gst.PadDirection.SRC, | ||
Gst.PadPresence.ALWAYS, | ||
Gst.Caps.new_any()), | ||
Gst.PadTemplate.new("sink", | ||
Gst.PadDirection.SINK, | ||
Gst.PadPresence.ALWAYS, | ||
Gst.Caps.new_any())) | ||
|
||
|
||
def __init__(self): | ||
GstBase.BaseTransform.__init__(self) | ||
# self.max_needed_buffer_size = 65536 | ||
#super().set_blocksize(self.max_needed_buffer_size) | ||
|
||
def do_set_property(self, prop, value): | ||
if prop.name == 'in_file': | ||
self.in_file = value | ||
|
||
def do_start(self): | ||
print("Metis process plugin started") | ||
return True | ||
|
||
#Passthrough mode | ||
#Element has no interest in modifying the buffer. | ||
#It may want to inspect it, in which case the element should have a transform_ip function. | ||
#If there is no transform_ip function in passthrough mode, the buffer is pushed intact. | ||
def do_transform_ip(self, buf): | ||
pass | ||
#def do_transform(self, inbuf, outbuf): | ||
# print("Sending.") | ||
#try: | ||
#buf.memset(0, 0, self.max_needed_buffer_size) | ||
#with buf.map(Gst.MapFlags.READ) as info: | ||
# buffer = info.data.copy() | ||
# print("dasd") | ||
|
||
#except Exception as e: | ||
# Gst.error("Mapping error: %s" % e) | ||
# return Gst.FlowReturn.ERROR | ||
|
||
return (Gst.FlowReturn.OK, buf) | ||
|
||
|
||
# Register plugin to use it from command line | ||
GObject.type_register(metis_process) | ||
__gstelementfactory__ = ("metis_process", Gst.Rank.NONE, metis_process) |
Oops, something went wrong.