Commit ec64a602 authored by Nigel McNie's avatar Nigel McNie
Browse files

Removed the last few scripts. They're not needed in this repository.

parent 05f747b8
#!/bin/bash
#
# Builds and releases Mahara to the debian repo
#
# This script can release just one version (stable|testing|unstable), or all at
# once
#
set -e
BUILDDIR="/tmp/mahara_release"
REPODIR="/tmp/mahara_repo"
ARCHLIST="i386 amd64"
DATE="`date`"
print_usage() {
echo "Usage: ./scripts/catalyst-packages.sh [stable|unstable]"
echo "Run this script from the root directory of a Mahara checkout"
echo ""
}
if [ ! -d .git ]; then
print_usage
exit 1
fi
echo " *** STOP *** "
echo " Make sure you have merged master into pkg-catalyst, and the latest"
echo " stable branch into the appropriate pkg-catalyst-* branch. If you"
echo " have not done this, hit Ctrl-C now and do so."
read junk
RELEASE=$1
if [ "$RELEASE" = "" ]; then
echo -n "Building ALL versions: are you sure? (y/N) "
read ANS
if [ "$ANS" != "y" ] && [ "$ANS" != "Y" ]; then
echo "Abort."
exit 1
fi
RELEASELIST="stable unstable"
elif [ "$RELEASE" != "stable" ] && [ "$RELEASE" != "unstable" ]; then
echo "Invalid release: $RELEASE"
exit 1
else
RELEASELIST=$RELEASE
fi
if [ -d ${BUILDDIR} ]; then
rm -rf ${BUILDDIR}
fi
if [ -d ${REPODIR} ]; then
rm -rf ${REPODIR}
fi
mkdir ${BUILDDIR}
# Create repo dirs
for release in $RELEASELIST; do
mkdir -p ${REPODIR}/dists/${release}/mahara
pushd ${REPODIR}/dists/${release}/mahara
mkdir binary-all
for arch in ${ARCHLIST}; do mkdir binary-${arch}; done
popd
mkdir -p ${REPODIR}/pool/${release}
done
# If done properly, we don't need this here - the build can happen from any place that has this script
git-fetch -t
STABLE_RELEASE="`ls -1 .git/refs/tags | egrep '[0-9]+\.[0-9]+\.[0-9]+_RELEASE$' | tail -n1`"
TESTING_RELEASE="`git branch -a | grep "origin.*STABLE$" | sort | tail -1 | sed 's/origin\///' | tr -d ' '`"
STABLE_DEBIAN_BRANCH=${STABLE_RELEASE:0:3}
pushd ${BUILDDIR}
# Build Stable
if [ "$RELEASE" = "" ] || [ "$RELEASE" = "stable" ]; then
echo
echo "Building ${STABLE_RELEASE} ..."
git clone -n "git+ssh://git.catalyst.net.nz/git/public/mahara.git" mahara
( cd mahara && git checkout -b "pkg-catalyst-${STABLE_DEBIAN_BRANCH}" "origin/pkg-catalyst-${STABLE_DEBIAN_BRANCH}" )
rm -f *.deb
pushd ${BUILDDIR}/mahara
make
popd
cp *.deb ${REPODIR}/pool/stable/
rm ${BUILDDIR}/mahara -rf
fi
# Build Unstable
if [ "$RELEASE" = "" ] || [ "$RELEASE" = "unstable" ]; then
echo
echo "Building Unstable ..."
git clone "git+ssh://git.catalyst.net.nz/git/public/mahara.git" mahara
( cd mahara && git checkout -b pkg-catalyst origin/pkg-catalyst )
rm -f *.deb
pushd ${BUILDDIR}/mahara
make
popd
cp *.deb ${REPODIR}/pool/unstable/
rm ${BUILDDIR}/mahara -rf
fi
# Link other arches into all and build packages
for release in $RELEASELIST; do
pushd ${REPODIR}/pool
for arch in all ${ARCHLIST}; do
dpkg-scanpackages ${release} /dev/null /pool/ | /bin/gzip -9 > ${REPODIR}/dists/${release}/mahara/binary-${arch}/Packages.gz
dpkg-scanpackages ${release} /dev/null /pool/ > ${REPODIR}/dists/${release}/mahara/binary-${arch}/Packages
done
popd
pushd ${REPODIR}/dists/${release}
# Create Release file
cat <<EOHDR >Release
Origin: Mahara
Label: Mahara
Suite: ${release}
Date: ${DATE}
Architectures: ${ARCHLIST}
Components: mahara
Description: Mahara ${release} repository
MD5Sum:
EOHDR
for file in `find mahara -type f -name 'Packages*'`; do
MD5="`md5sum $file | cut -c1-32`"
SIZE="`cat $file | wc -c`"
printf " %s %16d %s\n" "${MD5}" "${SIZE}" "${file}" >>Release
done
gpg --yes --armour --sign-with 1D18A55D --detach-sign --output Release.gpg Release
popd
done
popd
# Steal the latest index.html and dump into
git cat-file blob origin/pkg-catalyst:debian/index.html > ${REPODIR}/index.html
# Now (optionally) sync the repo to the git repository
echo " The repo has now been set up in ${REPODIR}. If you're really sure,"
echo " this script can rsync this to the git repository."
echo " rsync to git repository? [y/N] "
read ANS
if [ "$ANS" != "y" ] && [ "$ANS" != "Y" ]; then
echo "Abort."
exit 1
fi
if [ "$RELEASE" = "" ]; then
rsync -PIlvr --delete-after --no-p --no-g --chmod=Dg+ws,Fg+w ${REPODIR}/* locke.catalyst.net.nz:/home/ftp/pub/mahara/
else
rsync -PIlvr --no-p --no-g --chmod=Dg+ws,Fg+w ${REPODIR}/* locke.catalyst.net.nz:/home/ftp/pub/mahara/
fi
#!/usr/bin/perl
use strict;
use warnings;
use FindBin;
use File::Find;
use File::Slurp qw/slurp/;
use Text::Diff;
my $EXCLUDE_FILES = [
qr{ \A test/ }xms,
qr{ \A examples/ }xms,
qr{ \A htdocs/config.php }xms,
qr{ \A htdocs/tests }xms,
qr{ \A htdocs/lib/adodb }xms,
qr{ \A htdocs/lib/phpmailer }xms,
qr{ \A htdocs/lib/xmldb }xms,
qr{ \A htdocs/lib/pieforms }xms,
qr{ \A htdocs/lib/smarty }xms,
qr{ \A htdocs/lib/ddl.php }xms,
qr{ \A htdocs/lib/dml.php }xms,
qr{ \A htdocs/lib/file.php }xms,
qr{ \A htdocs/lib/uploadmanager.php }xms,
qr{ \A htdocs/lib/xmlize.php }xms,
qr{ \A htdocs/lib/kses.php }xms,
qr{ \A htdocs/lib/pear/ }xms,
qr{ \A htdocs/lib/validateurlsyntax.php }xms,
];
my $FILE_HEADER = <<EOF;
<?php
/**
* Mahara: Electronic portfolio, weblog, resume builder and social networking
* Copyright (C) 2006-2007 Catalyst IT Ltd (http://www.catalyst.net.nz)
*
* This program 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, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* \@package mahara
EOF
my $projectroot = qq{$FindBin::Bin/../};
my $language_strings = {};
find( \&readlang, $projectroot );
find( \&process, $projectroot );
# loads language strings
sub readlang {
my $filename = $_;
my $directory = $File::Find::dir;
return unless $directory =~ m{ lang/en.utf8/? \z }xms;
return unless $filename =~ m{ \A (.*)\.php \z }xms;
my $section = $1;
my $file_data = slurp $directory . '/' . $filename;
while ( $file_data =~ m{ \$string\['(.*?)'\] \s+ = \s+ }xmsg ) {
$language_strings->{$section}{$1} = 1;
}
}
sub process {
my $filename = $_;
my $directory = $File::Find::dir;
$directory =~ s{ \A $projectroot }{}xms;
$directory =~ s{ ([^/])$ }{$1/}xms;
return unless $filename =~ m{ \.php \z }xms;
foreach my $exclude_file ( @{$EXCLUDE_FILES} ) {
return if ( ( $directory . $filename ) =~ $exclude_file );
}
my $file_data = slurp $projectroot . $directory . $filename;
# check header
if ( $FILE_HEADER ne substr ($file_data, 0, length $FILE_HEADER) ) {
my $header = substr ($file_data, 0, length $FILE_HEADER);
print $directory, $filename, " failed header check\n";
print diff \$header, \$FILE_HEADER;
}
# check footer
if ( $file_data !~ m{ \? > \n \z }xms ) {
print $directory, $filename, " failed footer check\n";
}
# check subpackage
if ( $file_data =~ m{ \@subpackage (.*?) $ }xms ) {
my $subpackage_data = $1;
unless (
$subpackage_data =~ m{ \A \s* ( core | lang | tests | admin | ( auth | form | artefact | notification | search )(?:-.+)? ) \s* \z }xms
) {
print $directory, $filename, " invalid \@subpackage '$subpackage_data'\n";
}
}
else {
print $directory, $filename, " missing \@subpackage\n";
}
# check author
my $author;
if ( $file_data =~ m{ \@author (.*?) $ }xms ) {
my $author_data = $1;
my $valid_authors = {
Martyn => qr{ \s* Martyn \s Smith \s <martyn\@catalyst\.net\.nz> \s* }xms,
Penny => qr{ \s* Penny \s Leach \s <penny\@catalyst\.net\.nz> \s* }xms,
Nigel => qr{ \s* Nigel \s McNie \s <nigel\@catalyst\.net\.nz> \s* }xms,
Alastair => qr{ \s* Alastair \s Pharo \s <alastair\@catalyst\.net\.nz> \s* }xms,
Richard => qr{ \s* Richard \s Mansfield \s <richard\.mansfield\@catalyst\.net\.nz> \s* }xms,
};
while ( my ($name, $regexp) = each %{$valid_authors} ) {
$author = $name if ( $author_data =~ $regexp );
}
print $directory, $filename, " invalid \@author '$author_data'\n" unless defined $author;
}
else {
print $directory, $filename, " missing \@author\n";
}
# check copyright
if ( $file_data !~ m{\@copyright \(C\) 2006,2007 Catalyst IT Ltd http://catalyst\.net\.nz} ) {
print $directory, $filename, " missing \@copyright (or invalid)\n";
}
# check for json stuff
if ($filename =~ m{.*\.json\.php}) {
if ($file_data !~ m{define\('JSON',\s*1\)} ) {
print $directory, $filename, " appears to be a json script but doesn't define('JSON', 1);\n";
}
if ($file_data !~ m{json_headers} ) {
print $directory, $filename, " appears to be a json script but doesn't send json_headers(); \n";
}
}
# check language strings
while ( $file_data =~ m{ get_string\( ['"](.*?)['"] \s* (?: , \s* ['"](.*?)['"] )? .*? \)* }xmg ) {
my ( $tag, $section ) = ( $1, $2 );
next if ( $tag =~ m{ \$ }xms or ( defined $section and $section =~ m{ \$ }xms ) );
next if ( defined $section and $section =~ m{ \.$ }xms );
$section ||= 'mahara';
unless ( exists $language_strings->{$section}{$tag} ) {
print "($author) ", $directory, $filename, " has call to get_string that doesn't exist: get_string('$tag', '$section')\n";
}
}
# check for page titles
if ( $file_data =~ m{define.*\(.*INTERNAL.*1.*\)} and $file_data !~ m{define.*\(.*JSON.*1.*\)} and $file_data !~ m{define.*\(.*TITLE.*\)} ) {
print "($author) ", $directory, $filename, " is missing page title [ define('TITLE', get_string(...)); ]\n";
}
}
#!/bin/bash
#
# Builds release tarballs of Mahara at the given version, ready for
# distribution
set -e
print_usage() {
echo "Usage is release.sh [version]"
echo "e.g. release.sh 0.6.2"
echo "e.g. release.sh 1.0.0alpha1"
}
if [ -z "$1" ]; then
print_usage
exit 1
fi
MAJOR=${1:0:3}
MINOR=${1:4:1}
MICRO=${1:5}
BUILDDIR="/tmp/mahara_release"
CURRENTDIR="`pwd`"
if [ -z "${MAJOR}" ] || [ -z "${MINOR}" ]; then
print_usage
exit 1
fi
VERSION="${MAJOR}.${MINOR}${MICRO}"
if [ -d ${BUILDDIR} ]; then
rm -rf ${BUILDDIR}
fi
mkdir ${BUILDDIR}
pushd ${BUILDDIR}
# Get the stable branch
git clone -n "http://git.catalyst.net.nz/mahara.git" mahara
pushd ${BUILDDIR}/mahara
# Switch to the release tag
#git checkout -b "${MAJOR}_STABLE" "origin/${MAJOR}_STABLE"
RELEASETAG="`echo $VERSION | tr '[:lower:]' '[:upper:]'`_RELEASE"
git checkout $RELEASETAG
# Remove git stuff
rm .git -rf
find . -name '.gitignore' -exec rm {} \;
# Pack MochiKit
bash scripts/pack.sh
popd
mv mahara mahara-${VERSION}
tar zcf ${CURRENTDIR}/mahara-${VERSION}.tar.gz mahara-${VERSION}
tar jcf ${CURRENTDIR}/mahara-${VERSION}.tar.bz2 mahara-${VERSION}
zip -qrT9 ${CURRENTDIR}/mahara-${VERSION}.zip mahara-${VERSION}
popd
#rm -rf ${BUILDDIR}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment