Class: DevBall::PkgSpec::Djb

Inherits:
Tarball
  • Object
show all
Defined in:
lib/devball/pkgspec/djb.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.set_type(type) ⇒ Object

use this to set the type of the package in djb’s world (ie. admin)



14
15
16
# File 'lib/devball/pkgspec/djb.rb', line 14

def self.set_type(type)
	@type = type
end

.typeObject



17
18
19
# File 'lib/devball/pkgspec/djb.rb', line 17

def self.type()
	return @type
end

Instance Method Details

#extract_dir_nameObject



6
7
8
# File 'lib/devball/pkgspec/djb.rb', line 6

def extract_dir_name()
	return build_dir_name
end

#package_build_dir_nameObject



9
10
11
# File 'lib/devball/pkgspec/djb.rb', line 9

def package_build_dir_name()
	return extract_dir_name + "/#{type}/#{ball_version}"
end

#step_buildObject



40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/devball/pkgspec/djb.rb', line 40

def step_build()
	Dir.chdir(package_build_dir_name()) {|dir|
		# build source
		system("package/compile") || raise(BuildFailed, "Build of djb package failed: #{$?}")
		# build man pages
		Dir.chdir("man") {|dir|
			Dir["*.?"].each {|manfile|
				system("gzip", manfile)
			}
		}
	}
end

#step_configureObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/devball/pkgspec/djb.rb', line 24

def step_configure()
	# look for makefiles and turn off -static flags in them. (ugh)
	if (RUBY_PLATFORM =~ /darwin/)
		Dir[package_build_dir_name() + "/**/Makefile"].each {|makefile|
			File.rename(makefile, makefile + ".old")
			File.open(makefile + ".old", "r") {|fin|
				File.open(makefile, "w") {|fout|
					fin.each {|line|
						fout.puts(line.gsub(/\-static/, ''))
					}
				}
			}
		}
	end
end

#step_installObject



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/devball/pkgspec/djb.rb', line 53

def step_install()
	# get commands from command/ and put them in the package install dir's bin directory
	Dir.chdir(package_build_dir_name) {|dir|
		# install the commands as specified by package/commands.
		commands = IO.readlines("package/commands")
		FileUtils.mkdir_p(package_install_dir + "/bin")
		commands.each {|command|
			FileUtils.copy("compile/" + command.chomp, package_install_dir + "/bin")
		}
		# install the man pages
		Dir["man/*.?.gz"].each {|manpage|
			mantype = /(.+)\.([0-8])\.gz/.match(manpage)
			FileUtils.mkdir_p(package_install_dir + "/man/man#{mantype[2]}")
			FileUtils.copy(manpage, package_install_dir + "/man/man#{mantype[2]}")
		}
	}
	return []
end

#typeObject



20
21
22
# File 'lib/devball/pkgspec/djb.rb', line 20

def type()
	return self.class.type
end