Just created a fast dirty fix:
- Copy the output warnings (all the "parsing file '/var/lib/dpkg/status'
near line XXX" lines) in a file named "/tmp/warnings"
- Copy the code below in a file named "repair_status.rb"
- In the code replace "Architecture: i386" for your architecture line
- Run "ruby repair_status.rb".

 It will create a /tmp/output file that you can use as a new
"/var/lib/dpkg/status" (backup it first). The "Architecture: i386" line (or
the one you replaced) will be added above the first "Maintaner:" line found
before the line warning


def find_line(lines, line_number)
    1.upto(100) do |i|
        line = lines[line_number-i]
        return -1 if !line || line.strip.length==0
        return line_number-i-1 if line.start_with?("Maintainer:")
    end
    return -1
end

warnings = File.read("/tmp/warnings").split("\n")
lines = File.read("/var/lib/dpkg/status").split("\n")
lines << ""
warnings.map{|line| (line =~ /parsing file '\/var\/lib\/dpkg\/status' near
line (\d+)/) ? $1.to_i : nil}.compact.reverse .each do |line_number|
    line = find_line(lines, line_number)
    if (line>0)
        lines.insert(line, "Architecture: i386")
        puts "inserting architecure in line #{line}, missing from
#{line_number}"
    else
        puts "not fixed for #{line_number}"
    end
end

File.open("/tmp/output", "w+") {|f| f.write(lines.join("\n"))}

Reply via email to