update
Some checks are pending
Setup Native Action / native (3.12.7) (push) Waiting to run
Setup Native Action / docker (3.12.7) (push) Waiting to run

This commit is contained in:
KaySar12 2025-03-25 13:37:00 +07:00
parent 857dffc58f
commit c2f10038b5

View File

@ -12,7 +12,7 @@ import tempfile
import textwrap
import time
import traceback
import stat
from pathlib import Path
from xmlrpc import client as xmlrpclib
@ -36,17 +36,26 @@ GPGID = os.getenv("GPGID")
DOCKERVERSION = VERSION.replace("+", "")
INSTALL_TIMEOUT = 600
DOCKERUSER = """
RUN mkdir /var/lib/odoo && \
groupadd -g %(group_id)s odoo && \
useradd -u %(user_id)s -g odoo odoo -d /var/lib/odoo && \
mkdir /data && \
chown odoo:odoo /var/lib/odoo /data
USER odoo
""" % {
"group_id": os.getgid(),
"user_id": os.getuid(),
}
if os.getuid() == 0:
DOCKERUSER = """
RUN mkdir -p /var/lib/odoo /data && \
groupadd -r odoo && \
useradd -m -d /var/lib/odoo -s /bin/bash -g odoo odoo && \
chown odoo:odoo /var/lib/odoo /data
USER odoo
"""
else:
DOCKERUSER = """
RUN mkdir /var/lib/odoo && \
groupadd -g %(group_id)s odoo && \
useradd -u %(user_id)s -g odoo odoo -d /var/lib/odoo && \
mkdir /data && \
chown odoo:odoo /var/lib/odoo /data
USER odoo
""" % {
"group_id": os.getgid(),
"user_id": os.getuid(),
}
class OdooTestTimeoutError(Exception):
@ -202,6 +211,13 @@ def rpm_sign(args, file_name):
rpmsign.expect(pexpect.EOF)
def _set_permissions(path):
uid = os.getuid() # Get current user ID
gid = os.getgid() # Get current group ID
os.chown(path, uid, gid) # Set ownership
os.chmod(path, stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) # Set full permissions
def _prepare_build_dir(args, win32=False, move_addons=True):
"""Copy files to the build directory"""
logging.info('Preparing build dir "%s"', args.build_dir)
@ -254,6 +270,8 @@ def _prepare_build_dir(args, win32=False, move_addons=True):
logging.warning(
"Cannot remove '{}': {}".format(addon_path, rm_error)
)
logging.info(f"Setting full permisson to {args.build_dir}")
_set_permissions(args.build_dir)
# Docker stuffs