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" ;
1516}
17+ my $package_name = $github_repo_name ;
18+ if ( $PROJECT eq " pgautofailover" ) {
19+ $github_repo_name = " pg_auto_failover" ;
20+ $package_name = " pg-auto-failover" ;
21+ $log_repo_name = " pg_auto_failover" ;
22+ $version_suffix = " " ;
23+ }
24+ if ( $PROJECT eq " pgautofailover-enterprise" ) {
25+ $github_repo_name = " citus-ha" ;
26+ $package_name = " pg-auto-failover-enterprise" ;
27+ $log_repo_name = " pg_auto_failover enterprise" ;
28+ $version_suffix = " " ;
29+ }
1630
1731my $github_token = get_and_verify_token();
1832
@@ -56,23 +70,25 @@ sub get_changelog_for_debian {
5670
5771# Necessary to create unique branch
5872$curTime = time ();
73+ my $main_branch = " $DISTRO_VERSION -$PROJECT " ;
74+ my $pr_branch = " $DISTRO_VERSION -$PROJECT -$VERSION -push-$curTime " ;
5975
6076# Checkout the distro's branch
61- ` git checkout $DISTRO_VERSION - $PROJECT ` ;
77+ ` git checkout $main_branch ` ;
6278# Update distro's branch
63- ` git pull origin $DISTRO_VERSION - $PROJECT ` ;
79+ ` git pull origin $main_branch ` ;
6480
6581# Create a new branch based on the distro's branch
66- ` git checkout -b $DISTRO_VERSION - $PROJECT -push- $curTime ` ;
82+ ` git checkout -b $pr_branch ` ;
6783
6884# Update pkgvars
69- ` sed -i 's/^pkglatest.*/pkglatest=$VERSION .citus -1/g' pkgvars` ;
85+ ` sed -i 's/^pkglatest.*/pkglatest=$VERSION$version_suffix -1/g' pkgvars` ;
7086
7187# Based on the repo, update the package related variables
7288if ( $DISTRO_VERSION eq " redhat" || $DISTRO_VERSION eq " microsoft" || $DISTRO_VERSION eq " all" ) {
73- ` sed -i 's|^Version:.*|Version: $VERSION .citus |g' $github_repo_name .spec` ;
74- ` sed -i 's|^Source0:.*|Source0: https:\/\/ github.com\/ citusdata\/ $github_repo_name \/ archive\/ v$VERSION .tar.gz|g' $github_repo_name .spec` ;
75- ` sed -i 's|^%changelog |%changelog \\ n* $abbr_day [$wday ] $abbr_mon [$mon ] $mday $year - $git_name <$microsoft_email > $VERSION .citus -1\\ n- Update to $log_repo_name $VERSION \\ n|g' $github_repo_name .spec` ;
89+ ` sed -i 's|^Version:.*|Version: $VERSION$version_suffix |g' $package_name .spec` ;
90+ ` sed -i 's|^Source0:.*|Source0: https:\/\/ github.com\/ citusdata\/ $package_name \/ archive\/ v$VERSION .tar.gz|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` ;
7692}
7793if ( $DISTRO_VERSION eq " debian" || $DISTRO_VERSION eq " microsoft" || $DISTRO_VERSION eq " all" ) {
7894 open ( DEB_CLOG_FILE, " <./debian/changelog" ) || die " Debian changelog file not found" ;
@@ -81,18 +97,33 @@ sub get_changelog_for_debian {
8197
8298 # Change hour and get changelog (TODO: may update it !)
8399 $print_hour = $hour - 3;
84- @changelog_print = get_changelog_for_debian();
100+ if ($PROJECT eq ' citus' || $PROJECT eq ' enterprise' ) {
101+ @changelog_print = get_changelog_for_debian();
102+ }
103+
85104
86105 # Update the changelog file of the debian branch
87106 open ( DEB_CLOG_FILE, " >./debian/changelog" ) || die " Debian changelog file not found" ;
88- print DEB_CLOG_FILE " $github_repo_name ($VERSION .citus-1) stable; urgency=low\n " ;
89- print DEB_CLOG_FILE @changelog_print ;
107+ print DEB_CLOG_FILE " $package_name ($VERSION$version_suffix -1) stable; urgency=low\n " ;
108+ if ($PROJECT eq ' citus' || $PROJECT eq ' enterprise' ) {
109+ print DEB_CLOG_FILE @changelog_print ;
110+ }
111+ else
112+ {
113+ print DEB_CLOG_FILE " \n * Official $VERSION release of $log_repo_name \n\n " ;
114+ }
90115 print DEB_CLOG_FILE " -- $git_name <$microsoft_email > $abbr_day [$wday ], $mday $abbr_mon [$mon ] $year $print_hour :$min :$sec +0000\n\n " ;
91116 print DEB_CLOG_FILE @lines ;
92117 close (DEB_CLOG_FILE);
93118}
94119
120+
121+ my $commit_message_distro_version = " $DISTRO_VERSION " ;
122+ if ($DISTRO_VERSION eq " all" ) {
123+ $commit_message_distro_version = " " ;
124+ }
95125# Commit, push changes and open a pull request
96- ` git commit -a -m "Bump $DISTRO_VERSION $log_repo_name $VERSION "` ;
97- ` git push origin $DISTRO_VERSION -$PROJECT -push-$curTime ` ;
98- ` 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