99# Name of the repo is represented differently on logs and repos
1010my $github_repo_name = " citus" ;
1111my $log_repo_name = " Citus" ;
12+ my $version_suffix = " .citus" ;
1213if ( $PROJECT eq " enterprise" ) {
1314 $github_repo_name = " citus-enterprise" ;
1415 $log_repo_name = " Citus Enterprise" ;
1819 $github_repo_name = " pg_auto_failover" ;
1920 $package_name = " pg-auto-failover" ;
2021 $log_repo_name = " pg_auto_failover" ;
22+ $version_suffix = " " ;
2123}
2224if ( $PROJECT eq " pgautofailover-enterprise" ) {
2325 $github_repo_name = " citus-ha" ;
2426 $package_name = " pg-auto-failover-enterprise" ;
2527 $log_repo_name = " pg_auto_failover enterprise" ;
28+ $version_suffix = " " ;
2629}
2730
2831my $github_token = get_and_verify_token();
@@ -67,23 +70,25 @@ sub get_changelog_for_debian {
6770
6871# Necessary to create unique branch
6972$curTime = time ();
73+ my $main_branch = " $DISTRO_VERSION -$PROJECT " ;
74+ my $pr_branch = " $DISTRO_VERSION -$PROJECT -$VERSION -push-$curTime " ;
7075
7176# Checkout the distro's branch
72- ` git checkout $DISTRO_VERSION - $PROJECT ` ;
77+ ` git checkout $main_branch ` ;
7378# Update distro's branch
74- ` git pull origin $DISTRO_VERSION - $PROJECT ` ;
79+ ` git pull origin $main_branch ` ;
7580
7681# Create a new branch based on the distro's branch
77- ` git checkout -b $DISTRO_VERSION - $PROJECT -push- $curTime ` ;
82+ ` git checkout -b $pr_branch ` ;
7883
7984# Update pkgvars
80- ` sed -i 's/^pkglatest.*/pkglatest=$VERSION .citus -1/g' pkgvars` ;
85+ ` sed -i 's/^pkglatest.*/pkglatest=$VERSION$version_suffix -1/g' pkgvars` ;
8186
8287# Based on the repo, update the package related variables
8388if ( $DISTRO_VERSION eq " redhat" || $DISTRO_VERSION eq " microsoft" || $DISTRO_VERSION eq " all" ) {
84- ` sed -i 's|^Version:.*|Version: $VERSION .citus |g' $package_name .spec` ;
89+ ` sed -i 's|^Version:.*|Version: $VERSION$version_suffix |g' $package_name .spec` ;
8590 ` sed -i 's|^Source0:.*|Source0: https:\/\/ github.com\/ citusdata\/ $package_name \/ archive\/ v$VERSION .tar.gz|g' $package_name .spec` ;
86- ` sed -i 's|^%changelog |%changelog \\ n* $abbr_day [$wday ] $abbr_mon [$mon ] $mday $year - $git_name <$microsoft_email > $VERSION .citus -1\\ n- Official $VERSION release of $log_repo_name \\ n|g' $package_name .spec` ;
91+ ` sed -i 's|^%changelog |%changelog \\ n* $abbr_day [$wday ] $abbr_mon [$mon ] $mday $year - $git_name <$microsoft_email > $VERSION$version_suffix -1\\ n- Official $VERSION release of $log_repo_name \\ n|g' $package_name .spec` ;
8792}
8893if ( $DISTRO_VERSION eq " debian" || $DISTRO_VERSION eq " microsoft" || $DISTRO_VERSION eq " all" ) {
8994 open ( DEB_CLOG_FILE, " <./debian/changelog" ) || die " Debian changelog file not found" ;
@@ -99,7 +104,7 @@ sub get_changelog_for_debian {
99104
100105 # Update the changelog file of the debian branch
101106 open ( DEB_CLOG_FILE, " >./debian/changelog" ) || die " Debian changelog file not found" ;
102- print DEB_CLOG_FILE " $package_name ($VERSION .citus -1) stable; urgency=low\n " ;
107+ print DEB_CLOG_FILE " $package_name ($VERSION$version_suffix -1) stable; urgency=low\n " ;
103108 if ($PROJECT eq ' citus' || $PROJECT eq ' enterprise' ) {
104109 print DEB_CLOG_FILE @changelog_print ;
105110 }
@@ -112,7 +117,13 @@ sub get_changelog_for_debian {
112117 close (DEB_CLOG_FILE);
113118}
114119
120+
121+ my $commit_message_distro_version = " $DISTRO_VERSION " ;
122+ if ($DISTRO_VERSION eq " all" ) {
123+ $commit_message_distro_version = " " ;
124+ }
115125# Commit, push changes and open a pull request
116- ` git commit -a -m "Bump $DISTRO_VERSION $log_repo_name $VERSION "` ;
117- ` git push origin $DISTRO_VERSION -$PROJECT -push-$curTime ` ;
118- ` curl -g -H "Accept: application/vnd.github.v3.full+json" -X POST --user "$github_token :x-oauth-basic" -d '{\" title\" :\" Bump $PROJECT $DISTRO_VERSION version to $VERSION \" , \" head\" :\" $DISTRO_VERSION -$PROJECT -push-$curTime \" , \" base\" :\" $DISTRO_VERSION -$PROJECT \" }' https://api.github.com/repos/citusdata/packaging/pulls` ;
126+ my $commit_message = " Bump $commit_message_distro_version$log_repo_name version to $VERSION " ;
127+ ` git commit -a -m "$commit_message "` ;
128+ ` git push origin $pr_branch ` ;
129+ ` curl -g -H "Accept: application/vnd.github.v3.full+json" -X POST --user "$github_token :x-oauth-basic" -d '{\" title\" :\" $commit_message \" , \" head\" :\" $pr_branch \" , \" base\" :\" $main_branch \" }' https://api.github.com/repos/citusdata/packaging/pulls` ;
0 commit comments