Debian Codegraph @

bin/gen-ruby-trans-pkgs

raw
1 #!/usr/bin/ruby
2 # Generate debian/control snippets
3
4 if ARGV.length != 1
5 puts "generate-ruby-transitional-packages OLD_SOURCE_PACKAGE"
6 exit(1)
7 end
8
9 version = `dpkg-parsechangelog`.split($/).grep(/^Version: /)[0].split[1]
10 package = `dh_listpackages`.split[0]
11 allpackages = `dh_listpackages`.split
12
13 binaries = []
14 `apt-cache showsrc #{ARGV[0]}`.split($/).grep(/^Binary/).each do |l|
15 binaries += l.split(/[, ]+/)[1..-1]
16 end
17 binaries.uniq!
18 binaries -= allpackages
19
20 rstring = binaries.map { |pkg| "#{pkg} (<< #{version}~)" }.join(', ')
21 puts "# For the replacement package"
22 puts "Replaces: #{rstring}"
23 puts "Breaks: #{rstring}"
24 puts "Provides: #{binaries.join(', ')}"
25
26 puts
27 puts "# Transitional packages"
28 binaries.each do |pkg|
29 puts <<-EOF
30 Package: #{pkg}
31 Section: oldlibs
32 Priority: extra
33 Architecture: all
34 Depends: ${misc:Depends}, #{package}
35 Description: Transitional package for #{package}
36 This is a transitional package to ease upgrades to the #{package}
37 package. It can safely be removed.
38
39 EOF
40 end
41
42 __END__
43 =head1 NAME
44
45 gen-ruby-trans-pkgs - generate ruby transitional packages
46
47 =head1 SYNOPSIS
48
49 B<gen-ruby-trans-pkgs> I<SOURCE_PKG_TO_REPLACE>
50
51 =head1 DESCRIPTION
52
53 B<gen-ruby-trans-pkgs> reads debian/control, debian/changelog, and the output
54 of apt-cache showsrc I<SOURCE_PKG_TO_REPLACE>, and generates debian/control
55 snippets to add transitional packages.
56
57 =head1 SEE ALSO
58
59 L<B<gem2deb>>(1)
60
61 =head1 COPYRIGHT AND AUTHORS
62
63 Copyright (c) 2011, Lucas Nussbaum <[email protected]>
64
65 This program is free software: you can redistribute it and/or modify
66 it under the terms of the GNU General Public License as published by
67 the Free Software Foundation, either version 3 of the License, or
68 (at your option) any later version.
69
70 This program is distributed in the hope that it will be useful,
71 but WITHOUT ANY WARRANTY; without even the implied warranty of
72 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
73 GNU General Public License for more details.
74
75 You should have received a copy of the GNU General Public License
76 along with this program. If not, see <http://www.gnu.org/licenses/>.