1616
1717my $github_token = get_and_verify_token();
1818
19+ my $microsoft_email = get_microsoft_email();
20+ my $git_name = get_git_name();
21+
1922# Debian branch has it's own changelog, we can get them through the CHANGELOG file of the code repo
2023sub get_changelog_for_debian {
2124
2225 # Update project spec file
23- @changelog_file = ` curl --user "$github_token :x-oauth-basic" -H "Accept: application/vnd.github.v3.raw" -X GET 'https://api.github.com/repos/citusdata/$github_repo_name /contents/CHANGELOG.md' 2> /dev/null` ;
26+ @changelog_file = ` curl --user "$github_token :x-oauth-basic" -H "Accept: application/vnd.github.v3.raw" -X GET 'https://api.github.com/repos/citusdata/$github_repo_name /contents/CHANGELOG.md?ref=v $VERSION ' 2> /dev/null` ;
2427
2528 $first_version_has_seen = 0;
2629 my @changelog_items ;
@@ -56,6 +59,8 @@ sub get_changelog_for_debian {
5659
5760# Checkout the distro's branch
5861` git checkout $DISTRO_VERSION -$PROJECT ` ;
62+ # Update distro's branch
63+ ` git pull origin $DISTRO_VERSION -$PROJECT ` ;
5964
6065# Create a new branch based on the distro's branch
6166` git checkout -b $DISTRO_VERSION -$PROJECT -push-$curTime ` ;
@@ -64,12 +69,12 @@ sub get_changelog_for_debian {
6469` sed -i 's/^pkglatest.*/pkglatest=$VERSION .citus-1/g' pkgvars` ;
6570
6671# Based on the repo, update the package related variables
67- if ( $DISTRO_VERSION eq " redhat" ) {
72+ if ( $DISTRO_VERSION eq " redhat" || $DISTRO_VERSION eq " microsoft " || $DISTRO_VERSION eq " all " ) {
6873 ` sed -i 's|^Version:.*|Version: $VERSION .citus|g' $github_repo_name .spec` ;
69- ` sed -i 's|^Source0:.*|Source0: https:\/\/ github.com\/ citusdata\/ $github_repo_name \/ archive\/ v$VERSION .tar.gz|g' $github_repo_name .spec` ;
70- ` sed -i 's|^%changelog |%changelog \\ n* $abbr_day [$wday ] $abbr_mon [$mon ] $mday $year - Burak Velioglu <velioglub \@ citusdata.com > $VERSION .citus-1\\ n- Update to $log_repo_name $VERSION \\ n|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` ;
7176}
72- elsif ( $DISTRO_VERSION eq " debian" ) {
77+ if ( $DISTRO_VERSION eq " debian" || $DISTRO_VERSION eq " microsoft " || $DISTRO_VERSION eq " all " ) {
7378 open ( DEB_CLOG_FILE, " <./debian/changelog" ) || die " Debian changelog file not found" ;
7479 my @lines = <DEB_CLOG_FILE>;
7580 close (DEB_CLOG_FILE);
@@ -82,12 +87,12 @@ sub get_changelog_for_debian {
8287 open ( DEB_CLOG_FILE, " >./debian/changelog" ) || die " Debian changelog file not found" ;
8388 print DEB_CLOG_FILE " $github_repo_name ($VERSION .citus-1) stable; urgency=low\n " ;
8489 print DEB_CLOG_FILE @changelog_print ;
85- print DEB_CLOG_FILE " -- Burak Velioglu <velioglub \@ citusdata.com > $abbr_day [$wday ], $mday $abbr_mon [$mon ] $year $print_hour :$min :$sec +0000\n\n " ;
90+ print DEB_CLOG_FILE " -- $git_name < $microsoft_email > $abbr_day [$wday ], $mday $abbr_mon [$mon ] $year $print_hour :$min :$sec +0000\n\n " ;
8691 print DEB_CLOG_FILE @lines ;
8792 close (DEB_CLOG_FILE);
8893}
8994
9095# Commit, push changes and open a pull request
9196` git commit -a -m "Bump $DISTRO_VERSION $log_repo_name $VERSION "` ;
9297` git push origin $DISTRO_VERSION -$PROJECT -push-$curTime ` ;
93- ` 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 \" , \" head\" :\" $DISTRO_VERSION -$PROJECT -push-$curTime \" , \" base\" :\" $DISTRO_VERSION -$PROJECT \" }' https://api.github.com/repos/citusdata/packaging/pulls` ;
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` ;
0 commit comments