Changeset 539 in ProjectBuilder


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

Location:
devel
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • devel/pb-modules/Makefile.PL

    r514 r539  
    55# the contents of the Makefile that is written.
    66WriteMakefile(
    7     NAME         => 'ProjectBuilder',
    8     DISTNAME     => 'perl-ProjectBuilder',
     7    NAME         => 'PBPKG',
     8    DISTNAME     => 'PBPKG',
    99    VERSION      => 'PBVER',
    1010    INST_SCRIPT  => 'blib/bin',
  • devel/pb/bin/pb

    r537 r539  
    483483        pb_log(0,"Management of $pbpkg $pbver-$pbtag (rev $pbrev)\n");
    484484        die "Unable to get env var PBDESTDIR" if (not defined $ENV{'PBDESTDIR'});
     485
    485486        # Clean up dest if necessary. The export will recreate it
    486487        my $dest = "$ENV{'PBDESTDIR'}/$pbpkg-$pbver";
     
    536537        }
    537538
    538         # Setup %pb structure to allow filtering later on on files using that structure
     539        # Setup %pb structure to allow filtering later on, on files using that structure
    539540        $pb{'tag'} = $pbtag;
    540541        $pb{'rev'} = $pbrev;
    541         $pb{'pkg'} = $pbpkg;
    542542        $pb{'ver'} = $pbver;
    543543        $pb{'date'} = $pbdate;
     
    558558            pb_log(2,"DEBUG: distro tuple: ".Dumper($ddir, $dver, $dfam, $pb{'dtype'}, $pb{'suf'})."\n");
    559559            pb_log(2,"DEBUG Filtering PBDATE => $pbdate, PBTAG => $pbtag, PBVER => $pbver\n");
     560
     561            # We need to compute the real name of the package
     562            my $pbpkgreal = pb_cms_get_real_pkg($pbpkg,$pb{'dtype'});
     563            $pb{'pkg'} = $pbpkgreal;
    560564
    561565            # Filter build files from the less precise up to the most with overloading
     
    703707    pb_log(2,"DEBUG pkgs: ".Dumper(%pkgs)."\n");
    704708    open(PKG,"> $ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.pb") || die "Unable to create $ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.pb";
    705     foreach my $pbpkg (@pkgs) {
     709    foreach my $pbpkg (keys %pkgs) {
    706710        print PKG "pbpkg $pbpkg = $pkgs{$pbpkg}\n";
    707711    }
  • 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
  • devel/pb/lib/ProjectBuilder/Env.pm

    r505 r539  
    118118# Detect the root dir for hosting all the content generated with pb
    119119#
    120 # Tree will look like this:
    121 #
    122 #             maint pbdefdir                         PBDEFDIR            dev dir (optional)
    123 #                  |                                                        |
    124 #            ------------------------                                --------------------
    125 #            |                      |                                |                  |
    126 #         pbproj1                pbproj2             PBPROJ       pbproj1           pbproj2   PBPROJDIR
    127 #            |                                                       |
    128 #  ---------------------------------------------                ----------
    129 #  *      *        *       |        |          |                *        *
    130 # tag    dev    pbconf    ...     build     delivery PBCONFDIR dev      tag                 
    131 #  |               |                           |     PBDESTDIR           |
    132 #  ---          ------                        pbrc   PBBUILDDIR       -------
    133 #    |          |    |                                                |     |
    134 #   1.1        dev  tag                                              1.0   1.1                PBDIR
    135 #                    |
    136 #                 -------
    137 #                 |     |
    138 #                1.0   1.1                           PBROOTDIR
    139 #                       |
    140 #               ----------------------------------
    141 #               |          |           |         |
    142 #             pkg1      pbproj1.pb   pbfilter   pbcl
    143 #               |
    144 #        -----------------
    145 #        |      |        |
    146 #       rpm    deb    pbfilter
    147 #
    148 #
    149 # (*) By default, if no relocation in .pbrc, dev dir is taken in the maint pbdefdir (when appropriate)
    150 # Names under a pbproj and the corresponding pbconf should be similar
    151 #
     120=over 4
     121
     122 Tree will look like this:
     123
     124             maint pbdefdir                         PBDEFDIR            dev dir (optional)
     125                  |                                                        |
     126            ------------------------                                --------------------
     127            |                      |                                |                  |
     128         pbproj1                pbproj2             PBPROJ       pbproj1           pbproj2   PBPROJDIR
     129            |                                                       |
     130  ---------------------------------------------                ----------
     131  *      *        *       |        |          |                *        *
     132 tag    dev    pbconf    ...     build     delivery PBCONFDIR dev      tag                 
     133  |               |                           |     PBDESTDIR           |
     134  ---          ------                        pbrc   PBBUILDDIR       -------
     135    |          |    |                                                |     |
     136   1.1        dev  tag                                              1.0   1.1                PBDIR
     137                    |
     138                 -------
     139                 |     |
     140                1.0   1.1                           PBROOTDIR
     141                       |
     142               ----------------------------------
     143               |          |           |         |
     144             pkg1      pbproj1.pb   pbfilter   pbcl
     145               |
     146        -----------------
     147        |      |        |
     148       rpm    deb    pbfilter
     149
     150
     151 (*) By default, if no relocation in .pbrc, dev dir is taken in the maint pbdefdir (when appropriate)
     152 Names under a pbproj and the corresponding pbconf should be similar
     153
     154=cut
    152155
    153156my ($pbdefdir) = pb_conf_get_if("pbdefdir");
     
    217220
    218221#
    219 # The following part is only useful when in cms2something of newver
     222# The following part is only useful when in cms2something or newsomething
    220223# In VMs/VEs we want to skip that by providing good env vars.
    221224# return values in that case are useless
Note: See TracChangeset for help on using the changeset viewer.