Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

executable file 139 lines (116 sloc) 3.791 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
#!/bin/zsh
project="pkgbuilder"
aurcat="system"

version=$1
if [[ $version = '' ]]; then
    echo 'Version number?'
    echo -n '> '
    read version
fi

rm -rf pkgbuilder.egg-info __pycache__ pkgbuilder/__pycache__ dist build

date=$(date '+%Y-%m-%d')
datel=$(date '+%Y-%m-%d %H:%M%z')

sed "s/version=.*/version='$version',/g" setup.py -i
sed "s/release = .*/release = '$version'/g" docs/conf.py -i
sed "s/:Version: .*/:Version: $version/g" docs/*.rst -i
sed "s/BUILDer .* do/BUILDer $version do/g" docs/index.rst -i
sed "s/# PKG.*/# PKGBUILDer v$version/g" pkgbuilder/*.py -i
sed "s/__version__ = .*/__version__ = '$version'/g" pkgbuilder/__init__.py -i
sed "s/pkgver=.*/pkgver=$version/g" PKGBUILD -i

sed "s/:Date: .*/:Date: $date/g" docs/*.rst -i

cp docs/README.rst README.rst
cp docs/README.rst README

rm docs/pkgbuilder.8.gz | true
rst2man docs/pkgbuilder.rst > docs/pkgbuilder.8
gzip docs/pkgbuilder.8

xgettext -c ./pkgbuilder/*.py INSTALL.py -o ./messages.pot

sed '1,+17d' ./messages.pot > ./messages.pot.tmp

pot='# PKGBUILDer pot file.
# Copyright (C) 2011-2012, Kwpolska.
# This file is distributed under the same license as the PKGBUILDer package.
# Kwpolska <kwpolska@kwpolska.tk>, 2011-2012.
#
msgid ""
msgstr ""
"Project-Id-Version: #version\\n"
"Report-Msgid-Bugs-To: Kwpolska <kwpolska@kwpolska.tk>\\n"
"POT-Creation-Date: #datel\\n"
"PO-Revision-Date: #datel\\n"
"Last-Translator: Kwpolska <kwpolska@kwpolska.tk>\\n"
"Language-Team: Kwpolska <kwpolska@kwpolska.tk>\\n"
"Language: en\\n"
"MIME-Version: 1.0\\n"
"Content-Type: text/plain; charset=UTF-8\\n"
"Content-Transfer-Encoding: 8bit\\n"'

echo $pot > messages.pot
cat ./messages.pot.tmp >> messages.pot
rm ./messages.pot.tmp

sed "s/#version/$version/g" messages.pot -i
sed "s/#datel/$datel/g" messages.pot -i

for i in ./locale/*; do
    language=$(basename $i)

    podir="./locale/$language/LC_MESSAGES"
    popath="./locale/$language/LC_MESSAGES/pkgbuilder.po"
    sed 's/\"Project-Id-Version: .*/\"Project-Id-Version: '$version'\\n\"/' $popath -i
    msgmerge $popath messages.pot -o $popath
    fuzzy=$(cat $popath | grep '#, fuzzy')
    echo "Hit Enter to validate language $language."
    read validatesure
    $EDITOR $popath
    msgfmt -o $podir/pkgbuilder.mo $popath
done

# pacman help testing, for pbwrapper
pacman -h > /tmp/pachelp
pacman -Dh >> /tmp/pachelp
pacman -Qh >> /tmp/pachelp
pacman -Rh >> /tmp/pachelp
pacman -Sh >> /tmp/pachelp
pacman -Th >> /tmp/pachelp
pacman -Uh >> /tmp/pachelp

diff -u .pachelp /tmp/pachelp > /tmp/pbwrapperdiff
if [[ $? = 1 ]]; then
    echo 'Pacman help has changed.'
    cat /tmp/pbwrapperdiff
    echo 'Hit Enter to quit or c to copy the file over and continue.'
    read pachelp
    if [[ pachelp = 'c' ]]; then
        cp /tmp/pachelp .pachelp
        rm /tmp/pachelp /tmp/pbwrapperdiff
        echo 'Continuing with release scripts.'
    else
    fi
fi

python -c 'import pkgbuilder'
if [[ $? = 1 ]]; then
    echo "Import failed. Fix your code or don't come back."
    exit 1
fi

./tests.py
if [[ $? = 1 ]]; then
    echo "Tests failed. Fix your code or don't come back."
    exit 1
fi

./setup.py sdist upload

md5out=$(md5sum 'dist/'$project'-'$version'.tar.gz'|awk '{print $1}')
sed "s/md5sums=.*/md5sums=('$md5out')/" PKGBUILD -i
rm -rf MKPKGBUILD
mkdir -p MKPKGBUILD/$project
cp PKGBUILD MKPKGBUILD/$project
cd MKPKGBUILD
tar -czvf pkgbuilder.src.tar.gz pkgbuilder
burp -u Kwpolska -c system pkgbuilder.src.tar.gz
cd ..
rm -rf MKPKGBUILD

echo 'Commit message (sans the version?)'
echo -n '> '
read commitmsg

rm -rf pkgbuilder.egg-info __pycache__ pkgbuilder/__pycache__

git add *
if [[ $2 = '-c' ]]; then
    git commit -as
else
    git commit -asm "v$version: $commitmsg"
fi
git tag -a "v$version" -m "Version $version"
git push --tags
git push
Something went wrong with that request. Please try again.