[elbe-devel] [PATCH 04/10] elbepack: db: remove project owner
Thomas Weißschuh
thomas.weissschuh at linutronix.de
Fri Feb 28 14:59:15 CET 2025
The user functionality is going away.
Therefore the project owner is pointless now.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
docs/elbe-db.rst | 3 ---
elbepack/commands/db.py | 5 +----
elbepack/db.py | 15 ++-------------
elbepack/projectmanager.py | 4 ++--
4 files changed, 5 insertions(+), 22 deletions(-)
diff --git a/docs/elbe-db.rst b/docs/elbe-db.rst
index dcdbd5b25e7983be9549155444bfcd094ad8ec70..7895c7f575aee0aee1d69a4d074d8575cba3b52c 100644
--- a/docs/elbe-db.rst
+++ b/docs/elbe-db.rst
@@ -32,9 +32,6 @@ OPTIONS
-h, --help
Displays help.
---user
- User name of the project owner.
-
--clean
Deletes the target and chroot directory in <project-dir>.
diff --git a/elbepack/commands/db.py b/elbepack/commands/db.py
index a527463f4aff281b22b75dd228bb4d835fa7e977..59cdfac919b00dc8d08566209cdb70c9f2e23da6 100644
--- a/elbepack/commands/db.py
+++ b/elbepack/commands/db.py
@@ -24,13 +24,10 @@ def _list_projects(args):
print(f'{p.builddir}: {p.name} [{p.version}] {p.edit}')
- at add_argument('--user', dest='user',
- help='user name of the designated project owner')
@add_argument('project_dir')
def _create_project(args):
db = ElbeDB()
- owner_id = db.get_user_id(args.user)
- db.create_project(args.project_dir, owner_id)
+ db.create_project(args.project_dir)
@add_argument('project_dir')
diff --git a/elbepack/db.py b/elbepack/db.py
index 0baa57faac24a11bc70f1f01b3117fd372a44d33..701c5d839fe1b2f7dc0828fef7aa2cdbbc2157f4 100644
--- a/elbepack/db.py
+++ b/elbepack/db.py
@@ -176,7 +176,7 @@ class ElbeDB:
# TODO what about source.xml ? stored always in db ? version management ?
# build/needs_build state ? locking ?
- def create_project(self, builddir, owner_id=None):
+ def create_project(self, builddir):
# Throws: ElbeDBError, OSError
directory_created = False
@@ -196,8 +196,7 @@ class ElbeDB:
f'project directory {builddir} already exists')
raise
- p = Project(builddir=builddir, status='empty_project',
- owner_id=owner_id)
+ p = Project(builddir=builddir, status='empty_project')
s.add(p)
except BaseException:
# If we have created a project directory but could not add the
@@ -551,15 +550,6 @@ class ElbeDB:
# Everything good, now return the user id to the caller
return int(u.id)
- def get_user_id(self, name):
- with session_scope(self.session) as s:
- try:
- u = s.query(User).filter(User.name == name).one()
- except NoResultFound:
- raise ElbeDBError(f'no user with name {name}')
-
- return int(u.id)
-
@classmethod
def init_db(cls, name, fullname, password, email):
@@ -600,7 +590,6 @@ class Project (Base): # type: ignore
xml = Column(String)
status = Column(String)
edit = Column(DateTime, default=datetime.utcnow)
- owner_id = Column(Integer, ForeignKey('users.id'))
files = relationship('ProjectFile', backref='project')
diff --git a/elbepack/projectmanager.py b/elbepack/projectmanager.py
index a49d39a00034e698e98a450bb2e592e7c2b2521b..78780e5a4c4f086acd54ad89dc8356e640c0ea04 100644
--- a/elbepack/projectmanager.py
+++ b/elbepack/projectmanager.py
@@ -43,7 +43,7 @@ class ProjectManager:
def new_project(self, userid):
subdir = str(uuid7())
builddir = path.join(self.basepath, subdir)
- self.db.create_project(builddir, owner_id=userid)
+ self.db.create_project(builddir)
return builddir
def create_project(
@@ -54,7 +54,7 @@ class ProjectManager:
subdir = str(uuid7())
builddir = path.join(self.basepath, subdir)
- self.db.create_project(builddir, owner_id=userid)
+ self.db.create_project(builddir)
try:
self.db.set_xml(builddir, xml_file)
--
2.48.1
More information about the elbe-devel
mailing list