summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2014-02-20 18:02:37 (GMT)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2014-02-20 18:15:57 (GMT)
commit89e093411459637c07ef0a162e8c124daa39d8f0 (patch)
tree3d27bf557db5cf0d2fffa00ef991e1241b7be762
parent4f31b84839e5591633ace337b0ec00750ac6a9fa (diff)
downloadopen-build-service-89e093411459637c07ef0a162e8c124daa39d8f0.tar.gz
open-build-service-89e093411459637c07ef0a162e8c124daa39d8f0.tar.xz
cleanup_empty_projects: add new configuration option
Normally, if a submit request is accepted and results in cleaning up the last package in a branched project, the branched project is deleted too. This is annoying if the branched project is a long-running branch (e.g. for a developer in a small team) and has been reconfigured, for instance to turn on publishing in installations where branches do not normally have publishing. This is a backport to our 2.3.8-based OBS; the patches I've sent upstream are rather different, because the way OBS deals with configuration has changed significantly. Bug: https://github.com/openSUSE/open-build-service/issues/596 Applied-upstream: no
-rw-r--r--src/api/app/controllers/request_controller.rb2
-rw-r--r--src/api/config/options.yml.example4
2 files changed, 5 insertions, 1 deletions
diff --git a/src/api/app/controllers/request_controller.rb b/src/api/app/controllers/request_controller.rb
index e35d53e..7fe0498 100644
--- a/src/api/app/controllers/request_controller.rb
+++ b/src/api/app/controllers/request_controller.rb
@@ -1686,7 +1686,7 @@ class RequestController < ApplicationController
# cleanup source project
source_project = DbProject.find_by_name(action.source.project)
delete_path = nil
- if source_project.db_packages.count == 1 or not action.source.has_attribute?(:package)
+ if (source_project.db_packages.count == 1 and CONFIG['cleanup_empty_projects'] != false) or not action.source.has_attribute?(:package)
# remove source project, if this is the only package and not the user's home project
if source_project.name != "home:" + user.login
source_project.destroy
diff --git a/src/api/config/options.yml.example b/src/api/config/options.yml.example
index a72defa..67cc74a 100644
--- a/src/api/config/options.yml.example
+++ b/src/api/config/options.yml.example
@@ -37,3 +37,7 @@ source_server_url: http://localhost:5352
# Minimum count of rating votes a project/package needs to # be taken in account
# for global statistics:
min_votes_for_rating: 3
+
+# If the last package in a project is cleaned up by sourceupdate=cleanup,
+# delete the whole project unless this is set to "false"
+#cleanup_empty_projects: true