Top Level Namespace

Defined Under Namespace

Modules: RPM Classes: RPMdb

Constant Summary collapse

HEADERS =
[ "rpmlog", "rpmps", "rpmts", "rpmds" ]

Instance Method Summary collapse

Instance Method Details

#check_dbObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'ext/rpm/extconf.rb', line 27

def check_db
  dir_config('db')
  if have_library("db-4.2","db_version")
    return true
  end
  4.downto(2) do |i|
    if have_library("db-#{i}.0", "db_version") or
        have_library("db#{i}", "db_version") then
      return true
    end
  end
  if have_library("db", "db_version") then
    true
  else
    STDERR.puts "db not found"
  end
end

#check_debugObject



79
80
81
82
83
84
85
86
# File 'ext/rpm/extconf.rb', line 79

def check_debug
  if ENV["RUBYRPM_DEBUG"] then
    puts "debug mode\n"
    $CFLAGS="#{$CFLAGS} -O0 -g -ggdb"
  else
    puts "non-debug mode\n"
  end
end

#check_poptObject



18
19
20
21
22
23
24
25
# File 'ext/rpm/extconf.rb', line 18

def check_popt
  if have_header('popt.h') and have_library('popt') then
    true
  else
    STDERR.puts "libpopt not found"
    false
  end
end

#check_rpmObject



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'ext/rpm/extconf.rb', line 45

def check_rpm
  # Set things up manually
  dir_config("rpm")
  $libs = append_library($libs, 'rpmdb') if rpm_version < rpm_version([4,6,0])
  $libs = append_library($libs, 'rpm')
  have_library('rpmbuild', 'getBuildTime')
  if rpm_version >= rpm_version([4,6,0])
    $defs << "-D_RPM_4_4_COMPAT"
    return true
  end
  if have_header('rpm/rpmlib.h') and
      check_db and
      have_library('rpmio') then
    true
  else
    STDERR.puts "rpm library not found"
    false
  end
end

#check_rpm_versionObject



73
74
75
76
77
# File 'ext/rpm/extconf.rb', line 73

def check_rpm_version
  # TODO: zaki: strict checking is requires
  verflag = "-DRPM_VERSION_CODE=#{rpm_version}"
  $defs << verflag
end

#rpm_version(ver = []) ⇒ Object

if no parameters, returns the installed rpm version, or the one specified by the array ie: [4,1,0]



68
69
70
71
# File 'ext/rpm/extconf.rb', line 68

def rpm_version(ver=[])
  ver = `LANG=C rpm --version| cut -d' ' -f 3`.split(/\./) if ver.empty?
  return (ver[0].to_i<<16) + (ver[1].to_i<<8) + (ver[2].to_i<<0)
end