foreman_remote_execution 14.0.0 → 14.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/foreman_remote_execution/locale/de/foreman_remote_execution.js +77 -77
  3. data/app/assets/javascripts/foreman_remote_execution/locale/en/foreman_remote_execution.js +2 -1667
  4. data/app/assets/javascripts/foreman_remote_execution/locale/en_GB/foreman_remote_execution.js +7 -7
  5. data/app/assets/javascripts/foreman_remote_execution/locale/es/foreman_remote_execution.js +33 -33
  6. data/app/assets/javascripts/foreman_remote_execution/locale/fr/foreman_remote_execution.js +131 -131
  7. data/app/assets/javascripts/foreman_remote_execution/locale/ja/foreman_remote_execution.js +131 -131
  8. data/app/assets/javascripts/foreman_remote_execution/locale/ka/foreman_remote_execution.js +38 -38
  9. data/app/assets/javascripts/foreman_remote_execution/locale/ko/foreman_remote_execution.js +16 -16
  10. data/app/assets/javascripts/foreman_remote_execution/locale/pt_BR/foreman_remote_execution.js +33 -33
  11. data/app/assets/javascripts/foreman_remote_execution/locale/ru/foreman_remote_execution.js +7 -7
  12. data/app/assets/javascripts/foreman_remote_execution/locale/zh_CN/foreman_remote_execution.js +134 -134
  13. data/app/assets/javascripts/foreman_remote_execution/locale/zh_TW/foreman_remote_execution.js +6 -6
  14. data/app/controllers/api/v2/job_invocations_controller.rb +34 -17
  15. data/app/helpers/job_invocations_helper.rb +1 -1
  16. data/app/helpers/remote_execution_helper.rb +2 -2
  17. data/app/lib/actions/remote_execution/proxy_action.rb +10 -5
  18. data/app/lib/actions/remote_execution/run_host_job.rb +1 -1
  19. data/app/lib/actions/remote_execution/template_invocation_progress_logging.rb +2 -3
  20. data/app/models/concerns/foreman_remote_execution/errors_flattener.rb +2 -2
  21. data/app/views/api/v2/job_invocations/hosts.json.rabl +15 -0
  22. data/app/views/template_invocations/show.html.erb +1 -1
  23. data/app/views/templates/script/package_action.erb +1 -1
  24. data/config/routes.rb +1 -0
  25. data/db/migrate/20240312133027_extend_template_invocation_events.rb +19 -0
  26. data/db/migrate/20240522093413_migrate_smart_proxy_ids_to_template_invocations.rb +3 -0
  27. data/lib/foreman_remote_execution/engine.rb +0 -4
  28. data/lib/foreman_remote_execution/version.rb +1 -1
  29. data/locale/Makefile +12 -2
  30. data/locale/de/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  31. data/locale/de/foreman_remote_execution.po +81 -80
  32. data/locale/en/foreman_remote_execution.po +0 -1675
  33. data/locale/en_GB/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  34. data/locale/en_GB/foreman_remote_execution.po +7 -7
  35. data/locale/es/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  36. data/locale/es/foreman_remote_execution.po +33 -33
  37. data/locale/fr/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  38. data/locale/fr/foreman_remote_execution.po +132 -132
  39. data/locale/ja/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  40. data/locale/ja/foreman_remote_execution.po +131 -131
  41. data/locale/ka/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  42. data/locale/ka/foreman_remote_execution.po +38 -38
  43. data/locale/ko/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  44. data/locale/ko/foreman_remote_execution.po +16 -16
  45. data/locale/pt_BR/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  46. data/locale/pt_BR/foreman_remote_execution.po +33 -33
  47. data/locale/ru/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  48. data/locale/ru/foreman_remote_execution.po +7 -7
  49. data/locale/zh_CN/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  50. data/locale/zh_CN/foreman_remote_execution.po +136 -134
  51. data/locale/zh_TW/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  52. data/locale/zh_TW/foreman_remote_execution.po +6 -6
  53. data/webpack/JobInvocationDetail/JobInvocationActions.js +1 -1
  54. data/webpack/JobInvocationDetail/JobInvocationConstants.js +84 -0
  55. data/webpack/JobInvocationDetail/JobInvocationDetail.scss +0 -1
  56. data/webpack/JobInvocationDetail/JobInvocationHostTable.js +210 -0
  57. data/webpack/JobInvocationDetail/JobInvocationSelectors.js +2 -2
  58. data/webpack/JobInvocationDetail/__tests__/MainInformation.test.js +5 -1
  59. data/webpack/JobInvocationDetail/__tests__/fixtures.js +9 -0
  60. data/webpack/JobInvocationDetail/index.js +56 -34
  61. data/webpack/__mocks__/foremanReact/components/HostDetails/DetailsCard/DefaultLoaderEmptyState.js +1 -2
  62. data/webpack/react_app/components/RecentJobsCard/JobStatusIcon.js +38 -7
  63. data/webpack/react_app/components/RecentJobsCard/constants.js +4 -0
  64. data/webpack/react_app/components/TargetingHosts/__tests__/__snapshots__/HostStatus.test.js.snap +1 -1
  65. data/webpack/react_app/components/TargetingHosts/components/HostStatus.js +6 -6
  66. metadata +6 -95
  67. data/.babelrc.js +0 -3
  68. data/.eslintignore +0 -3
  69. data/.eslintrc +0 -13
  70. data/.github/workflows/js_ci.yml +0 -32
  71. data/.github/workflows/release.yml +0 -16
  72. data/.github/workflows/ruby_ci.yml +0 -19
  73. data/.gitignore +0 -18
  74. data/.packit.yaml +0 -45
  75. data/.prettierrc +0 -4
  76. data/.rubocop.yml +0 -105
  77. data/.rubocop_todo.yml +0 -516
  78. data/.tx/config +0 -10
  79. data/Gemfile +0 -5
  80. data/app/mailers/.gitkeep +0 -0
  81. data/app/views/dashboard/.gitkeep +0 -0
  82. data/foreman_remote_execution.gemspec +0 -33
  83. data/jsconfig.json +0 -8
  84. data/locale/action_names.rb +0 -2
  85. data/test/benchmark/run_hosts_job_benchmark.rb +0 -70
  86. data/test/benchmark/targeting_benchmark.rb +0 -31
  87. data/test/factories/foreman_remote_execution_factories.rb +0 -147
  88. data/test/functional/api/v2/foreign_input_sets_controller_test.rb +0 -58
  89. data/test/functional/api/v2/job_invocations_controller_test.rb +0 -446
  90. data/test/functional/api/v2/job_templates_controller_test.rb +0 -110
  91. data/test/functional/api/v2/registration_controller_test.rb +0 -73
  92. data/test/functional/api/v2/remote_execution_features_controller_test.rb +0 -34
  93. data/test/functional/api/v2/template_invocations_controller_test.rb +0 -33
  94. data/test/functional/cockpit_controller_test.rb +0 -16
  95. data/test/functional/job_invocations_controller_test.rb +0 -132
  96. data/test/functional/job_templates_controller_test.rb +0 -31
  97. data/test/functional/ui_job_wizard_controller_test.rb +0 -16
  98. data/test/graphql/mutations/job_invocations/create_test.rb +0 -58
  99. data/test/graphql/queries/job_invocation_query_test.rb +0 -31
  100. data/test/graphql/queries/job_invocations_query_test.rb +0 -35
  101. data/test/helpers/remote_execution_helper_test.rb +0 -46
  102. data/test/support/remote_execution_helper.rb +0 -5
  103. data/test/test_plugin_helper.rb +0 -9
  104. data/test/unit/actions/run_host_job_test.rb +0 -115
  105. data/test/unit/actions/run_hosts_job_test.rb +0 -214
  106. data/test/unit/api_params_test.rb +0 -25
  107. data/test/unit/concerns/foreman_tasks_cleaner_extensions_test.rb +0 -29
  108. data/test/unit/concerns/host_extensions_test.rb +0 -219
  109. data/test/unit/concerns/nic_extensions_test.rb +0 -9
  110. data/test/unit/execution_task_status_mapper_test.rb +0 -92
  111. data/test/unit/input_template_renderer_test.rb +0 -503
  112. data/test/unit/job_invocation_composer_test.rb +0 -974
  113. data/test/unit/job_invocation_report_template_test.rb +0 -60
  114. data/test/unit/job_invocation_test.rb +0 -232
  115. data/test/unit/job_template_effective_user_test.rb +0 -37
  116. data/test/unit/job_template_test.rb +0 -316
  117. data/test/unit/remote_execution_feature_test.rb +0 -86
  118. data/test/unit/remote_execution_provider_test.rb +0 -298
  119. data/test/unit/renderer_scope_input_test.rb +0 -49
  120. data/test/unit/targeting_test.rb +0 -206
  121. data/test/unit/template_invocation_input_value_test.rb +0 -38
@@ -3,11 +3,11 @@
3
3
  "locale_data": {
4
4
  "foreman_remote_execution": {
5
5
  "": {
6
- "Project-Id-Version": "foreman_remote_execution 9.0.1",
6
+ "Project-Id-Version": "foreman_remote_execution 14.0.0",
7
7
  "Report-Msgid-Bugs-To": "",
8
8
  "PO-Revision-Date": "2016-02-15 13:54+0000",
9
9
  "Last-Translator": "FULL NAME <EMAIL@ADDRESS>",
10
- "Language-Team": "Chinese (Taiwan) (http://www.transifex.com/foreman/foreman/language/zh_TW/)",
10
+ "Language-Team": "Chinese (Taiwan) (http://app.transifex.com/foreman/foreman/language/zh_TW/)",
11
11
  "MIME-Version": "1.0",
12
12
  "Content-Type": "text/plain; charset=UTF-8",
13
13
  "Content-Transfer-Encoding": "8bit",
@@ -85,7 +85,7 @@
85
85
  ""
86
86
  ],
87
87
  "Access denied": [
88
- ""
88
+ "拒絕存取"
89
89
  ],
90
90
  "Actions": [
91
91
  "動作"
@@ -136,7 +136,7 @@
136
136
  ""
137
137
  ],
138
138
  "Back": [
139
- ""
139
+ "上一步"
140
140
  ],
141
141
  "Back to Job": [
142
142
  "回到工作"
@@ -775,7 +775,7 @@
775
775
  ""
776
776
  ],
777
777
  "Next": [
778
- ""
778
+ "下一步"
779
779
  ],
780
780
  "No (override)": [
781
781
  ""
@@ -1553,7 +1553,7 @@
1553
1553
  "您不能看到目前指定的範本。現在儲存表單會取消指定範本。"
1554
1554
  ],
1555
1555
  "You are not authorized to perform this action.": [
1556
- ""
1556
+ "您未經許可執行這項動作。"
1557
1557
  ],
1558
1558
  "You have %s results to display. Showing first %s results": [
1559
1559
  ""
@@ -3,10 +3,11 @@ module Api
3
3
  class JobInvocationsController < ::Api::V2::BaseController
4
4
  include ::Api::Version2
5
5
  include ::Foreman::Renderer
6
+ include RemoteExecutionHelper
6
7
 
7
8
  before_action :find_optional_nested_object, :only => %w{output raw_output}
8
9
  before_action :find_host, :only => %w{output raw_output}
9
- before_action :find_resource, :only => %w{show update destroy clone cancel rerun outputs}
10
+ before_action :find_resource, :only => %w{show update destroy clone cancel rerun outputs hosts}
10
11
 
11
12
  wrap_parameters JobInvocation, :include => (JobInvocation.attribute_names + [:ssh])
12
13
 
@@ -20,14 +21,9 @@ module Api
20
21
  param :id, :identifier, :required => true
21
22
  param :host_status, :bool, required: false, desc: N_('Show Job status for the hosts')
22
23
  def show
23
- @hosts = @job_invocation.targeting.hosts.authorized(:view_hosts, Host)
24
- @template_invocations = @job_invocation.template_invocations
25
- .where(host: @hosts)
26
- .includes(:input_values)
27
-
24
+ set_hosts_and_template_invocations
28
25
  if params[:host_status] == 'true'
29
- template_invocations = @template_invocations.includes(:run_host_job_task).to_a
30
- @host_statuses = Hash[template_invocations.map { |ti| [ti.host_id, template_invocation_status(ti)] }]
26
+ set_statuses_and_smart_proxies
31
27
  end
32
28
  end
33
29
 
@@ -111,6 +107,19 @@ module Api
111
107
  render :json => host_output(@nested_obj, @host, :default => [], :since => params[:since])
112
108
  end
113
109
 
110
+ api :GET, '/job_invocations/:id/hosts', N_('List hosts belonging to job invocation')
111
+ param_group :search_and_pagination, ::Api::V2::BaseController
112
+ add_scoped_search_description_for(JobInvocation)
113
+ param :id, :identifier, :required => true
114
+ def hosts
115
+ set_hosts_and_template_invocations
116
+ set_statuses_and_smart_proxies
117
+ @total = @job_invocation.targeting.hosts.size
118
+ @hosts = @hosts.search_for(params[:search], :order => params[:order]).paginate(:page => params[:page], :per_page => params[:per_page])
119
+ @subtotal = @hosts.respond_to?(:total_entries) ? @hosts.total_entries : @hosts.sizes
120
+ render :hosts, :layout => 'api/v2/layouts/index_layout'
121
+ end
122
+
114
123
  api :GET, '/job_invocations/:id/hosts/:host_id/raw', N_('Get raw output for a host')
115
124
  param :id, :identifier, :required => true
116
125
  param :host_id, :identifier, :required => true
@@ -187,7 +196,7 @@ module Api
187
196
 
188
197
  def action_permission
189
198
  case params[:action]
190
- when 'output', 'raw_output', 'outputs'
199
+ when 'output', 'raw_output', 'outputs', 'hosts'
191
200
  :view
192
201
  when 'cancel'
193
202
  :cancel
@@ -256,15 +265,23 @@ module Api
256
265
  resource_class.where(nil)
257
266
  end
258
267
 
259
- def template_invocation_status(template_invocation)
260
- task = template_invocation.try(:run_host_job_task)
261
- parent_task = @job_invocation.task
262
-
263
- return(parent_task.result == 'cancelled' ? 'cancelled' : 'N/A') if task.nil?
264
- return task.state if task.state == 'running' || task.state == 'planned'
265
- return 'error' if task.result == 'warning'
268
+ def set_hosts_and_template_invocations
269
+ @hosts = @job_invocation.targeting.hosts.authorized(:view_hosts, Host)
270
+ @template_invocations = @job_invocation.template_invocations
271
+ .where(host: @hosts)
272
+ .includes(:input_values)
273
+ end
266
274
 
267
- task.result
275
+ def set_statuses_and_smart_proxies
276
+ template_invocations = @template_invocations.includes(:run_host_job_task).to_a
277
+ hosts = @hosts.to_a
278
+ @host_statuses = Hash[hosts.map do |host|
279
+ template_invocation = template_invocations.find { |ti| ti.host_id == host.id }
280
+ task = template_invocation.try(:run_host_job_task)
281
+ [host.id, template_invocation_status(task, @job_invocation.task)]
282
+ end]
283
+ @smart_proxy_id = Hash[template_invocations.map { |ti| [ti.host_id, ti.smart_proxy_id] }]
284
+ @smart_proxy_name = Hash[template_invocations.map { |ti| [ti.host_id, ti.smart_proxy_name] }]
268
285
  end
269
286
  end
270
287
  end
@@ -33,7 +33,7 @@ module JobInvocationsHelper
33
33
  end
34
34
 
35
35
  def collapsed_preview(target)
36
- title = target || 'N/A'
36
+ title = (target || 'N/A').to_s
37
37
  content_tag(:h5,
38
38
  :class => "expander collapsed out",
39
39
  :data => { :toggle => 'collapse',
@@ -18,9 +18,9 @@ module RemoteExecutionHelper
18
18
  end
19
19
 
20
20
  def template_invocation_status(task, parent_task)
21
- return(parent_task.result == 'cancelled' ? _('cancelled') : _('Awaiting start')) if task.nil?
21
+ return(parent_task.result == 'cancelled' ? 'cancelled' : 'N/A') if task.nil?
22
22
  return task.state if task.state == 'running' || task.state == 'planned'
23
- return _('error') if task.result == 'warning'
23
+ return 'error' if task.result == 'warning'
24
24
 
25
25
  task.result
26
26
  end
@@ -33,7 +33,7 @@ module Actions
33
33
  {
34
34
  # For N-1 compatibility, we assume that the output provided here is
35
35
  # complete
36
- sequence_id: update['sequence_id'] || seq_id,
36
+ external_id: update['id'] || seq_id,
37
37
  template_invocation_id: template_invocation.id,
38
38
  event: update['output'],
39
39
  timestamp: Time.at(update['timestamp']).getlocal,
@@ -41,17 +41,22 @@ module Actions
41
41
  }
42
42
  end
43
43
  if data['exit_status']
44
- last = events.last || {:sequence_id => -1, :timestamp => Time.zone.now}
44
+ last = events.last || {:timestamp => Time.zone.now}
45
+ exit_timestamp = if data['exit_status_timestamp']
46
+ Time.at(data['exit_status_timestamp']).getlocal
47
+ else
48
+ last[:timestamp] + 1
49
+ end
45
50
  events << {
46
- sequence_id: last[:sequence_id] + 1,
51
+ external_id: 'exit',
47
52
  template_invocation_id: template_invocation.id,
48
53
  event: data['exit_status'],
49
- timestamp: last[:timestamp],
54
+ timestamp: exit_timestamp,
50
55
  event_type: 'exit',
51
56
  }
52
57
  end
53
58
  events.each_slice(1000) do |batch|
54
- TemplateInvocationEvent.insert_all(batch, unique_by: [:template_invocation_id, :sequence_id]) # rubocop:disable Rails/SkipsModelValidations
59
+ TemplateInvocationEvent.insert_all(batch, unique_by: [:template_invocation_id, :external_id]) # rubocop:disable Rails/SkipsModelValidations
55
60
  end
56
61
  end
57
62
  end
@@ -160,7 +160,7 @@ module Actions
160
160
  # This is enough, the error will get shown using add_exception at the end of the method
161
161
  end
162
162
 
163
- task.template_invocation.template_invocation_events.order(:sequence_id).find_each do |output|
163
+ task.template_invocation.template_invocation_events.order(:timestamp).find_each do |output|
164
164
  if output.event_type == 'exit'
165
165
  continuous_output.add_output(_('Exit status: %s') % output.event, 'stdout', output.timestamp)
166
166
  else
@@ -6,13 +6,12 @@ module Actions
6
6
  end
7
7
 
8
8
  def log_template_invocation_exception(exception)
9
- last = template_invocation.template_invocation_events.order(:sequence_id).last
10
- id = last ? last.sequence_id + 1 : 0
9
+ id = 'exception-' + SecureRandom.hex(4)
11
10
  template_invocation.template_invocation_events.create!(
12
11
  :event_type => 'debug',
13
12
  :event => "#{exception.class}: #{exception.message}",
14
13
  :timestamp => Time.zone.now,
15
- :sequence_id => id
14
+ :external_id => id
16
15
  )
17
16
  end
18
17
 
@@ -7,8 +7,8 @@ module ForemanRemoteExecution
7
7
  def flattened_errors
8
8
  errors = Hash.new { |h, k| h[k] = [] }
9
9
  # self.errors is ActiveModel::Errors, not Hash and doesn't have the #each_key method
10
- self.errors.keys.each do |key|
11
- messages = self.errors[key]
10
+ self.errors.attribute_names.each do |key|
11
+ messages = self.errors.messages_for(key)
12
12
  invalid_objects = invalid_objects_for_attribute(key)
13
13
  if invalid_objects.blank?
14
14
  errors[key] = messages
@@ -0,0 +1,15 @@
1
+ collection @hosts
2
+
3
+ attribute :name, :operatingsystem_id, :operatingsystem_name, :hostgroup_id, :hostgroup_name
4
+
5
+ node :job_status do |host|
6
+ @host_statuses[host.id]
7
+ end
8
+
9
+ node :smart_proxy_id do |host|
10
+ @smart_proxy_id[host.id]
11
+ end
12
+
13
+ node :smart_proxy_name do |host|
14
+ @smart_proxy_name[host.id]
15
+ end
@@ -55,7 +55,7 @@ end
55
55
  </div>
56
56
 
57
57
  <script>
58
- <%= render :partial => 'refresh.js' %>
58
+ <%= render partial: 'refresh', formats: :js %>
59
59
  </script>
60
60
  <% else %>
61
61
  <%= _("Could not display data for job invocation.") %>
@@ -148,7 +148,7 @@ handle_zypp_res_codes () {
148
148
  end
149
149
  -%>
150
150
  zypper refresh
151
- zypper -n <%= action %> <%= input("options") %> <%= input("package") %>
151
+ zypper -n --gpg-auto-import-keys <%= action %> <%= input("options") %> <%= input("package") %>
152
152
  handle_zypp_res_codes $? "<%= action %>"
153
153
  <% end -%>
154
154
  RETVAL=$?
data/config/routes.rb CHANGED
@@ -63,6 +63,7 @@ Rails.application.routes.draw do
63
63
  get '/raw', :to => 'job_invocations#raw_output'
64
64
  end
65
65
  member do
66
+ get 'hosts'
66
67
  post 'cancel'
67
68
  post 'rerun'
68
69
  get 'template_invocations', :to => 'template_invocations#template_invocations'
@@ -0,0 +1,19 @@
1
+ class ExtendTemplateInvocationEvents < ActiveRecord::Migration[6.1]
2
+ def up
3
+ change_table :template_invocation_events do |t|
4
+ t.string :external_id
5
+ end
6
+
7
+ TemplateInvocationEvent.update_all("external_id = CASE WHEN event_type = 'exit' THEN 'exit' ELSE sequence_id::varchar END")
8
+
9
+ remove_index :template_invocation_events, name: :unique_template_invocation_events_index
10
+ remove_column :template_invocation_events, :sequence_id
11
+
12
+ change_table :template_invocation_events do |t|
13
+ t.index [:template_invocation_id, :external_id],
14
+ unique: true,
15
+ name: 'unique_template_invocation_events_index'
16
+ t.change :external_id, :string, null: false
17
+ end
18
+ end
19
+ end
@@ -1,10 +1,13 @@
1
1
  class MigrateSmartProxyIdsToTemplateInvocations < ActiveRecord::Migration[6.0]
2
2
  def up
3
+ proxy_lookup_cache = {}
3
4
  ForemanTasks::Link.joins(:task)
4
5
  .where(resource_type: 'SmartProxy', task: { label: 'Actions::RemoteExecution::RunHostJob' })
5
6
  .where.not(resource_id: nil)
6
7
  .find_in_batches do |batch|
7
8
  batch.group_by(&:resource_id).each do |resource_id, links|
9
+ proxy_lookup_cache[resource_id] = SmartProxy.where(id: resource_id).exists? unless proxy_lookup_cache.key?(resource_id)
10
+ next unless proxy_lookup_cache[resource_id]
8
11
  template_invocation_ids = ForemanTasks::Link.where(resource_type: 'TemplateInvocation', task_id: links.map(&:task_id)).select(:resource_id)
9
12
  TemplateInvocation.where(id: template_invocation_ids).update_all(smart_proxy_id: resource_id)
10
13
  end
@@ -4,10 +4,6 @@ module ForemanRemoteExecution
4
4
  class Engine < ::Rails::Engine
5
5
  engine_name 'foreman_remote_execution'
6
6
 
7
- config.autoload_paths += Dir["#{config.root}/app/controllers/concerns"]
8
- config.autoload_paths += Dir["#{config.root}/app/helpers/concerns"]
9
- config.autoload_paths += Dir["#{config.root}/app/models/concerns"]
10
-
11
7
  # Precompile any JS or CSS files under app/assets/
12
8
  # If requiring files from each other, list them explicitly here to avoid precompiling the same
13
9
  # content twice.
@@ -1,3 +1,3 @@
1
1
  module ForemanRemoteExecution
2
- VERSION = '14.0.0'.freeze
2
+ VERSION = '14.1.0'.freeze
3
3
  end
data/locale/Makefile CHANGED
@@ -31,9 +31,16 @@ all-mo: $(MOFILES)
31
31
  cat $@
32
32
  ! grep -q msgid $@
33
33
 
34
- %.edit.po:
34
+ %.edit.po: %.po.time_stamp
35
35
  touch $@
36
36
 
37
+ # gettext will trash the .edit.po file if the time stamp doesn't exist or is older than the po file
38
+ %.po.time_stamp: %.po
39
+ touch --reference $< $@
40
+
41
+ # Prevent make from treating this as an intermediate file to be cleaned up
42
+ .PRECIOUS: %.po.time_stamp
43
+
37
44
  check: $(POXFILES)
38
45
 
39
46
  # Unify duplicate translations
@@ -43,7 +50,10 @@ uniq-po:
43
50
  done
44
51
 
45
52
  tx-pull: $(EDITFILES)
46
- cd .. && tx pull -f --all
53
+ # Initialize new languages
54
+ cd .. && tx pull -f --all --minimum-perc 50
55
+ # Force update all existing languages
56
+ cd .. && tx pull -f --minimum-perc 0
47
57
  for f in $(EDITFILES) ; do \
48
58
  sed -i 's/^\("Project-Id-Version: \).*$$/\1$(DOMAIN) $(VERSION)\\n"/' $$f; \
49
59
  done