| 1 | #!/usr/bin/perl -w |
|---|
| 2 | # |
|---|
| 3 | # Creates common environment for distributions |
|---|
| 4 | # |
|---|
| 5 | # $Id$ |
|---|
| 6 | # |
|---|
| 7 | |
|---|
| 8 | package ProjectBuilder::Distribution; |
|---|
| 9 | |
|---|
| 10 | use strict; |
|---|
| 11 | use Data::Dumper; |
|---|
| 12 | use ProjectBuilder::Base; |
|---|
| 13 | use ProjectBuilder::Conf; |
|---|
| 14 | use File::Basename; |
|---|
| 15 | use File::Copy; |
|---|
| 16 | |
|---|
| 17 | # Inherit from the "Exporter" module which handles exporting functions. |
|---|
| 18 | |
|---|
| 19 | use Exporter; |
|---|
| 20 | |
|---|
| 21 | # Export, by default, all the functions into the namespace of |
|---|
| 22 | # any code which uses this module. |
|---|
| 23 | |
|---|
| 24 | our @ISA = qw(Exporter); |
|---|
| 25 | our @EXPORT = qw(pb_distro_init pb_distro_get pb_distro_installdeps pb_distro_getdeps pb_distro_only_deps_needed pb_distro_setuprepo pb_distro_get_param); |
|---|
| 26 | |
|---|
| 27 | =pod |
|---|
| 28 | |
|---|
| 29 | =head1 NAME |
|---|
| 30 | |
|---|
| 31 | ProjectBuilder::Distribution, part of the project-builder.org - module dealing with distribution detection |
|---|
| 32 | |
|---|
| 33 | =head1 DESCRIPTION |
|---|
| 34 | |
|---|
| 35 | This modules provides functions to allow detection of Linux distributions, and giving back some attributes concerning them. |
|---|
| 36 | |
|---|
| 37 | =head1 SYNOPSIS |
|---|
| 38 | |
|---|
| 39 | use ProjectBuilder::Distribution; |
|---|
| 40 | |
|---|
| 41 | # |
|---|
| 42 | # Return information on the running distro |
|---|
| 43 | # |
|---|
| 44 | my ($ddir, $dver, $dfam, $dtype, $pbsuf, $pbupd, $arch) = pb_distro_init(); |
|---|
| 45 | print "distro tuple: ".Dumper($ddir, $dver, $dfam, $dtype, $pbsuf, $pbupd, $arch)."\n"; |
|---|
| 46 | # |
|---|
| 47 | # Return information on the requested distro |
|---|
| 48 | # |
|---|
| 49 | my ($ddir, $dver, $dfam, $dtype, $pbsuf, $pbupd, $arch) = pb_distro_init("ubuntu","7.10","x86_64"); |
|---|
| 50 | print "distro tuple: ".Dumper($ddir, $dver, $dfam, $dtype, $pbsuf, $pbupd, $arch)."\n"; |
|---|
| 51 | # |
|---|
| 52 | # Return information on the running distro |
|---|
| 53 | # |
|---|
| 54 | my ($ddir,$dver) = pb_distro_get(); |
|---|
| 55 | my ($ddir, $dver, $dfam, $dtype, $pbsuf, $pbupd, $arch) = pb_distro_init($ddir,$dver); |
|---|
| 56 | print "distro tuple: ".Dumper($ddir, $dver, $dfam, $dtype, $pbsuf, $pbupd, $arch)."\n"; |
|---|
| 57 | |
|---|
| 58 | =head1 USAGE |
|---|
| 59 | |
|---|
| 60 | =over 4 |
|---|
| 61 | |
|---|
| 62 | =item B<pb_distro_init> |
|---|
| 63 | |
|---|
| 64 | This function returns a list of 7 parameters indicating the distribution name, version, family, type of build system, suffix of packages, update command line and architecture of the underlying Linux distribution. The value of the 7 fields may be "unknown" in case the function was unable to recognize on which distribution it is running. |
|---|
| 65 | |
|---|
| 66 | As an example, Ubuntu and Debian are in the same "du" family. As well as RedHat, RHEL, CentOS, fedora are on the same "rh" family. |
|---|
| 67 | Mandriva, Open SuSE and Fedora have all the same "rpm" type of build system. Ubuntu ad Debian have the same "deb" type of build system. |
|---|
| 68 | And "fc" is the extension generated for all Fedora packages (Version will be added by pb). |
|---|
| 69 | All these information are stored in an external configuration file typically at /etc/pb/pb.conf |
|---|
| 70 | |
|---|
| 71 | When passing the distribution name and version as parameters, the B<pb_distro_init> function returns the parameter of that distribution instead of the underlying one. |
|---|
| 72 | |
|---|
| 73 | Cf: http://linuxmafia.com/faq/Admin/release-files.html |
|---|
| 74 | Ideas taken from http://search.cpan.org/~kerberus/Linux-Distribution-0.14/lib/Linux/Distribution.pm |
|---|
| 75 | |
|---|
| 76 | =cut |
|---|
| 77 | |
|---|
| 78 | |
|---|
| 79 | sub pb_distro_init { |
|---|
| 80 | |
|---|
| 81 | my $ddir = shift || undef; |
|---|
| 82 | my $dver = shift || undef; |
|---|
| 83 | my $dfam = "unknown"; |
|---|
| 84 | my $dtype = "unknown"; |
|---|
| 85 | my $dsuf = "unknown"; |
|---|
| 86 | my $dupd = "unknown"; |
|---|
| 87 | my $darch = shift || undef; |
|---|
| 88 | my $dnover = "false"; |
|---|
| 89 | my $drmdot = "false"; |
|---|
| 90 | |
|---|
| 91 | # Adds conf file for distribution description |
|---|
| 92 | # the location of the conf file is finalyzed at install time |
|---|
| 93 | # depending whether we deal with package install or tar file install |
|---|
| 94 | pb_conf_add("CCCC/pb.conf"); |
|---|
| 95 | |
|---|
| 96 | # If we don't know which distribution we're on, then guess it |
|---|
| 97 | ($ddir,$dver) = pb_distro_get() if ((not defined $ddir) || (not defined $dver)); |
|---|
| 98 | |
|---|
| 99 | # Initialize arch |
|---|
| 100 | $darch=pb_get_arch() if (not defined $darch); |
|---|
| 101 | |
|---|
| 102 | my ($osfamily,$ostype,$osupd,$ossuffix,$osnover,$osremovedotinver) = pb_conf_get("osfamily","ostype","osupd","ossuffix","osnover","osremovedotinver"); |
|---|
| 103 | |
|---|
| 104 | $dfam = pb_distro_get_param($ddir,$dver,$darch,$osfamily); |
|---|
| 105 | $dtype = $ostype->{$dfam} if (defined $ostype->{$dfam}); |
|---|
| 106 | $dupd = pb_distro_get_param($ddir,$dver,$darch,$osupd,$dfam,$dtype); |
|---|
| 107 | $dsuf = pb_distro_get_param($ddir,$dver,$darch,$ossuffix,$dfam,$dtype); |
|---|
| 108 | $dnover = pb_distro_get_param($ddir,$dver,$darch,$osnover,$dfam,$dtype); |
|---|
| 109 | $drmdot = pb_distro_get_param($ddir,$dver,$darch,$osremovedotinver,$dfam,$dtype); |
|---|
| 110 | |
|---|
| 111 | # Some OS have no interesting version |
|---|
| 112 | $dver = "nover" if ($dnover eq "true"); |
|---|
| 113 | |
|---|
| 114 | # For some OS remove the . in version name |
|---|
| 115 | $dver =~ s/\.// if ($drmdot eq "true"); |
|---|
| 116 | |
|---|
| 117 | if ((not defined $dsuf) || ($dsuf eq "unknown")) { |
|---|
| 118 | # By default suffix is a concatenation of .ddir and dver |
|---|
| 119 | $dsuf = ".$ddir$dver" |
|---|
| 120 | } else { |
|---|
| 121 | # concat just the version to what has been found |
|---|
| 122 | $dsuf = ".$dsuf$dver"; |
|---|
| 123 | } |
|---|
| 124 | |
|---|
| 125 | # if ($arch eq "x86_64") { |
|---|
| 126 | # $opt="--exclude=*.i?86"; |
|---|
| 127 | # } |
|---|
| 128 | |
|---|
| 129 | return($ddir, $dver, $dfam, $dtype, $dsuf, $dupd, $darch); |
|---|
| 130 | } |
|---|
| 131 | |
|---|
| 132 | =item B<pb_distro_get> |
|---|
| 133 | |
|---|
| 134 | This function returns a list of 2 parameters indicating the distribution name and version of the underlying Linux distribution. The value of those 2 fields may be "unknown" in case the function was unable to recognize on which distribution it is running. |
|---|
| 135 | |
|---|
| 136 | On my home machine it would currently report ("mandriva","2009.0"). |
|---|
| 137 | |
|---|
| 138 | =cut |
|---|
| 139 | |
|---|
| 140 | sub pb_distro_get { |
|---|
| 141 | |
|---|
| 142 | # 1: List of files that unambiguously indicates what distro we have |
|---|
| 143 | # 2: List of files that ambiguously indicates what distro we have |
|---|
| 144 | # 3: Should have the same keys as the previous one. If ambiguity, which other distributions should be checked |
|---|
| 145 | # 4: Matching Rg. Expr to detect distribution and version |
|---|
| 146 | my ($single_rel_files, $ambiguous_rel_files,$distro_similar,$distro_match) = pb_conf_get("osrelfile","osrelambfile","osambiguous","osrelexpr"); |
|---|
| 147 | |
|---|
| 148 | my $release; |
|---|
| 149 | my $distro; |
|---|
| 150 | |
|---|
| 151 | # Begin to test presence of non-ambiguous files |
|---|
| 152 | # that way we reduce the choice |
|---|
| 153 | my ($d,$r); |
|---|
| 154 | while (($d,$r) = each %$single_rel_files) { |
|---|
| 155 | if (-f "$r" && ! -l "$r") { |
|---|
| 156 | my $tmp=pb_get_content("$r"); |
|---|
| 157 | # Found the only possibility. |
|---|
| 158 | # Try to get version and return |
|---|
| 159 | if (defined ($distro_match->{$d})) { |
|---|
| 160 | ($release) = $tmp =~ m/$distro_match->{$d}/m; |
|---|
| 161 | } else { |
|---|
| 162 | print STDERR "Unable to find $d version in $r\n"; |
|---|
| 163 | print STDERR "Please report to the maintainer bruno_at_project-builder.org\n"; |
|---|
| 164 | $release = "unknown"; |
|---|
| 165 | } |
|---|
| 166 | return($d,$release); |
|---|
| 167 | } |
|---|
| 168 | } |
|---|
| 169 | |
|---|
| 170 | # Now look at ambiguous files |
|---|
| 171 | # Ubuntu includes a /etc/debian_version file that creates an ambiguity with debian |
|---|
| 172 | # So we need to look at distros in reverse alphabetic order to treat ubuntu always first via lsb |
|---|
| 173 | foreach $d (reverse keys %$ambiguous_rel_files) { |
|---|
| 174 | $r = $ambiguous_rel_files->{$d}; |
|---|
| 175 | if (-f "$r" && !-l "$r") { |
|---|
| 176 | # Found one possibility. |
|---|
| 177 | # Get all distros concerned by that file |
|---|
| 178 | my $tmp=pb_get_content("$r"); |
|---|
| 179 | my $found = 0; |
|---|
| 180 | my $ptr = $distro_similar->{$d}; |
|---|
| 181 | pb_log(2,"amb: ".Dumper($ptr)."\n"); |
|---|
| 182 | $release = "unknown"; |
|---|
| 183 | foreach my $dd (split(/,/,$ptr)) { |
|---|
| 184 | pb_log(2,"check $dd\n"); |
|---|
| 185 | # Try to check pattern |
|---|
| 186 | if (defined $distro_match->{$dd}) { |
|---|
| 187 | pb_log(2,"cmp: $distro_match->{$dd} - vs - $tmp\n"); |
|---|
| 188 | ($release) = $tmp =~ m/$distro_match->{$dd}/m; |
|---|
| 189 | if ((defined $release) && ($release ne "unknown")) { |
|---|
| 190 | $distro = $dd; |
|---|
| 191 | $found = 1; |
|---|
| 192 | last; |
|---|
| 193 | } |
|---|
| 194 | } |
|---|
| 195 | } |
|---|
| 196 | if ($found == 0) { |
|---|
| 197 | print STDERR "Unable to find $d version in $r\n"; |
|---|
| 198 | print STDERR "Please report to the maintainer bruno_at_project-builder.org\n"; |
|---|
| 199 | $release = "unknown"; |
|---|
| 200 | } else { |
|---|
| 201 | return($distro,$release); |
|---|
| 202 | } |
|---|
| 203 | } |
|---|
| 204 | } |
|---|
| 205 | return("unknown","unknown"); |
|---|
| 206 | } |
|---|
| 207 | |
|---|
| 208 | |
|---|
| 209 | =over 4 |
|---|
| 210 | |
|---|
| 211 | =item B<pb_distro_installdeps> |
|---|
| 212 | |
|---|
| 213 | This function install the dependencies required to build the package on an RPM based distro |
|---|
| 214 | dependencies can be passed as a parameter in which case they are not computed |
|---|
| 215 | |
|---|
| 216 | =cut |
|---|
| 217 | |
|---|
| 218 | sub pb_distro_installdeps { |
|---|
| 219 | |
|---|
| 220 | # SPEC file |
|---|
| 221 | my $f = shift || undef; |
|---|
| 222 | my $dtype = shift || undef; |
|---|
| 223 | my $dupd = shift || undef; |
|---|
| 224 | my $deps = shift || undef; |
|---|
| 225 | |
|---|
| 226 | # Protection |
|---|
| 227 | return if (not defined $dupd); |
|---|
| 228 | |
|---|
| 229 | # Get dependecies in the build file if not forced |
|---|
| 230 | $deps = pb_distro_getdeps("$f", $dtype) if (not defined $deps); |
|---|
| 231 | pb_log(2,"deps: $deps\n"); |
|---|
| 232 | return if ((not defined $deps) || ($deps =~ /^\s*$/)); |
|---|
| 233 | if ($deps !~ /^[ ]*$/) { |
|---|
| 234 | pb_system("$dupd $deps","Installing dependencies ($deps)"); |
|---|
| 235 | } |
|---|
| 236 | } |
|---|
| 237 | |
|---|
| 238 | =over 4 |
|---|
| 239 | |
|---|
| 240 | =item B<pb_distro_getdeps> |
|---|
| 241 | |
|---|
| 242 | This function computes the dependencies indicated in the build file and return them as a string of packages to install |
|---|
| 243 | |
|---|
| 244 | =cut |
|---|
| 245 | |
|---|
| 246 | sub pb_distro_getdeps { |
|---|
| 247 | |
|---|
| 248 | my $f = shift || undef; |
|---|
| 249 | my $dtype = shift || undef; |
|---|
| 250 | |
|---|
| 251 | my $regexp = ""; |
|---|
| 252 | my $deps = ""; |
|---|
| 253 | my $sep = $/; |
|---|
| 254 | |
|---|
| 255 | pb_log(3,"entering pb_distro_getdeps: $dtype - $f\n"); |
|---|
| 256 | # Protection |
|---|
| 257 | return("") if (not defined $dtype); |
|---|
| 258 | if ($dtype eq "rpm") { |
|---|
| 259 | # In RPM this could include files, but we do not handle them atm. |
|---|
| 260 | $regexp = '^BuildRequires:(.*)$'; |
|---|
| 261 | } elsif ($dtype eq "deb") { |
|---|
| 262 | $regexp = '^Build-Depends:(.*)$'; |
|---|
| 263 | } elsif ($dtype eq "ebuild") { |
|---|
| 264 | $sep = '"'.$/; |
|---|
| 265 | $regexp = '^DEPEND="(.*)"\n' |
|---|
| 266 | } else { |
|---|
| 267 | # No idea |
|---|
| 268 | return(""); |
|---|
| 269 | } |
|---|
| 270 | pb_log(2,"regexp: $regexp\n"); |
|---|
| 271 | |
|---|
| 272 | |
|---|
| 273 | # Protection |
|---|
| 274 | return("") if (not defined $f); |
|---|
| 275 | |
|---|
| 276 | # Preserve separator before using the one we need |
|---|
| 277 | my $oldsep = $/; |
|---|
| 278 | $/ = $sep; |
|---|
| 279 | open(DESC,"$f") || die "Unable to open $f"; |
|---|
| 280 | while (<DESC>) { |
|---|
| 281 | pb_log(4,"read: $_\n"); |
|---|
| 282 | next if (! /$regexp/); |
|---|
| 283 | chomp(); |
|---|
| 284 | # What we found with the regexp is the list of deps. |
|---|
| 285 | pb_log(2,"found deps: $_\n"); |
|---|
| 286 | s/$regexp/$1/i; |
|---|
| 287 | # Remove conditions in the middle and at the end for deb |
|---|
| 288 | s/\(\s*[><=]+.*\)\s*,/,/g; |
|---|
| 289 | s/\(\s*[><=]+.*$//g; |
|---|
| 290 | # Same for rpm |
|---|
| 291 | s/[><=]+.*,/,/g; |
|---|
| 292 | s/[><=]+.*$//g; |
|---|
| 293 | # Improve string format (remove , and spaces at start, end and in double |
|---|
| 294 | s/,/ /g; |
|---|
| 295 | s/^\s*//; |
|---|
| 296 | s/\s*$//; |
|---|
| 297 | s/\s+/ /g; |
|---|
| 298 | $deps .= " ".$_; |
|---|
| 299 | } |
|---|
| 300 | close(DESC); |
|---|
| 301 | $/ = $oldsep; |
|---|
| 302 | pb_log(2,"now deps: $deps\n"); |
|---|
| 303 | my $deps2 = pb_distro_only_deps_needed($dtype,$deps); |
|---|
| 304 | return($deps2); |
|---|
| 305 | } |
|---|
| 306 | |
|---|
| 307 | |
|---|
| 308 | =over 4 |
|---|
| 309 | |
|---|
| 310 | =item B<pb_distro_only_deps_needed> |
|---|
| 311 | |
|---|
| 312 | This function returns only the dependencies not yet installed |
|---|
| 313 | |
|---|
| 314 | =cut |
|---|
| 315 | |
|---|
| 316 | sub pb_distro_only_deps_needed { |
|---|
| 317 | |
|---|
| 318 | my $dtype = shift || undef; |
|---|
| 319 | my $deps = shift || undef; |
|---|
| 320 | |
|---|
| 321 | return("") if ((not defined $deps) || ($deps =~ /^\s*$/)); |
|---|
| 322 | my $deps2 = ""; |
|---|
| 323 | # Avoid to install what is already there |
|---|
| 324 | foreach my $p (split(/ /,$deps)) { |
|---|
| 325 | if ($dtype eq "rpm") { |
|---|
| 326 | my $res = pb_system("rpm -q --whatprovides --quiet $p","","quiet"); |
|---|
| 327 | next if ($res eq 0); |
|---|
| 328 | } elsif ($dtype eq "deb") { |
|---|
| 329 | my $res = pb_system("dpkg -L $p","","quiet"); |
|---|
| 330 | next if ($res eq 0); |
|---|
| 331 | } elsif ($dtype eq "ebuild") { |
|---|
| 332 | } else { |
|---|
| 333 | # Not reached |
|---|
| 334 | } |
|---|
| 335 | pb_log(2,"found deps2: $p\n"); |
|---|
| 336 | $deps2 .= " $p"; |
|---|
| 337 | } |
|---|
| 338 | |
|---|
| 339 | $deps2 =~ s/^\s*//; |
|---|
| 340 | pb_log(2,"now deps2: $deps2\n"); |
|---|
| 341 | return($deps2); |
|---|
| 342 | } |
|---|
| 343 | |
|---|
| 344 | =over 4 |
|---|
| 345 | |
|---|
| 346 | =item B<pb_distro_setuprepo> |
|---|
| 347 | |
|---|
| 348 | This function sets up potential additional repository to the build environment |
|---|
| 349 | |
|---|
| 350 | =cut |
|---|
| 351 | |
|---|
| 352 | sub pb_distro_setuprepo { |
|---|
| 353 | |
|---|
| 354 | my $ddir = shift || undef; |
|---|
| 355 | my $dver = shift; |
|---|
| 356 | my $darch = shift; |
|---|
| 357 | my $dtype = shift || undef; |
|---|
| 358 | |
|---|
| 359 | my ($addrepo) = pb_conf_read("$ENV{'PBDESTDIR'}/pbrc","addrepo"); |
|---|
| 360 | return if (not defined $addrepo); |
|---|
| 361 | |
|---|
| 362 | my $param = pb_distro_get_param($ddir,$dver,$darch,$addrepo); |
|---|
| 363 | return if ($param eq ""); |
|---|
| 364 | |
|---|
| 365 | # Loop on the list of additional repo |
|---|
| 366 | foreach my $i (split(/,/,$param)) { |
|---|
| 367 | |
|---|
| 368 | my ($scheme, $account, $host, $port, $path) = pb_get_uri($i); |
|---|
| 369 | my $bn = basename($i); |
|---|
| 370 | |
|---|
| 371 | # The repo file can be local or remote. download or copy at the right place |
|---|
| 372 | if (($scheme eq "ftp") || ($scheme eq "http")) { |
|---|
| 373 | pb_system("wget -O $ENV{'PBTMP'}/$bn $i","Donwloading additional repository file $i"); |
|---|
| 374 | } else { |
|---|
| 375 | copy($i,$ENV{'PBTMP'}/$bn); |
|---|
| 376 | } |
|---|
| 377 | |
|---|
| 378 | # The repo file can be a real file or a package |
|---|
| 379 | if ($dtype eq "rpm") { |
|---|
| 380 | if ($bn =~ /\.rpm$/) { |
|---|
| 381 | my $pn = $bn; |
|---|
| 382 | $pn =~ s/\.rpm//; |
|---|
| 383 | if (pb_system("rpm -q --quiet $pn","","quiet") != 0) { |
|---|
| 384 | pb_system("sudo rpm -Uvh $ENV{'PBTMP'}/$bn","Adding package to setup repository"); |
|---|
| 385 | } |
|---|
| 386 | } elsif ($bn =~ /\.repo$/) { |
|---|
| 387 | # Yum repo |
|---|
| 388 | pb_system("sudo mv $ENV{'PBTMP'}/$bn /etc/yum.repos.d","Adding yum repository") if (not -f "/etc/yum.repos.d/$bn"); |
|---|
| 389 | } elsif ($bn =~ /\.addmedia/) { |
|---|
| 390 | # URPMI repo |
|---|
| 391 | # We should test that it's not already a urpmi repo |
|---|
| 392 | pb_system("chmod 755 $ENV{'PBTMP'}/$bn ; sudo $ENV{'PBTMP'}/$bn 2>&1 > /dev/null","Adding urpmi repository"); |
|---|
| 393 | } else { |
|---|
| 394 | pb_log(0,"Unable to deal with repository file $i on rpm distro ! Please report to dev team\n"); |
|---|
| 395 | } |
|---|
| 396 | } elsif ($dtype eq "deb") { |
|---|
| 397 | if (($bn =~ /\.sources.list$/) && (not -f "/etc/apt/sources.list.d/$bn")) { |
|---|
| 398 | pb_system("sudo mv $ENV{'PBTMP'}/$bn /etc/apt/sources.list.d","Adding apt repository"); |
|---|
| 399 | pb_system("sudo apt-get update","Updating apt repository"); |
|---|
| 400 | } else { |
|---|
| 401 | pb_log(0,"Unable to deal with repository file $i on deb distro ! Please report to dev team\n"); |
|---|
| 402 | } |
|---|
| 403 | } else { |
|---|
| 404 | pb_log(0,"Unable to deal with repository file $i on that distro ! Please report to dev team\n"); |
|---|
| 405 | } |
|---|
| 406 | } |
|---|
| 407 | return; |
|---|
| 408 | } |
|---|
| 409 | |
|---|
| 410 | =over 4 |
|---|
| 411 | |
|---|
| 412 | =item B<pb_distro_get_param> |
|---|
| 413 | |
|---|
| 414 | This function gets the parameter in the conf file from the most precise tuple up to default |
|---|
| 415 | |
|---|
| 416 | =cut |
|---|
| 417 | |
|---|
| 418 | sub pb_distro_get_param { |
|---|
| 419 | |
|---|
| 420 | my $param = ""; |
|---|
| 421 | my $ddir = shift; |
|---|
| 422 | my $dver = shift; |
|---|
| 423 | my $darch = shift; |
|---|
| 424 | my $opt = shift; |
|---|
| 425 | my $dfam = shift || "unknown"; |
|---|
| 426 | my $dtype = shift || "unknown"; |
|---|
| 427 | |
|---|
| 428 | if (defined $opt->{"$ddir-$dver-$darch"}) { |
|---|
| 429 | $param = $opt->{"$ddir-$dver-$darch"}; |
|---|
| 430 | } elsif (defined $opt->{"$ddir-$dver"}) { |
|---|
| 431 | $param = $opt->{"$ddir-$dver"}; |
|---|
| 432 | } elsif (defined $opt->{"$ddir"}) { |
|---|
| 433 | $param = $opt->{"$ddir"}; |
|---|
| 434 | } elsif (defined $opt->{$dfam}) { |
|---|
| 435 | $param = $opt->{$dfam}; |
|---|
| 436 | } elsif (defined $opt->{$dtype}) { |
|---|
| 437 | $param = $opt->{$dtype}; |
|---|
| 438 | } elsif (defined $opt->{"default"}) { |
|---|
| 439 | $param = $opt->{"default"}; |
|---|
| 440 | } else { |
|---|
| 441 | $param = "unknown"; |
|---|
| 442 | } |
|---|
| 443 | return($param); |
|---|
| 444 | |
|---|
| 445 | } |
|---|
| 446 | |
|---|
| 447 | |
|---|
| 448 | =back |
|---|
| 449 | |
|---|
| 450 | =head1 WEB SITES |
|---|
| 451 | |
|---|
| 452 | The main Web site of the project is available at L<http://www.project-builder.org/>. Bug reports should be filled using the trac instance of the project at L<http://trac.project-builder.org/>. |
|---|
| 453 | |
|---|
| 454 | =head1 USER MAILING LIST |
|---|
| 455 | |
|---|
| 456 | None exists for the moment. |
|---|
| 457 | |
|---|
| 458 | =head1 AUTHORS |
|---|
| 459 | |
|---|
| 460 | The Project-Builder.org team L<http://trac.project-builder.org/> lead by Bruno Cornec L<mailto:bruno@project-builder.org>. |
|---|
| 461 | |
|---|
| 462 | =head1 COPYRIGHT |
|---|
| 463 | |
|---|
| 464 | Project-Builder.org is distributed under the GPL v2.0 license |
|---|
| 465 | described in the file C<COPYING> included with the distribution. |
|---|
| 466 | |
|---|
| 467 | =cut |
|---|
| 468 | |
|---|
| 469 | |
|---|
| 470 | 1; |
|---|