Page MenuHomePhabricator

Bash_script_to_automatically_package_python_extensions_needed_by_Sentry

Authored By
Gilles
Mar 24 2015, 8:40 AM
Size
1 KB
Referenced Files
None
Subscribers
None

Bash_script_to_automatically_package_python_extensions_needed_by_Sentry

#!/bin/bash
author="Gilles Dubuc <gilles@wikimedia.org>"
packages=( "django-crispy-forms" "django-paging" "django-recaptcha" "django-statsd-mozilla" "django-sudo" "django-templatetag-sugar" "email_reply_parser" "gunicorn" "logan" "nydus" "raven" "toronado" "python-memcached" "sentry" )
debianize_options="-i foobar" # Only build the foobar dependency, i.e. don't build any dependency
if ! [ -x "$(command -v fpm)" ]; then
apt-get update
apt-get install ruby ruby-dev rubygems
gem update
gem install fpm
fi
if ! [ -x "$(command -v git)" ]; then
apt-get update
apt-get install git
fi
if ! [ -x "$(command -v pip)" ]; then
apt-get update
apt-get install python python-setuptools
easy_install pip
fi
timestamp=$(date "+%s")
workingdir="/tmp/sentrypackages-$timestamp"
mkdir $workingdir
cd $workingdir
git clone git://github.com/specialunderwear/debianize.sh.git
for package in "${packages[@]}"
do
jsonuri="https://pypi.python.org/pypi/$package/json"
version=$(wget -q -O - $jsonuri | ruby -rjson -e 'j = JSON.parse(ARGF.read); puts j["info"]["version"]')
uri=$(wget -q -O - $jsonuri | ruby -rjson -e 'j = JSON.parse(ARGF.read); j["urls"].each { |x| if x["packagetype"] == "sdist" then puts x["url"] end }')
versionedpackage="$package-$version"
wget $uri
if [ -e "$versionedpackage.zip" ]; then
package="$versionedpackage.zip"
unzip $package
else
package="$versionedpackage.tar.gz"
tar xzvf $package
fi
cd $versionedpackage
../debianize.sh/debianize.sh -m "$author" $debianize_options
mv *.deb ..
cd ..
rm -rf $versionedpackage
rm "$package"
done
rm -rf debianize.sh

File Metadata

Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
100399
Default Alt Text
Bash_script_to_automatically_package_python_extensions_needed_by_Sentry (1 KB)

Event Timeline