Skip to content

Instantly share code, notes, and snippets.

@TobiX
Last active December 11, 2015 12:59
Show Gist options
  • Save TobiX/4604650 to your computer and use it in GitHub Desktop.
Save TobiX/4604650 to your computer and use it in GitHub Desktop.
Simple tool to calculate distance between Debian releases (and freezes)
--- Debian history ---
Version 0.93R6 was released 1995-10-26
235 days (0.64384 years) later came Version 1.1 (buzz)
178 days (0.48767 years) later came Version 1.2 (rex)
175 days (0.47945 years) later came Version 1.3 (bo)
414 days (1.13425 years) later came Version 2.0 (hamm)
228 days (0.62466 years) later came Version 2.1 (slink)
525 days (1.43836 years) later came Version 2.2 (potato) (freeze time: 212 days)
703 days (1.92603 years) later came Version 3.0 (woody) (freeze time: 383 days)
1053 days (2.88493 years) later came Version 3.1 (sarge) (freeze time: 34 days)
671 days (1.83836 years) later came Version 4.0 (etch) (freeze time: 243 days)
679 days (1.86027 years) later came Version 5.0 (lenny) (freeze time: 203 days)
721 days (1.97534 years) later came Version 6.0 (squeeze) (freeze time: 184 days)
731 days (2.00274 years) later maybe comes Version 7.0 (wheezy) (freeze time: 221 days)
730 days (2.00000 years) later maybe comes Version 8.0? (jessie)
#!/usr/bin/ruby
require 'date'
class DebianRelease
def initialize(version, name, release, freeze = nil)
@version = version
@name = name
@release = release
@freeze = freeze
end
attr_reader :version, :name, :release, :freeze
def to_s
@version + ((@name)?" (%s)" % @name:"")
end
def -(other)
@release - other.release
end
end
data = [
DebianRelease.new("0.93R6", nil, Date::civil(1995, 10, 26)),
# DebianRelease.new("no 1.0", nil, Date::civil(1995, 12, 11)),
DebianRelease.new("1.1", "buzz", Date::civil(1996, 6, 17)),
DebianRelease.new("1.2", "rex", Date::civil(1996, 12, 12)),
DebianRelease.new("1.3", "bo", Date::civil(1997, 6, 5)),
DebianRelease.new("2.0", "hamm", Date::civil(1998, 7, 24)),
DebianRelease.new("2.1", "slink", Date::civil(1999, 3, 9), Date::civil(1998, 11, 4)),
DebianRelease.new("2.2", "potato", Date::civil(2000, 8, 15), Date::civil(2000, 1, 16)),
DebianRelease.new("3.0", "woody", Date::civil(2002, 7, 19), Date::civil(2001, 7, 1)),
DebianRelease.new("3.1", "sarge", Date::civil(2005, 6, 6), Date::civil(2005, 5, 3)),
DebianRelease.new("4.0", "etch", Date::civil(2007, 4, 8), Date::civil(2006, 8, 8)),
DebianRelease.new("5.0", "lenny", Date::civil(2009, 2, 15), Date::civil(2008, 7, 27)),
DebianRelease.new("6.0", "squeeze", Date::civil(2011, 2, 6), Date::civil(2010, 8, 6)),
DebianRelease.new("7.0", "wheezy", Date::civil(2013, 2, 6), Date::civil(2012, 6, 30)),
DebianRelease.new("8.0?", "jessie", Date::civil(2015, 2, 6)),
]
puts "--- Debian history ---"
last = nil
data.sort_by {|e| e.release }.each { |ver|
if (last)
printf "%5i days (%1.5f years) later %s Version %s", ver - last, (ver - last) / 365,
((ver.release > Date.today)? "maybe comes" : "came"), ver
else
printf "Version %s was released %s", ver, ver.release
end
printf " (freeze time: %i days)", ver.release - ver.freeze if ver.freeze
puts
last = ver
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment