Skip to content

Commit

Permalink
[frontend][backend] making modules proof to auto-deletion script
Browse files Browse the repository at this point in the history
  • Loading branch information
clime committed Sep 17, 2016
1 parent 6ccdb6c commit 3064beb
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
6 changes: 3 additions & 3 deletions backend/backend/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ def handle_build_module(self, result):
project_path = os.path.join(self.opts.destdir, ownername, projectname)

try:
modules_file_read = open(os.path.join(project_path, "modules.json"), "r+")
modules_file_read = open(os.path.join(project_path, "modules", "modules.json"), "r+")
modules = json.loads(modules_file_read.read())
modules_file_read.close()
except:
Expand All @@ -384,7 +384,7 @@ def handle_build_module(self, result):
srcdir = os.path.join(project_path, chroot)
module_tag = chroot + '+' + mmd.name + '-' + mmd.version + '-' + mmd.release
module_relpath = os.path.join(module_tag, "latest", arch)
destdir = os.path.join(project_path, module_relpath)
destdir = os.path.join(project_path, "modules", module_relpath)

if os.path.exists(destdir):
self.log.warning("Module {0} already exists. Ommitting.".format(destdir))
Expand All @@ -404,7 +404,7 @@ def handle_build_module(self, result):
username=ownername, projectname=projectname,
override_acr_flag=True)

modules_file_write = open(os.path.join(project_path, "modules.json"), "w+")
modules_file_write = open(os.path.join(project_path, "modules", "modules.json"), "w+")
modules_file_write.write(json.dumps(modules, indent=4))
modules_file_write.close()

Expand Down
4 changes: 4 additions & 0 deletions backend/run/copr_prune_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ def prune_project(self, project_path, username, projectname):

for sub_dir_name in os.listdir(project_path):
chroot_path = os.path.join(project_path, sub_dir_name)

if sub_dir_name == 'modules':
continue

if not os.path.isdir(chroot_path):
continue

Expand Down
4 changes: 4 additions & 0 deletions frontend/coprs_frontend/coprs/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,10 @@ def repo_url(self):
u"results",
self.full_name])

@property
def modules_url(self):
return "/".join([self.repo_url, "modules"])

@property
def repo_id(self):
if self.is_a_group_project:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[{{ copr.repo_id }}]
name = Copr modules repo for {{ copr.full_name }}
url = {{ copr.repo_url | fix_url_https_backend }}
url = {{ copr.modules_url | fix_url_https_backend }}
enabled = 1

0 comments on commit 3064beb

Please sign in to comment.