my $arg_spec = ""; # spec file to be built this time
my $start_time = ""; # build start time
my $gbs_version = ""; # show gbs version info in final report
+my $use_build_count = 0; # use build count to specify the release of package
my @tofind = (); # for resolve final build binary list
my @pre_packs = (); # temp packages data, item structure :
"with-submodules" => \$with_submodules,
"release=s" => \$release_tag,
"nocumulate" => \$nocumulate,
+ "use-build-count" => \$use_build_count,
);
if ( $help ) {
my_system("cat '$order_dir'/.repo.cache.local '$order_dir'/.repo.cache.remote >'$order_dir'/.repo.cache");
}
+#---------------------------------------------------------------------
+# update build count of package
+#---------------------------------------------------------------------
+sub update_build_count {
+ my ($pkg_name) = @_;
+ my $build_count_file = "$cache_path/$pkg_name.bcnt";
+ my $build_count = 1;
+
+ if (-e "$build_count_file") {
+ open(my $fh_in, '<', "$build_count_file") or die "$build_count_file - $!";
+ my $line = readline($fh_in);
+ close($fh_in);
+ chomp $line;
+ $build_count = int($line) < 999 ? int($line) + 1 : 1;
+ }
+
+ open(my $fh, '>', "$build_count_file") or die "$build_count_file - $!";
+ print $fh $build_count . "\n";
+ close($fh);
+
+ return $build_count;
+}
+
#---------------------------------------------------------------------
# Generate buid command and run it
#---------------------------------------------------------------------
}
if ($release_tag ne "") {
- push @args, "--release=$release_tag";
+ push @args, "--release=$release_tag";
+ } else {
+ if ($use_build_count == 1) {
+ my $build_count = update_build_count("$name-$version-$release");
+ push @args, "--release=$release.$build_count";
+ }
}
if ($nocumulate) {
push @args, "--nocumulate";