[2] | 1 | #!/usr/bin/perl -w
|
---|
| 2 | #
|
---|
[74] | 3 | # Base subroutines for the Project-Builder project
|
---|
[2] | 4 | #
|
---|
| 5 | # $Id$
|
---|
| 6 | #
|
---|
| 7 |
|
---|
[318] | 8 | package ProjectBuilder::Base;
|
---|
| 9 |
|
---|
[18] | 10 | use strict;
|
---|
[5] | 11 | use lib qw (lib);
|
---|
[2] | 12 | use File::Basename;
|
---|
[9] | 13 | use File::Path;
|
---|
[320] | 14 | use File::stat;
|
---|
[315] | 15 | use File::Copy;
|
---|
[318] | 16 | use File::Temp qw(tempdir);
|
---|
[8] | 17 | use Data::Dumper;
|
---|
[315] | 18 | use POSIX qw(strftime);
|
---|
[318] | 19 | use Time::localtime qw(localtime);
|
---|
[2] | 20 |
|
---|
[199] | 21 | use ProjectBuilder::Changelog qw (pb_changelog);
|
---|
| 22 |
|
---|
[318] | 23 | # Inherit from the "Exporter" module which handles exporting functions.
|
---|
| 24 |
|
---|
| 25 | use Exporter;
|
---|
| 26 |
|
---|
| 27 | # Export, by default, all the functions into the namespace of
|
---|
| 28 | # any code which uses this module.
|
---|
| 29 |
|
---|
| 30 | our $debug = 0;
|
---|
| 31 | our $LOG = \*STDOUT;
|
---|
| 32 |
|
---|
| 33 | our @ISA = qw(Exporter);
|
---|
[320] | 34 | our @EXPORT = qw(pb_env_init pb_conf_read pb_conf_read_if pb_conf_get pb_conf_get_if pb_cms_init pb_mkdir_p pb_system pb_rm_rf pb_get_filters pb_filter_file pb_filter_file_pb pb_filter_file_inplace pb_cms_export pb_cms_log pb_cms_isdiff pb_cms_copy pb_cms_checkout pb_get_date pb_log pb_log_init pb_get_pkg $debug $LOG);
|
---|
[318] | 35 |
|
---|
[49] | 36 | $ENV{'PBETC'} = "$ENV{'HOME'}/.pbrc";
|
---|
[5] | 37 |
|
---|
[74] | 38 | sub pb_env_init {
|
---|
[2] | 39 |
|
---|
[273] | 40 | my $proj=shift || undef;
|
---|
| 41 | my $pbinit=shift || undef;
|
---|
[5] | 42 | my $ver;
|
---|
| 43 | my $tag;
|
---|
[2] | 44 |
|
---|
[8] | 45 | #
|
---|
[5] | 46 | # Check project name
|
---|
[49] | 47 | # Could be with env var PBPROJ
|
---|
| 48 | # or option -p
|
---|
| 49 | # if not define take the first in conf file
|
---|
[8] | 50 | #
|
---|
[5] | 51 | if ((defined $ENV{'PBPROJ'}) &&
|
---|
| 52 | (not (defined $proj))) {
|
---|
| 53 | $proj = $ENV{'PBPROJ'};
|
---|
| 54 | }
|
---|
[69] | 55 |
|
---|
[49] | 56 | #
|
---|
[313] | 57 | # We get the pbconf file for that project
|
---|
[69] | 58 | # and use its content
|
---|
| 59 | #
|
---|
[322] | 60 | my ($pbconf) = pb_conf_read("$ENV{'PBETC'}","pbconfurl");
|
---|
| 61 | pb_log(2,"DEBUG pbconfurl: ".Dumper($pbconf)."\n");
|
---|
[69] | 62 |
|
---|
[313] | 63 | my %pbconf = %$pbconf;
|
---|
[69] | 64 | if (not defined $proj) {
|
---|
| 65 | # Take the first as the default project
|
---|
[313] | 66 | $proj = (keys %pbconf)[0];
|
---|
[315] | 67 | if (defined $proj) {
|
---|
[316] | 68 | pb_log(0,"WARNING: using $proj as default project as none has been specified\n");
|
---|
[322] | 69 | pb_log(0," Please either create a pbconfurl reference for project $proj in $ENV{'PBETC'}\n");
|
---|
[319] | 70 | pb_log(0," or call pb with the -p project option or use the env var PBPROJ\n");
|
---|
| 71 | pb_log(0," if you want to use another project\n");
|
---|
[313] | 72 | }
|
---|
[69] | 73 | }
|
---|
[322] | 74 | die "No project defined - use env var PBPROJ or -p proj or a pbconfurl entry in $ENV{'PBETC'}" if (not (defined $proj));
|
---|
[69] | 75 |
|
---|
[313] | 76 | # That's always the environment variable that will be used
|
---|
| 77 | $ENV{'PBPROJ'} = $proj;
|
---|
[318] | 78 | pb_log(2,"PBPROJ: $ENV{'PBPROJ'}\n");
|
---|
[313] | 79 |
|
---|
| 80 | if (not defined ($pbconf{$ENV{'PBPROJ'}})) {
|
---|
[322] | 81 | die "Please create a pbconfurl reference for project $ENV{'PBPROJ'} in $ENV{'PBETC'}\n";
|
---|
[313] | 82 | }
|
---|
| 83 |
|
---|
[69] | 84 | #
|
---|
[313] | 85 | # Detect the root dir for hosting all the content generated with pb
|
---|
[69] | 86 | #
|
---|
[314] | 87 | # Tree will look like this:
|
---|
| 88 | #
|
---|
[322] | 89 | # maint pbdefdir PBDEFDIR dev dir (optional) PBDEVDIR
|
---|
[315] | 90 | # | |
|
---|
| 91 | # ------------------------ --------------------
|
---|
| 92 | # | | | |
|
---|
| 93 | # pbproj1 pbproj2 PBPROJ pbproj1 pbproj2 PBDEVPROJ
|
---|
| 94 | # | |
|
---|
| 95 | # --------------------------------------------- ----------
|
---|
[322] | 96 | # * * * | | | * *
|
---|
[319] | 97 | # 1.0 dev pbconf ... build delivery PBCONF dev tag PBDEVROOT
|
---|
| 98 | # | | PBDESTDIR |
|
---|
| 99 | # ------ pbrc PBBUILDDIR -------
|
---|
| 100 | # | | | |
|
---|
| 101 | # dev tag PBROOT 1.0 1.1
|
---|
[314] | 102 | # |
|
---|
[319] | 103 | # -------
|
---|
| 104 | # | |
|
---|
| 105 | # 1.0 1.1
|
---|
| 106 | # |
|
---|
[314] | 107 | # ----------------------------------
|
---|
| 108 | # | | | |
|
---|
| 109 | # pkg1 pbproj1.pb pbfilter pbcl
|
---|
| 110 | # |
|
---|
| 111 | # -----------------
|
---|
| 112 | # | | |
|
---|
| 113 | # rpm deb pbfilter
|
---|
| 114 | #
|
---|
| 115 | #
|
---|
[322] | 116 | # (*) By default, if no relocation in .pbrc, dev dir is taken in the maint pbdefdir (when appropriate)
|
---|
[314] | 117 | # Names under a pbproj and the corresponding pbconf should be similar
|
---|
| 118 | #
|
---|
[313] | 119 |
|
---|
[322] | 120 | my ($pbdefdir) = pb_conf_get_if("pbdefdir");
|
---|
| 121 | my %pbdefdir = %$pbdefdir;
|
---|
[314] | 122 |
|
---|
[322] | 123 | if (not defined $ENV{'PBDEFDIR'}) {
|
---|
| 124 | if ((not defined $pbdefdir) || (not defined $pbdefdir{$ENV{'PBPROJ'}})) {
|
---|
| 125 | pb_log(0,"WARNING: no pbdefdir defined, using /var/cache\n");
|
---|
| 126 | pb_log(0," Please create a pbdefdir reference for project $ENV{'PBPROJ'} in $ENV{'PBETC'}\n");
|
---|
[318] | 127 | pb_log(0," if you want to use another directory\n");
|
---|
[322] | 128 | $ENV{'PBDEFDIR'} = "/var/cache";
|
---|
[316] | 129 | } else {
|
---|
| 130 | # That's always the environment variable that will be used
|
---|
[322] | 131 | $ENV{'PBDEFDIR'} = $pbdefdir{$ENV{'PBPROJ'}};
|
---|
[313] | 132 | }
|
---|
[273] | 133 | }
|
---|
[108] | 134 | # Expand potential env variable in it
|
---|
[322] | 135 | eval { $ENV{'PBDEFDIR'} =~ s/(\$ENV.+\})/$1/eeg };
|
---|
[69] | 136 |
|
---|
[322] | 137 | pb_log(2,"PBDEFDIR: $ENV{'PBDEFDIR'}\n");
|
---|
[69] | 138 | #
|
---|
[313] | 139 | # Set delivery directory
|
---|
[49] | 140 | #
|
---|
[322] | 141 | $ENV{'PBDESTDIR'}="$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}/delivery";
|
---|
[313] | 142 |
|
---|
[318] | 143 | pb_log(2,"PBDESTDIR: $ENV{'PBDESTDIR'}\n");
|
---|
[313] | 144 | #
|
---|
| 145 | # Removes all directory existing below the delivery dir
|
---|
| 146 | # as they are temp dir only
|
---|
| 147 | # Files stay and have to be cleaned up manually if needed
|
---|
| 148 | # those files serves as communication channels between pb phases
|
---|
| 149 | # Removing them prevents a following phase to detect what has been done before
|
---|
| 150 | #
|
---|
| 151 | if (-d $ENV{'PBDESTDIR'}) {
|
---|
| 152 | opendir(DIR,$ENV{'PBDESTDIR'}) || die "Unable to open directory $ENV{'PBDESTDIR'}: $!";
|
---|
| 153 | foreach my $d (readdir(DIR)) {
|
---|
| 154 | next if ($d =~ /^\./);
|
---|
| 155 | next if (-f "$ENV{'PBDESTDIR'}/$d");
|
---|
| 156 | pb_rm_rf("$ENV{'PBDESTDIR'}/$d") if (-d "$ENV{'PBDESTDIR'}/$d");
|
---|
[67] | 157 | }
|
---|
[313] | 158 | closedir(DIR);
|
---|
[49] | 159 | }
|
---|
[313] | 160 | if (! -d "$ENV{'PBDESTDIR'}") {
|
---|
| 161 | pb_mkdir_p($ENV{'PBDESTDIR'}) || die "Unable to recursively create $ENV{'PBDESTDIR'}";
|
---|
| 162 | }
|
---|
[2] | 163 |
|
---|
[8] | 164 | #
|
---|
[313] | 165 | # Set build directory
|
---|
[8] | 166 | #
|
---|
[322] | 167 | $ENV{'PBBUILDDIR'}="$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}/build";
|
---|
[313] | 168 | if (! -d "$ENV{'PBBUILDDIR'}") {
|
---|
| 169 | pb_mkdir_p($ENV{'PBBUILDDIR'}) || die "Unable to recursively create $ENV{'PBBUILDDIR'}";
|
---|
| 170 | }
|
---|
| 171 |
|
---|
[318] | 172 | pb_log(2,"PBBUILDDIR: $ENV{'PBBUILDDIR'}\n");
|
---|
[313] | 173 | #
|
---|
| 174 | # Set temp directory
|
---|
| 175 | #
|
---|
| 176 | if (not defined $ENV{'TMPDIR'}) {
|
---|
| 177 | $ENV{'TMPDIR'}="/tmp";
|
---|
| 178 | }
|
---|
| 179 | $ENV{'PBTMP'} = tempdir( "pb.XXXXXXXXXX", DIR => $ENV{'TMPDIR'}, CLEANUP => 1 );
|
---|
[318] | 180 | pb_log(2,"PBTMP: $ENV{'PBTMP'}\n");
|
---|
[313] | 181 |
|
---|
| 182 | #
|
---|
[320] | 183 | # The following part is only useful when in cms2build
|
---|
| 184 | # In VMs/VEs we want to skip that by providing a good PBCONF env var.
|
---|
| 185 | # return values in that case are useless
|
---|
| 186 | #
|
---|
| 187 | return if (defined $ENV{'PBCONF'});
|
---|
| 188 |
|
---|
| 189 | #
|
---|
[313] | 190 | # Check pbconf compliance
|
---|
| 191 | #
|
---|
[322] | 192 | my ($pbconfdir) = pb_conf_get_if("pbconfdir");
|
---|
| 193 | my %pbconfdir = %$pbconfdir;
|
---|
| 194 |
|
---|
| 195 | if ((defined $pbconfdir) && (defined $pbconfdir{$ENV{'PBPROJ'}})) {
|
---|
| 196 | # That's always the environment variable that will be used
|
---|
| 197 | $ENV{'PBCONF'} = $pbconfdir{$ENV{'PBPROJ'}};
|
---|
| 198 | } else {
|
---|
| 199 | pb_log(0,"WARNING: no pbconfdir defined, using $ENV{'PBDIR'}/$ENV{'PBPROJ'}/pbconf\n");
|
---|
| 200 | pb_log(0," Please create a pbconfdir reference for project $ENV{'PBPROJ'} in $ENV{'PBETC'}\n");
|
---|
| 201 | pb_log(0," if you want to use another directory\n");
|
---|
| 202 | $ENV{'PBCONF'} = "$ENV{'PBDIR'}/$ENV{'PBPROJ'}/pbconf";
|
---|
| 203 | }
|
---|
[318] | 204 | pb_log(2,"PBCONF: $ENV{'PBCONF'}\n");
|
---|
[313] | 205 |
|
---|
[314] | 206 | my ($scheme, $account, $host, $port, $path) = pb_get_uri($pbconf{$ENV{'PBPROJ'}});
|
---|
[313] | 207 |
|
---|
[318] | 208 | if ((! -d "$ENV{'PBCONF'}") || (defined $pbinit)) {
|
---|
[316] | 209 | pb_log(1,"Checking out pbconf\n");
|
---|
[315] | 210 | pb_cms_checkout($scheme,$pbconf{$ENV{'PBPROJ'}},$ENV{'PBCONF'});
|
---|
[314] | 211 | } else {
|
---|
[316] | 212 | pb_log(1,"pbconf found, checking content\n");
|
---|
[315] | 213 | my $cmsurl = pb_cms_getinfo($scheme,$ENV{'PBCONF'},"URL:");
|
---|
[318] | 214 | my ($scheme2, $account2, $host2, $port2, $path2) = pb_get_uri($cmsurl);
|
---|
| 215 | if ($scheme2 ne $scheme) {
|
---|
| 216 | pb_log(1,"WARNING: Content of $ENV{'PBCONF'} irrelevant, cleaning up and checking it out\n");
|
---|
[314] | 217 | pb_rm_rf("$ENV{'PBCONF'}");
|
---|
[315] | 218 | pb_cms_checkout($scheme,$pbconf{$ENV{'PBPROJ'}},$ENV{'PBCONF'});
|
---|
[314] | 219 | } elsif ($cmsurl ne $pbconf{$ENV{'PBPROJ'}}) {
|
---|
| 220 | # The local content doesn't correpond to the repository
|
---|
[316] | 221 | pb_log(0,"ERROR: Inconsistency detected:\n");
|
---|
[318] | 222 | pb_log(0," * $ENV{'PBCONF'} refers to $cmsurl but\n");
|
---|
| 223 | pb_log(0," * $ENV{'PBETC'} refers to $pbconf{$ENV{'PBPROJ'}}\n");
|
---|
[314] | 224 | die "Project $ENV{'PBPROJ'} is not Project-Builder compliant.";
|
---|
| 225 | } else {
|
---|
[316] | 226 | pb_log(1,"Content correct - doing nothing - you may want to update your repository however\n");
|
---|
[314] | 227 | # they match - do nothing - there may be local changes
|
---|
[273] | 228 | }
|
---|
[314] | 229 | }
|
---|
[2] | 230 |
|
---|
[314] | 231 | # Check where is our PBROOT (release tag name can't be guessed the first time)
|
---|
| 232 | if (not defined $ENV{'PBROOT'}) {
|
---|
| 233 | if (! -f ("$ENV{'PBDESTDIR'}/pbrc")) {
|
---|
| 234 | opendir(DIR,$ENV{'PBCONF'}) || die "Unable to open directory $ENV{'PBCONF'}: $!";
|
---|
[315] | 235 | my $maxmtime = 0;
|
---|
[314] | 236 | foreach my $d (readdir(DIR)) {
|
---|
[320] | 237 | pb_log(3,"Looking at \'$d\'...");
|
---|
[314] | 238 | next if ($d =~ /^\./);
|
---|
[320] | 239 | next if (! -d "$ENV{'PBCONF'}/$d");
|
---|
| 240 | my $s = stat("$ENV{'PBCONF'}/$d");
|
---|
| 241 | next if (not defined $s);
|
---|
| 242 | pb_log(3,"KEEP\n");
|
---|
[314] | 243 | # Keep the most recent
|
---|
[320] | 244 | pb_log(2," $s->mtime\n");
|
---|
| 245 | if ($s->mtime > $maxmtime) {
|
---|
[314] | 246 | $ENV{'PBROOT'} = "$ENV{'PBCONF'}/$d";
|
---|
[320] | 247 | $maxmtime = $s->mtime;
|
---|
[314] | 248 | }
|
---|
| 249 | }
|
---|
| 250 | closedir(DIR);
|
---|
[316] | 251 | die "No directory found under $ENV{'PBCONF'}" if (not defined $ENV{'PBROOT'});
|
---|
| 252 | pb_log(0,"WARNING: no pbroot defined, using $ENV{'PBROOT'}\n");
|
---|
[318] | 253 | pb_log(0," Please use -r release if you want to use another release\n");
|
---|
[314] | 254 | } else {
|
---|
| 255 | my ($pbroot) = pb_conf_read_if("$ENV{'PBDESTDIR'}/pbrc","pbroot");
|
---|
| 256 | # That's always the environment variable that will be used
|
---|
[316] | 257 | die "Please remove inconsistent $ENV{'PBDESTDIR'}/pbrc" if ((not defined $pbroot) || (not defined $pbroot->{$ENV{'PBPROJ'}}));
|
---|
[315] | 258 | $ENV{'PBROOT'} = $pbroot->{$ENV{'PBPROJ'}};
|
---|
[314] | 259 | }
|
---|
| 260 | } else {
|
---|
| 261 | # transform in full path if relative
|
---|
[316] | 262 | $ENV{'PBROOT'} = "$ENV{'PBCONF'}/$ENV{'PBROOT'}" if ($ENV{'PBROOT'} !~ /^\//);
|
---|
| 263 | die "$ENV{'PBROOT'} is not a directory" if (not -d $ENV{'PBROOT'});
|
---|
[314] | 264 | }
|
---|
| 265 |
|
---|
[74] | 266 | my %version = ();
|
---|
[108] | 267 | my %defpkgdir = ();
|
---|
| 268 | my %extpkgdir = ();
|
---|
| 269 | my %filteredfiles = ();
|
---|
[300] | 270 | my %supfiles = ();
|
---|
[74] | 271 |
|
---|
[314] | 272 | if ((-f "$ENV{'PBROOT'}/$ENV{'PBPROJ'}.pb") and (not defined $pbinit)) {
|
---|
[74] | 273 | # List of pkg to build by default (mandatory)
|
---|
[320] | 274 | my ($defpkgdir,$pbpackager) = pb_conf_get("defpkgdir","pbpackager");
|
---|
[74] | 275 | # List of additional pkg to build when all is called (optional)
|
---|
| 276 | # Valid version names (optional)
|
---|
| 277 | # List of files to filter (optional)
|
---|
[313] | 278 | # Project version and tag (optional)
|
---|
| 279 | my ($extpkgdir, $version, $filteredfiles, $supfiles, $pkgv, $pkgt) = pb_conf_get_if("extpkgdir","version","filteredfiles","supfiles","projver","projtag");
|
---|
[315] | 280 | pb_log(2,"DEBUG: defpkgdir: ".Dumper($defpkgdir)."\n");
|
---|
| 281 | pb_log(2,"DEBUG: extpkgdir: ".Dumper($extpkgdir)."\n");
|
---|
| 282 | pb_log(2,"DEBUG: version: ".Dumper($version)."\n");
|
---|
| 283 | pb_log(2,"DEBUG: filteredfiles: ".Dumper($filteredfiles)."\n");
|
---|
| 284 | pb_log(2,"DEBUG: supfiles: ".Dumper($supfiles)."\n");
|
---|
[74] | 285 | # Global
|
---|
| 286 | %defpkgdir = %$defpkgdir;
|
---|
[114] | 287 | %extpkgdir = %$extpkgdir if (defined $extpkgdir);
|
---|
[74] | 288 | %version = %$version if (defined $version);
|
---|
| 289 | %filteredfiles = %$filteredfiles if (defined $filteredfiles);
|
---|
[300] | 290 | %supfiles = %$supfiles if (defined $supfiles);
|
---|
[106] | 291 | #
|
---|
| 292 | # Get global Version/Tag
|
---|
| 293 | #
|
---|
| 294 | if (not defined $ENV{'PBVER'}) {
|
---|
[313] | 295 | if ((defined $pkgv) && (defined $pkgv->{$ENV{'PBPROJ'}})) {
|
---|
| 296 | $ENV{'PBVER'}=$pkgv->{$ENV{'PBPROJ'}};
|
---|
[106] | 297 | } else {
|
---|
[314] | 298 | die "No projver found in $ENV{'PBROOT'}/$ENV{'PBPROJ'}.pb";
|
---|
[106] | 299 | }
|
---|
[98] | 300 | }
|
---|
[314] | 301 | die "Invalid version name $ENV{'PBVER'} in $ENV{'PBROOT'}/$ENV{'PBPROJ'}.pb" if (($ENV{'PBVER'} !~ /[0-9.]+/) && (not defined $version) && ($ENV{'PBVER'} =~ /$version{$ENV{'PBPROJ'}}/));
|
---|
[106] | 302 |
|
---|
| 303 | if (not defined $ENV{'PBTAG'}) {
|
---|
[313] | 304 | if ((defined $pkgt) && (defined $pkgt->{$ENV{'PBPROJ'}})) {
|
---|
| 305 | $ENV{'PBTAG'}=$pkgt->{$ENV{'PBPROJ'}};
|
---|
[106] | 306 | } else {
|
---|
[314] | 307 | die "No projtag found in $ENV{'PBROOT'}/$ENV{'PBPROJ'}.pb";
|
---|
[106] | 308 | }
|
---|
[98] | 309 | }
|
---|
[314] | 310 | die "Invalid tag name $ENV{'PBTAG'} in $ENV{'PBROOT'}/$ENV{'PBPROJ'}.pb" if ($ENV{'PBTAG'} !~ /[0-9.]+/);
|
---|
[320] | 311 |
|
---|
| 312 |
|
---|
| 313 | if (not defined $ENV{'PBPACKAGER'}) {
|
---|
| 314 | if ((defined $pbpackager) && (defined $pbpackager->{$ENV{'PBPROJ'}})) {
|
---|
| 315 | $ENV{'PBPACKAGER'}=$pbpackager->{$ENV{'PBPROJ'}};
|
---|
| 316 | } else {
|
---|
| 317 | die "No pbpackager found in $ENV{'PBROOT'}/$ENV{'PBPROJ'}.pb";
|
---|
| 318 | }
|
---|
| 319 | }
|
---|
[106] | 320 | } else {
|
---|
[273] | 321 | if (defined $pbinit) {
|
---|
[316] | 322 | my $ptr = pb_get_pkg();
|
---|
[317] | 323 | my @pkgs = @$ptr;
|
---|
[316] | 324 | @pkgs = ("pkg1") if (not @pkgs);
|
---|
| 325 |
|
---|
[314] | 326 | open(CONF,"> $ENV{'PBROOT'}/$ENV{'PBPROJ'}.pb") || die "Unable to create $ENV{'PBROOT'}/$ENV{'PBPROJ'}.pb";
|
---|
[273] | 327 | print CONF << "EOF";
|
---|
| 328 | #
|
---|
| 329 | # Project Builder configuration file
|
---|
[313] | 330 | # For project $ENV{'PBPROJ'}
|
---|
[273] | 331 | #
|
---|
| 332 | # \$Id\$
|
---|
| 333 | #
|
---|
| 334 |
|
---|
| 335 | #
|
---|
[316] | 336 | # What is the project URL
|
---|
[273] | 337 | #
|
---|
[316] | 338 | #pbproj $ENV{'PBPROJ'} = svn://svn.$ENV{'PBPROJ'}.org/$ENV{'PBPROJ'}/devel
|
---|
| 339 | #pbproj $ENV{'PBPROJ'} = svn://svn+ssh.$ENV{'PBPROJ'}.org/$ENV{'PBPROJ'}/devel
|
---|
| 340 | #pbproj $ENV{'PBPROJ'} = cvs://cvs.$ENV{'PBPROJ'}.org/$ENV{'PBPROJ'}/devel
|
---|
| 341 | #pbproj $ENV{'PBPROJ'} = http://www.$ENV{'PBPROJ'}.org/src/$ENV{'PBPROJ'}-devel.tar.gz
|
---|
| 342 | #pbproj $ENV{'PBPROJ'} = ftp://ftp.$ENV{'PBPROJ'}.org/src/$ENV{'PBPROJ'}-devel.tar.gz
|
---|
| 343 | #pbproj $ENV{'PBPROJ'} = file:///src/$ENV{'PBPROJ'}-devel.tar.gz
|
---|
[319] | 344 | #pbproj $ENV{'PBPROJ'} = dir:///src/$ENV{'PBPROJ'}-devel
|
---|
[273] | 345 |
|
---|
| 346 | #
|
---|
| 347 | # Packager label
|
---|
| 348 | #
|
---|
[320] | 349 | #pbpackager $ENV{'PBPROJ'} = "William Porte <bill\@$ENV{'PBPROJ'}.org>"
|
---|
[273] | 350 | #
|
---|
| 351 |
|
---|
| 352 | # For delivery to a machine by SSH (potentially the FTP server)
|
---|
| 353 | # Needs hostname, account and directory
|
---|
| 354 | #
|
---|
[313] | 355 | #sshhost $ENV{'PBPROJ'} = www.$ENV{'PBPROJ'}.org
|
---|
| 356 | #sshlogin $ENV{'PBPROJ'} = bill
|
---|
| 357 | #sshdir $ENV{'PBPROJ'} = /$ENV{'PBPROJ'}/ftp
|
---|
| 358 | #sshport $ENV{'PBPROJ'} = 22
|
---|
[273] | 359 |
|
---|
| 360 | #
|
---|
| 361 | # For Virtual machines management
|
---|
| 362 | # Naming convention to follow: distribution name (as per ProjectBuilder::Distribution)
|
---|
| 363 | # followed by '_' and by release number
|
---|
| 364 | # a .vmtype extension will be added to the resulting string
|
---|
| 365 | # a QEMU rhel_3 here means that the VM will be named rhel_3.qemu
|
---|
| 366 | #
|
---|
[313] | 367 | #vmlist $ENV{'PBPROJ'} = mandrake_10.1,mandrake_10.2,mandriva_2006.0,mandriva_2007.0,mandriva_2007.1,mandriva_2008.0,redhat_7.3,redhat_9,fedora_4,fedora_5,fedora_6,fedora_7,rhel_3,rhel_4,rhel_5,suse_10.0,suse_10.1,suse_10.2,suse_10.3,sles_9,sles_10,gentoo_nover,debian_3.1,debian_4.0,ubuntu_6.06,ubuntu_7.04,ubuntu_7.10
|
---|
[273] | 368 |
|
---|
| 369 | #
|
---|
| 370 | # Valid values for vmtype are
|
---|
| 371 | # qemu, (vmware, xen, ... TBD)
|
---|
[313] | 372 | #vmtype $ENV{'PBPROJ'} = qemu
|
---|
[273] | 373 |
|
---|
| 374 | # Hash for VM stuff on vmtype
|
---|
| 375 | #vmntp default = pool.ntp.org
|
---|
| 376 |
|
---|
| 377 | # We suppose we can commmunicate with the VM through SSH
|
---|
[313] | 378 | #vmhost $ENV{'PBPROJ'} = localhost
|
---|
| 379 | #vmlogin $ENV{'PBPROJ'} = pb
|
---|
| 380 | #vmport $ENV{'PBPROJ'} = 2222
|
---|
[273] | 381 |
|
---|
| 382 | # Timeout to wait when VM is launched/stopped
|
---|
| 383 | #vmtmout default = 120
|
---|
| 384 |
|
---|
| 385 | # per VMs needed paramaters
|
---|
[313] | 386 | #vmopt $ENV{'PBPROJ'} = -m 384 -daemonize
|
---|
| 387 | #vmpath $ENV{'PBPROJ'} = /home/qemu
|
---|
| 388 | #vmsize $ENV{'PBPROJ'} = 5G
|
---|
[273] | 389 |
|
---|
| 390 | #
|
---|
| 391 | # Global version/tag for the project
|
---|
| 392 | #
|
---|
[313] | 393 | #projver $ENV{'PBPROJ'} = devel
|
---|
| 394 | #projtag $ENV{'PBPROJ'} = 1
|
---|
[273] | 395 |
|
---|
[316] | 396 | # Hash of valid version names
|
---|
| 397 | #version $ENV{'PBPROJ'} = devel,stable
|
---|
| 398 |
|
---|
[273] | 399 | # Adapt to your needs:
|
---|
| 400 | # Optional if you need to overwrite the global values above
|
---|
| 401 | #
|
---|
[316] | 402 | EOF
|
---|
| 403 |
|
---|
| 404 | foreach my $pp (@pkgs) {
|
---|
| 405 | print CONF << "EOF";
|
---|
| 406 | #pkgver $pp = stable
|
---|
| 407 | #pkgtag $pp = 3
|
---|
| 408 | EOF
|
---|
| 409 | }
|
---|
| 410 | foreach my $pp (@pkgs) {
|
---|
| 411 | print CONF << "EOF";
|
---|
[273] | 412 | # Hash of default package/package directory
|
---|
[319] | 413 | #defpkgdir $pp = dir-$pp
|
---|
[316] | 414 | EOF
|
---|
| 415 | }
|
---|
[273] | 416 |
|
---|
[316] | 417 | print CONF << "EOF";
|
---|
[273] | 418 | # Hash of additional package/package directory
|
---|
[319] | 419 | #extpkgdir minor-pkg = dir-minor-pkg
|
---|
[273] | 420 |
|
---|
| 421 | # List of files per pkg on which to apply filters
|
---|
| 422 | # Files are mentioned relatively to pbroot/defpkgdir
|
---|
| 423 | EOF
|
---|
[316] | 424 | foreach my $pp (@pkgs) {
|
---|
| 425 | print CONF << "EOF";
|
---|
| 426 | #filteredfiles $pp = Makefile.PL,configure.in,install.sh,$pp.8
|
---|
| 427 | #supfiles $pp = $pp.init
|
---|
| 428 | EOF
|
---|
| 429 | }
|
---|
[273] | 430 | close(CONF);
|
---|
[314] | 431 | pb_mkdir_p("$ENV{'PBROOT'}/pbfilter") || die "Unable to create $ENV{'PBROOT'}/pbfilter";
|
---|
| 432 | open(CONF,"> $ENV{'PBROOT'}/pbfilter/all.pbf") || die "Unable to create $ENV{'PBROOT'}/pbfilter/all.pbf";
|
---|
[273] | 433 | print CONF << "EOF";
|
---|
| 434 | #
|
---|
| 435 | # \$Id\$
|
---|
| 436 | #
|
---|
| 437 | # Filter for all files
|
---|
| 438 | #
|
---|
| 439 | # PBSRC is replaced by the source package format
|
---|
[313] | 440 | #filter PBSRC = ftp://ftp.$ENV{'PBPROJ'}.org/src/%{name}-%{version}.tar.gz
|
---|
[273] | 441 |
|
---|
| 442 | # PBVER is replaced by the version (\$pbver in code)
|
---|
| 443 | #filter PBVER = \$pbver
|
---|
| 444 |
|
---|
| 445 | # PBDATE is replaced by the date (\$pbdate in code)
|
---|
| 446 | #filter PBDATE = \$pbdate
|
---|
| 447 |
|
---|
| 448 | # PBLOG is replaced by the changelog if value is yes
|
---|
| 449 | #filter PBLOG = yes
|
---|
| 450 |
|
---|
| 451 | # PBTAG is replaced by the tag (\$pbtag in code)
|
---|
| 452 | #filter PBTAG = \$pbtag
|
---|
| 453 |
|
---|
| 454 | # PBREV is replaced by the revision (\$pbrev in code)
|
---|
| 455 | #filter PBREV = \$pbrev
|
---|
| 456 |
|
---|
| 457 | # PBPKG is replaced by the package name (\$pbpkg in code)
|
---|
| 458 | #filter PBPKG = \$pbpkg
|
---|
| 459 |
|
---|
| 460 | # PBPACKAGER is replaced by the packager name (\$pbpackager in code)
|
---|
| 461 | #filter PBPACKAGER = \$pbpackager
|
---|
| 462 |
|
---|
| 463 | # PBDESC contains the description of the package
|
---|
| 464 | #filter PBDESC = "Bla-Bla"
|
---|
| 465 |
|
---|
| 466 | # PBURL contains the URL of the Web site of the project
|
---|
[313] | 467 | #filter PBURL = http://www.$ENV{'PBPROJ'}.org
|
---|
[273] | 468 | EOF
|
---|
| 469 | close(CONF);
|
---|
[314] | 470 | open(CONF,"> $ENV{'PBROOT'}/pbfilter/rpm.pbf") || die "Unable to create $ENV{'PBROOT'}/pbfilter/rpm.pbf";
|
---|
[273] | 471 | print CONF << "EOF";
|
---|
| 472 | #
|
---|
| 473 | # \$Id\$
|
---|
| 474 | #
|
---|
| 475 | # Filter for rpm build
|
---|
| 476 | #
|
---|
| 477 |
|
---|
| 478 | # PBGRP is replaced by the RPM group of apps
|
---|
[288] | 479 | # Cf: http://fedoraproject.org/wiki/RPMGroups
|
---|
[273] | 480 | #filter PBGRP = Applications/Archiving
|
---|
| 481 |
|
---|
[316] | 482 | # PBLIC is replaced by the license of the application
|
---|
| 483 | # Cf: http://fedoraproject.org/wiki/Licensing
|
---|
| 484 | #filter PBLIC = GPL
|
---|
| 485 |
|
---|
[273] | 486 | # PBDEP is replaced by the list of dependencies
|
---|
| 487 | #filter PBDEP =
|
---|
| 488 |
|
---|
| 489 | # PBSUF is replaced by the package name (\$pbpkg in code)
|
---|
| 490 | #filter PBSUF = \$pbsuf
|
---|
| 491 |
|
---|
| 492 | # PBOBS is replaced by the Obsolete line
|
---|
| 493 | #filter PBOBS =
|
---|
| 494 |
|
---|
| 495 | EOF
|
---|
| 496 | close(CONF);
|
---|
[314] | 497 | open(CONF,"> $ENV{'PBROOT'}/pbfilter/deb.pbf") || die "Unable to create $ENV{'PBROOT'}/pbfilter/deb.pbf";
|
---|
[273] | 498 | print CONF << "EOF";
|
---|
| 499 | #
|
---|
| 500 | # \$Id\$
|
---|
| 501 | #
|
---|
| 502 | # Filter for debian build
|
---|
| 503 | #
|
---|
| 504 | # PBGRP is replaced by the group of apps
|
---|
| 505 | #filter PBGRP = utils
|
---|
| 506 |
|
---|
[316] | 507 | # PBLIC is replaced by the license of the application
|
---|
| 508 | # Cf:
|
---|
| 509 | #filter PBLIC = GPL
|
---|
| 510 |
|
---|
[273] | 511 | # PBVER is replaced by the version (\$pbver in code)
|
---|
| 512 | #filter PBVER = \$pbver
|
---|
| 513 |
|
---|
| 514 | # PBDEP is replaced by the list of dependencies
|
---|
| 515 | #filter PBDEP =
|
---|
| 516 |
|
---|
| 517 | # PBSUG is replaced by the list of suggestions
|
---|
| 518 | #filter PBSUG =
|
---|
| 519 |
|
---|
| 520 | # PBREC is replaced by the list of recommandations
|
---|
| 521 | #filter PBREC =
|
---|
| 522 |
|
---|
| 523 | # PBLOG is replaced by the changelog if value is yes
|
---|
| 524 | #filter PBLOG = yes
|
---|
| 525 |
|
---|
| 526 | # PBPKG is replaced by the package name (\$pbpkg in code)
|
---|
| 527 | #filter PBPKG = \$pbpkg
|
---|
| 528 |
|
---|
| 529 | # PBPACKAGER is replaced by the packager name (\$pbpackager in code)
|
---|
| 530 | #filter PBPACKAGER = \$pbpackager
|
---|
| 531 |
|
---|
| 532 | EOF
|
---|
| 533 | close(CONF);
|
---|
[314] | 534 | open(CONF,"> $ENV{'PBROOT'}/pbfilter/md.pbf") || die "Unable to create $ENV{'PBROOT'}/pbfilter/md.pbf";
|
---|
[273] | 535 | print CONF << "EOF";
|
---|
[313] | 536 | # Specific group for Mandriva for $ENV{'PBPROJ'}
|
---|
[316] | 537 | # Cf: http://wiki.mandriva.com/en/Development/Packaging/Groups
|
---|
[273] | 538 | filter PBGRP = Archiving/Backup
|
---|
[316] | 539 |
|
---|
| 540 | # PBLIC is replaced by the license of the application
|
---|
| 541 | # Cf: http://wiki.mandriva.com/en/Development/Packaging/Licenses
|
---|
| 542 | #filter PBLIC = GPL
|
---|
| 543 |
|
---|
[273] | 544 | EOF
|
---|
| 545 | close(CONF);
|
---|
[314] | 546 | open(CONF,"> $ENV{'PBROOT'}/pbfilter/novell.pbf") || die "Unable to create $ENV{'PBROOT'}/pbfilter/novell.pbf";
|
---|
[273] | 547 | print CONF << "EOF";
|
---|
[313] | 548 | # Specific group for SuSE for $ENV{'PBPROJ'}
|
---|
[316] | 549 | # Cf: http://en.opensuse.org/SUSE_Package_Conventions/RPM_Groups
|
---|
[273] | 550 | filter PBGRP = Productivity/Archiving/Backup
|
---|
[316] | 551 |
|
---|
| 552 | # PBLIC is replaced by the license of the application
|
---|
| 553 | # Cf: http://en.opensuse.org/Packaging/SUSE_Package_Conventions/RPM_Style#1.6._License_Tag
|
---|
| 554 | #filter PBLIC = GPL
|
---|
| 555 |
|
---|
[273] | 556 | EOF
|
---|
| 557 | close(CONF);
|
---|
[316] | 558 | foreach my $pp (@pkgs) {
|
---|
| 559 | pb_mkdir_p("$ENV{'PBROOT'}/$pp/deb") || die "Unable to create $ENV{'PBROOT'}/$pp/deb";
|
---|
| 560 | open(CONF,"> $ENV{'PBROOT'}/$pp/deb/control") || die "Unable to create $ENV{'PBROOT'}/$pp/deb/control";
|
---|
| 561 | print CONF << "EOF";
|
---|
[273] | 562 | Source: PBPKG
|
---|
| 563 | Section: PBGRP
|
---|
| 564 | Priority: optional
|
---|
| 565 | Maintainer: PBPACKAGER
|
---|
| 566 | Build-Depends: debhelper (>= 4.2.20), PBDEP
|
---|
| 567 | Standards-Version: 3.6.1
|
---|
| 568 |
|
---|
| 569 | Package: PBPKG
|
---|
| 570 | Architecture: amd64 i386 ia64
|
---|
| 571 | Section: PBGRP
|
---|
| 572 | Priority: optional
|
---|
| 573 | Depends: \${shlibs:Depends}, \${misc:Depends}, PBDEP
|
---|
| 574 | Recommends: PBREC
|
---|
| 575 | Suggests: PBSUG
|
---|
| 576 | Description:
|
---|
| 577 | PBDESC
|
---|
| 578 | .
|
---|
| 579 | Homepage: PBURL
|
---|
| 580 |
|
---|
| 581 | EOF
|
---|
[316] | 582 | close(CONF);
|
---|
| 583 | open(CONF,"> $ENV{'PBROOT'}/$pp/deb/copyright") || die "Unable to create $ENV{'PBROOT'}/$pp/deb/copyright";
|
---|
| 584 | print CONF << "EOF";
|
---|
[273] | 585 | This package is debianized by PBPACKAGER
|
---|
| 586 | `date`
|
---|
| 587 |
|
---|
| 588 | The current upstream source was downloaded from
|
---|
[313] | 589 | ftp://ftp.$ENV{'PBPROJ'}.org/src/.
|
---|
[273] | 590 |
|
---|
| 591 | Upstream Authors: Put their name here
|
---|
| 592 |
|
---|
| 593 | Copyright:
|
---|
| 594 |
|
---|
| 595 | This package is free software; you can redistribute it and/or modify
|
---|
| 596 | it under the terms of the GNU General Public License as published by
|
---|
| 597 | the Free Software Foundation; version 2 dated June, 1991.
|
---|
| 598 |
|
---|
| 599 | This package is distributed in the hope that it will be useful,
|
---|
| 600 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 601 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 602 | GNU General Public License for more details.
|
---|
| 603 |
|
---|
| 604 | You should have received a copy of the GNU General Public License
|
---|
| 605 | along with this package; if not, write to the Free Software
|
---|
| 606 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
|
---|
| 607 | MA 02110-1301, USA.
|
---|
| 608 |
|
---|
| 609 | On Debian systems, the complete text of the GNU General
|
---|
| 610 | Public License can be found in /usr/share/common-licenses/GPL.
|
---|
| 611 |
|
---|
| 612 | EOF
|
---|
[316] | 613 | close(CONF);
|
---|
| 614 | open(CONF,"> $ENV{'PBROOT'}/$pp/deb/changelog") || die "Unable to create $ENV{'PBROOT'}/$pp/deb/changelog";
|
---|
| 615 | print CONF << "EOF";
|
---|
[273] | 616 | PBLOG
|
---|
| 617 | EOF
|
---|
[316] | 618 | close(CONF);
|
---|
| 619 | open(CONF,"> $ENV{'PBROOT'}/$pp/deb/compat") || die "Unable to create $ENV{'PBROOT'}/$pp/deb/compat";
|
---|
| 620 | print CONF << "EOF";
|
---|
[273] | 621 | 4
|
---|
| 622 | EOF
|
---|
[316] | 623 | close(CONF);
|
---|
| 624 | open(CONF,"> $ENV{'PBROOT'}/$pp/deb/pkg1.dirs") || die "Unable to create $ENV{'PBROOT'}/$pp/deb/$pp.dirs";
|
---|
| 625 | print CONF << "EOF";
|
---|
[273] | 626 | EOF
|
---|
[316] | 627 | close(CONF);
|
---|
| 628 | open(CONF,"> $ENV{'PBROOT'}/$pp/deb/$pp.docs") || die "Unable to create $ENV{'PBROOT'}/$pp/deb/$pp.docs";
|
---|
| 629 | print CONF << "EOF";
|
---|
[273] | 630 | INSTALL
|
---|
| 631 | COPYING
|
---|
| 632 | AUTHORS
|
---|
| 633 | NEWS
|
---|
| 634 | README
|
---|
| 635 | EOF
|
---|
[316] | 636 | close(CONF);
|
---|
| 637 | open(CONF,"> $ENV{'PBROOT'}/$pp/deb/rules") || die "Unable to create $ENV{'PBROOT'}/$pp/deb/rules";
|
---|
| 638 | print CONF << 'EOF';
|
---|
[273] | 639 | #!/usr/bin/make -f
|
---|
| 640 | # -*- makefile -*-
|
---|
| 641 | # Sample debian/rules that uses debhelper.
|
---|
| 642 | # GNU copyright 1997 to 1999 by Joey Hess.
|
---|
| 643 | #
|
---|
| 644 | # $Id$
|
---|
| 645 | #
|
---|
| 646 |
|
---|
| 647 | # Uncomment this to turn on verbose mode.
|
---|
| 648 | #export DH_VERBOSE=1
|
---|
| 649 |
|
---|
| 650 | # Define package name variable for a one-stop change.
|
---|
| 651 | PACKAGE_NAME = PBPKG
|
---|
| 652 |
|
---|
| 653 | # These are used for cross-compiling and for saving the configure script
|
---|
| 654 | # from having to guess our platform (since we know it already)
|
---|
| 655 | DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
|
---|
| 656 | DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
|
---|
| 657 |
|
---|
| 658 | CFLAGS = -Wall -g
|
---|
| 659 |
|
---|
| 660 | ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
|
---|
| 661 | CFLAGS += -O0
|
---|
| 662 | else
|
---|
| 663 | CFLAGS += -O2
|
---|
| 664 | endif
|
---|
| 665 | ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
|
---|
| 666 | INSTALL_PROGRAM += -s
|
---|
| 667 | endif
|
---|
| 668 | config.status: configure
|
---|
| 669 | dh_testdir
|
---|
| 670 |
|
---|
| 671 | # Configure the package.
|
---|
| 672 | CFLAGS="$(CFLAGS)" ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr
|
---|
| 673 | --mandir=\$${prefix}/share/man
|
---|
| 674 |
|
---|
| 675 | # Build both architecture dependent and independent
|
---|
| 676 | build: build-arch build-indep
|
---|
| 677 |
|
---|
| 678 | # Build architecture dependent
|
---|
| 679 | build-arch: build-arch-stamp
|
---|
| 680 |
|
---|
| 681 | build-arch-stamp: config.status
|
---|
| 682 | dh_testdir
|
---|
| 683 |
|
---|
| 684 | # Compile the package.
|
---|
| 685 | $(MAKE)
|
---|
| 686 |
|
---|
| 687 | touch build-stamp
|
---|
| 688 |
|
---|
| 689 | # Build architecture independent
|
---|
| 690 | build-indep: build-indep-stamp
|
---|
| 691 |
|
---|
| 692 | build-indep-stamp: config.status
|
---|
| 693 | # Nothing to do, the only indep item is the manual which is available as html in original source
|
---|
| 694 | touch build-indep-stamp
|
---|
| 695 |
|
---|
| 696 | # Clean up
|
---|
| 697 | clean:
|
---|
| 698 | dh_testdir
|
---|
| 699 | dh_testroot
|
---|
| 700 | rm -f build-arch-stamp build-indep-stamp #CONFIGURE-STAMP#
|
---|
| 701 | # Clean temporary document directory
|
---|
| 702 | rm -rf debian/doc-temp
|
---|
| 703 | # Clean up.
|
---|
| 704 | -$(MAKE) distclean
|
---|
| 705 | rm -f config.log
|
---|
| 706 | ifneq "$(wildcard /usr/share/misc/config.sub)" ""
|
---|
| 707 | cp -f /usr/share/misc/config.sub config.sub
|
---|
| 708 | endif
|
---|
| 709 | ifneq "$(wildcard /usr/share/misc/config.guess)" ""
|
---|
| 710 | cp -f /usr/share/misc/config.guess config.guess
|
---|
| 711 | endif
|
---|
| 712 |
|
---|
| 713 | dh_clean
|
---|
| 714 |
|
---|
| 715 | # Install architecture dependent and independent
|
---|
| 716 | install: install-arch install-indep
|
---|
| 717 |
|
---|
| 718 | # Install architecture dependent
|
---|
| 719 | install-arch: build-arch
|
---|
| 720 | dh_testdir
|
---|
| 721 | dh_testroot
|
---|
| 722 | dh_clean -k -s
|
---|
| 723 | dh_installdirs -s
|
---|
| 724 |
|
---|
| 725 | # Install the package files into build directory:
|
---|
| 726 | # - start with upstream make install
|
---|
| 727 | $(MAKE) install prefix=$(CURDIR)/debian/$(PACKAGE_NAME)/usr mandir=$(CURDIR)/debian/$(PACKAGE_NAME)/us
|
---|
| 728 | r/share/man
|
---|
| 729 | # - copy html manual to temporary location for renaming
|
---|
| 730 | mkdir -p debian/doc-temp
|
---|
| 731 | dh_install -s
|
---|
| 732 |
|
---|
| 733 | # Install architecture independent
|
---|
| 734 | install-indep: build-indep
|
---|
| 735 | dh_testdir
|
---|
| 736 | dh_testroot
|
---|
| 737 | dh_clean -k -i
|
---|
| 738 | dh_installdirs -i
|
---|
| 739 | dh_install -i
|
---|
| 740 |
|
---|
| 741 | # Must not depend on anything. This is to be called by
|
---|
| 742 | # binary-arch/binary-indep
|
---|
| 743 | # in another 'make' thread.
|
---|
| 744 | binary-common:
|
---|
| 745 | dh_testdir
|
---|
| 746 | dh_testroot
|
---|
| 747 | dh_installchangelogs ChangeLog
|
---|
| 748 | dh_installdocs
|
---|
| 749 | dh_installman
|
---|
| 750 | dh_link
|
---|
| 751 | dh_strip
|
---|
| 752 | dh_compress
|
---|
| 753 | dh_fixperms
|
---|
| 754 | dh_installdeb
|
---|
| 755 | dh_shlibdeps
|
---|
| 756 | dh_gencontrol
|
---|
| 757 | dh_md5sums
|
---|
| 758 | dh_builddeb
|
---|
| 759 |
|
---|
| 760 | # Build architecture independant packages using the common target.
|
---|
| 761 | binary-indep: build-indep install-indep
|
---|
| 762 | $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
|
---|
| 763 |
|
---|
| 764 | # Build architecture dependant packages using the common target.
|
---|
| 765 | binary-arch: build-arch install-arch
|
---|
| 766 | $(MAKE) -f debian/rules DH_OPTIONS=-a binary-common
|
---|
| 767 |
|
---|
| 768 | # Build architecture depdendent and independent packages
|
---|
| 769 | binary: binary-arch binary-indep
|
---|
| 770 | .PHONY: clean binary
|
---|
| 771 |
|
---|
| 772 | EOF
|
---|
[316] | 773 | close(CONF);
|
---|
| 774 | pb_mkdir_p("$ENV{'PBROOT'}/$pp/rpm") || die "Unable to create $ENV{'PBROOT'}/$pp/rpm";
|
---|
| 775 | open(CONF,"> $ENV{'PBROOT'}/$pp/rpm/$pp.spec") || die "Unable to create $ENV{'PBROOT'}/$pp/rpm/$pp.spec";
|
---|
| 776 | print CONF << 'EOF';
|
---|
[273] | 777 | #
|
---|
| 778 | # $Id$
|
---|
| 779 | #
|
---|
| 780 |
|
---|
| 781 | Summary: bla-bla
|
---|
| 782 | Summary(fr): french bla-bla
|
---|
| 783 |
|
---|
| 784 | Name: PBPKG
|
---|
| 785 | Version: PBVER
|
---|
| 786 | Release: PBTAGPBSUF
|
---|
[316] | 787 | License: PBLIC
|
---|
[273] | 788 | Group: PBGRP
|
---|
| 789 | Url: PBURL
|
---|
| 790 | Source: PBSRC
|
---|
| 791 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(id -u -n)
|
---|
| 792 | Requires: PBDEP
|
---|
| 793 |
|
---|
| 794 | %description
|
---|
| 795 | PBDESC
|
---|
| 796 |
|
---|
| 797 | %description -l fr
|
---|
| 798 | french desc
|
---|
| 799 |
|
---|
| 800 | %prep
|
---|
| 801 | %setup -q
|
---|
| 802 |
|
---|
| 803 | %build
|
---|
| 804 | %configure
|
---|
[288] | 805 | make %{?_smp_mflags}
|
---|
[273] | 806 |
|
---|
| 807 | %install
|
---|
| 808 | %{__rm} -rf $RPM_BUILD_ROOT
|
---|
| 809 | make DESTDIR=$RPM_BUILD_ROOT install
|
---|
| 810 |
|
---|
| 811 | %clean
|
---|
| 812 | %{__rm} -rf $RPM_BUILD_ROOT
|
---|
| 813 |
|
---|
| 814 | %files
|
---|
| 815 | %defattr(-,root,root)
|
---|
| 816 | %doc ChangeLog
|
---|
| 817 | %doc INSTALL COPYING README AUTHORS NEWS
|
---|
| 818 |
|
---|
| 819 | %changelog
|
---|
| 820 | PBLOG
|
---|
| 821 |
|
---|
| 822 | EOF
|
---|
[316] | 823 | close(CONF);
|
---|
| 824 | pb_mkdir_p("$ENV{'PBROOT'}/$pp/pbfilter") || die "Unable to create $ENV{'PBROOT'}/$pp/pbfilter";
|
---|
[273] | 825 |
|
---|
[316] | 826 | pb_log(0,"\nDo not to forget to commit the pbconf directory in your CMS if needed\n");
|
---|
| 827 | }
|
---|
[273] | 828 | } else {
|
---|
[314] | 829 | die "Unable to open $ENV{'PBROOT'}/$ENV{'PBPROJ'}.pb";
|
---|
[273] | 830 | }
|
---|
[98] | 831 | }
|
---|
[8] | 832 | umask 0022;
|
---|
[315] | 833 | return(\%filteredfiles, \%supfiles, \%defpkgdir, \%extpkgdir);
|
---|
[2] | 834 | }
|
---|
[9] | 835 |
|
---|
[74] | 836 | # Internal mkdir -p function
|
---|
| 837 | sub pb_mkdir_p {
|
---|
[29] | 838 | my @dir = @_;
|
---|
| 839 | my $ret = mkpath(@dir, 0, 0755);
|
---|
| 840 | return($ret);
|
---|
[9] | 841 | }
|
---|
| 842 |
|
---|
[74] | 843 | # Internal rm -rf function
|
---|
| 844 | sub pb_rm_rf {
|
---|
[29] | 845 | my @dir = @_;
|
---|
| 846 | my $ret = rmtree(@dir, 0, 0);
|
---|
| 847 | return($ret);
|
---|
[9] | 848 | }
|
---|
| 849 |
|
---|
[74] | 850 | # Internal system function
|
---|
| 851 | sub pb_system {
|
---|
[29] | 852 |
|
---|
| 853 | my $cmd=shift;
|
---|
[30] | 854 | my $cmt=shift || $cmd;
|
---|
[29] | 855 |
|
---|
[319] | 856 | pb_log(0,"$cmt... ");
|
---|
[117] | 857 | #system("$cmd 2>&1 > $ENV{'PBTMP'}/system.log");
|
---|
[293] | 858 | system($cmd);
|
---|
[29] | 859 | if ($? == -1) {
|
---|
[319] | 860 | pb_log(0,"failed to execute ($cmd) : $!\n");
|
---|
[106] | 861 | pb_display_file("$ENV{'PBTMP'}/system.log");
|
---|
[29] | 862 | } elsif ($? & 127) {
|
---|
[319] | 863 | pb_log(0, "child ($cmd) died with signal ".($? & 127).", ".($? & 128) ? 'with' : 'without'." coredump\n");
|
---|
[106] | 864 | pb_display_file("$ENV{'PBTMP'}/system.log");
|
---|
| 865 | } elsif ($? == 0) {
|
---|
[319] | 866 | pb_log(0,"OK\n");
|
---|
[29] | 867 | } else {
|
---|
[319] | 868 | pb_log(0, "child ($cmd) exited with value ".($? >> 8)."\n");
|
---|
[106] | 869 | pb_display_file("$ENV{'PBTMP'}/system.log");
|
---|
[29] | 870 | }
|
---|
[30] | 871 | }
|
---|
[74] | 872 |
|
---|
[106] | 873 | sub pb_display_file {
|
---|
| 874 |
|
---|
| 875 | my $file=shift;
|
---|
| 876 |
|
---|
[117] | 877 | return if (not -f $file);
|
---|
| 878 | open(FILE,"$file");
|
---|
[106] | 879 | while (<FILE>) {
|
---|
[108] | 880 | print $_;
|
---|
[106] | 881 | }
|
---|
| 882 | close(FILE);
|
---|
| 883 | }
|
---|
| 884 |
|
---|
[242] | 885 | # Function which returns a pointer on a table
|
---|
| 886 | # corresponding to a set of values queried in the conf file
|
---|
[88] | 887 | # and test the returned vaue as they need to exist in that case
|
---|
| 888 | sub pb_conf_get {
|
---|
| 889 |
|
---|
| 890 | my @param = @_;
|
---|
[313] | 891 | my @return = pb_conf_get_if(@param);
|
---|
[88] | 892 |
|
---|
[315] | 893 | die "No params found for $ENV{'PBPROJ'}" if (not @return);
|
---|
[313] | 894 |
|
---|
| 895 | foreach my $i (0..$#param) {
|
---|
| 896 | die "No $param[$i] defined for $ENV{'PBPROJ'}" if (not defined $return[$i]);
|
---|
| 897 | }
|
---|
| 898 | return(@return);
|
---|
| 899 | }
|
---|
| 900 |
|
---|
| 901 | # Function which returns a pointer on a table
|
---|
| 902 | # corresponding to a set of values queried in the conf file
|
---|
| 903 | # Those value may be undef if they do not exist
|
---|
| 904 | sub pb_conf_get_if {
|
---|
| 905 |
|
---|
| 906 | my @param = @_;
|
---|
| 907 |
|
---|
[242] | 908 | # Everything is returned via ptr1
|
---|
[318] | 909 | my @ptr1 = ();
|
---|
| 910 | my @ptr2 = ();
|
---|
| 911 | @ptr1 = pb_conf_read_if("$ENV{'PBETC'}", @param) if (defined $ENV{'PBETC'});
|
---|
| 912 | @ptr2 = pb_conf_read_if("$ENV{'PBROOT'}/$ENV{'PBPROJ'}.pb", @param) if ((defined $ENV{'PBROOT'}) and (defined $ENV{'PBPROJ'}));
|
---|
[89] | 913 |
|
---|
[242] | 914 | my $p1;
|
---|
| 915 | my $p2;
|
---|
| 916 |
|
---|
[315] | 917 | pb_log(2,"DEBUG: param1: ".Dumper(@ptr1)."\n");
|
---|
| 918 | pb_log(2,"DEBUG: param2: ".Dumper(@ptr2)."\n");
|
---|
[262] | 919 |
|
---|
[88] | 920 | foreach my $i (0..$#param) {
|
---|
[262] | 921 | $p1 = $ptr1[$i];
|
---|
| 922 | $p2 = $ptr2[$i];
|
---|
[242] | 923 | # Always try to take the param from the home dir conf file in priority
|
---|
| 924 | # in order to mask what could be defined under the CMS to allow for overloading
|
---|
| 925 | if (not defined $p2) {
|
---|
| 926 | # No ref in CMS project conf file so use the home dir one.
|
---|
| 927 | $p1->{$ENV{'PBPROJ'}} = $p1->{'default'} if (not defined $p1->{$ENV{'PBPROJ'}});
|
---|
| 928 | } else {
|
---|
| 929 | # Ref found in CMS project conf file
|
---|
| 930 | if (not defined $p1) {
|
---|
| 931 | # No ref in home dir project conf file so use the CMS one.
|
---|
| 932 | $p2->{$ENV{'PBPROJ'}} = $p2->{'default'} if (not defined $p2->{$ENV{'PBPROJ'}});
|
---|
| 933 | $p1->{$ENV{'PBPROJ'}} = $p2->{$ENV{'PBPROJ'}};
|
---|
| 934 | } else {
|
---|
| 935 | # Both are defined - handling the overloading
|
---|
| 936 | if (not defined $p1->{'default'}) {
|
---|
| 937 | if (defined $p2->{'default'}) {
|
---|
| 938 | $p1->{'default'} = $p2->{'default'};
|
---|
| 939 | }
|
---|
| 940 | }
|
---|
| 941 |
|
---|
| 942 | if (not defined $p1->{$ENV{'PBPROJ'}}) {
|
---|
| 943 | if (defined $p2->{$ENV{'PBPROJ'}}) {
|
---|
| 944 | $p1->{$ENV{'PBPROJ'}} = $p2->{$ENV{'PBPROJ'}};
|
---|
| 945 | } else {
|
---|
| 946 | $p1->{$ENV{'PBPROJ'}} = $p1->{'default'};
|
---|
| 947 | }
|
---|
| 948 | }
|
---|
| 949 | }
|
---|
| 950 | }
|
---|
[262] | 951 | $ptr1[$i] = $p1;
|
---|
[315] | 952 | pb_log(2,"DEBUG: param ptr1: ".Dumper(@ptr1)."\n");
|
---|
[88] | 953 | }
|
---|
[242] | 954 | return(@ptr1);
|
---|
[88] | 955 | }
|
---|
| 956 |
|
---|
| 957 | # Function which returns a pointer on a hash
|
---|
[74] | 958 | # corresponding to a declaration (arg2) in a conf file (arg1)
|
---|
[313] | 959 | # if that conf file doesn't exist returns undef
|
---|
| 960 | sub pb_conf_read_if {
|
---|
| 961 |
|
---|
| 962 | my $conffile = shift;
|
---|
| 963 | my @param = @_;
|
---|
| 964 |
|
---|
| 965 | open(CONF,$conffile) || return((undef));
|
---|
| 966 | close(CONF);
|
---|
| 967 | return(pb_conf_read($conffile,@param));
|
---|
| 968 | }
|
---|
| 969 |
|
---|
| 970 | # Function which returns a pointer on a hash
|
---|
| 971 | # corresponding to a declaration (arg2) in a conf file (arg1)
|
---|
[74] | 972 | sub pb_conf_read {
|
---|
| 973 |
|
---|
| 974 | my $conffile = shift;
|
---|
| 975 | my @param = @_;
|
---|
| 976 | my $trace;
|
---|
| 977 | my @ptr;
|
---|
[291] | 978 | my %h;
|
---|
[74] | 979 |
|
---|
[291] | 980 | open(CONF,$conffile) || die "Unable to open $conffile";
|
---|
| 981 | while(<CONF>) {
|
---|
| 982 | if (/^\s*([A-z0-9-_]+)\s+([[A-z0-9-_]+)\s*=\s*(.+)$/) {
|
---|
[315] | 983 | pb_log(2,"DEBUG: 1:$1 2:$2 3:$3\n");
|
---|
[291] | 984 | $h{$1}{$2}=$3;
|
---|
| 985 | }
|
---|
[74] | 986 | }
|
---|
[291] | 987 | close(CONF);
|
---|
[74] | 988 |
|
---|
| 989 | for my $param (@param) {
|
---|
[291] | 990 | push @ptr,$h{$param};
|
---|
[74] | 991 | }
|
---|
[89] | 992 | return(@ptr);
|
---|
[74] | 993 | }
|
---|
| 994 |
|
---|
[313] | 995 | # Analyze a url passed and return protocol, account, password, server, port, path
|
---|
[314] | 996 | sub pb_get_uri {
|
---|
[313] | 997 |
|
---|
[314] | 998 | my $uri = shift || undef;
|
---|
[313] | 999 |
|
---|
[318] | 1000 | pb_log(2,"DEBUG: uri:$uri\n");
|
---|
[314] | 1001 | # A URL has the format protocol://[ac@]host[:port][path[?query][#fragment]].
|
---|
| 1002 | # Cf man URI
|
---|
| 1003 | my ($scheme, $authority, $path, $query, $fragment) =
|
---|
[318] | 1004 | $uri =~ m|(?:([^:/?#]+):)?(?://([^/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?| if (defined $uri);
|
---|
| 1005 | my ($account,$host,$port) = $authority =~ m|(?:([^\@]+)\@)?([^:]+)(:(?:[0-9]+))?| if (defined $authority);
|
---|
| 1006 |
|
---|
| 1007 | $scheme = "" if (not defined $scheme);
|
---|
| 1008 | $authority = "" if (not defined $authority);
|
---|
| 1009 | $path = "" if (not defined $path);
|
---|
| 1010 | $account = "" if (not defined $account);
|
---|
| 1011 | $host = "" if (not defined $host);
|
---|
| 1012 | $port = "" if (not defined $port);
|
---|
| 1013 |
|
---|
[315] | 1014 | pb_log(2,"DEBUG: scheme:$scheme ac:$account host:$host port:$port path:$path\n");
|
---|
[314] | 1015 | return($scheme, $account, $host, $port, $path);
|
---|
[313] | 1016 | }
|
---|
| 1017 |
|
---|
| 1018 |
|
---|
| 1019 | # Setup environment for CMS system for URL passed
|
---|
[74] | 1020 | sub pb_cms_init {
|
---|
| 1021 |
|
---|
| 1022 | my $proj = shift || undef;
|
---|
| 1023 |
|
---|
[315] | 1024 | # Use the project URI
|
---|
| 1025 | my ($uri) = pb_conf_get("pburl");
|
---|
[74] | 1026 |
|
---|
[315] | 1027 | # Extract values from that URI
|
---|
| 1028 | my ($scheme, $account, $host, $port, $path) = pb_get_uri($uri->{$ENV{'PBPROJ'}});
|
---|
| 1029 |
|
---|
| 1030 | if ($scheme =~ /^svn/) {
|
---|
| 1031 | $ENV{'PBREVISION'}= pb_cms_getinfo($scheme,$uri->{$ENV{'PBPROJ'}},"Revision:");
|
---|
| 1032 | #$ENV{'PBREVISION'}=`(cd "$ENV{'PBDEVDIR'}" ; svnversion .)`;
|
---|
[74] | 1033 | $ENV{'PBCMSLOGFILE'}="svn.log";
|
---|
[315] | 1034 | } elsif (($scheme eq "file") || ($scheme eq "ftp") || ($scheme eq "http")) {
|
---|
[226] | 1035 | $ENV{'PBREVISION'}="flat";
|
---|
[227] | 1036 | $ENV{'PBCMSLOGFILE'}="flat.log";
|
---|
[315] | 1037 | } elsif ($scheme eq "cvs") {
|
---|
[106] | 1038 | # Way too slow
|
---|
| 1039 | #$ENV{'PBREVISION'}=`(cd "$ENV{'PBROOT'}" ; cvs rannotate -f . 2>&1 | awk '{print \$1}' | grep -E '^[0-9]' | cut -d. -f2 |sort -nu | tail -1)`;
|
---|
| 1040 | #chomp($ENV{'PBREVISION'});
|
---|
| 1041 | $ENV{'PBREVISION'}="CVS";
|
---|
[74] | 1042 | $ENV{'PBCMSLOGFILE'}="cvs.log";
|
---|
[87] | 1043 | #
|
---|
| 1044 | # Export content if needed
|
---|
| 1045 | #
|
---|
[313] | 1046 | my ($cvsrsh) = pb_conf_get_if("cvsrsh");
|
---|
[299] | 1047 | $ENV{'CVS_RSH'} = $cvsrsh->{$proj} if (defined $cvsrsh->{$proj});
|
---|
[74] | 1048 | } else {
|
---|
[315] | 1049 | die "cms $scheme unknown";
|
---|
[74] | 1050 | }
|
---|
[315] | 1051 |
|
---|
| 1052 | #
|
---|
| 1053 | #if (not defined $scheme) {
|
---|
| 1054 | # We're an upstream guy
|
---|
| 1055 | # Try to make it easy for us
|
---|
| 1056 | #pb_log(2,"WARNING: Assuming a local project under $ENV{'PBDIR'}/$ENV{'PBPROJ'}:\n");
|
---|
[318] | 1057 | #pb_log(2," If not, pleaase setup a pbproj entry in $ENV{'PBROOT'}/$ENV{'PBPROJ'}.pb\n");
|
---|
[315] | 1058 | #return("");
|
---|
| 1059 | #}
|
---|
| 1060 |
|
---|
| 1061 | return($scheme,$uri->{$ENV{'PBPROJ'}});
|
---|
[74] | 1062 | }
|
---|
| 1063 |
|
---|
[315] | 1064 | sub pb_get_date {
|
---|
| 1065 |
|
---|
| 1066 | return(localtime->sec(), localtime->min(), localtime->hour(), localtime->mday(), localtime->mon(), localtime->year(), localtime->wday(), localtime->yday(), localtime->isdst());
|
---|
| 1067 | }
|
---|
| 1068 |
|
---|
[106] | 1069 | sub pb_cms_export {
|
---|
[315] | 1070 |
|
---|
[319] | 1071 | my $uri = shift;
|
---|
[108] | 1072 | my $source = shift;
|
---|
[106] | 1073 | my $destdir = shift;
|
---|
[108] | 1074 | my $tmp;
|
---|
[115] | 1075 | my $tmp1;
|
---|
[106] | 1076 |
|
---|
[315] | 1077 | my @date = pb_get_date();
|
---|
[319] | 1078 | # If it's not flat, then we have a real uri as source
|
---|
| 1079 | my ($scheme, $account, $host, $port, $path) = pb_get_uri($uri);
|
---|
[315] | 1080 |
|
---|
[321] | 1081 | if ($scheme =~ /^svn/) {
|
---|
[108] | 1082 | if (-d $source) {
|
---|
| 1083 | $tmp = $destdir;
|
---|
| 1084 | } else {
|
---|
| 1085 | $tmp = $destdir."/".basename($source);
|
---|
[320] | 1086 | pb_mkdir_p($destdir);
|
---|
[108] | 1087 | }
|
---|
[116] | 1088 | pb_system("svn export $source $tmp","Exporting $source from SVN to $tmp");
|
---|
[319] | 1089 | } elsif ($scheme eq "dir") {
|
---|
[320] | 1090 | pb_system("cp -a $path $destdir","Copying $uri from DIR to $destdir");
|
---|
[319] | 1091 | } elsif (($scheme eq "http") || ($scheme eq "ftp")) {
|
---|
| 1092 | my $f = basename($path);
|
---|
| 1093 | unlink "$ENV{'PBTMP'}/$f";
|
---|
| 1094 | if (-x "/usr/bin/wget") {
|
---|
[320] | 1095 | pb_system("/usr/bin/wget -nv -O $ENV{'PBTMP'}/$f $uri"," ");
|
---|
[319] | 1096 | } elsif (-x "/usr/bin/curl") {
|
---|
| 1097 | pb_system("/usr/bin/curl $uri -o $ENV{'PBTMP'}/$f","Downloading $uri with curl to $ENV{'PBTMP'}/$f\n");
|
---|
| 1098 | } else {
|
---|
| 1099 | die "Unable to download $uri.\nNo wget/curl available, please install one of those";
|
---|
| 1100 | }
|
---|
| 1101 | pb_cms_export("file://$ENV{'PBTMP'}/$f",$source,$destdir);
|
---|
| 1102 | } elsif ($scheme eq "file") {
|
---|
| 1103 | use File::MimeInfo;
|
---|
| 1104 | my $mm = mimetype($path);
|
---|
| 1105 | pb_log(2,"mimetype: $mm\n");
|
---|
[320] | 1106 | pb_mkdir_p($destdir);
|
---|
[319] | 1107 |
|
---|
| 1108 | if ($mm =~ /\/x-bzip-compressed-tar$/) {
|
---|
| 1109 | # tar+bzip2
|
---|
[320] | 1110 | pb_system("cd $destdir ; tar xfj $path","Extracting $path in $destdir");
|
---|
[319] | 1111 | } elsif ($mm =~ /\/x-lzma-compressed-tar$/) {
|
---|
| 1112 | # tar+lzma
|
---|
[320] | 1113 | pb_system("cd $destdir ; tar xfY $path","Extracting $path in $destdir");
|
---|
[319] | 1114 | } elsif ($mm =~ /\/x-compressed-tar$/) {
|
---|
| 1115 | # tar+gzip
|
---|
[320] | 1116 | pb_system("cd $destdir ; tar xfz $path","Extracting $path in $destdir");
|
---|
[319] | 1117 | } elsif ($mm =~ /\/x-tar$/) {
|
---|
| 1118 | # tar
|
---|
[320] | 1119 | pb_system("cd $destdir ; tar xf $path","Extracting $path in $destdir");
|
---|
[319] | 1120 | } elsif ($mm =~ /\/zip$/) {
|
---|
| 1121 | # zip
|
---|
[320] | 1122 | pb_system("cd $destdir ; unzip $path","Extracting $path in $destdir");
|
---|
[319] | 1123 | }
|
---|
[320] | 1124 | # Maybe we created an extra level of dir under destdir
|
---|
| 1125 | opendir(DIR,$destdir) || die "Unable to open $destdir";
|
---|
| 1126 | my $cnt = 0;
|
---|
| 1127 | my $d0;
|
---|
| 1128 | foreach my $d (readdir(DIR)) {
|
---|
| 1129 | pb_log(3,"Looking at \'$d\'...");
|
---|
| 1130 | next if ($d =~ /^\./);
|
---|
| 1131 | $cnt++;
|
---|
| 1132 | $d0 = $d;
|
---|
| 1133 | }
|
---|
| 1134 | closedir(DIR);
|
---|
| 1135 | # Fix that by moving everything below that extra dir under destdir
|
---|
| 1136 | # and remove the extra dir
|
---|
| 1137 | if ($cnt == 1) {
|
---|
| 1138 | pb_system("cd $destdir/$d0 ; mv * .??* .. 2>/dev/null");
|
---|
| 1139 | pb_rm_rf("$destdir/$d0");
|
---|
| 1140 | }
|
---|
[315] | 1141 | } elsif ($scheme eq "cvs") {
|
---|
[106] | 1142 | my $dir=dirname($destdir);
|
---|
| 1143 | my $base=basename($destdir);
|
---|
[115] | 1144 | if (-d $source) {
|
---|
| 1145 | $tmp1 = $source;
|
---|
| 1146 | $tmp1 =~ s|$ENV{'PBROOT'}/||;
|
---|
| 1147 | } else {
|
---|
| 1148 | $tmp1 = dirname($source);
|
---|
| 1149 | $tmp1 =~ s|$ENV{'PBROOT'}/||;
|
---|
| 1150 | $tmp1 = $tmp1."/".basename($source);
|
---|
| 1151 | }
|
---|
[106] | 1152 | # CVS needs a relative path !
|
---|
[310] | 1153 | my ($cvsroot) = pb_conf_get("cvsroot");
|
---|
[315] | 1154 | my $pbdate = strftime("%Y-%m-%d %H:%M:%S", @date);
|
---|
[310] | 1155 | pb_system("cd $dir ; cvs -d $cvsroot->{$ENV{'PBPROJ'}} export -D \"$pbdate\" -d $base $tmp1","Exporting $source from CVS to $destdir");
|
---|
[106] | 1156 | } else {
|
---|
[315] | 1157 | die "cms $scheme unknown";
|
---|
[106] | 1158 | }
|
---|
| 1159 | }
|
---|
| 1160 |
|
---|
[285] | 1161 |
|
---|
| 1162 | sub pb_create_authors {
|
---|
| 1163 |
|
---|
| 1164 | my $authors=shift;
|
---|
| 1165 | my $dest=shift;
|
---|
[315] | 1166 | my $scheme=shift;
|
---|
[285] | 1167 |
|
---|
[286] | 1168 | return if ($authors eq "/dev/null");
|
---|
| 1169 | open(SAUTH,$authors) || die "Unable to open $authors";
|
---|
[320] | 1170 | # Save a potentially existing AUTHORS file and write instead toi AUTHORS.pb
|
---|
| 1171 | my $ext = "";
|
---|
| 1172 | if (-f "$dest/AUTHORS") {
|
---|
| 1173 | $ext = ".pb";
|
---|
| 1174 | }
|
---|
| 1175 | open(DAUTH,"> $dest/AUTHORS$ext") || die "Unable to create $dest/AUTHORS$ext";
|
---|
[285] | 1176 | print DAUTH "Authors of the project are:\n";
|
---|
| 1177 | print DAUTH "===========================\n";
|
---|
[286] | 1178 | while (<SAUTH>) {
|
---|
[285] | 1179 | my ($nick,$gcos) = split(/:/);
|
---|
[286] | 1180 | chomp($gcos);
|
---|
[285] | 1181 | print DAUTH "$gcos";
|
---|
[315] | 1182 | if (defined $scheme) {
|
---|
[320] | 1183 | # Do not give a scheme for flat types
|
---|
| 1184 | my $endstr="";
|
---|
| 1185 | if ("$ENV{'PBREVISION'}" ne "flat") {
|
---|
| 1186 | $endstr = " under $scheme";
|
---|
| 1187 | }
|
---|
| 1188 | print DAUTH " ($nick$endstr)\n";
|
---|
[286] | 1189 | } else {
|
---|
| 1190 | print DAUTH "\n";
|
---|
| 1191 | }
|
---|
[285] | 1192 | }
|
---|
| 1193 | close(DAUTH);
|
---|
[286] | 1194 | close(SAUTH);
|
---|
[285] | 1195 | }
|
---|
| 1196 |
|
---|
[106] | 1197 | sub pb_cms_log {
|
---|
[320] | 1198 |
|
---|
[315] | 1199 | my $scheme = shift;
|
---|
[106] | 1200 | my $pkgdir = shift;
|
---|
[285] | 1201 | my $dest = shift;
|
---|
[286] | 1202 | my $chglog = shift;
|
---|
[285] | 1203 | my $authors = shift;
|
---|
[106] | 1204 |
|
---|
[315] | 1205 | pb_create_authors($authors,$dest,$scheme);
|
---|
[285] | 1206 |
|
---|
[320] | 1207 | if ($scheme =~ /^svn/) {
|
---|
[286] | 1208 | if (! -f "$dest/ChangeLog") {
|
---|
| 1209 | if (-x "/usr/bin/svn2cl") {
|
---|
[315] | 1210 | pb_system("/usr/bin/svn2cl --group-by-day --authors=$authors -i -o $dest/ChangeLog $pkgdir","Generating ChangeLog from SVN with svn2cl");
|
---|
[286] | 1211 | } else {
|
---|
| 1212 | # To be written from pbcl
|
---|
| 1213 | pb_system("svn log -v $pkgdir > $dest/$ENV{'PBCMSLOGFILE'}","Extracting log info from SVN");
|
---|
| 1214 | }
|
---|
[285] | 1215 | }
|
---|
[320] | 1216 | } elsif (($scheme eq "file") || ($scheme eq "dir") || ($scheme eq "http") || ($scheme eq "ftp")) {
|
---|
[288] | 1217 | if (! -f "$dest/ChangeLog") {
|
---|
| 1218 | pb_system("echo ChangeLog for $pkgdir > $dest/ChangeLog","Empty ChangeLog file created");
|
---|
| 1219 | }
|
---|
[315] | 1220 | } elsif ($scheme eq "cvs") {
|
---|
[106] | 1221 | my $tmp=basename($pkgdir);
|
---|
| 1222 | # CVS needs a relative path !
|
---|
[286] | 1223 | if (! -f "$dest/ChangeLog") {
|
---|
| 1224 | if (-x "/usr/bin/cvs2cl") {
|
---|
[315] | 1225 | pb_system("/usr/bin/cvs2cl --group-by-day -U $authors -f $dest/ChangeLog $pkgdir","Generating ChangeLog from CVS with cvs2cl");
|
---|
[286] | 1226 | } else {
|
---|
| 1227 | # To be written from pbcl
|
---|
| 1228 | pb_system("cvs log $tmp > $dest/$ENV{'PBCMSLOGFILE'}","Extracting log info from CVS");
|
---|
| 1229 | }
|
---|
[285] | 1230 | }
|
---|
[106] | 1231 | } else {
|
---|
[315] | 1232 | die "cms $scheme unknown";
|
---|
[106] | 1233 | }
|
---|
| 1234 | }
|
---|
| 1235 |
|
---|
[204] | 1236 | sub pb_cms_getinfo {
|
---|
[318] | 1237 |
|
---|
[315] | 1238 | my $scheme = shift;
|
---|
[314] | 1239 | my $dir = shift;
|
---|
[315] | 1240 | my $info = shift || "URL:";
|
---|
| 1241 |
|
---|
| 1242 | my $res = "";
|
---|
[204] | 1243 | my $void = "";
|
---|
[106] | 1244 |
|
---|
[315] | 1245 | if ($scheme =~ /^svn/) {
|
---|
[314] | 1246 | open(PIPE,"LANGUAGE=C svn info $dir |") || return("");
|
---|
[204] | 1247 | while (<PIPE>) {
|
---|
[315] | 1248 | ($void,$res) = split(/^$info/) if (/^$info/);
|
---|
[204] | 1249 | }
|
---|
[318] | 1250 | $res =~ s/^\s*//;
|
---|
[204] | 1251 | close(PIPE);
|
---|
[315] | 1252 | chomp($res);
|
---|
| 1253 | } elsif ($scheme eq "flat") {
|
---|
| 1254 | } elsif ($scheme eq "cvs") {
|
---|
[204] | 1255 | } else {
|
---|
[315] | 1256 | die "cms $scheme unknown";
|
---|
[204] | 1257 | }
|
---|
[318] | 1258 | pb_log(2,"Found CMS info: $res\n");
|
---|
[315] | 1259 | return($res);
|
---|
[204] | 1260 | }
|
---|
| 1261 |
|
---|
| 1262 | sub pb_cms_copy {
|
---|
[315] | 1263 | my $scheme = shift;
|
---|
[204] | 1264 | my $oldurl = shift;
|
---|
| 1265 | my $newurl = shift;
|
---|
| 1266 |
|
---|
[315] | 1267 | if ($scheme eq "svn") {
|
---|
[212] | 1268 | pb_system("svn copy -m \"Creation of $newurl from $oldurl\" $oldurl $newurl","Copying $oldurl to $newurl ");
|
---|
[315] | 1269 | } elsif ($scheme eq "flat") {
|
---|
| 1270 | } elsif ($scheme eq "cvs") {
|
---|
[204] | 1271 | } else {
|
---|
[315] | 1272 | die "cms $scheme unknown";
|
---|
[204] | 1273 | }
|
---|
| 1274 | }
|
---|
| 1275 |
|
---|
| 1276 | sub pb_cms_checkout {
|
---|
[315] | 1277 | my $scheme = shift;
|
---|
[204] | 1278 | my $url = shift;
|
---|
| 1279 | my $destination = shift;
|
---|
| 1280 |
|
---|
[315] | 1281 | if ($scheme =~ /^svn/) {
|
---|
[320] | 1282 | pb_system("svn co $url $destination","Checking out $url to $destination ");
|
---|
[315] | 1283 | } elsif ($scheme eq "flat") {
|
---|
| 1284 | } elsif ($scheme eq "cvs") {
|
---|
[204] | 1285 | } else {
|
---|
[315] | 1286 | die "cms $scheme unknown";
|
---|
[204] | 1287 | }
|
---|
| 1288 | }
|
---|
| 1289 |
|
---|
[208] | 1290 | sub pb_cms_checkin {
|
---|
[315] | 1291 | my $scheme = shift;
|
---|
[208] | 1292 | my $dir = shift;
|
---|
| 1293 |
|
---|
[212] | 1294 | my $ver = basename($dir);
|
---|
[315] | 1295 | if ($scheme eq "svn") {
|
---|
[212] | 1296 | pb_system("svn ci -m \"Updated to $ver\" $dir","Checking in $dir");
|
---|
[208] | 1297 | pb_system("svn up $dir","Updating $dir");
|
---|
[315] | 1298 | } elsif ($scheme eq "flat") {
|
---|
| 1299 | } elsif ($scheme eq "cvs") {
|
---|
[208] | 1300 | } else {
|
---|
[315] | 1301 | die "cms $scheme unknown";
|
---|
[208] | 1302 | }
|
---|
| 1303 | }
|
---|
| 1304 |
|
---|
[204] | 1305 | sub pb_cms_isdiff {
|
---|
[315] | 1306 | my $scheme = shift;
|
---|
[204] | 1307 |
|
---|
[315] | 1308 | if ($scheme eq "svn") {
|
---|
[204] | 1309 | open(PIPE,"svn diff $ENV{'PBROOT'} |") || die "Unable to get svn diff from $ENV{'PBROOT'}";
|
---|
| 1310 | my $l = 0;
|
---|
| 1311 | while (<PIPE>) {
|
---|
| 1312 | $l++;
|
---|
| 1313 | }
|
---|
| 1314 | return($l);
|
---|
[315] | 1315 | } elsif ($scheme eq "flat") {
|
---|
| 1316 | } elsif ($scheme eq "cvs") {
|
---|
[204] | 1317 | } else {
|
---|
[315] | 1318 | die "cms $scheme unknown";
|
---|
[204] | 1319 | }
|
---|
| 1320 | }
|
---|
| 1321 |
|
---|
[77] | 1322 | # Get all filters to apply
|
---|
| 1323 | # They're cumulative from less specific to most specific
|
---|
| 1324 | # suffix is .pbf
|
---|
| 1325 |
|
---|
| 1326 | sub pb_get_filters {
|
---|
| 1327 |
|
---|
| 1328 | my @ffiles;
|
---|
[235] | 1329 | my ($ffile00, $ffile0, $ffile1, $ffile2, $ffile3);
|
---|
| 1330 | my ($mfile00, $mfile0, $mfile1, $mfile2, $mfile3);
|
---|
[77] | 1331 | my $pbpkg = shift || die "No package specified";
|
---|
[236] | 1332 | my $dtype = shift || "";
|
---|
| 1333 | my $dfam = shift || "";
|
---|
| 1334 | my $ddir = shift || "";
|
---|
| 1335 | my $dver = shift || "";
|
---|
[77] | 1336 | my $ptr; # returned value pointer on the hash of filters
|
---|
[79] | 1337 | my %ptr;
|
---|
[291] | 1338 | my %h;
|
---|
[77] | 1339 |
|
---|
[169] | 1340 | # Global filter files first, then package specificities
|
---|
[314] | 1341 | if (-d "$ENV{'PBROOT'}/pbfilter") {
|
---|
| 1342 | $mfile00 = "$ENV{'PBROOT'}/pbfilter/all.pbf" if (-f "$ENV{'PBROOT'}/pbfilter/all.pbf");
|
---|
| 1343 | $mfile0 = "$ENV{'PBROOT'}/pbfilter/$dtype.pbf" if (-f "$ENV{'PBROOT'}/pbfilter/$dtype.pbf");
|
---|
| 1344 | $mfile1 = "$ENV{'PBROOT'}/pbfilter/$dfam.pbf" if (-f "$ENV{'PBROOT'}/pbfilter/$dfam.pbf");
|
---|
| 1345 | $mfile2 = "$ENV{'PBROOT'}/pbfilter/$ddir.pbf" if (-f "$ENV{'PBROOT'}/pbfilter/$ddir.pbf");
|
---|
| 1346 | $mfile3 = "$ENV{'PBROOT'}/pbfilter/$ddir-$dver.pbf" if (-f "$ENV{'PBROOT'}/pbfilter/$ddir-$dver.pbf");
|
---|
[169] | 1347 |
|
---|
[231] | 1348 | push @ffiles,$mfile00 if (defined $mfile00);
|
---|
[169] | 1349 | push @ffiles,$mfile0 if (defined $mfile0);
|
---|
| 1350 | push @ffiles,$mfile1 if (defined $mfile1);
|
---|
| 1351 | push @ffiles,$mfile2 if (defined $mfile2);
|
---|
| 1352 | push @ffiles,$mfile3 if (defined $mfile3);
|
---|
| 1353 | }
|
---|
| 1354 |
|
---|
[314] | 1355 | if (-d "$ENV{'PBROOT'}/$pbpkg/pbfilter") {
|
---|
| 1356 | $ffile00 = "$ENV{'PBROOT'}/$pbpkg/pbfilter/all.pbf" if (-f "$ENV{'PBROOT'}/$pbpkg/pbfilter/all.pbf");
|
---|
| 1357 | $ffile0 = "$ENV{'PBROOT'}/$pbpkg/pbfilter/$dtype.pbf" if (-f "$ENV{'PBROOT'}/$pbpkg/pbfilter/$dtype.pbf");
|
---|
| 1358 | $ffile1 = "$ENV{'PBROOT'}/$pbpkg/pbfilter/$dfam.pbf" if (-f "$ENV{'PBROOT'}/$pbpkg/pbfilter/$dfam.pbf");
|
---|
| 1359 | $ffile2 = "$ENV{'PBROOT'}/$pbpkg/pbfilter/$ddir.pbf" if (-f "$ENV{'PBROOT'}/$pbpkg/pbfilter/$ddir.pbf");
|
---|
| 1360 | $ffile3 = "$ENV{'PBROOT'}/$pbpkg/pbfilter/$ddir-$dver.pbf" if (-f "$ENV{'PBROOT'}/$pbpkg/pbfilter/$ddir-$dver.pbf");
|
---|
[77] | 1361 |
|
---|
[231] | 1362 | push @ffiles,$ffile00 if (defined $ffile00);
|
---|
[77] | 1363 | push @ffiles,$ffile0 if (defined $ffile0);
|
---|
| 1364 | push @ffiles,$ffile1 if (defined $ffile1);
|
---|
| 1365 | push @ffiles,$ffile2 if (defined $ffile2);
|
---|
| 1366 | push @ffiles,$ffile3 if (defined $ffile3);
|
---|
| 1367 | }
|
---|
| 1368 | if (@ffiles) {
|
---|
[315] | 1369 | pb_log(2,"DEBUG ffiles: ".Dumper(\@ffiles)."\n");
|
---|
[79] | 1370 |
|
---|
[291] | 1371 | foreach my $f (@ffiles) {
|
---|
| 1372 | open(CONF,$f) || next;
|
---|
| 1373 | while(<CONF>) {
|
---|
| 1374 | if (/^\s*([A-z0-9-_]+)\s+([[A-z0-9-_]+)\s*=\s*(.+)$/) {
|
---|
| 1375 | $h{$1}{$2}=$3;
|
---|
| 1376 | }
|
---|
[79] | 1377 | }
|
---|
[291] | 1378 | close(CONF);
|
---|
[79] | 1379 |
|
---|
[291] | 1380 | $ptr = $h{"filter"};
|
---|
[315] | 1381 | pb_log(2,"DEBUG f:".Dumper($ptr)."\n");
|
---|
[291] | 1382 | }
|
---|
[77] | 1383 | } else {
|
---|
| 1384 | $ptr = { };
|
---|
| 1385 | }
|
---|
[79] | 1386 | %ptr = %$ptr;
|
---|
| 1387 | return(\%ptr);
|
---|
[77] | 1388 | }
|
---|
| 1389 |
|
---|
[236] | 1390 | # Function which applies filter on pb build files
|
---|
[77] | 1391 | sub pb_filter_file_pb {
|
---|
| 1392 |
|
---|
| 1393 | my $f=shift;
|
---|
| 1394 | my $ptr=shift;
|
---|
| 1395 | my %filter=%$ptr;
|
---|
| 1396 | my $destfile=shift;
|
---|
| 1397 | my $dtype=shift;
|
---|
[99] | 1398 | my $pbsuf=shift;
|
---|
[297] | 1399 | my $pbproj=shift;
|
---|
[80] | 1400 | my $pbpkg=shift;
|
---|
| 1401 | my $pbver=shift;
|
---|
| 1402 | my $pbtag=shift;
|
---|
| 1403 | my $pbrev=shift;
|
---|
| 1404 | my $pbdate=shift;
|
---|
[108] | 1405 | my $defpkgdir = shift;
|
---|
| 1406 | my $extpkgdir = shift;
|
---|
[174] | 1407 | my $pbpackager = shift;
|
---|
[285] | 1408 | my $chglog = shift || undef;
|
---|
[77] | 1409 |
|
---|
[315] | 1410 | pb_log(2,"DEBUG: From $f to $destfile\n");
|
---|
[77] | 1411 | pb_mkdir_p(dirname($destfile)) if (! -d dirname($destfile));
|
---|
| 1412 | open(DEST,"> $destfile") || die "Unable to create $destfile";
|
---|
| 1413 | open(FILE,"$f") || die "Unable to open $f: $!";
|
---|
| 1414 | while (<FILE>) {
|
---|
| 1415 | my $line = $_;
|
---|
| 1416 | foreach my $s (keys %filter) {
|
---|
| 1417 | # Process single variables
|
---|
[315] | 1418 | pb_log(2,"DEBUG filter{$s}: $filter{$s}\n");
|
---|
[77] | 1419 | my $tmp = $filter{$s};
|
---|
| 1420 | next if (not defined $tmp);
|
---|
| 1421 | # Expand variables if any single one found
|
---|
[315] | 1422 | pb_log(2,"DEBUG tmp: $tmp\n");
|
---|
[77] | 1423 | if ($tmp =~ /\$/) {
|
---|
| 1424 | eval { $tmp =~ s/(\$\w+)/$1/eeg };
|
---|
| 1425 | # special case for ChangeLog only for pb
|
---|
[259] | 1426 | } elsif (($s =~ /^PBLOG$/) && ($line =~ /^PBLOG$/)) {
|
---|
[108] | 1427 | my $p = $defpkgdir->{$pbpkg};
|
---|
| 1428 | $p = $extpkgdir->{$pbpkg} if (not defined $p);
|
---|
[285] | 1429 | pb_changelog($dtype, $pbpkg, $pbver, $pbtag, $pbsuf, $p, \*DEST, $tmp, $chglog);
|
---|
[254] | 1430 | $tmp = "";
|
---|
[77] | 1431 | }
|
---|
| 1432 | $line =~ s|$s|$tmp|;
|
---|
| 1433 | }
|
---|
| 1434 | print DEST $line;
|
---|
| 1435 | }
|
---|
| 1436 | close(FILE);
|
---|
| 1437 | close(DEST);
|
---|
| 1438 | }
|
---|
| 1439 |
|
---|
| 1440 | # Function which applies filter on files (external call)
|
---|
[315] | 1441 | sub pb_filter_file_inplace {
|
---|
| 1442 |
|
---|
| 1443 | my $ptr=shift;
|
---|
| 1444 | my %filter=%$ptr;
|
---|
| 1445 | my $destfile=shift;
|
---|
| 1446 | my $pbproj=shift;
|
---|
| 1447 | my $pbpkg=shift;
|
---|
| 1448 | my $pbver=shift;
|
---|
| 1449 | my $pbtag=shift;
|
---|
| 1450 | my $pbrev=shift;
|
---|
| 1451 | my $pbdate=shift;
|
---|
| 1452 | my $pbpackager=shift;
|
---|
| 1453 |
|
---|
| 1454 | my $cp = "$ENV{'PBTMP'}/".basename($destfile);
|
---|
| 1455 | copy($destfile,$cp) || die "Unable to create $cp";
|
---|
| 1456 |
|
---|
| 1457 | pb_filter_file($cp,$ptr,$destfile,$pbproj,$pbpkg,$pbver,$pbtag,$pbrev,$pbdate,$pbpackager);
|
---|
| 1458 | unlink $cp;
|
---|
| 1459 | }
|
---|
| 1460 |
|
---|
| 1461 | # Function which applies filter on files (external call)
|
---|
[77] | 1462 | sub pb_filter_file {
|
---|
| 1463 |
|
---|
| 1464 | my $f=shift;
|
---|
| 1465 | my $ptr=shift;
|
---|
| 1466 | my %filter=%$ptr;
|
---|
| 1467 | my $destfile=shift;
|
---|
[298] | 1468 | my $pbproj=shift;
|
---|
[80] | 1469 | my $pbpkg=shift;
|
---|
| 1470 | my $pbver=shift;
|
---|
| 1471 | my $pbtag=shift;
|
---|
| 1472 | my $pbrev=shift;
|
---|
| 1473 | my $pbdate=shift;
|
---|
[174] | 1474 | my $pbpackager=shift;
|
---|
[77] | 1475 |
|
---|
[315] | 1476 | pb_log(2,"DEBUG: From $f to $destfile\n");
|
---|
[77] | 1477 | pb_mkdir_p(dirname($destfile)) if (! -d dirname($destfile));
|
---|
| 1478 | open(DEST,"> $destfile") || die "Unable to create $destfile";
|
---|
| 1479 | open(FILE,"$f") || die "Unable to open $f: $!";
|
---|
| 1480 | while (<FILE>) {
|
---|
| 1481 | my $line = $_;
|
---|
| 1482 | foreach my $s (keys %filter) {
|
---|
| 1483 | # Process single variables
|
---|
[315] | 1484 | pb_log(2,"DEBUG filter{$s}: $filter{$s}\n");
|
---|
[77] | 1485 | my $tmp = $filter{$s};
|
---|
| 1486 | next if (not defined $tmp);
|
---|
| 1487 | # Expand variables if any single one found
|
---|
| 1488 | if ($tmp =~ /\$/) {
|
---|
| 1489 | eval { $tmp =~ s/(\$\w+)/$1/eeg };
|
---|
| 1490 | }
|
---|
| 1491 | $line =~ s|$s|$tmp|;
|
---|
| 1492 | }
|
---|
| 1493 | print DEST $line;
|
---|
| 1494 | }
|
---|
| 1495 | close(FILE);
|
---|
| 1496 | close(DEST);
|
---|
| 1497 | }
|
---|
| 1498 |
|
---|
[315] | 1499 | sub pb_log_init {
|
---|
[77] | 1500 |
|
---|
[315] | 1501 | $debug = shift || 0;
|
---|
| 1502 | $LOG = shift || \*STDOUT;
|
---|
| 1503 |
|
---|
| 1504 | }
|
---|
| 1505 |
|
---|
| 1506 | sub pb_log {
|
---|
| 1507 |
|
---|
| 1508 | my $dlevel = shift;
|
---|
| 1509 | my $msg = shift;
|
---|
| 1510 |
|
---|
[318] | 1511 | print $LOG "$msg" if ($dlevel <= $debug);
|
---|
[315] | 1512 | }
|
---|
| 1513 |
|
---|
[316] | 1514 | #
|
---|
| 1515 | # Return the list of packages we are working on
|
---|
| 1516 | #
|
---|
| 1517 | sub pb_get_pkg {
|
---|
| 1518 |
|
---|
| 1519 | my @pkgs = ();
|
---|
| 1520 | my $defpkgdir = shift || undef;
|
---|
| 1521 | my $extpkgdir = shift || undef;
|
---|
| 1522 |
|
---|
| 1523 | # Get packages list
|
---|
| 1524 | if (not defined $ARGV[0]) {
|
---|
| 1525 | @pkgs = keys %$defpkgdir if (defined $defpkgdir);
|
---|
| 1526 | } elsif ($ARGV[0] =~ /^all$/) {
|
---|
[317] | 1527 | @pkgs = keys %$defpkgdir if (defined $defpkgdir);
|
---|
[316] | 1528 | push(@pkgs, keys %$extpkgdir) if (defined $extpkgdir);
|
---|
| 1529 | } else {
|
---|
| 1530 | @pkgs = @ARGV;
|
---|
| 1531 | }
|
---|
| 1532 | pb_log(0,"Packages: ".join(',',@pkgs)."\n");
|
---|
| 1533 | return(\@pkgs);
|
---|
| 1534 | }
|
---|
| 1535 |
|
---|
[2] | 1536 | 1;
|
---|