| 1 |
module CollabQA
|
| 2 |
class Log
|
| 3 |
def guess_failed_instest
|
| 4 |
tf = @lines.grep(/^-- Tests Failed: /)
|
| 5 |
if tf.length > 0
|
| 6 |
@reasons = tf[0].split(' ')[3..-1]
|
| 7 |
#@result = 'OK' if @reasons == ['inst-old'] or @reasons == ['upgrade-old'] or @reasons == ['pkg-upgrade']
|
| 8 |
else
|
| 9 |
@reasons = []
|
| 10 |
end
|
| 11 |
if @data =~ /dpkg: error processing common-lisp-controller/
|
| 12 |
@reasons << 'clisp'
|
| 13 |
end
|
| 14 |
if @data =~ /insserv: Service udev has to be enabled to start service lvm2/
|
| 15 |
@reasons << 'udevlvm2'
|
| 16 |
end
|
| 17 |
if @data =~ /dbconfig-common/
|
| 18 |
@reasons << 'dbconfig'
|
| 19 |
end
|
| 20 |
if @data =~ /WARNING: The following essential packages will be removed./
|
| 21 |
@reasons << 'essential'
|
| 22 |
end
|
| 23 |
if @data =~ /connections on Unix domain socket "\/var\/run\/postgresql/
|
| 24 |
@reasons << 'pgsql'
|
| 25 |
end
|
| 26 |
if @data =~ /Can't connect to local MySQL server through socket/
|
| 27 |
@reasons << 'mysql'
|
| 28 |
end
|
| 29 |
if @data =~ /Modified \(by you or by a script\) since installation./
|
| 30 |
@comment = <<EOF
|
| 31 |
Note that the configuration files were not modified during the test,
|
| 32 |
so this should not happen.
|
| 33 |
EOF
|
| 34 |
@reasons << 'modified-conffile'
|
| 35 |
end
|
| 36 |
if @data =~ /File on system created by you or by a script./
|
| 37 |
@comment = <<EOF
|
| 38 |
Note that no configuration files were created during the test,
|
| 39 |
so this should not happen.
|
| 40 |
EOF
|
| 41 |
@reasons << 'created-conffile'
|
| 42 |
end
|
| 43 |
if @data =~ /trying to overwrite.*which is also in package.*/
|
| 44 |
@reasons << 'overwrite-file'
|
| 45 |
end
|
| 46 |
end
|
| 47 |
|
| 48 |
def extract_log_instest
|
| 49 |
@sum_1l = "XXX"
|
| 50 |
@extract = []
|
| 51 |
@sum_ml = []
|
| 52 |
if @reasons.include?('find-deps')
|
| 53 |
g1 = @lines.grep_index(/^-- Finding depends( and recommends)?: FAILED$/)[0]
|
| 54 |
g2 = @lines.grep_index(/^-- Result: /)[0]
|
| 55 |
@sum_ml = @extract = @lines[g1+1..g2-1]
|
| 56 |
@sum_1l = "not installable"
|
| 57 |
elsif @reasons.include?('inst-after-deps')
|
| 58 |
g1 = @lines.grep_index(/^-- Installing the package after its depends and recommends: FAILED$/)[0]
|
| 59 |
g2 = @lines.grep_index(/^-- Result: /)[0]
|
| 60 |
@sum_ml = @extract = @lines[g1+1..g2-1]
|
| 61 |
@sum_1l = "installation fails"
|
| 62 |
elsif @reasons.include?('inst-with-deps')
|
| 63 |
g1 = @lines.grep_index(/^-- Installing the package together with its depends, without recommends: FAILED$/)[0]
|
| 64 |
g2 = @lines.grep_index(/^-- Result: /)[0]
|
| 65 |
@sum_ml = @extract = @lines[g1+1..g2-1]
|
| 66 |
@sum_1l = "installation fails"
|
| 67 |
elsif @reasons.include?('inst-aptitude')
|
| 68 |
g1 = @lines.grep_index(/^-- Installing the package with aptitude: FAILED$/)[0]
|
| 69 |
if g1
|
| 70 |
lines = @lines[g1+1..-1]
|
| 71 |
g2 = lines.grep_index(/^-- /)[0]
|
| 72 |
@sum_ml = @extract = lines[0..g2-1]
|
| 73 |
@sum_1l = "installation fails with aptitude"
|
| 74 |
else
|
| 75 |
g1 = @lines.grep_index(/^-- Creating new chroot and installing aptitude: FAILED while installing aptitude$/)[0]
|
| 76 |
lines = @lines[g1+1..-1]
|
| 77 |
g2 = lines.grep_index(/^-- /)[0]
|
| 78 |
@sum_ml = @extract = lines[0..g2-1]
|
| 79 |
@sum_1l = "installation fails with aptitude (while installing aptitude)"
|
| 80 |
end
|
| 81 |
elsif @reasons.include?('inst-with-recs')
|
| 82 |
g1 = @lines.grep_index(/^-- Installing the package together with its depends and recommends: FAILED$/)[0]
|
| 83 |
lines = @lines[g1+1..-1]
|
| 84 |
g2 = lines.grep_index(/^-- /)[0]
|
| 85 |
@sum_ml = @extract = lines[0..g2-1]
|
| 86 |
@sum_1l = "installation fails"
|
| 87 |
elsif @reasons.include?('rm-pkg')
|
| 88 |
g1 = @lines.grep_index(/^-- Removing the package: FAILED$/)[0]
|
| 89 |
lines = @lines[g1+1..-1]
|
| 90 |
g2 = lines.grep_index(/^-- /)[0]
|
| 91 |
@sum_ml = @extract = lines[0..g2-1]
|
| 92 |
@sum_1l = "package removal fails"
|
| 93 |
elsif @reasons.include?('purge-pkg')
|
| 94 |
g1 = @lines.grep_index(/^-- Removing all dependencies: OK$/)[0]
|
| 95 |
lines = @lines[g1..-1]
|
| 96 |
g2 = lines.grep_index(/^-- Now testing upgrade from/)[0]
|
| 97 |
if g2.nil?
|
| 98 |
g2 = lines.grep_index(/^-- Result: FAILED/)[0]
|
| 99 |
end
|
| 100 |
@sum_ml = @extract = lines[0..g2-1]
|
| 101 |
@sum_1l = "package purge (after dependencies removal) fails"
|
| 102 |
elsif @reasons.include?('find-rm-after-upgrade') or @reasons.include?('pkg-upgrade') or @reasons.include?('upgrade-old')
|
| 103 |
if @reasons.include?('pkg-upgrade')
|
| 104 |
l = @lines.grep(/-- New version is unstable version:/)[0]
|
| 105 |
if l =~ /UNINSTALLED/
|
| 106 |
@reasons << 'removed-during-upgrade'
|
| 107 |
else
|
| 108 |
@reasons << 'not-upgraded'
|
| 109 |
end
|
| 110 |
end
|
| 111 |
g1 = @lines.grep_index(/^-- Now testing upgrade from /)[0]
|
| 112 |
lines = @lines[g1..-1]
|
| 113 |
g2 = lines.grep_index(/^-- Result: FAILED/)[0]
|
| 114 |
@sum_ml = @extract = lines[0..g2-1]
|
| 115 |
@sum_1l = "package fails to upgrade properly from lenny"
|
| 116 |
end
|
| 117 |
end
|
| 118 |
end
|
| 119 |
end
|