Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
onurctirtir committed Aug 7, 2020
2 parents 1bab1ce + 5555ed4 commit 92314b7
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 32 deletions.
8 changes: 5 additions & 3 deletions automated_packaging/common_functions.pm
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,13 @@ sub create_release_changelog {
foreach $line (@log_output) {
if ($line =~ /^DESCRIPTION: */) {
$description_part = substr($line, length($&), -1);

if (length($description_part) > 78) {
print("You have to shorten PR message $description_part of $pr_url");
`git reset --hard`;
die "Can not add description longer than 78 charachters";
print("You have to shorten PR message $description_part of $pr_url\n");
print("Description should not be longer than 78 charachters, please manually shorten this description\n");
push(@comment_lines, "TODO: " . "PLEASE SHORTEN THE NEXT LINE MANUALLY, IT SHOULD BE NO LONGER THAN 78 CHARS\n");
}

print("Description $description_part has been added ... \n");
push(@comment_lines, "* " . $description_part . "\n\n");
}
Expand Down
2 changes: 1 addition & 1 deletion automated_packaging/update_docker.pl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
$curTime = time();

# Checkout to the release's branch
`git checkout develop`;
`git checkout master`;
`git checkout -b release-$VERSION-$curTime`;

# That means we want to update postgres version
Expand Down
57 changes: 44 additions & 13 deletions automated_packaging/update_os_package.pl
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,24 @@
# Name of the repo is represented differently on logs and repos
my $github_repo_name = "citus";
my $log_repo_name = "Citus";
my $version_suffix = ".citus";
if ( $PROJECT eq "enterprise" ) {
$github_repo_name = "citus-enterprise";
$log_repo_name = "Citus Enterprise";
}
my $package_name = $github_repo_name;
if ( $PROJECT eq "pgautofailover" ) {
$github_repo_name = "pg_auto_failover";
$package_name = "pg-auto-failover";
$log_repo_name = "pg_auto_failover";
$version_suffix = "";
}
if ( $PROJECT eq "pgautofailover-enterprise" ) {
$github_repo_name = "citus-ha";
$package_name = "pg-auto-failover-enterprise";
$log_repo_name = "pg_auto_failover enterprise";
$version_suffix = "";
}

my $github_token = get_and_verify_token();

Expand Down Expand Up @@ -56,23 +70,25 @@ sub get_changelog_for_debian {

# Necessary to create unique branch
$curTime = time();
my $main_branch = "$DISTRO_VERSION-$PROJECT";
my $pr_branch = "$DISTRO_VERSION-$PROJECT-$VERSION-push-$curTime";

# Checkout the distro's branch
`git checkout $DISTRO_VERSION-$PROJECT`;
`git checkout $main_branch`;
# Update distro's branch
`git pull origin $DISTRO_VERSION-$PROJECT`;
`git pull origin $main_branch`;

# Create a new branch based on the distro's branch
`git checkout -b $DISTRO_VERSION-$PROJECT-push-$curTime`;
`git checkout -b $pr_branch`;

# Update pkgvars
`sed -i 's/^pkglatest.*/pkglatest=$VERSION.citus-1/g' pkgvars`;
`sed -i 's/^pkglatest.*/pkglatest=$VERSION$version_suffix-1/g' pkgvars`;

# Based on the repo, update the package related variables
if ( $DISTRO_VERSION eq "redhat" || $DISTRO_VERSION eq "microsoft" || $DISTRO_VERSION eq "all") {
`sed -i 's|^Version:.*|Version: $VERSION.citus|g' $github_repo_name.spec`;
`sed -i 's|^Source0:.*|Source0: https:\/\/github.com\/citusdata\/$github_repo_name\/archive\/v$VERSION.tar.gz|g' $github_repo_name.spec`;
`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`;
`sed -i 's|^Version:.*|Version: $VERSION$version_suffix|g' $package_name.spec`;
`sed -i 's|^Source0:.*|Source0: https:\/\/github.com\/citusdata\/$package_name\/archive\/v$VERSION.tar.gz|g' $package_name.spec`;
`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`;
}
if ( $DISTRO_VERSION eq "debian" || $DISTRO_VERSION eq "microsoft" || $DISTRO_VERSION eq "all") {
open( DEB_CLOG_FILE, "<./debian/changelog" ) || die "Debian changelog file not found";
Expand All @@ -81,18 +97,33 @@ sub get_changelog_for_debian {

# Change hour and get changelog (TODO: may update it !)
$print_hour = $hour - 3;
@changelog_print = get_changelog_for_debian();
if ($PROJECT eq 'citus' || $PROJECT eq 'enterprise') {
@changelog_print = get_changelog_for_debian();
}


# Update the changelog file of the debian branch
open( DEB_CLOG_FILE, ">./debian/changelog" ) || die "Debian changelog file not found";
print DEB_CLOG_FILE "$github_repo_name ($VERSION.citus-1) stable; urgency=low\n";
print DEB_CLOG_FILE @changelog_print;
print DEB_CLOG_FILE "$package_name ($VERSION$version_suffix-1) stable; urgency=low\n";
if ($PROJECT eq 'citus' || $PROJECT eq 'enterprise') {
print DEB_CLOG_FILE @changelog_print;
}
else
{
print DEB_CLOG_FILE "\n * Official $VERSION release of $log_repo_name\n\n";
}
print DEB_CLOG_FILE " -- $git_name <$microsoft_email> $abbr_day[$wday], $mday $abbr_mon[$mon] $year $print_hour:$min:$sec +0000\n\n";
print DEB_CLOG_FILE @lines;
close(DEB_CLOG_FILE);
}


my $commit_message_distro_version = "$DISTRO_VERSION ";
if ($DISTRO_VERSION eq "all") {
$commit_message_distro_version = "";
}
# Commit, push changes and open a pull request
`git commit -a -m "Bump $DISTRO_VERSION $log_repo_name $VERSION"`;
`git push origin $DISTRO_VERSION-$PROJECT-push-$curTime`;
`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`;
my $commit_message = "Bump $commit_message_distro_version$log_repo_name version to $VERSION";
`git commit -a -m "$commit_message"`;
`git push origin $pr_branch`;
`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`;
5 changes: 2 additions & 3 deletions automated_packaging/update_pgxn.pl
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,10 @@

# Update META.json file
`sed -i 's/$old_version_escape_dot/$NEW_VERSION/g' META.json`;
`sed -i 's/$old_minor_version-[[:digit:]]/$new_minor_version-$new_point_version/g' META.json`;

# Commit changes to github
`git commit -a -m "Bump Citus to $NEW_VERSION"`;
`git commit -a -m "Bump Citus PGXN to $NEW_VERSION"`;
`git push origin pgxn-citus-push-$curTime`;

# Open a PR to the master
`curl -g -H "Accept: application/vnd.github.v3.full+json" -X POST --user "$github_token:x-oauth-basic" -d '{\"title\":\"Bump Citus to $NEW_VERSION\", \"base\":\"pgxn-citus\", \"head\":\"pgxn-citus-push-$curTime\"}' https://api.github.com/repos/citusdata/packaging/pulls`;
`curl -g -H "Accept: application/vnd.github.v3.full+json" -X POST --user "$github_token:x-oauth-basic" -d '{\"title\":\"Bump Citus PGXN to $NEW_VERSION\", \"base\":\"pgxn-citus\", \"head\":\"pgxn-citus-push-$curTime\"}' https://api.github.com/repos/citusdata/packaging/pulls`;
2 changes: 2 additions & 0 deletions packaging/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

## Usage

First, please read `man citus_package`, we have a man page for it :)

Ensure your `GITHUB_TOKEN` environment variable is properly set (see the man page if you're not sure how to do that). Make sure Docker is running, then you're off to the races! For example, to build a `citus` community "release" on Debian Jessie and Ubuntu Xenial, first change your directory into "citusdata/packaging" repo directory and then checkout the `all-citus` (would be `all-enterprise` for enterprise) branch as this branch has the specific `pkgvars` for community packages. Then execute the following:

`citus_package -p debian/jessie -p ubuntu/xenial local release`
Expand Down
4 changes: 2 additions & 2 deletions travis/install_custom_pg
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ if [ "$(ls -A postgresql)" ]; then
git -C postgresql pull
else
pgmajornum="${PGVERSION%%.*}"
if [ "${pgmajornum}" -gt '12' ]; then
# twelve is highest stable build; use master for higher
if [ "${pgmajornum}" -gt '13' ]; then
# 13 is highest stable build; use master for higher
gitref="master"
elif [ "${pgmajornum}" -gt '9' ]; then
gitref="REL_${PGVERSION}_STABLE"
Expand Down
8 changes: 4 additions & 4 deletions travis/setup_apt
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 7FCC7D46ACCC4CF8
sudo rm -f /etc/apt/sources.list.d/google-chrome*
sudo rm -f /etc/apt/sources.list.d/pgdg.list

# add the PostgreSQL 12 repository
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main 12" >> /etc/apt/sources.list.d/postgresql.list'
# add the PostgreSQL 13 repository
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main 13" >> /etc/apt/sources.list.d/postgresql.list'

# need testing repository after version 12
if [ "${PGVERSION%%.*}" -gt '12' ]; then
# need testing repository after version 13
if [ "${PGVERSION%%.*}" -gt '13' ]; then
# add a PostgreSQL testing repository
sudo sh -Ec 'echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg-testing main ${PGVERSION}" >> /etc/apt/sources.list.d/postgresql.list'

Expand Down
12 changes: 6 additions & 6 deletions uncrustify/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ clean:
rm -f *.1

installdirs:
$(INSTALL) -d $(DESTDIR)$(bindir) $(DESTDIR)$(pkgsysconfdir) $(DESTDIR)$(mandir)/man1
$(INSTALL) -d $(bindir) $(pkgsysconfdir) $(mandir)/man1

install: all installdirs
$(INSTALL_SCRIPT) citus_indent $(DESTDIR)$(bindir)
$(INSTALL_DATA) $(MANPAGES) $(DESTDIR)$(mandir)/man1
$(INSTALL_DATA) citus-style.cfg $(DESTDIR)$(pkgsysconfdir)
$(INSTALL_SCRIPT) citus_indent $(bindir)
$(INSTALL_DATA) $(MANPAGES) $(mandir)/man1
$(INSTALL_DATA) citus-style.cfg $(pkgsysconfdir)
perl -pi -e 's,/usr/local/etc/citustools,$(pkgsysconfdir),g' \
$(DESTDIR)$(bindir)/citus_indent \
$(DESTDIR)$(mandir)/man1/citus_indent.1
$(bindir)/citus_indent \
$(mandir)/man1/citus_indent.1

.PHONY: all man clean installdirs install

0 comments on commit 92314b7

Please sign in to comment.