From fc13eebb62ba1eccb39e9c52a9f6a7285f2919e3 Mon Sep 17 00:00:00 2001
From: Alessio Igor Bogani <alessio.bogani@elettra.eu>
Date: Tue, 21 Mar 2023 13:07:22 +0100
Subject: [PATCH] Revert "Add the chance to execute a preparation script before
 building"

This reverts commit 27488e055931c627b21a966643d6400e31379ab3.
---
 inau-dispatcher.py | 16 ++++++----------
 inau.py            |  1 -
 lib/db.py          |  1 -
 3 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/inau-dispatcher.py b/inau-dispatcher.py
index 9c5814c..4bedea2 100755
--- a/inau-dispatcher.py
+++ b/inau-dispatcher.py
@@ -84,14 +84,10 @@ class Store(Build):
         self.emails = emails
 
 class Builder:
-    def __init__(self, name, platform_id, environment):
+    def __init__(self, name, platform_id):
         self.name = name
         self.platform_id = platform_id
         self.platdir = args.repo + '/' + str(platform_id)
-        if environment is None:
-            self.environment = ""
-        else:
-            self.environment = "source " + environment + "; "
         self.queue = Queue()
         self.process = Process(target=self.handler)
         self.process.start()
@@ -118,7 +114,7 @@ class Builder:
             sshClient.set_missing_host_key_policy(paramiko.AutoAddPolicy())
             sshClient.connect(hostname=self.name, port=22, username="inau",
                     key_filename="/home/inau/.ssh/id_rsa.pub")
-            _, raw, _ = sshClient.exec_command("(" + self.environment + "source /etc/profile; cd " + builddir
+            _, raw, _ = sshClient.exec_command("(source /etc/profile; cd " + builddir 
                                 + " && (test -f *.pro && qmake && cuuimake --plain-text-output);"
                                 + " make -j`getconf _NPROCESSORS_ONLN`) 2>&1")
             job.status = raw.channel.recv_exit_status()
@@ -215,10 +211,10 @@ def reconcile():
         newbuilders = {}
         oldbuilders = allbuilders
         for b in session.query(db.Builders).all():
-            if b.platform_id in newbuilders:
-                newbuilders[b.platform_id].append(Builder(b.name, b.platform_id, b.environment))
-            else:
-                newbuilders[b.platform_id] = [Builder(b.name, b.platform_id, b.environment)]
+            try:
+                newbuilders[b.platform_id].append(Builder(b.name, b.platform_id))
+            except KeyError:
+                newbuilders[b.platform_id] = [Builder(b.name, b.platform_id)]
         allbuilders = newbuilders
 
         for oldbuilder in oldbuilders.values():
diff --git a/inau.py b/inau.py
index 9f9cac2..0074106 100644
--- a/inau.py
+++ b/inau.py
@@ -96,7 +96,6 @@ class Builders(db.Model):
     id = db.Column(db.Integer, primary_key=True)
     platform_id = db.Column(db.Integer, db.ForeignKey('platforms.id'), nullable=False)
     name = db.Column(db.String(255), unique=False, nullable=False)
-    environment = db.Column(db.String(255), nullable=True)
     platform = db.relationship('Platforms', lazy=True, backref=db.backref('builders', lazy=True))
 
 class Artifacts(db.Model):
diff --git a/lib/db.py b/lib/db.py
index 4169a50..d475344 100644
--- a/lib/db.py
+++ b/lib/db.py
@@ -67,7 +67,6 @@ class Builders(Base):
     id = Column(Integer, primary_key=True)
     platform_id = Column(Integer, ForeignKey('platforms.id'), nullable=False)
     name = Column(String(255), unique=False, nullable=False)
-    environment = Column(String(255), unique=False, nullable=True)
 
 class Providers(Base):
     __tablename__ = 'providers'
-- 
GitLab