Skip to content

Instantly share code, notes, and snippets.

@qmmr
Forked from DamienCassou/update-emacs-ppa.sh
Created October 20, 2012 18:40
Show Gist options
  • Save qmmr/3924307 to your computer and use it in GitHub Desktop.
Save qmmr/3924307 to your computer and use it in GitHub Desktop.
Emacs-snapshot build script for Ubuntu PPA
#!/bin/bash
# Author: Damien Cassou
#
# This is the script I use to build https://launchpad.net/~cassou/+archive/emacs/
# from http://emacs.naquadah.org/.
MAIN_VERSION=20120911
SUB_VERSION=1
function packageForDistribution() {
distrib="$1"
mkdir build_$distrib
cp *.tar.gz build_$distrib
cp *.tar.bz2 build_$distrib
cd build_$distrib
tar xfz *.tar.gz
tar xfj *.tar.bz2
BUILD_DIR=${PACKAGE}-${MAIN_VERSION}*
mv debian $BUILD_DIR/
cd $BUILD_DIR
cd debian
# Changes compression from xz to bzip2
sed --in-place 's/\(dh_builddeb .* \)-Z xz/\1-Z bzip2/' rules
# Lower dependency requirements for older ubuntu distributions
sed --in-place 's/\(dpkg.* \)(>= 1.15.6)/\1(>= 1.15.5)/' control
sed --in-place 's/\(dpkg.* \)(>= 1.15.6)/\1(>= 1.15.5)/' control.in
sed --in-place 's/debhelper (>= .*)/debhelper (>= 5.0.0)/' control
sed --in-place 's/debhelper (>= .*)/debhelper (>= 5.0.0)/' control.in
sed --in-place 's/Standards-Version: .*/Standards-Version: 3.9.1/' control
sed --in-place 's/Standards-Version: .*/Standards-Version: 3.9.1/' control.in
echo 7 > compat
cd ..
[email protected] dch -l ~ppa$SUB_VERSION~$distrib "Build for $distrib"
debuild -S -sa --changes-option='-DDistribution='${distrib}
cd ..
dput ppa:cassou/emacs ${PACKAGE}_${MAIN_VERSION}*.changes
cd ..
}
function clean-temp-directory() {
cd /tmp && rm -rf emacs && mkdir emacs && cd emacs
}
function convert-from-xz() {
# Convert from tar.xz to tar.bz2 to support Ubuntu lucid and its dpkg < 1.15.6
file=${PACKAGE}_${MAIN_VERSION}.orig.tar
unxz --stdout $file.xz | bzip2 --compress --stdout > $file.bz2
rm -f $file.xz
}
function prepare-build-from-debian-unstable() {
clean-temp-directory
SERVER=http://emacs.naquadah.org/unstable
PKG_VERSION=-1
VERSION=${MAIN_VERSION}${PKG_VERSION}
PACKAGE=emacs-snapshot
wget --no-clobber ${SERVER}/${PACKAGE}_${VERSION}.dsc
wget --no-clobber ${SERVER}/${PACKAGE}_${MAIN_VERSION}.orig.tar.xz
wget --no-clobber ${SERVER}/${PACKAGE}_${VERSION}.debian.tar.gz
convert-from-xz
}
function prepare-build-from-debian-stable() {
clean-temp-directory
SERVER=http://emacs.naquadah.org/stable
PKG_VERSION=-1+squeeze
VERSION=${MAIN_VERSION}${PKG_VERSION}
PACKAGE=emacs-snapshot
wget --no-clobber ${SERVER}/${PACKAGE}_${VERSION}.dsc
wget --no-clobber ${SERVER}/${PACKAGE}_${MAIN_VERSION}.orig.tar.xz
wget --no-clobber ${SERVER}/${PACKAGE}_${VERSION}.debian.tar.gz
convert-from-xz
}
function prepare-build-from-debian-release() {
clean-temp-directory
SERVER=http://ftp.de.debian.org/debian/pool/main/e/emacs24/
MAIN_VERSION=24.2+1
PKG_VERSION=-1
VERSION=${MAIN_VERSION}${PKG_VERSION}
PACKAGE=emacs24
wget --no-clobber ${SERVER}/${PACKAGE}_${VERSION}.dsc
wget --no-clobber ${SERVER}/${PACKAGE}_${MAIN_VERSION}.orig.tar.bz2
wget --no-clobber ${SERVER}/${PACKAGE}_${VERSION}.debian.tar.gz
}
prepare-build-from-debian-unstable
packageForDistribution precise # 12.04 LTS
# packageForDistribution quantal # 12.10
# prepare-build-from-debian-stable
# packageForDistribution lucid # 10.04 LTS
# packageForDistribution oneiric # 11.10
# packageForDistribution natty # 11.04
# packageForDistribution maverick # 10.10 -- no longer supported
# prepare-build-from-debian-release
# packageForDistribution precise # 12.04 LTS
# packageForDistribution quantal # 12.10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment