From 39984204f87c6dfab617bd4fbb7369bfdbc6e51e Mon Sep 17 00:00:00 2001 From: Daniel Nichter Date: Tue, 19 Jul 2011 12:24:19 -0600 Subject: [PATCH] Work on build-packages for deb pkg. Update config/deb/ files. Add util/log-entires. --- config/deb/compat | 1 - config/deb/control | 23 ++++----- config/deb/copyright | 45 ++++++++++-------- config/deb/watch | 3 -- util/build-packages | 111 ++++++++++++++++++++++++++++++++++--------- util/log-entries | 21 ++++++++ 6 files changed, 143 insertions(+), 61 deletions(-) delete mode 100644 config/deb/watch create mode 100755 util/log-entries diff --git a/config/deb/compat b/config/deb/compat index 51d7b8d1..7ed6ff82 100644 --- a/config/deb/compat +++ b/config/deb/compat @@ -1,2 +1 @@ 5 - diff --git a/config/deb/control b/config/deb/control index 55228f7e..68631018 100644 --- a/config/deb/control +++ b/config/deb/control @@ -1,21 +1,18 @@ -Source: maatkit +Source: percona-toolkit Section: utils Priority: optional -Maintainer: Baron Schwartz -Uploaders: Norbert Tretkowski +Maintainer: Percona Toolkit Developers Build-Depends: debhelper (>= 4.2) Build-Depends-Indep: perl (>= 5.6.0-16), libdbi-perl (>= 1.13), libdbd-mysql-perl (>= 1.0), libterm-readkey-perl (>=2.10) Standards-Version: 3.7.2 -Homepage: http://code.google.com/p/maatkit/ -Vcs-Browser: http://code.google.com/p/maatkit/source/browse/ -Vcs-Svn: http://code.google.com/p/maatkit/source/browse/ +Homepage: http://www.percona.com/software/percona-toolkit/ +Vcs-Browser: http://bazaar.launchpad.net/~percona-toolkit-dev/percona-toolkit/0.9/files +Vcs-Bzr: bzr+ssh://bazaar.launchpad.net/~percona-toolkit-ddev/percona-toolkit/0.9/ -Package: maatkit +Package: percona-toolkit Architecture: all -Replaces: mysqltoolkit Depends: ${perl:Depends}, libdbi-perl (>= 1.13), libdbd-mysql-perl | libdbd-mysql-5.1-perl, libterm-readkey-perl (>=2.10) -Description: Command-line utilities for MySQL - Contains utilities to check replication slaves for consistency with the - master, efficiently synchronize remote tables, archive rows from OLTP - servers, log deadlocks, find duplicate indexes and foreign keys, profile - queries, and perform other essential tasks. +Description: Advanced MySQL and system command-line tools used by Percona + Percona Toolkit is a collection of advanced command-line tools used by + Percona (http://www.percona.com/) support staff to perform a variety of + MySQL and system tasks that are too difficult or complex to perform manually. diff --git a/config/deb/copyright b/config/deb/copyright index 966297ff..2b92c030 100644 --- a/config/deb/copyright +++ b/config/deb/copyright @@ -1,32 +1,35 @@ -This package was debianized by Baron Schwartz on -Sun, 10 Jun 2007 22:30:36 -0500 +This package was debianized by Percona Toolkit Developers + on Sun, 10 Jun 2007 22:30:36 -0500 -It was downloaded from http://code.google.com/p/maatkit/ +It was downloaded from http://www.percona.com/downloads/ -Debian Sponsor: Norbert Tretkowski +Upstream Author: -Upstream Author: Baron Schwartz + Percona Toolkit Developers -Copyright: "Copyright(c) 2006-2007 Baron Schwartz" +Copyright: + + Copyright 2011 Percona Inc. License: - This software is dual licensed, either GPL version 2 or Artistic License. - This package is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, version 2; OR the Perl Artistic License. + This software is dual licensed, either GPL version 2 or Artistic License. - This package is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This package is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, version 2; OR the Perl Artistic License. - You should have received a copy of the GNU General Public License - along with this package; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -On Debian systems, the complete text of the GNU General Public License version 2 -can be found in `/usr/share/common-licenses/GPL-2'. + You should have received a copy of the GNU General Public License + along with this package; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -On Debian systems, the complete text of the Artistic License can -be found in `/usr/share/common-licenses/Artistic'. +On Debian systems, the complete text of the GNU General Public License version +2 can be found in `/usr/share/common-licenses/GPL-2'. + +On Debian systems, the complete text of the Artistic License can be found in +`/usr/share/common-licenses/Artistic'. diff --git a/config/deb/watch b/config/deb/watch deleted file mode 100644 index b4fdb188..00000000 --- a/config/deb/watch +++ /dev/null @@ -1,3 +0,0 @@ -version=3 -http://code.google.com/p/maatkit/downloads/list \ -http://maatkit.googlecode.com/files/maatkit-(.*)\.tar\.gz debian diff --git a/util/build-packages b/util/build-packages index 2ed8b687..f84c7a3b 100755 --- a/util/build-packages +++ b/util/build-packages @@ -37,10 +37,10 @@ fi # Paths # ############################################################################ -DOCS=$BRANCH/docs -DEB=$BRANCH/config/deb -RPM=$BRANCH/config/rpm -RELEASE=$BRANCH/release +DOCS_DIR=$BRANCH/docs +DEB_CONFIG_DIR=$BRANCH/config/deb +RPM_CONFIG_DIR=$BRANCH/config/rpm +RELEASE_DIR=$BRANCH/release # ############################################################################ # Programs and their options @@ -71,6 +71,19 @@ check_version() { echo "OK" } +check_changelog() { + echo -n "Checking Changelog: " + cd $BRANCH + first_line=$(head -n 3 Changelog | tail -n 1) + if [ $(expr "$first_line" : "v[0-9]") -gt 0 ]; then + die "No changes since $first_line" + fi + if [ -n "$(grep "^v$VERSION" Changelog)" ]; then + die "Entries for v$VERSION already exist" + fi + echo "OK" +} + update_version() { echo -n "Updating version in tools... " cd $BRANCH/bin @@ -119,7 +132,7 @@ update_copyright_year() { echo "OK" echo -n "Updating copyright year in percona-toolkit.pod..." - local pod=$DOCS/percona-toolkit.pod + local pod=$DOCS_DIR/percona-toolkit.pod local copyright=$(grep "[0-9] Percona Inc." $pod) local new_copyright=$(../util/new-copyright-year $YEAR "$copyright") if [ $? -ne 0 ]; then @@ -148,7 +161,7 @@ update_manifest() { update_percona_toolkit_pod() { echo -n "Updating TOOLS section in percona-toolkit.pod: " cd $BRANCH/bin - local pod=$DOCS/percona-toolkit.pod + local pod=$DOCS_DIR/percona-toolkit.pod local tool_list=/tmp/percona-tool-list.pod echo "=head1 TOOLS @@ -183,34 +196,59 @@ L. echo "OK" } +update_changelog() { + echo -n "Updating Changelog: " + cd $BRANCH + head -n 2 Changelog > /tmp/changelog.tmp + echo "v$VERSION released $DATE" >> /tmp/changelog.tmp + echo >> /tmp/changelog.tmp + n_lines=$(wc -l Changelog | awk '{print $1}') + tail -n $((n_lines - 2)) Changelog >> /tmp/changelog.tmp + mv /tmp/changelog.tmp $BRANCH/Changelog + echo "OK" + + echo -n "Updating Debian changelog: " + cd $DEB_CONFIG_DIR + echo "percona-toolkit ($VERSION) unstable; urgency=low +" > /tmp/changelog.tmp + + cat $BRANCH/Changelog | $BRANCH/util/log-entries -v version="$VERSION" >> /tmp/changelog.tmp + echo >> /tmp/changelog.tmp + echo " -- Percona Toolkit Developers $DEB_DATE +" >> /tmp/changelog.tmp + cat changelog >> /tmp/changelog.tmp + mv /tmp/changelog.tmp changelog + echo "OK" +} + prep_release_dir() { echo -n "Preparing release directory: " cd $BRANCH - if [ ! -d $RELEASE ]; then - mkdir $RELEASE - elif [ -d $RELEASE/$PKG ]; then - rm -rf $RELEASE/$PKG + if [ ! -d $RELEASE_DIR ]; then + mkdir $RELEASE_DIR + elif [ -d $RELEASE_DIR/$PKG ]; then + rm -rf $RELEASE_DIR/$PKG fi ( - cd $RELEASE + cd $RELEASE_DIR mkdir -p $PKG $PKG/bin $PKG/docs $PKG/lib ) for file in `cat MANIFEST`; do - cp $file $RELEASE/$PKG/$file + cp $file $RELEASE_DIR/$PKG/$file done echo "OK" } build_tar() { echo -n "Building $PKG.tar.gz: " - cd $RELEASE + cd $RELEASE_DIR $TAR czf "$PKG.tar.gz" $PKG echo "OK" } build_rpm() { echo -n "Building $PKG-1.noarch.rpm: " - cd $RELEASE + cd $RELEASE_DIR if [ ! -f "$PKG.tar.gz" ]; then die "Cannot build RPM because $PKG.tar.gz does not exist" fi @@ -220,24 +258,43 @@ build_rpm() { local topdir=`pwd` # Build RPM package from the tarball. - rpmbuild -bb --clean $BRANCH/config/rpm/percona-toolkit.spec \ + rpmbuild -bb --clean $RPM_CONFIG_DIR/percona-toolkit.spec \ --quiet \ --define "_topdir $PWD" \ - --define "_sourcedir $RELEASE" \ + --define "_sourcedir $RELEASE_DIR" \ --define "version $VERSION" \ --define "release 1" if [ ! -f "RPMS/noarch/$PKG-1.noarch.rpm" ]; then die "RPMS/noarch/$PKG-1.noarch.rpm did not build" fi - mv "RPMS/noarch/$PKG-1.noarch.rpm" $RELEASE - rm -rf $RELEASE/rpm + mv "RPMS/noarch/$PKG-1.noarch.rpm" $RELEASE_DIR + rm -rf $RELEASE_DIR/rpm echo "OK" } build_deb() { - : + local deb_pkg="percona-toolkit_$VERSION-1_all.deb" + echo -n "Building $deb_pkg: " + + cd $RELEASE_DIR + if [ ! -f "$PKG.tar.gz" ]; then + die "Cannot build RPM because $PKG.tar.gz does not exist" + fi + + # Copy debian pkg files. + if [ ! -d "$RELEASE_DIR/$PKG/debian" ]; then + mkdir $RELEASE_DIR/$PKG/debian + fi + cp $BRANCH/config/deb/* $RELEASE_DIR/$PKG/debian/ + + # Build Debian source and binary packages + cd $RELEASE_DIR/$PKG + debuild -S -sa -us -uc + debuild -b -us -uc + + echo "OK" } # ############################################################################ @@ -248,10 +305,16 @@ if [ $# -eq 0 ]; then die "Usage: $0 VERSION" fi -YEAR=$(date -u +'%Y') # for updating copyright year -DATE=$(date -u +'%F') # for updating release date -VERSION=$1 # for PKG -PKG="percona-toolkit-$VERSION" # what we're building +# My machine's language is not English. This affects DEB_DATE because +# date %a is language-sensitive. We want abbreviated day names in English. +# Setting LANG as such works for me; hopefully it works for you, too. +LANG='en_US.UTF-8' + +YEAR=$(date -u +'%Y') # for updating copyright year +DATE=$(date -u +'%F') # for updating release date +DEB_DATE=$(date -u +'%a, %d %m %Y %T %z') # for updating deb/changelog +VERSION=$1 # for PKG +PKG="percona-toolkit-$VERSION" # what we're building # This script does not check that you've done pre-release tasks like running # the test suite, updating Changelog entries, etc. You're responsible for @@ -260,6 +323,7 @@ CHECK=${CHECK:-1} if [ $CHECK -eq 1 ]; then check_branch check_version + check_changelog fi # These items need to be updated automatically for each release. @@ -269,6 +333,7 @@ if [ $UPDATE -eq 1 ]; then update_copyright_year update_manifest update_percona_toolkit_pod + update_changelog fi # Now that those ^ items are updated, you need to commit and push one more diff --git a/util/log-entries b/util/log-entries new file mode 100755 index 00000000..fbe144ca --- /dev/null +++ b/util/log-entries @@ -0,0 +1,21 @@ +#!/usr/bin/awk -f + +BEGIN { + if ( version == "" ) { + print "Usage: log-entries VERSION" + exit + } + + start = "^v" version +} + +$0 ~ start { + while ( getline ) { + if ( $0 ~ /^v[0-9]/ ) + exit + if ( $0 ~ /^$/ ) + continue + + print + } +}