Changeset 539 in ProjectBuilder for devel/pb/lib/ProjectBuilder/CMS.pm


Ignore:
Timestamp:
Sep 15, 2008, 2:54:42 AM (16 years ago)
Author:
Bruno Cornec
Message:

First attempt to code support for real/virtual names for packages in order to support perl naming in both Debian and RPM distributions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/pb/lib/ProjectBuilder/CMS.pm

    r537 r539  
    3030 
    3131our @ISA = qw(Exporter);
    32 our @EXPORT = qw(pb_cms_init pb_cms_export pb_cms_get_uri pb_cms_copy pb_cms_checkout pb_cms_up pb_cms_checkin pb_cms_isdiff pb_cms_get_pkg pb_cms_compliant pb_cms_log pb_cms_add);
     32our @EXPORT = qw(pb_cms_init pb_cms_export pb_cms_get_uri pb_cms_copy pb_cms_checkout pb_cms_up pb_cms_checkin pb_cms_isdiff pb_cms_get_pkg pb_cms_get_real_pkg pb_cms_compliant pb_cms_log pb_cms_add);
    3333
    3434=pod
     
    449449}
    450450
    451 =item B<pb_cms_getpkg>
     451=item B<pb_cms_get_pkg>
    452452
    453453This function returns the list of packages we are working on in a CMS action.
     
    474474pb_log(0,"Packages: ".join(',',@pkgs)."\n");
    475475return(\@pkgs);
     476}
     477
     478=item B<pb_cms_get_real_pkg>
     479
     480This function returns the real name of a virtual package we are working on in a CMS action.
     481It supports the following types: perl.
     482The first parameter is the virtual package name
     483
     484=cut
     485
     486sub pb_cms_get_real_pkg {
     487
     488my $pbpkg = shift || undef;
     489my $dtype = shift;
     490my $pbpkgreal = $pbpkg;
     491
     492my @nametype = pb_conf_get_if("namingtype");
     493my $type = $nametype[0]->{$pbpkg};
     494if (defined $type) {
     495    if ($type eq "perl") {
     496        if ($dtype eq "rpm") {
     497            $pbpkgreal = "perl-".$pbpkg;
     498        } elsif ($dtype eq "deb") {
     499            $pbpkgreal = "lib".lc($pbpkg)."-perl";
     500        } elsif ($dtype eq "ebuild") {
     501            $pbpkgreal = $pbpkg;
     502        } else {
     503            die "pb_cms_get_real_pkg not implemented for $dtype yet";
     504        }
     505    } else {
     506        die "nametype $type not implemented yet";
     507    }
     508}
     509
     510pb_log(2,"Real Package: $pbpkgreal\n");
     511return($pbpkgreal);
    476512}
    477513
Note: See TracChangeset for help on using the changeset viewer.