public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Magnus Granberg" <zorry@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/tinderbox-cluster:master commit in: buildbot_gentoo_ci/steps/
Date: Fri, 28 Jan 2022 10:09:27 +0000 (UTC)	[thread overview]
Message-ID: <1643364552.adea4206026bfb0ef1cc9a5f2995a90e58fd9fa5.zorry@gentoo> (raw)

commit:     adea4206026bfb0ef1cc9a5f2995a90e58fd9fa5
Author:     Magnus Granberg <zorry <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 28 10:09:12 2022 +0000
Commit:     Magnus Granberg <zorry <AT> gentoo <DOT> org>
CommitDate: Fri Jan 28 10:09:12 2022 +0000
URL:        https://gitweb.gentoo.org/proj/tinderbox-cluster.git/commit/?id=adea4206

Change use of repository_basedir and use pathlib for symlink

Signed-off-by: Magnus Granberg <zorry <AT> gentoo.org>

 buildbot_gentoo_ci/steps/portage.py | 31 ++++++++++++++++++-------------
 buildbot_gentoo_ci/steps/repos.py   | 21 ++++++++++++++-------
 buildbot_gentoo_ci/steps/version.py |  5 ++---
 3 files changed, 34 insertions(+), 23 deletions(-)

diff --git a/buildbot_gentoo_ci/steps/portage.py b/buildbot_gentoo_ci/steps/portage.py
index e5d0a25..2332626 100644
--- a/buildbot_gentoo_ci/steps/portage.py
+++ b/buildbot_gentoo_ci/steps/portage.py
@@ -3,6 +3,7 @@
 
 import os
 import io
+from pathlib import Path
 
 from portage import config as portage_config
 from portage import auxdbkeys
@@ -403,24 +404,29 @@ class CheckPathLocal(BuildStep):
     @defer.inlineCallbacks
     def run(self):
         self.gentooci = self.master.namedServices['services'].namedServices['gentooci']
-        self.repository_linkname = self.gentooci.config.project['repository_basedir']
-        self.repository_basedir2 = '/home/repos2/'
         self.portage_path = yield os.path.join('etc', 'portage')
         self.profile_path = yield os.path.join(self.portage_path, 'make.profile')
         self.repos_path = yield os.path.join(self.portage_path, 'repos.conf')
-        print(os.getcwd())
+        self.repository_basedir_db = yield os.path.join(self.master.basedir, 'repositorys')
+        self.build_repository_basedir_db = yield os.path.join(self.getProperty("builddir"), 'repositorys')
+        #print(self.repository_basedir_db)
+        log = yield self.addLog('CheckPathLocal')
+        #print(os.getcwd())
         print(self.getProperty("builddir"))
-        yield os.chdir(self.getProperty("builddir"))
-        print(os.getcwd())
+        #yield os.chdir(self.getProperty("builddir"))
+        #print(os.getcwd())
         for x in [
                 self.portage_path,
                 self.profile_path,
                 self.repos_path,
                 ]:
-            if not os.path.isdir(x):
-                os.makedirs(x)
-        if not os.path.islink(self.repository_linkname):
-            os.symlink(self.repository_basedir2, self.repository_linkname)
+            check_dir = yield os.path.join(self.getProperty("builddir"), x)
+            if not Path(check_dir).is_dir():
+                yield Path(check_dir).mkdir(parents=True)
+                yield log.addStdout(' '.join(['Makeing missing dir', x]))
+        if not Path(self.build_repository_basedir_db).is_dir():
+            yield Path(self.build_repository_basedir_db).symlink_to(self.repository_basedir_db)
+            yield log.addStdout(' '.join(['Makeing missing link', 'repositorys', 'to', self.repository_basedir_db]))
         return SUCCESS
 
 class SetMakeProfileLocal(BuildStep):
@@ -442,7 +448,7 @@ class SetMakeProfileLocal(BuildStep):
             return SKIPPED
         self.gentooci = self.master.namedServices['services'].namedServices['gentooci']
         self.profile_repository_data = yield self.gentooci.db.repositorys.getRepositoryByUuid(self.getProperty('project_data')['profile_repository_uuid'])
-        self.repository_basedir = self.gentooci.config.project['repository_basedir']
+        self.repository_basedir = 'repositorys'
         makeprofiles_paths = []
         makeprofiles_data = yield self.gentooci.db.projects.getAllProjectPortageByUuidAndDirectory(self.getProperty('project_data')['uuid'], 'make.profile')
         for makeprofile in makeprofiles_data:
@@ -468,8 +474,7 @@ class SetReposConfLocal(BuildStep):
         repos_conf_path = yield os.path.join('etc', 'portage', 'repos.conf')
         repos_conf_default_path = yield os.path.join(repos_conf_path, 'default.conf')
         self.gentooci = self.master.namedServices['services'].namedServices['gentooci']
-        # the path should be set in the confg
-        self.repository_basedir2 = '/home/repos2/'
+        self.repository_basedir_db = yield os.path.join(self.master.basedir, 'repositorys')
         if not os.path.isfile(repos_conf_default_path):
             # setup the default.conf
             repos_conf_data = yield self.gentooci.db.projects.getProjectPortageByUuidAndDirectory(self.getProperty('project_data')['uuid'], 'repos.conf')
@@ -483,7 +488,7 @@ class SetReposConfLocal(BuildStep):
             yield WriteTextToFile(repos_conf_default_path, default_conf)
         repos_conf_repository_path = yield os.path.join(repos_conf_path, self.getProperty("repository_data")['name'] + '.conf')
         if not os.path.isfile(repos_conf_repository_path):
-            repository_path = yield os.path.join(self.repository_basedir2, self.getProperty("repository_data")['name'])
+            repository_path = yield os.path.join(self.repository_basedir_db, self.getProperty("repository_data")['name'])
             repository_conf = []
             repository_conf.append('[' + self.getProperty("repository_data")['name'] + ']')
             repository_conf.append('location = ' + repository_path)

diff --git a/buildbot_gentoo_ci/steps/repos.py b/buildbot_gentoo_ci/steps/repos.py
index f5c12d2..ae63c78 100644
--- a/buildbot_gentoo_ci/steps/repos.py
+++ b/buildbot_gentoo_ci/steps/repos.py
@@ -3,6 +3,7 @@
 
 import os
 import git
+from pathlib import Path
 
 from twisted.internet import defer
 
@@ -25,14 +26,20 @@ class CheckPathRepositoryLocal(BuildStep):
     def __init__(self, **kwargs):
         super().__init__(**kwargs)
 
+    @defer.inlineCallbacks
     def run(self):
         self.gentooci = self.master.namedServices['services'].namedServices['gentooci']
-        # self.repository_basedir = self.gentooci.config.project['mirror_repository_basedir']
-        repository_basedir = '/home/repos2/'
-        self.setProperty("repository_basedir", repository_basedir, 'repository_basedir')
-        if os.path.isdir(repository_basedir):
-            return SUCCESS
-        return FAILURE
+        self.repository_basedir_db = yield os.path.join(self.master.basedir, 'repositorys')
+        print(self.repository_basedir_db)
+        print(self.gentooci.config.project['repository_basedir'])
+        p = Path(self.repository_basedir_db)
+        self.setProperty("repository_basedir_db", self.repository_basedir_db, 'repository_basedir_db')
+        log = yield self.addLog('CheckPathRepositoryLocal')
+        if not Path(self.repository_basedir_db).is_dir():
+            yield log.addStdout(' '.join(['Missing link', self.repository_basedir_db]))
+            p.symlink_to(self.gentooci.config.project['repository_basedir'])
+            yield log.addStdout(' '.join(['Makeing missing link', 'repositorys', 'to', self.gentooci.config.project['repository_basedir']]))
+        return SUCCESS
 
 class CheckRepository(BuildStep):
 
@@ -105,7 +112,7 @@ class CheckRepository(BuildStep):
     @defer.inlineCallbacks
     def checkRepos(self, repository_data):
         success = False
-        repository_path = yield os.path.join(self.getProperty("repository_basedir"), repository_data['name'])
+        repository_path = yield os.path.join(self.getProperty("repository_basedir_db"), repository_data['name'])
         try:
             repo = git.Repo(repository_path)
         except:

diff --git a/buildbot_gentoo_ci/steps/version.py b/buildbot_gentoo_ci/steps/version.py
index 2b0c1e1..86d5963 100644
--- a/buildbot_gentoo_ci/steps/version.py
+++ b/buildbot_gentoo_ci/steps/version.py
@@ -230,9 +230,8 @@ class CheckPathHash(BuildStep):
     @defer.inlineCallbacks
     def run(self):
         self.gentooci = self.master.namedServices['services'].namedServices['gentooci']
-        self.repository_basedir = self.gentooci.config.project['repository_basedir']
-        self.repository_path = yield os.path.join('/home', 'repos2', self.getProperty("repository_data")['name'])
-        #self.repository_path = yield os.path.join(self.repository_basedir, self.getProperty("repository_data")['name'])
+        self.repository_basedir_db = yield os.path.join(self.master.basedir, 'repositorys')
+        self.repository_path = yield os.path.join(self.repository_basedir_db, self.getProperty("repository_data")['name'])
         self.cp_path = yield pkgsplit(self.getProperty("cpv"))[0]
         self.file_name = yield self.getProperty("package_data")['name'] + '-' + self.getProperty("version") + '.ebuild'
         self.ebuild_file = yield os.path.join(self.repository_path, self.cp_path, self.file_name)


             reply	other threads:[~2022-01-28 10:09 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-28 10:09 Magnus Granberg [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-10-16 20:50 [gentoo-commits] proj/tinderbox-cluster:master commit in: buildbot_gentoo_ci/steps/ Magnus Granberg
2024-03-31 19:40 Magnus Granberg
2024-03-31 19:40 Magnus Granberg
2024-03-23 14:13 Magnus Granberg
2024-03-21 16:56 Magnus Granberg
2024-03-19 17:19 Magnus Granberg
2024-03-17 20:40 Magnus Granberg
2024-03-16  8:49 Magnus Granberg
2024-02-05 18:54 Magnus Granberg
2024-02-04 11:32 Magnus Granberg
2024-02-04  9:49 Magnus Granberg
2024-02-03 10:02 Magnus Granberg
2023-07-26  9:23 Magnus Granberg
2023-06-10 10:08 Magnus Granberg
2023-06-05  8:09 Magnus Granberg
2023-06-05  8:09 Magnus Granberg
2023-05-08 20:19 Magnus Granberg
2023-03-10 22:36 Magnus Granberg
2023-03-10 22:36 Magnus Granberg
2023-03-10  1:47 Magnus Granberg
2023-02-28 21:41 Magnus Granberg
2023-02-28 21:41 Magnus Granberg
2022-09-25 11:46 Magnus Granberg
2022-08-10 21:51 Magnus Granberg
2022-08-05 18:32 Magnus Granberg
2022-07-30 22:40 Magnus Granberg
2022-07-27 11:02 Magnus Granberg
2022-07-27 11:02 Magnus Granberg
2022-07-27 11:02 Magnus Granberg
2022-07-27 11:02 Magnus Granberg
2022-07-26 11:54 Magnus Granberg
2022-07-13 20:01 Magnus Granberg
2022-07-08 21:54 Magnus Granberg
2022-07-06 18:44 Magnus Granberg
2022-07-04 17:44 Magnus Granberg
2022-06-28 23:26 Magnus Granberg
2022-06-01  0:19 Magnus Granberg
2022-04-22 12:34 Magnus Granberg
2022-01-24  8:41 Magnus Granberg
2022-01-24  0:42 Magnus Granberg
2022-01-22 20:50 Magnus Granberg
2022-01-18 20:20 Magnus Granberg
2022-01-18 19:38 Magnus Granberg
2022-01-18 19:16 Magnus Granberg
2022-01-08 17:25 Magnus Granberg
2021-11-01  2:22 Magnus Granberg
2021-10-23 22:26 Magnus Granberg
2021-10-23 22:24 Magnus Granberg
2021-10-06  1:35 Magnus Granberg
2021-10-02 20:52 Magnus Granberg
2021-09-28 22:16 Magnus Granberg
2021-09-22  0:04 Magnus Granberg
2021-09-21  1:29 Magnus Granberg
2021-09-20 23:28 Magnus Granberg
2021-09-07  0:46 Magnus Granberg
2021-07-17  8:14 Magnus Granberg
2021-05-18  8:55 Magnus Granberg
2021-04-26 20:26 Magnus Granberg
2021-04-20  7:05 Magnus Granberg
2021-04-13 19:03 Magnus Granberg
2021-04-02 22:12 Magnus Granberg
2021-04-02 22:12 Magnus Granberg
2021-04-02 22:12 Magnus Granberg
2021-04-02 22:12 Magnus Granberg
2021-03-29  0:34 Magnus Granberg
2021-03-29  0:34 Magnus Granberg
2021-03-20 13:42 Magnus Granberg
2021-03-20 13:42 Magnus Granberg
2021-03-20 13:42 Magnus Granberg
2021-02-28 18:48 Magnus Granberg
2021-02-24 21:27 Magnus Granberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1643364552.adea4206026bfb0ef1cc9a5f2995a90e58fd9fa5.zorry@gentoo \
    --to=zorry@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox