| 309 | end |
| 310 | |
| 311 | def apt_prepare_debian_dir(tmp_dir, target) |
| 312 | source_debian_dir = nil |
| 313 | specific_debian_dir = "debian.#{target}" |
| 314 | distribution, code_name, _architecture = split_target(target) |
| 315 | platform = [distribution, code_name].join("-") |
| 316 | platform_debian_dir = "debian.#{platform}" |
| 317 | if File.exist?(specific_debian_dir) |
| 318 | source_debian_dir = specific_debian_dir |
| 319 | elsif File.exist?(platform_debian_dir) |
| 320 | source_debian_dir = platform_debian_dir |
| 321 | else |
| 322 | source_debian_dir = "debian" |
| 323 | end |
| 324 | |
| 325 | prepared_debian_dir = "#{tmp_dir}/debian.#{target}" |
| 326 | cp_r(source_debian_dir, prepared_debian_dir) |
| 327 | control_in_path = "#{prepared_debian_dir}/control.in" |
| 328 | if File.exist?(control_in_path) |
| 329 | control_in = File.read(control_in_path, encoding: "UTF-8") |
| 330 | rm_f(control_in_path) |
| 331 | File.open("#{prepared_debian_dir}/control", "w") do |control| |
| 332 | prepared_control = apt_prepare_debian_control(control_in, target) |
| 333 | control.print(prepared_control) |
| 334 | end |
| 335 | end |
| 336 | end |
| 337 | |
| 338 | def apt_prepare_debian_control(control_in, target) |
| 339 | message = "#{__method__} must be defined to use debian/control.in" |