SHA256
Compare commits
2
Commits
da2d80592c
...
958c37d7ce
| Author | SHA256 | Date | |
|---|---|---|---|
|
|
958c37d7ce | ||
|
|
bc0324f474 |
No files matched your search
Executable → Regular
+1
-1
@@ -10,4 +10,4 @@ BBFILE_PATTERN_meta-openplc = "^${LAYERDIR}/"
|
|||||||
BBFILE_PRIORITY_meta-openplc = "6"
|
BBFILE_PRIORITY_meta-openplc = "6"
|
||||||
|
|
||||||
LAYERDEPENDS_meta-openplc = "core"
|
LAYERDEPENDS_meta-openplc = "core"
|
||||||
LAYERSERIES_COMPAT_meta-openplc = "walnascar whinlatter"
|
LAYERSERIES_COMPAT_meta-openplc = "walnascar whinlatter wrynose"
|
||||||
@@ -129,3 +129,29 @@ index 4b5b633..f8bfba7 100755
|
|||||||
|
|
||||||
echo "Dependencies installed..."
|
echo "Dependencies installed..."
|
||||||
echo "Virtual environment created at $VENV_DIR"
|
echo "Virtual environment created at $VENV_DIR"
|
||||||
|
diff --git a/scripts/manage_plugin_venvs.sh b/scripts/manage_plugin_venvs.sh
|
||||||
|
index 2069e14..6c8ea9e 100755
|
||||||
|
--- a/scripts/manage_plugin_venvs.sh
|
||||||
|
+++ b/scripts/manage_plugin_venvs.sh
|
||||||
|
@@ -97,7 +97,7 @@ create_plugin_venv() {
|
||||||
|
log_info "MSYS2 detected: using --system-site-packages for pre-built package access"
|
||||||
|
python3 -m venv --system-site-packages "$venv_path"
|
||||||
|
else
|
||||||
|
- python3 -m venv "$venv_path"
|
||||||
|
+ python3 -m venv --system-site-packages "$venv_path"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Upgrade pip
|
||||||
|
diff --git a/start_openplc.sh b/start_openplc.sh
|
||||||
|
index af80f51..2ee5449 100755
|
||||||
|
--- a/start_openplc.sh
|
||||||
|
+++ b/start_openplc.sh
|
||||||
|
@@ -86,7 +86,7 @@ setup_runtime_venv() {
|
||||||
|
log_info "Runtime virtual environment already exists."
|
||||||
|
else
|
||||||
|
log_info "Creating runtime virtual environment..."
|
||||||
|
- python3 -m venv "$VENV_DIR"
|
||||||
|
+ python3 -m venv --system-site-packages "$VENV_DIR"
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
log_error "Failed to create runtime virtual environment."
|
||||||
|
exit 1
|
||||||
@@ -13,3 +13,4 @@ ExecStart=/openplc/start_openplc.sh
|
|||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
After=rt.service
|
||||||
Executable → Regular
+408
-61
@@ -2,11 +2,10 @@ SUMMARY = "This recipe will automatically install the OpenPLC Runtime Environmen
|
|||||||
HOMEPAGE = "https://autonomylogic.com/"
|
HOMEPAGE = "https://autonomylogic.com/"
|
||||||
LICENSE = "MIT"
|
LICENSE = "MIT"
|
||||||
|
|
||||||
#SRC_URI:append = "file://sdaglue.service"
|
|
||||||
SRC_URI:append = "git://github.com/Autonomy-Logic/openplc-runtime.git;protocol=https;branch=main \
|
SRC_URI:append = "git://github.com/Autonomy-Logic/openplc-runtime.git;protocol=https;branch=main \
|
||||||
file://openplc.service \
|
file://openplc-runtime.service \
|
||||||
file://fake_root.patch \
|
file://fake_root.patch \
|
||||||
"
|
"
|
||||||
SRCREV = "cd9825b703f17c0d5db2fc99c5454f3cf822f3b3"
|
SRCREV = "cd9825b703f17c0d5db2fc99c5454f3cf822f3b3"
|
||||||
|
|
||||||
LIC_FILES_CHKSUM = "file://LICENSE;md5=1e9650a938047d709b897ea200cd0a71"
|
LIC_FILES_CHKSUM = "file://LICENSE;md5=1e9650a938047d709b897ea200cd0a71"
|
||||||
@@ -14,8 +13,9 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=1e9650a938047d709b897ea200cd0a71"
|
|||||||
#UNPACKDIR = "${D}/openplc"
|
#UNPACKDIR = "${D}/openplc"
|
||||||
#WORKDIR = "${D}/openplc"
|
#WORKDIR = "${D}/openplc"
|
||||||
OPENPLC_USER = "plc"
|
OPENPLC_USER = "plc"
|
||||||
|
#S = "${UNPACKDIR}/git"
|
||||||
|
|
||||||
inherit systemd cmake pkgconfig
|
inherit systemd cmake pkgconfig setuptools3
|
||||||
|
|
||||||
#do_configure:prepend() {
|
#do_configure:prepend() {
|
||||||
#rm -rf ${S}/*
|
#rm -rf ${S}/*
|
||||||
@@ -28,71 +28,410 @@ do_install[network] = "1"
|
|||||||
INHIBIT_PACKAGE_STRIP = "1"
|
INHIBIT_PACKAGE_STRIP = "1"
|
||||||
PACKAGE_STRIP = "no"
|
PACKAGE_STRIP = "no"
|
||||||
INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
|
INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
|
||||||
do_install() {
|
HAS_SYSTEMD = "${@bb.utils.contains('DISTRO_FEATURES','systemd','1','',d)}"
|
||||||
mkdir -p ${D}/openplc
|
|
||||||
#chown ${OPENPLC_USER} ${D}/openplc
|
#######################################################
|
||||||
#TODO make this more granular. openplc depends on some files from the source to be present on the final system, but surely not all of them.
|
# Colors for output
|
||||||
#cp -r ${S}/* ${D}/openplc
|
RED = '\033[0;31m'
|
||||||
#find ${S}/* -type f -exec install -Dm 755 -o ${OPENPLC_USER} "{}" "${D}/openplc/{}" \;
|
GREEN = '\033[0;32m'
|
||||||
export tmppwd=${PWD}
|
YELLOW = '\033[1;33m'
|
||||||
#cd ${S}
|
BLUE = '\033[0;34m'
|
||||||
#find ./ -type f -exec install -Dm 755 "{}" "${D}/openplc/{}" \;
|
NC = '\033[0m'
|
||||||
#cd $tmppwd
|
|
||||||
#cd ${D}/openplc
|
# Helper functions
|
||||||
#chroot ${D}
|
#log_info() {
|
||||||
export D="${D}/openplc"
|
# echo -e "${BLUE}[INFO]${NC} $1"
|
||||||
export TGTPY=$(find ${D}/../../../python3 -type l -wholename */image${PYTHON} -executable)
|
#}
|
||||||
echo "find ${B}/python3 -type l -wholename */image${PYTHON} -executable)"
|
|
||||||
#export PYDIR="${STAGING_LIBDIR}"
|
#log_success() {
|
||||||
#mkdir ${D}/openplc
|
# echo -e "${GREEN}[SUCCESS]${NC} $1"
|
||||||
#${D}/openplc/install.sh
|
#}
|
||||||
#/openplc/install.sh
|
|
||||||
#exit
|
#log_warning() {
|
||||||
#cd $tmppwd
|
# echo -e "${YELLOW}[WARNING]${NC} $1"
|
||||||
|
#}
|
||||||
|
|
||||||
|
#log_error() {
|
||||||
|
# echo -e "${RED}[ERROR]${NC} $1"
|
||||||
|
#}
|
||||||
|
|
||||||
|
install_systemd_service() {
|
||||||
|
service_file="$ROOT_DIR/etc/systemd/system/openplc-runtime.service"
|
||||||
|
|
||||||
|
#log_info "Installing OpenPLC Runtime systemd service..."
|
||||||
|
|
||||||
|
# Create the service file
|
||||||
|
cat > "$service_file" <<EOF
|
||||||
|
[Unit]
|
||||||
|
Description=OpenPLC Runtime v4 Service
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
Restart=always
|
||||||
|
RestartSec=5
|
||||||
|
User=root
|
||||||
|
Group=root
|
||||||
|
WorkingDirectory=$OPENPLC_DIR
|
||||||
|
ExecStart=$OPENPLC_DIR/start_openplc.sh
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Reload systemd daemon to recognize the new service
|
||||||
|
# systemctl daemon-reload
|
||||||
|
|
||||||
|
# Enable and start the service
|
||||||
|
# #log_info "Enabling and starting OpenPLC Runtime service..."
|
||||||
|
# systemctl enable --now openplc-runtime.service
|
||||||
|
|
||||||
|
# #log_success "OpenPLC Runtime service installed and started"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
${S}/install.sh
|
# Function to setup plugin virtual environments
|
||||||
#grep -rlw ${S}/venvs -e "${S}" | xargs sed -i -e "s|${S}|/|g"
|
#setup_plugin_venvs() {
|
||||||
|
# plugins_dir="$OPENPLC_DIR/core/src/drivers/plugins/python"
|
||||||
|
# manage_script="$OPENPLC_DIR/scripts/manage_plugin_venvs.sh"
|
||||||
|
|
||||||
cp ${S}/start_openplc.sh ${D}/openplc
|
# #log_info "Checking for plugins that need virtual environments..."
|
||||||
#cp -r ${S}/venvs ${D}/openplc #bitbake seems to have a problem with either stripping these files out or giving incorrect ownership
|
|
||||||
#rm -rf ${D}/openplc/venvs/opcua
|
|
||||||
#rm -rf "${D}/openplc/venvs/runtime/lib/python3.12/site-packages/greenlet"
|
|
||||||
#rm -rf "${D}/openplc/venvs/runtime/lib/python3.12/site-packages/sqlalchemy"
|
|
||||||
|
|
||||||
cp -r ${S}/scripts ${D}/openplc
|
# # Check if plugins directory exists
|
||||||
cp -r ${S}/webserver ${D}/openplc
|
# if [ ! -d "$plugins_dir" ]; then
|
||||||
mkdir -p ${D}/openplc/build/
|
# #log_warning "Plugins directory not found: $plugins_dir"
|
||||||
cp ${S}/build/plc_main ${D}/openplc/build
|
# return 0
|
||||||
cp -r ${S}/build/plugins ${D}/openplc/build
|
# fi
|
||||||
|
# # Find directories with requirements.txt for all plugins (regardless of enabled status)
|
||||||
|
# plugins_with_requirements=()
|
||||||
|
# #:
|
||||||
|
# # ln -s /proc/self/fd /dev/fd
|
||||||
|
# find "$plugins_dir" -name "requirements.txt" -type f |
|
||||||
|
# while IFS= read -r -d '' requirements_file
|
||||||
|
# do
|
||||||
|
# # Get the directory name (plugin name)
|
||||||
|
# plugin_dir=$(dirname "$requirements_file")
|
||||||
|
# plugin_name=$(basename "$plugin_dir")
|
||||||
|
|
||||||
|
# # Skip if it's in examples or shared directories (common libraries)
|
||||||
|
# if [[ "$plugin_dir" == *"/examples/"* ]] || [[ "$plugin_dir" == *"/shared/"* ]]; then
|
||||||
|
# #log_info "Skipping $plugin_name (in examples/shared directory)"
|
||||||
|
# continue
|
||||||
|
# fi
|
||||||
|
|
||||||
|
# # echo ${#plugins_with_requirements[@]}
|
||||||
|
# plugins_with_requirements+=("$plugin_name")
|
||||||
|
# # echo ${#plugins_with_requirements[@]}
|
||||||
|
# #log_info "Found plugin with requirements: $plugin_name"
|
||||||
|
# done
|
||||||
|
# #done
|
||||||
|
# #rm tmp
|
||||||
|
# #echo ${#plugins_with_requirements[@]}
|
||||||
|
|
||||||
|
# # If no plugins found, return
|
||||||
|
# if [ ${#plugins_with_requirements[@]} -eq 0 ]; then
|
||||||
|
# #log_info "No plugins with requirements.txt found"
|
||||||
|
# return 0
|
||||||
|
# fi
|
||||||
|
|
||||||
|
# #log_info "Found ${#plugins_with_requirements[@]} plugin(s) that need virtual environments"
|
||||||
|
|
||||||
|
# # Create virtual environments for each plugin
|
||||||
|
# for plugin_name in "${plugins_with_requirements[@]}"; do
|
||||||
|
# venv_path="$OPENPLC_DIR/venvs/$plugin_name"
|
||||||
|
# requirements_file="$plugins_dir/$plugin_name/requirements.txt"
|
||||||
|
|
||||||
|
# if [ -d "$venv_path" ]; then
|
||||||
|
# #log_info "Virtual environment already exists for $plugin_name"
|
||||||
|
|
||||||
|
# # Check if requirements.txt is newer than the venv (dependencies may have changed)
|
||||||
|
# if [ "$requirements_file" -nt "$venv_path" ]; then
|
||||||
|
# #log_warning "Requirements file is newer than venv for $plugin_name"
|
||||||
|
# #log_info "Updating dependencies for $plugin_name..."
|
||||||
|
|
||||||
|
# if bash "$manage_script" install "$plugin_name"; then
|
||||||
|
# #log_success "Dependencies updated for $plugin_name"
|
||||||
|
# else
|
||||||
|
# #log_error "Failed to update dependencies for $plugin_name"
|
||||||
|
# return 1
|
||||||
|
# fi
|
||||||
|
# else
|
||||||
|
# #log_info "Dependencies are up to date for $plugin_name"
|
||||||
|
# fi
|
||||||
|
# else
|
||||||
|
# #log_info "Creating virtual environment for plugin: $plugin_name"
|
||||||
|
|
||||||
|
# if bash "$manage_script" create "$plugin_name"; then
|
||||||
|
# #log_success "Virtual environment created for $plugin_name"
|
||||||
|
# else
|
||||||
|
# #log_error "Failed to create virtual environment for $plugin_name"
|
||||||
|
# return 1
|
||||||
|
# fi
|
||||||
|
# fi
|
||||||
|
# done
|
||||||
|
|
||||||
|
# #log_success "All plugin virtual environments are ready"
|
||||||
|
# return 0
|
||||||
|
#}
|
||||||
|
#
|
||||||
|
# Function to build native plugins that have CMakeLists.txt
|
||||||
|
|
||||||
|
do_configure:prepend() {
|
||||||
|
cat > ${S}/setup.py <<-EOF
|
||||||
|
from setuptools import setup
|
||||||
|
|
||||||
|
setup(
|
||||||
|
name="${PYPI_PACKAGE}",
|
||||||
|
version="${PV}",
|
||||||
|
license="${LICENSE}",
|
||||||
|
)
|
||||||
|
EOF
|
||||||
|
|
||||||
|
###############################################################################################################################################
|
||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
|
||||||
#cp -r ${S}/* ${D}/openplc
|
# Detect the project root directory
|
||||||
#${D}/openplc/install.sh
|
# This works whether the script is called from project root, Docker, or anywhere else
|
||||||
|
#SCRIPT_DIR=$(cd $(dirname ${BASH_SOURCE[0]}) && pwd)
|
||||||
|
SCRIPT_DIR=${S}
|
||||||
|
OPENPLC_DIR=${S}
|
||||||
|
VENV_DIR=$OPENPLC_DIR/venvs/runtime
|
||||||
|
SCRIPTS_DIR=$OPENPLC_DIR/scripts
|
||||||
|
ROOT_DIR=${D}
|
||||||
|
|
||||||
rm -rf ${D}/var
|
|
||||||
|
|
||||||
find ${D} -name *.pyc -delete
|
# Ensure we're in the project directory
|
||||||
#find ${D}/openplc/venvs -name python3 -delete #should hopefully only kil symlinks
|
cd $OPENPLC_DIR
|
||||||
#grep -rlw ${D}/openplc/venvs -e "${D}" | xargs sed -i -e "s|${D}|/|g"
|
|
||||||
#grep -rlw ${D}/openplc -e ${TMPDIR} | xargs sed -i -e "s|${TMPDIR}|/tmp|g" #this should maybe pipe to rm -f instead?
|
echo "OpenPLC Runtime Installation"
|
||||||
install -d ${D}${systemd_system_unitdir}
|
echo "Project directory: $OPENPLC_DIR"
|
||||||
install -m 0755 ${UNPACKDIR}/openplc.service ${D}${systemd_system_unitdir}/openplc.service
|
echo "Working directory: $(pwd)"
|
||||||
|
echo "Simulated Root directory: $ROOT_DIR"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Setup runtime directory (needed for both Linux and Docker)
|
||||||
|
mkdir -p $ROOT_DIR/var/run/runtime
|
||||||
|
chmod 775 $ROOT_DIR/var/run/runtime 2>/dev/null || true # Ignore permission errors in Docker
|
||||||
|
|
||||||
|
# Create persistent data directory for native Linux installs
|
||||||
|
# This directory stores .env and database files that must survive reboot
|
||||||
|
# In Docker, /var/run/runtime is mounted as a persistent volume instead
|
||||||
|
if [ HAS_SYSTEMD ]; then
|
||||||
|
mkdir -p $ROOT_DIR/var/lib/openplc-runtime
|
||||||
|
chmod 755 $ROOT_DIR/var/lib/openplc-runtime
|
||||||
|
#log_info "Created persistent data directory at /var/lib/openplc-runtime"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Make scripts executable
|
||||||
|
chmod +x "$OPENPLC_DIR/install.sh" 2>/dev/null || true
|
||||||
|
chmod +x "$OPENPLC_DIR/scripts/"* 2>/dev/null || true
|
||||||
|
chmod +x "$OPENPLC_DIR/start_openplc.sh" 2>/dev/null || true
|
||||||
|
|
||||||
|
#python3 -m venv "$VENV_DIR"
|
||||||
|
#./cross-venv/bin/cross-python3 -m venv "$VENV_DIR"
|
||||||
|
#"$VENV_DIR/bin/python3" -m pip install --upgrade pip setuptools wheel
|
||||||
|
#"$VENV_DIR/bin/python3" -m pip install -r "$OPENPLC_DIR/requirements.txt"
|
||||||
|
#"$VENV_DIR/bin/python3" -m pip install -e .
|
||||||
|
#python3 -m pip install --upgrade pip setuptools wheel
|
||||||
|
#python3 -m pip install -r "$OPENPLC_DIR/requirements.txt"
|
||||||
|
#python3 -m pip install -e .
|
||||||
|
|
||||||
|
#echo "Dependencies installed..."
|
||||||
|
#echo "Virtual environment created at $VENV_DIR"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
compile_plc() {
|
||||||
|
echo "Preparing build directory..."
|
||||||
|
|
||||||
|
# Always clean build directory for Docker environment or when CMake cache exists
|
||||||
|
# This prevents cross-contamination between Linux and Docker builds
|
||||||
|
if [ -d $OPENPLC_DIR/build ] && [ -f $OPENPLC_DIR/build/CMakeCache.txt ]; then
|
||||||
|
echo "Cleaning existing build directory to ensure clean build..."
|
||||||
|
rm -rf $OPENPLC_DIR/build
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create build directory
|
||||||
|
if ! mkdir -p $OPENPLC_DIR/build; then
|
||||||
|
echo "ERROR: Failed to create build directory" >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd $OPENPLC_DIR/build
|
||||||
|
echo "Running cmake configuration..."
|
||||||
|
if ! cmake ..; then
|
||||||
|
echo "ERROR: CMake configuration failed" >&2
|
||||||
|
cd $OPENPLC_DIR
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Compiling with make (using $(nproc) cores)..."
|
||||||
|
if ! make -j"$(nproc)"; then
|
||||||
|
echo "ERROR: Compilation failed" >&2
|
||||||
|
cd $OPENPLC_DIR
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd $OPENPLC_DIR
|
||||||
|
|
||||||
|
echo "SUCCESS: OpenPLC compiled successfully!"
|
||||||
|
}
|
||||||
|
|
||||||
|
build_native_plugins() {
|
||||||
|
native_plugins_dir=$OPENPLC_DIR/core/src/drivers/plugins/native
|
||||||
|
plugins_output_dir=$OPENPLC_DIR/build/plugins
|
||||||
|
|
||||||
|
#log_info "Scanning for native plugins to build..."
|
||||||
|
|
||||||
|
# Check if native plugins directory exists
|
||||||
|
if [ ! -d $native_plugins_dir ]; then
|
||||||
|
#log_warning "Native plugins directory not found: $native_plugins_dir"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create plugins output directory
|
||||||
|
mkdir -p $plugins_output_dir
|
||||||
|
|
||||||
|
# Find directories with CMakeLists.txt (indicates buildable plugin)
|
||||||
|
plugins_found=0
|
||||||
|
plugins_built=0
|
||||||
|
plugins_failed=0
|
||||||
|
|
||||||
|
for plugin_dir in $native_plugins_dir/*/; do
|
||||||
|
# Skip if not a directory
|
||||||
|
[ -d $plugin_dir ] || continue
|
||||||
|
|
||||||
|
plugin_name=$(basename $plugin_dir)
|
||||||
|
cmake_file=$plugin_dir/CMakeLists.txt
|
||||||
|
|
||||||
|
# Skip if no CMakeLists.txt
|
||||||
|
if [ ! -f $cmake_file ]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
plugins_found=1
|
||||||
|
#$((plugins_found + 1))
|
||||||
|
#log_info "Found native plugin: $plugin_name"
|
||||||
|
|
||||||
|
# Create build directory for this plugin
|
||||||
|
plugin_build_dir=$plugin_dir/build
|
||||||
|
|
||||||
|
# Clean existing build directory
|
||||||
|
if [ -d $plugin_build_dir ]; then
|
||||||
|
#log_info "Cleaning existing build directory for $plugin_name..."
|
||||||
|
rm -rf $plugin_build_dir
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p $plugin_build_dir
|
||||||
|
|
||||||
|
# Build the plugin
|
||||||
|
#log_info "Building $plugin_name..."
|
||||||
|
cd $plugin_build_dir
|
||||||
|
# Configure with cmake, passing OpenPLC root directory
|
||||||
|
cmake -DOPENPLC_ROOT=$OPENPLC_DIR ..
|
||||||
|
# Build with make
|
||||||
|
make -j"$(nproc)"
|
||||||
|
|
||||||
|
# Copy built plugin to central plugins directory
|
||||||
|
built_lib=$(find $plugin_build_dir -name "*.so" -type f 2>/dev/null | head -1)
|
||||||
|
if [ -n $built_lib ] && [ -f $built_lib ]; then
|
||||||
|
cp $built_lib $plugins_output_dir
|
||||||
|
#log_success "Built and installed: $plugin_name ($(basename "$built_lib"))"
|
||||||
|
plugins_built=1
|
||||||
|
#$((plugins_built + 1))
|
||||||
|
else
|
||||||
|
#log_warning "No .so file found after building $plugin_name"
|
||||||
|
plugins_failed=1
|
||||||
|
#$((plugins_failed + 1))
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
do_configure:append() {
|
||||||
|
#setup_plugin_venvs
|
||||||
|
|
||||||
|
echo "Compiling OpenPLC..."
|
||||||
|
if compile_plc; then
|
||||||
|
echo "Build process completed successfully!"
|
||||||
|
|
||||||
|
# Build native plugins after main compilation
|
||||||
|
echo "Building native plugins..."
|
||||||
|
build_native_plugins
|
||||||
|
|
||||||
|
# Create installation marker (must be done before starting the service)
|
||||||
|
touch "$OPENPLC_DIR/.installed"
|
||||||
|
echo "Installation completed at $(date)" > "$OPENPLC_DIR/.installed"
|
||||||
|
|
||||||
|
# Check if systemd is available and install the service
|
||||||
|
SYSTEMD_SERVICE_INSTALLED=0
|
||||||
|
if [ HAS_SYSTEMD ]; then
|
||||||
|
#log_info "Systemd detected. Installing OpenPLC Runtime service..."
|
||||||
|
if install_systemd_service; then
|
||||||
|
SYSTEMD_SERVICE_INSTALLED=1
|
||||||
|
#log_warning "Failed to install systemd service. You can start the runtime manually."
|
||||||
|
fi
|
||||||
|
#log_info "Systemd not available. Skipping service installation."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
###################################################################################################################################################################################
|
||||||
|
do_install:append() {
|
||||||
|
mkdir -p ${D}/openplc
|
||||||
|
#TODO make this more granular. openplc depends on some files from the source to be present on the final system, but surely not all of them.
|
||||||
|
export tmppwd=${PWD}
|
||||||
|
# export D="${D}/openplc"
|
||||||
|
|
||||||
|
|
||||||
|
#bash ${S}/install.sh
|
||||||
|
|
||||||
|
cp ${S}/start_openplc.sh ${D}/openplc
|
||||||
|
#cp -r ${S}/venvs ${D}/openplc #bitbake seems to have a problem with either stripping these files out or giving incorrect ownership
|
||||||
|
#rm -rf ${D}/openplc/venvs/opcua
|
||||||
|
#rm -rf "${D}/openplc/venvs/runtime/lib/python3.12/site-packages/greenlet"
|
||||||
|
#rm -rf "${D}/openplc/venvs/runtime/lib/python3.12/site-packages/sqlalchemy"
|
||||||
|
|
||||||
|
cp -r ${S}/scripts ${D}/openplc
|
||||||
|
cp -r ${S}/webserver ${D}/openplc
|
||||||
|
mkdir -p ${D}/openplc/build/
|
||||||
|
cp ${S}/build/plc_main ${D}/openplc/build
|
||||||
|
cp -r ${S}/build/plugins ${D}/openplc/build
|
||||||
|
cp -r ${S}/core ${D}/openplc
|
||||||
|
cp ${S}/.installed ${D}/openplc
|
||||||
|
cp ${S}/plugins.conf ${D}/openplc
|
||||||
|
|
||||||
|
|
||||||
|
find ${D}/openplc/ -wholename "*CMake*" -delete
|
||||||
|
find ${D}/openplc/ -name "Makefile" -delete
|
||||||
|
grep -rlw ${D} -e "${S}" | xargs sed -i -e "s|${S}|/openplc|g"
|
||||||
|
#grep -rlw ${D} -e "${D}" | xargs sed -i -e "s|${D}|/openplc|g"
|
||||||
|
#grep -rlw ${D} -e ${TMPDIR} | xargs rm -f
|
||||||
|
grep -rlw ${D} -e ${TMPDIR} | xargs sed -i -e "s|${TMPDIR}|/tmp_dir|g"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
rm -rf ${D}/var
|
||||||
|
rm -rf ${D}/usr/
|
||||||
|
|
||||||
|
find ${D} -name *.pyc -delete
|
||||||
|
#find ${D}/openplc/venvs -name python3 -delete #should hopefully only kil symlinks
|
||||||
|
#grep -rlw ${D}/openplc/venvs -e "${D}" | xargs sed -i -e "s|${D}|/|g"
|
||||||
|
#grep -rlw ${D}/openplc -e ${TMPDIR} | xargs sed -i -e "s|${TMPDIR}|/tmp|g" #this should maybe pipe to rm -f instead?
|
||||||
|
install -d ${D}${systemd_system_unitdir}
|
||||||
|
install -m 0755 ${UNPACKDIR}/openplc-runtime.service ${D}${systemd_system_unitdir}/openplc-runtime.service
|
||||||
|
|
||||||
|
#bbwarn "attempting to install service"
|
||||||
|
#${D}${BIN_FILE} service install
|
||||||
|
#bbwarn "attempting to start service"
|
||||||
|
#${D}${BIN_FILE} service start
|
||||||
|
|
||||||
#bbwarn "attempting to install service"
|
|
||||||
#${D}${BIN_FILE} service install
|
|
||||||
#bbwarn "attempting to start service"
|
|
||||||
#${D}${BIN_FILE} service start
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#addtask do_populate_sdk before do_install after do_fetch_sources
|
|
||||||
|
|
||||||
do_package:append() {
|
|
||||||
#the following scrubs all instances of tmpdir from the target files. This will probably break things
|
|
||||||
#os.system('grep -Rnw ${D}/openplc -e ${D} | sed -i -e "s|${D}|/|g"')
|
|
||||||
#os.system('grep -Rnw ${D}/openplc -e ${TMPDIR} | sed -i -e "s|${TMPDIR}|/|g"') #this should maybe pipe to rm -f instead?
|
|
||||||
}
|
|
||||||
|
|
||||||
INHERIT += "extrausers"
|
INHERIT += "extrausers"
|
||||||
EXTRA_USERS_PARAMS += " useradd ${OPENPLC_USER}; \
|
EXTRA_USERS_PARAMS += " useradd ${OPENPLC_USER}; \
|
||||||
@@ -100,18 +439,19 @@ EXTRA_USERS_PARAMS += " useradd ${OPENPLC_USER}; \
|
|||||||
"
|
"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SYSTEMD_PACKAGES = "${@bb.utils.contains('DISTRO_FEATURES','systemd','${PN}','',d)}"
|
SYSTEMD_PACKAGES = "${@bb.utils.contains('DISTRO_FEATURES','systemd','${PN}','',d)}"
|
||||||
SYSTEMD_SERVICE:${PN} = "openplc.service"
|
SYSTEMD_SERVICE:${PN} = "openplc-runtime.service"
|
||||||
SYSTEMD_AUTO_ENABLE:${PN} = "enable"
|
SYSTEMD_AUTO_ENABLE:${PN} = "enable"
|
||||||
|
|
||||||
DEPENDS = "\
|
DEPENDS = "\
|
||||||
python3 \
|
python3 \
|
||||||
python3-pip \
|
python3-pip \
|
||||||
|
python3-setuptools \
|
||||||
|
python3-wheel \
|
||||||
pkgconfig \
|
pkgconfig \
|
||||||
cmake \
|
cmake \
|
||||||
pkgconfig-native \
|
pkgconfig-native \
|
||||||
"
|
"
|
||||||
|
|
||||||
RDEPENDS:${PN} = "\
|
RDEPENDS:${PN} = "\
|
||||||
python3 \
|
python3 \
|
||||||
@@ -140,6 +480,13 @@ RDEPENDS:${PN} = "\
|
|||||||
python3-flask-jwt-extended \
|
python3-flask-jwt-extended \
|
||||||
python3-flask-login \
|
python3-flask-login \
|
||||||
python3-aiomqtt \
|
python3-aiomqtt \
|
||||||
|
python3-flask-socketio \
|
||||||
|
python3-aiofiles \
|
||||||
|
python3-aiosqlite \
|
||||||
|
python3-pyopenssl \
|
||||||
|
python3-dateutil \
|
||||||
|
python3-pytz \
|
||||||
|
python3-sortedcontainers \
|
||||||
bash \
|
bash \
|
||||||
"
|
"
|
||||||
#python3-dev
|
#python3-dev
|
||||||
@@ -152,6 +499,6 @@ FILES:${PN} = "\
|
|||||||
/run/runtime \
|
/run/runtime \
|
||||||
/openplc \
|
/openplc \
|
||||||
/openplc/* \
|
/openplc/* \
|
||||||
${systemd_system_unitdir}/openplc.service \
|
${systemd_system_unitdir}/openplc-runtime.service \
|
||||||
"
|
"
|
||||||
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
|
|
||||||
SUMMARY = "File support for asyncio."
|
|
||||||
HOMEPAGE = "None"
|
|
||||||
AUTHOR = "None <Tin Tvrtkovic <tinchester@gmail.com>>"
|
|
||||||
LICENSE = "Apache-2.0"
|
|
||||||
LIC_FILES_CHKSUM = "file://LICENSE;md5=d2794c0df5b907fdace235a619d80314"
|
|
||||||
|
|
||||||
SRC_URI = "https://files.pythonhosted.org/packages/41/c3/534eac40372d8ee36ef40df62ec129bee4fdb5ad9706e58a29be53b2c970/aiofiles-25.1.0.tar.gz"
|
|
||||||
SRC_URI[md5sum] = "7a92207aab48342239959dc5ccffb81d"
|
|
||||||
SRC_URI[sha256sum] = "a8d728f0a29de45dc521f18f07297428d56992a742f0cd2701ba86e44d23d5b2"
|
|
||||||
|
|
||||||
#S = "${WORKDIR}/aiofiles-25.1.0"
|
|
||||||
|
|
||||||
RDEPENDS_${PN} = ""
|
|
||||||
|
|
||||||
inherit setuptools3
|
|
||||||
@@ -5,12 +5,19 @@ AUTHOR = "None <Amethyst Reese <amethyst@n7.gg>>"
|
|||||||
LICENSE = "MIT"
|
LICENSE = "MIT"
|
||||||
LIC_FILES_CHKSUM = "file://LICENSE;md5=f0c422eaa1f23d09f8203dc0af3e2d54"
|
LIC_FILES_CHKSUM = "file://LICENSE;md5=f0c422eaa1f23d09f8203dc0af3e2d54"
|
||||||
|
|
||||||
SRC_URI = "https://files.pythonhosted.org/packages/4e/8a/64761f4005f17809769d23e518d915db74e6310474e733e3593cfc854ef1/aiosqlite-0.22.1.tar.gz"
|
|
||||||
SRC_URI[md5sum] = "254707dc29315a01a95728d749d13e56"
|
|
||||||
SRC_URI[sha256sum] = "043e0bd78d32888c0a9ca90fc788b38796843360c855a7262a532813133a0650"
|
SRC_URI[sha256sum] = "043e0bd78d32888c0a9ca90fc788b38796843360c855a7262a532813133a0650"
|
||||||
|
SRC_URI[md5sum] = "254707dc29315a01a95728d749d13e56"
|
||||||
|
|
||||||
|
#SRC_URI = "https://files.pythonhosted.org/packages/4e/8a/64761f4005f17809769d23e518d915db74e6310474e733e3593cfc854ef1/aiosqlite-0.22.1.tar.gz"
|
||||||
|
#SRC_URI[md5sum] = "254707dc29315a01a95728d749d13e56"
|
||||||
|
#SRC_URI[sha256sum] = "043e0bd78d32888c0a9ca90fc788b38796843360c855a7262a532813133a0650"
|
||||||
|
|
||||||
#S = "${WORKDIR}/aiosqlite-0.22.1"
|
#S = "${WORKDIR}/aiosqlite-0.22.1"
|
||||||
|
|
||||||
RDEPENDS_${PN} = ""
|
RDEPENDS_${PN} = ""
|
||||||
|
|
||||||
inherit setuptools3
|
|
||||||
|
|
||||||
|
inherit pypi python_flit_core
|
||||||
|
|
||||||
|
RDEPENDS:${PN} = "python3-typing-extensions"
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
|
|
||||||
SUMMARY = "Python wrapper module around the OpenSSL library"
|
|
||||||
HOMEPAGE = "https://pyopenssl.org/"
|
|
||||||
AUTHOR = "The pyOpenSSL developers <cryptography-dev@python.org>"
|
|
||||||
LICENSE = "Apache-2.0"
|
|
||||||
LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"
|
|
||||||
|
|
||||||
SRC_URI = "https://files.pythonhosted.org/packages/80/be/97b83a464498a79103036bc74d1038df4a7ef0e402cfaf4d5e113fb14759/pyopenssl-25.3.0.tar.gz"
|
|
||||||
SRC_URI[md5sum] = "d755732945157fb8ca98c2d66a55755d"
|
|
||||||
SRC_URI[sha256sum] = "c981cb0a3fd84e8602d7afc209522773b94c1c2446a3c710a75b06fe1beae329"
|
|
||||||
|
|
||||||
#S = "${WORKDIR}/pyopenssl-25.3.0"
|
|
||||||
|
|
||||||
RDEPENDS_${PN} = "python3-cryptography"
|
|
||||||
|
|
||||||
inherit setuptools3
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
|
|
||||||
SUMMARY = "Extensions to the standard Python datetime module"
|
|
||||||
HOMEPAGE = "https://github.com/dateutil/dateutil"
|
|
||||||
AUTHOR = "Gustavo Niemeyer <gustavo@niemeyer.net>"
|
|
||||||
LICENSE = "BSD"
|
|
||||||
LIC_FILES_CHKSUM = "file://LICENSE;md5=e3155c7bdc71f66e02678411d2abf996"
|
|
||||||
|
|
||||||
SRC_URI = "https://files.pythonhosted.org/packages/66/c0/0c8b6ad9f17a802ee498c46e004a0eb49bc148f2fd230864601a86dcf6db/python-dateutil-2.9.0.post0.tar.gz"
|
|
||||||
SRC_URI[md5sum] = "81cb6aad924ef40ebfd3d62eaebe47c6"
|
|
||||||
SRC_URI[sha256sum] = "37dd54208da7e1cd875388217d5e00ebd4179249f90fb72437e91a35459a0ad3"
|
|
||||||
|
|
||||||
#S = "${WORKDIR}/python-dateutil-2.9.0.post0"
|
|
||||||
|
|
||||||
RDEPENDS_${PN} = "python3-six"
|
|
||||||
|
|
||||||
inherit setuptools3
|
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
|
||||||
|
SUMMARY = "Python interpreter discovery"
|
||||||
|
HOMEPAGE = "None"
|
||||||
|
AUTHOR = "None <None>"
|
||||||
|
LICENSE = "MIT"
|
||||||
|
LIC_FILES_CHKSUM = "file://LICENSE;md5=11610a9d8fd95649cf8159be12b98cb7"
|
||||||
|
|
||||||
|
SRC_URI = "https://files.pythonhosted.org/packages/ec/67/09765eacf4e44413c4f8943ba5a317fcb9c7b447c3b8b0b7fce7e3090b0b/python_discovery-1.1.1.tar.gz"
|
||||||
|
SRC_URI[md5sum] = "4786572355509f9e5359e443f6e8cd6c"
|
||||||
|
SRC_URI[sha256sum] = "584c08b141c5b7029f206b4e8b78b1a1764b22121e21519b89dec56936e95b0a"
|
||||||
|
|
||||||
|
S = "${UNPACKDIR}/python_discovery-1.1.1"
|
||||||
|
|
||||||
|
RDEPENDS_${PN} = "python3-filelock python3-platformdirs"
|
||||||
|
|
||||||
|
inherit setuptools3
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
|
|
||||||
SUMMARY = "World timezone definitions, modern and historical"
|
|
||||||
HOMEPAGE = "http://pythonhosted.org/pytz"
|
|
||||||
AUTHOR = "Stuart Bishop <stuart@stuartbishop.net>"
|
|
||||||
LICENSE = "MIT"
|
|
||||||
LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=1a67fc46c1b596cce5d21209bbe75999"
|
|
||||||
|
|
||||||
SRC_URI = "https://files.pythonhosted.org/packages/56/db/b8721d71d945e6a8ac63c0fc900b2067181dbb50805958d4d4661cf7d277/pytz-2026.1.post1.tar.gz"
|
|
||||||
SRC_URI[md5sum] = "d805ceb0fe3717e324299865398d70b0"
|
|
||||||
SRC_URI[sha256sum] = "3378dde6a0c3d26719182142c56e60c7f9af7e968076f31aae569d72a0358ee1"
|
|
||||||
|
|
||||||
S = "${UNPACKDIR}/pytz-2026.1.post1"
|
|
||||||
|
|
||||||
RDEPENDS_${PN} = ""
|
|
||||||
|
|
||||||
inherit setuptools3
|
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
SUMMARY = "Simple WebSocket server and client for Python"
|
||||||
|
HOMEPAGE = "https://github.com/miguelgrinberg/simple-websocket"
|
||||||
|
LICENSE = "MIT"
|
||||||
|
LIC_FILES_CHKSUM = "file://LICENSE;md5=9d272c9fe2437531b5bbecf4fcc82e24"
|
||||||
|
|
||||||
|
SRC_URI[sha256sum] = "7939234e7aa067c534abdab3a9ed933ec9ce4691b0713c78acb195560aa52ae4"
|
||||||
|
|
||||||
|
inherit pypi python_setuptools_build_meta ptest-python-pytest
|
||||||
|
|
||||||
|
PYPI_PACKAGE = "simple_websocket"
|
||||||
|
UPSTREAM_CHECK_PYPI_PACKAGE = "${PYPI_PACKAGE}"
|
||||||
|
|
||||||
|
RDEPENDS:${PN} = "python3-wsproto"
|
||||||
|
|
||||||
|
RDEPENDS:${PN}-ptest = "\
|
||||||
|
python3-pytest-cov \
|
||||||
|
python3-wsproto \
|
||||||
|
"
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
|
|
||||||
SUMMARY = "Python 2 and 3 compatibility utilities"
|
|
||||||
HOMEPAGE = "https://github.com/benjaminp/six"
|
|
||||||
AUTHOR = "Benjamin Peterson <benjamin@python.org>"
|
|
||||||
LICENSE = "MIT"
|
|
||||||
LIC_FILES_CHKSUM = "file://LICENSE;md5=e50fab7e9501f3dfc920eafeb24b46ea"
|
|
||||||
|
|
||||||
SRC_URI = "https://files.pythonhosted.org/packages/94/e7/b2c673351809dca68a0e064b6af791aa332cf192da575fd474ed7d6f16a2/six-1.17.0.tar.gz"
|
|
||||||
SRC_URI[md5sum] = "a0387fe15662c71057b4fb2b7aa9056a"
|
|
||||||
SRC_URI[sha256sum] = "ff70335d468e7eb6ec65b95b99d3a2836546063f63acc5171de367e834932a81"
|
|
||||||
|
|
||||||
S = "${UNPACKDIR}/six-1.17.0"
|
|
||||||
|
|
||||||
RDEPENDS_${PN} = ""
|
|
||||||
|
|
||||||
inherit setuptools3
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
|
|
||||||
SUMMARY = "Backported and Experimental Type Hints for Python 3.9+"
|
|
||||||
HOMEPAGE = "None"
|
|
||||||
AUTHOR = "None <"Guido van Rossum, Jukka Lehtosalo, Łukasz Langa, Michael Lee" <levkivskyi@gmail.com>>"
|
|
||||||
LICENSE = "MIT"
|
|
||||||
LIC_FILES_CHKSUM = "file://LICENSE;md5=fcf6b249c2641540219a727f35d8d2c2"
|
|
||||||
|
|
||||||
SRC_URI = "https://files.pythonhosted.org/packages/72/94/1a15dd82efb362ac84269196e94cf00f187f7ed21c242792a923cdb1c61f/typing_extensions-4.15.0.tar.gz"
|
|
||||||
SRC_URI[md5sum] = "079e529d0b271647f3ec2720aee8fc65"
|
|
||||||
SRC_URI[sha256sum] = "0cea48d173cc12fa28ecabc3b837ea3cf6f38c6d1136f85cbaaf598984861466"
|
|
||||||
|
|
||||||
S = "${UNPACKDIR}/typing_extensions-4.15.0"
|
|
||||||
|
|
||||||
RDEPENDS_${PN} = ""
|
|
||||||
|
|
||||||
inherit python_flit_core
|
|
||||||
Reference in new issue
Block a user