pkgbinarymangler-121/0000775000000000000000000000000012315121523011576 5ustar pkgbinarymangler-121/pkgstriptranslations.10000664000000000000000000000360211426557621016204 0ustar .TH pkgstriptranslations 1 "December 17, 2004" "Martin Pitt" .SH NAME pkgstriptranslations \- extract translation files and remove gettext *.mo files from package build directories .SH SYNOPSIS .B pkgstriptranslations .SH DESCRIPTION .B pkgstriptranslations extracts all gettext related files from the source and package build directories and puts them into .I /../package_version_arch_suffix.tar.gz\fR. .I suffix is configurable in .I /etc/pkgbinarymangler/striptranslations.conf and defaults to .B translations\fR. Tarball layout: .TP .B source/ contains all pot and po files from source package, preserving the directory structure. .TP .B debname1/, debname2/, ... There will be one directory per generated binary deb package, each contains all .mo files from this deb, preserving directory structure. .P This script also removes all gettext .I *.mo files below .I /usr/share/locale from all built binary packages. It will also remove subdirectories which became empty after removal of the gettext files. However, if a file .I /CurrentlyBuilding is present (as on the Ubuntu autobuilders), then the .I *.mo files are only deleted if the Component: value in this file matches one of the components configured in .I /etc/pkgbinarymangler/striptranslations.conf\fR. This allows to selectively strip files only for source packages which are in e. g. .B main and .B restricted\fR, but not in e. g. .B universe\fR. By default, .B pkgstriptranslations is inactive. To enable it, the .B enable option in the configuration file must be set to .B true\fR. .SH ENVIRONMENT VARIABLES .TP .B NO_PKG_MANGLE If this variable is set to a nonempty value, then pkgstriptranslations is disabled. This is most useful if source packages build nested binary packages as part of their build. .SH AUTHOR .B pkgstriptranslations is developed by Martin Pitt . pkgbinarymangler-121/sanitychecks.conf0000664000000000000000000000016411426557621015154 0ustar # pkgsanitychecks configuration file # pkgsanitychecks will do nothing unless enable is set to "true" enable: true pkgbinarymangler-121/pkgmaintainermangler0000775000000000000000000000403412311623073015727 0ustar #!/bin/bash -e CONFFILE=/etc/pkgbinarymangler/maintainermangler.conf CONFFILE=${PKGBINARYMANGLER_CONF_DIR:-/etc/pkgbinarymangler}/maintainermangler.conf OVERRIDEFILE=${PKMAINTAINERGMANGLER_OVERRIDES:-/etc/pkgbinarymangler/maintainermangler.overrides} . ${PKGBINARYMANGLER_COMMON_PATH:-/usr/share/pkgbinarymangler}/common readctrl "$OVERRIDEFILE" "default" OVERRIDE="$RET" if [ -f "$BUILDINFO" ]; then readctrl "$BUILDINFO" "Component" COMPONENT="$RET" readctrl "$OVERRIDEFILE" "%$RET" if [ -n "$RET" ]; then OVERRIDE="$RET" fi if grep -qs '^Purpose: PPA' "$BUILDINFO"; then echo "INFO: Disabling pkgmaintainermangler for PPA build" exit 0 fi fi readctrl "$PKGCTL" "Maintainer" OLDMAINT="$RET" OLDMAINTEMAIL=$(echo "$OLDMAINT" | sed -e 's/.*<\(.*\)>.*/\1/') OLDMAINTDOMAIN=$(echo "$OLDMAINTEMAIL" | sed -e 's/.*@//') readctrl "$OVERRIDEFILE" "ignore_domains" IGNORE_DOMAINS="$RET" if [ -n "$IGNORE_DOMAINS" ]; then for i in $IGNORE_DOMAINS; do if [ "$i" = "$OLDMAINTDOMAIN" ]; then echo "pkgmaintainermangler: Not overriding Maintainer for domain $OLDMAINTDOMAIN" exit 0 fi done fi readctrl "$OVERRIDEFILE" "ignore_emails" IGNORE_EMAILS="$RET" if [ -n "$IGNORE_EMAILS" ]; then for i in $IGNORE_EMAILS; do if [ "$i" = "$OLDMAINTEMAIL" ]; then echo "pkgmaintainermangler: Not overriding Maintainer for address $OLDMAINTEMAIL" exit 0 fi done fi readctrl "$OVERRIDEFILE" "@$OLDMAINTEMAIL" if [ -n "$RET" ]; then OVERRIDE="$RET" fi readctrl "$PKGCTL" "Original-Maintainer" if [ -n "$RET" ]; then echo "pkgmaintainermangler: $PKGCTL already contains an Original-Maintainer field; doing nothing" >&2 exit 0 fi if [ "$OLDMAINT" = "$OVERRIDE" ]; then echo "pkgmaintainermangler: Override matches original Maintainer; doing nothing" exit 0 fi echo "pkgmaintainermangler: Maintainer field overridden to \"$OVERRIDE\"" sed -i -e "s/^Maintainer: \(.*\)$/Maintainer: $OVERRIDE\nOriginal-Maintainer: \1/" $PKGCTL pkgbinarymangler-121/pkgsanitychecks.10000664000000000000000000000165211426557621015074 0ustar .TH pkgsanitychecks 1 "January 05, 2009" "Matthias Klose" .SH NAME pkgsanitychecks \- run sanity checks on the package .SH SYNOPSIS .B pkgsanitychecks .IR directory .SH DESCRIPTION .B pkgsanitychecks runs sanity checks on the binary packages and lets the build fail if the sanity checks don't pass. The following checks are run: .TP .B Location of public python modules Starting with python-2.6 the public python modules are expected to be placed in .I /usr/lib/pythonX.Y/dist-packages instead of .I /usr/lib/pythonX.Y/site-packages. .TP .B Files in /usr/local Checks if any files are placed in .I /usr/local instead of .I /usr. .SH ENVIRONMENT VARIABLES .TP .B NO_PKG_MANGLE If this variable is set to a nonempty value, then pkgsanitychecks is disabled. This is most useful if source packages build nested binary packages as part of their build. .SH AUTHOR .B pkgsanitychecks is developed by Matthias Klose . pkgbinarymangler-121/pkgsanitychecks0000775000000000000000000000246311660431500014724 0ustar #!/bin/bash -e CONFFILE=${PKGBINARYMANGLER_CONF_DIR:-/etc/pkgbinarymangler}/sanitychecks.conf . ${PKGBINARYMANGLER_COMMON_PATH:-/usr/share/pkgbinarymangler}/common if grep -q '^Section: debian-installer$' "$PKGCTL"; then echo "INFO: Disabling pkgsanitychecks for udeb" >&2 exit 0 fi readctrl $PKGCTL Package PKGNAME=$RET DIR=$(dirname $(dirname "$PKGCTL")) # locations of python modules for 2.6 and newer python versions case $PKGNAME in python2.6|python2.7|python3.0|python3.1) : ;; *) for pv in 2.6 2.7 3.0 3.1; do if [ -d $DIR/usr/lib/python$pv/site-packages ]; then echo "Found files in /usr/lib/python$pv/site-packages (must be in dist-packages for python$pv)." >&2 find $DIR/usr/lib/python$pv/site-packages >&2 pysite_found=y fi if [ -d $DIR/usr/local/lib/python$pv ]; then echo "Found files in /usr/local/lib/python$pv (must be in /usr/lib for python$pv)." >&2 find $DIR/usr/local/lib/python$pv >&2 pysite_found=y fi done if [ -n "$pysite_found" ]; then break_build=y fi esac # check for files in /usr/local if [ -d $DIR/usr/local ]; then echo "Found files in /usr/local (must be in /usr)." >&2 find $DIR/usr/local >&2 break_build=y fi # more sanity checks ... # break the build if necessary if [ -n "$break_build" ]; then exit 1 fi exit 0 pkgbinarymangler-121/pkgmaintainermangler.10000664000000000000000000000231411426557621016075 0ustar .TH pkgmaintainermangler 1 "September 06, 2006" "Adam Conrad" .SH NAME pkgmaintainermangler \- change the Debian Maintainer field in a binary package during the build .SH SYNOPSIS .B pkgmaintainermangler .IR directory .SH DESCRIPTION .B pkgmaintainermangler adjusts the maintainer field in binary packages to match a set of rules defined in the .B pkgmaintainermangler configuration file, found at .I /etc/pkgbinarymangler/maintainermangler.conf\fR. The .IR directory option tells pkgmaintainermangler where to find the build directory which contains DEBIAN/control, so it can mangle it appropriately. As pkgmaintainermangler is generally invoked from a .B dpkg-deb\fR(1) wrapper, it will also accept .B dpkg-deb\fR's command-line syntax, ignoring superfluous options. By default, .B pkgmaintainermangler is inactive. To enable it, the .B enable option in the configuration file must be set to .B true\fR. .SH ENVIRONMENT VARIABLES .TP .B NO_PKG_MANGLE If this variable is set to a nonempty value, then pkgmaintainermangler is disabled. This is most useful if source packages build nested binary packages as part of their build. .SH AUTHOR .B pkgmaintainermangler is developed by Adam Conrad . pkgbinarymangler-121/dpkg-deb0000775000000000000000000000345111540173320013205 0ustar #!/bin/bash -e # Checks whether -b or --build is in the flags has_build_flag() { local arg for arg; do if [ "$arg" = "--build" ] || [ "$arg" = "-b" ]; then return 0 fi done return 1 } if [ -z "$NO_PKG_MANGLE" ] && has_build_flag "$@"; then if grep -qs '^Suite: [a-z]*-autotest' ${CURRENTLY_BUILDING_PATH:-"/CurrentlyBuilding"}; then NO_PKG_MANGLE=1 echo "INFO: Disabling pkgbinarymangler for archive rebuild test" fi if grep -q '^Section: partner' debian/control; then NO_PKG_MANGLE=1 echo "INFO: Disabling pkgbinarymangler for partner packages" fi if [ -z "$NO_PKG_MANGLE" ]; then if which pkgsanitychecks >/dev/null; then pkgsanitychecks "$@" else echo "ERROR: dpkg-deb is diverted, but pkgsanitychecks is not executable; please check your configuration" exit 1 fi if which pkgstriptranslations >/dev/null; then pkgstriptranslations "$@" else echo "ERROR: dpkg-deb is diverted, but pkgstriptranslations is not executable; please check your configuration" exit 1 fi if which pkgmaintainermangler >/dev/null; then pkgmaintainermangler "$@" else echo "ERROR: dpkg-deb is diverted, but pkgmaintainermangler is not executable; please check your configuration" exit 1 fi if which pkgstripfiles >/dev/null; then pkgstripfiles "$@" else echo "ERROR: dpkg-deb is diverted, but pkgstripfiles is not executable; please check your configuration" exit 1 fi else echo "WARNING: not running pkgbinarymangler for this package, as requested" fi fi exec -a "$0" dpkg-deb.pkgbinarymangler "$@" pkgbinarymangler-121/common0000664000000000000000000000313011660431137013015 0ustar # read value for attribute $2 in dpkg control style file $1 # return value in $RET readctrl() { _line=$(grep "^$2: " $1) || true RET=${_line#"$2: "} } # # Execution starts here # # Check configuration: enabled? [ -f "$CONFFILE" ] || exit 0 readctrl "$CONFFILE" "enable" [ "$RET" = "true" ] || exit 0 if [ ! -f debian/control ]; then echo "$0: Error: not in source package directory" >&2 exit 0 fi srcname=$(dpkg-parsechangelog | grep ^Source: | cut -f 2 -d\ ) version=$(dpkg-parsechangelog | grep ^Version: | cut -f 2 -d\ ) version=${version#*:} BUILDINFO=${CURRENTLY_BUILDING_PATH:-"/CurrentlyBuilding"} # check whether build info is present and if it's consistent if [ "$PKG_IGNORE_CURRENTLY_BUILDING" != 1 ] && [ -f "$BUILDINFO" ]; then unset ignore_invalid_cb readctrl "$CONFFILE" "invalid_currentlybuilding" [ "$RET" != "ignore" ] || ignore_invalid_cb=1 readctrl "$BUILDINFO" "Package" if [ "$RET" != $srcname ]; then echo "$0: inconsistent $BUILDINFO file, Package: value is $RET (should be $srcname)" >&2 [ "$ignore_invalid_cb" ] || exit 1 fi readctrl "$BUILDINFO" "Component" if [ -z "$RET" ]; then echo "$0: inconsistent $BUILDINFO file, Component: value is empty" >&2 [ "$ignore_invalid_cb" ] || exit 1 fi fi # find binary package control file and name while [ $# -gt 0 ]; do if [ -f "$1"/DEBIAN/control ]; then PKGCTL="$1"/DEBIAN/control break else shift fi done if [ -z "$PKGCTL" ]; then echo "$0: did not find a package name argument or control file, skipping" exit 0 fi pkgbinarymangler-121/pkgstriptranslations0000775000000000000000000003055312311623073016042 0ustar #!/bin/bash -e CONFFILE=${PKGBINARYMANGLER_CONF_DIR:-/etc/pkgbinarymangler}/striptranslations.conf . ${PKGBINARYMANGLER_COMMON_PATH:-/usr/share/pkgbinarymangler}/common compliant_symlink() { # Shell port of lines 184-222 of dh_link from debhelper # 8.9.0ubuntu1 # # This function must be called from the top-level of the package local tmp src dest src_dirs dest_dirs x i src="$(echo "$1" | sed -e 's,/+,/,g; s,^/,,')" dest="$(echo "$2" | sed -e 's,/+,/,g; s,^/,,')" # Make sure the directory the link will be in exists mkdir -p "$(dirname "$dest")" # Policy says that if the link is all within one toplevel # directory, it should be relative. If it's between top level # directories, leave it absolute. IFS="/" read -ra src_dirs <<< "$src" IFS="/" read -ra dest_dirs <<< "$dest" if [ ${#src_dirs[@]} -gt 0 ] && [ "${src_dirs[0]}" = "${dest_dirs[0]}" ]; then # Figure out how much of a path $src and $dest share in common for (( x = 0; x < ${#src_dirs[@]}; x++ )); do [ "${src_dirs[$x]}" = "${dest_dirs[$x]}" ] || break done # Build up the new src src="" # Note: use of < and not <= is deliberate here - the Perl # version used $#dest_dirs, which is "the index of dest_dirs' # last element" - i.e. length minus 1 for (( i = 1; i < (${#dest_dirs[@]} - x); i++ )); do src="${src}../" done for (( i = x; i < ${#src_dirs[@]}; i++ )); do src="${src}${src_dirs[$i]}/" done if [ $x -gt ${#src_dirs[@]} ] && [ "$src" = "" ]; then src="." # special case fi src="${src%/}" else # Make sure it's properly absolute src="/$src" fi if [ -d "$dest" ] && ! [ -L "$dest" ]; then echo "pkgstriptranslations: link destination $dest is a directory" fi rm -f "$dest" ln -sf "$src" "$dest" } # strip translations from .desktop files if they have a gettext domain (since # inline translations are preferred) desktop_files() { for desktop in `find "$PKGDIR" -type f -name "*.desktop"`; do if grep -q '^X-.*-Gettext-Domain=' "$desktop"; then echo "$desktop: stripping translations" sed -ri '/^(Name|GenericName|Comment|Keywords)\[/d' "$desktop"; # adapt md5sums file if [ -f $PKGDIR/DEBIAN/md5sums ]; then P=${desktop#$PKGDIR} P=${P#/} (cd "$PKGDIR"; sed -i "s#^[[:alnum:]]\+ $P\$#`md5sum $P`#" DEBIAN/md5sums) fi else echo "$desktop: does not have gettext domain, not stripping" fi done } # save/strip GNOME help files; put translations into $tmp/_static/ gnome2_help() { [ -d "$PKGDIR/usr/share/gnome/help" ] || return 0 r=`pwd` pushd "$PKGDIR/usr/share/gnome/help" >/dev/null # replace help files which are copies of the C version with a symlink # to the C version find -type f ! -wholename '*/C/*' | while read f; do f=${f#./} # construct relative path to C file numslash=`echo "$f" | tr -cd / | wc -c` dirqueue=./${f#*\/*\/*} # strip off initial pkgname/locale prefix back="" dir="" while [ $numslash -gt 1 ]; do back="../$back" dir=$dir${dirqueue%%/*}/ dirqueue=${dirqueue#*/} numslash=$((numslash-1)) done dir=${dir#./} # beautify c_file="${back}C/$dir$(basename "$f")" # if C file exists and is identical, symlink it fdir=`dirname "$f"` if [ -e "$fdir/$c_file" ] && zcmp "$f" "$fdir/$c_file" >/dev/null; then echo "symlinking duplicate GNOME help file $f to $c_file" rm "$f" ln -s "$c_file" "$f" [ ! -f $r/$PKGDIR/DEBIAN/md5sums ] || sed -i "\& usr/share/gnome/help/$f$&d" $r/$PKGDIR/DEBIAN/md5sums fi done popd >/dev/null # extract the files which are actually translated and replace with # links to the langpack pushd "$PKGDIR" >/dev/null (find usr/share/gnome/help -type f ! -wholename '*/C/*'; [ ! -d usr/share/omf ] || find usr/share/omf -type f -name '*.omf' ! -name '*-C.omf') | while read f; do install -D -m 644 "$f" "$tmp/_static/$PKGNAME/$f" dest=${f/gnome\/help/gnome\/help-langpack} dest=${dest/share\/omf/share\/omf-langpack} compliant_symlink "$dest" "$f" [ ! -f DEBIAN/md5sums ] || sed -i "\& $f$&d" DEBIAN/md5sums done popd >/dev/null } # save/strip Mallard help files; put translations into $tmp/_static/ mallard_help() { [ -d "$PKGDIR/usr/share/help" ] || return 0 r=`pwd` pushd "$PKGDIR/usr/share/help" >/dev/null # replace help files which are copies of the C version with a symlink # to the C version find -type f ! -wholename './C/*' | while read f; do f=${f#./} loc=${f%%/*} sub=${f#*/} project=${sub%%/*} sub=${sub#*/} # construct relative path to C file numslash=`echo "$sub" | tr -cd / | wc -c` c_file="../../C/$project/$sub" while [ $numslash -gt 0 ]; do c_file="../$c_file" numslash=$((numslash-1)) done # if C file exists and is identical, symlink it fdir=`dirname "$f"` if [ -e "$fdir/$c_file" ] && zcmp "$f" "$fdir/$c_file" >/dev/null; then echo "symlinking duplicate Mallard help file $f to $c_file" rm "$f" ln -s "$c_file" "$f" [ ! -f $r/$PKGDIR/DEBIAN/md5sums ] || sed -i "\& usr/share/help/$f$&d" $r/$PKGDIR/DEBIAN/md5sums fi done popd >/dev/null # extract the files which are actually translated and replace with # links to the langpack pushd "$PKGDIR" >/dev/null find usr/share/help -type f ! -wholename '*/C/*' | while read f; do install -D -m 644 "$f" "$tmp/_static/$PKGNAME/$f" dest=${f/share\/help/share\/help-langpack} compliant_symlink "$dest" "$f" [ ! -f DEBIAN/md5sums ] || sed -i "\& $f$&d" DEBIAN/md5sums done popd >/dev/null } # Remove gettext *.mo files from binary, and save translations gettext() { # copy po/pot files; no need to do it again if tarball already exists # these might be used for help translations etc., so we need to do this # even if none of the packages ships *.mo files if [ ! -f "$tarball" ]; then find \( -name "*.po" -o -name "*.pot" -o -name "*.ts" \) ! -wholename '*/.pc/*' ! -empty -exec install -D -m 644 '{}' "$tmp/source/{}" \; fi if [ ! -d "$PKGDIR/usr/share/locale" ]; then echo "pkgstriptranslations: $PKGNAME does not contain translations, skipping" return 0 fi # save *.mo files pushd "$PKGDIR" >/dev/null find -type f -name "*.mo" -exec install -D -m 644 '{}' "$tmp/$PKGNAME/{}" \; find usr/share/locale -type f -name "*.mo" -exec rm '{}' \; find usr/share/locale -depth -type d -empty -exec rmdir '{}' \; || true # adapt md5sums file if [ -f DEBIAN/md5sums ]; then sed -i '/usr\/share\/locale\/.*\.mo$/d' DEBIAN/md5sums fi # adapt Installed-Size is=`du -k -s .|cut -f1` sed -i "s/^Installed-Size:.*$/Installed-Size: $is/" DEBIAN/control popd >/dev/null } # grab sdf files from LibO libreoffice() { if [ "$srcname" = "openoffice.org" ]; then find debian/ -name "*.sdf" -exec install -D -m 644 '{}' "$tmp/source/{}" \; fi } # if we saved any files, create/update $tarball and $tarball_static save_files() { if [ -n "$(ls -I _static $tmp)" ]; then if [ -f "$tarball" ]; then echo -n "pkgstriptranslations: updating translation tarball $tarball_name..." tar -C $tmp -xzf "$tarball" else echo -n "pkgstriptranslations: preparing translation tarball $tarball_name..." dpkg-distaddfile "$tarball_name" raw-translations - fi tar -C $tmp -c --exclude=_static . | gzip -9 > "$tarball" echo "done" else echo "pkgstriptranslations: no translation files, not creating tarball" fi if [ -d "$tmp/_static" ]; then if [ -f "$tarball_static" ]; then echo -n "pkgstriptranslations: updating static translation tarball $tarball_static_name..." tar -C "$tmp/_static" -xzf "$tarball_static" else echo -n "pkgstriptranslations: preparing static translation tarball $tarball_static_name..." dpkg-distaddfile "$tarball_static_name" raw-translations-static - fi tar -C $tmp/_static -c . | gzip -9 > "$tarball_static" echo "done " fi } # # main # echo "INFO: pkgstriptranslations version #VERSION#" # ignore language packs if echo "$srcname" | grep -q ^language-pack; then echo "pkgstriptranslations: building language pack, doing nothing" exit 0 fi # ignore backports if dpkg-parsechangelog | grep -q 'Distribution:.*backport'; then echo "pkgstriptranslations: building backport, doing nothing" exit 0 fi # first, check if the package explicitly requests stripping if grep -q 'X[[:alpha:]]*-Ubuntu-Use-Langpack: yes' debian/control; then dostrip=1 # check whether build info is present; so we can check the component elif [ -f "$BUILDINFO" ]; then unset dostrip if grep -qs '^Purpose: PPA' "$BUILDINFO"; then if grep -q '/oem-archive' ${PKGBINARYMANGLER_APT_CONF_DIR:-/etc/apt}/sources.list; then echo "INFO: Running pkgstriptranslations for OEM build" oemstrip=1 # check blacklist readctrl "$CONFFILE" oem_blacklist for project in $RET; do if grep -q "oem-archive/$project" ${PKGBINARYMANGLER_APT_CONF_DIR:-/etc/apt}/sources.list; then echo "INFO: Disabling pkgstriptranslations for blacklisted OEM project" exit 0 fi done else echo "INFO: Disabling pkgstriptranslations for PPA build" exit 0 fi else # we have a PRIMARY build, check component readctrl "$CONFFILE" "components" stripcomponents="$RET" readctrl "$BUILDINFO" "Component" for c in $stripcomponents; do if [ $c = "$RET" ]; then dostrip=1; fi done fi else dostrip=1 fi # determine tarball name readctrl "$CONFFILE" "posuffix" posuffix=$RET arch=$(dpkg --print-architecture) [ "$posuffix" ] || posuffix=translations tarball_name=${srcname}_${version}_${arch}_$posuffix.tar.gz tarball=`pwd`/../$tarball_name tarball_static_name=${srcname}_${version}_static_${posuffix}.tar.gz tarball_static=`pwd`/../$tarball_static_name readctrl $PKGCTL Package PKGNAME=$RET PKGDIR=$(dirname $(dirname $PKGCTL)) # skip installer udebs readctrl $PKGCTL Section if [ "$RET" = debian-installer ]; then exit 0 fi # special-case OEM builds here: strip packages if we are building a package # for an OEM archive which would be stripped in Ubuntu if [ -n "$oemstrip" ]; then if env -u LD_PRELOAD apt-cache madison "$PKGNAME" | egrep -v '://[^ ]*ppa' | grep -q '/ubuntu.*/main .*Packages'; then echo "INFO (OEM mode): Package is in Ubuntu main, enabling stripping of *.mo" dostrip=1 else echo "INFO (OEM mode): Package is not in Ubuntu main, not stripping" unset dostrip fi fi echo "pkgstriptranslations: processing $PKGNAME (in $PKGDIR); do_strip: $dostrip, oemstrip: $oemstrip" # read blacklist file and test all regexps if [ -f /etc/pkgbinarymangler/striptranslations.blacklist ]; then while read regex; do if echo "$PKGNAME" | egrep -xq "$regex"; then echo "pkgstriptranslations: $PKGNAME is blacklisted, not stripping" exit 0 fi done < /etc/pkgbinarymangler/striptranslations.blacklist fi # check for empty files, as they indicate a package bug EMPTYFILES="`find -mindepth 1 -name '.*' -prune -o \( -name "*.po" -o -name "*.pot" \) -empty -print`" if [ -n "$EMPTYFILES" ]; then cat </../.tar.gz posuffix: translations # OEM projects which should not be stripped oem_blacklist: partner pkgbinarymangler-121/stripfiles.conf0000664000000000000000000000016011455037201014631 0ustar # pkgstripfiles configuration file # pkgstripfiles will do nothing unless enable is set to "true" enable: true pkgbinarymangler-121/test/0000775000000000000000000000000012311774164012570 5ustar pkgbinarymangler-121/test/run0000775000000000000000000016304012265451321013321 0ustar #!/usr/bin/python3 # pkgbinarymangler automatic tests # (C) 2010 - 2011 Canonical Ltd. # Author: Martin Pitt # License: GPL 2 or later import pickle import unittest import subprocess import tempfile import shutil import os.path import sys import tarfile import re from glob import glob class T(unittest.TestCase): def setUp(self): self.srcdir = os.path.dirname(os.path.dirname(os.path.abspath(sys.argv[0]))) self.workdir = tempfile.mkdtemp() self.pkgdir = os.path.join(self.workdir, 'icecream') shutil.copytree(os.path.join(self.srcdir, 'test', 'icecream'), self.pkgdir) self.buildinfo = None # do not depend on host induced build options os.environ['DEB_BUILD_OPTIONS'] = '' os.environ['PKGBINARYMANGLER_COMMON_PATH'] = self.srcdir # locally fake the diversions if os.path.exists('/usr/bin/dpkg-deb.pkgbinarymangler'): os.symlink('/usr/bin/dpkg-deb.pkgbinarymangler', os.path.join(self.srcdir, 'dpkg-deb.pkgbinarymangler')) else: os.symlink('/usr/bin/dpkg-deb', os.path.join(self.srcdir, 'dpkg-deb.pkgbinarymangler')) if os.path.exists('/usr/bin/dh_builddeb.pkgbinarymangler'): os.symlink('/usr/bin/dh_builddeb.pkgbinarymangler', os.path.join(self.srcdir, 'dh_builddeb.pkgbinarymangler')) else: os.symlink('/usr/bin/dh_builddeb', os.path.join(self.srcdir, 'dh_builddeb.pkgbinarymangler')) # copy our default configuration files, and enable them for conf in glob(os.path.join(self.srcdir, '*.conf')): with open(conf) as old: with open(os.path.join(self.workdir, os.path.basename(conf)), 'w') as new: new.write(old.read().replace('enable: false', 'enable: true')) os.environ['PKGBINARYMANGLER_CONF_DIR'] = self.workdir os.environ['PKMAINTAINERGMANGLER_OVERRIDES'] = os.path.join( self.srcdir, 'maintainermangler.overrides') # point to local debhelper sequencer d = os.path.join(self.workdir, 'Debian', 'Debhelper', 'Sequence') os.makedirs(d) shutil.copy('translations.pm', d) os.environ['PERLLIB'] = '%s:%s' % (self.workdir, os.environ.get('PERLLIB', '')) def tearDown(self): shutil.rmtree(self.workdir) os.unlink(os.path.join(self.srcdir, 'dpkg-deb.pkgbinarymangler')) os.unlink(os.path.join(self.srcdir, 'dh_builddeb.pkgbinarymangler')) def build(self, use_local_mangler=True, extra_env=None, srcname='icecream'): env = os.environ.copy() if use_local_mangler: env['PATH'] = self.srcdir + ':' + env.get('PATH', '') bi = os.path.join(self.workdir, 'CurrentlyBuilding') env['CURRENTLY_BUILDING_PATH'] = bi # ignore system apt sources, otherwise we'll break some tests if we # run them in an OEM buildd environment env['PKGBINARYMANGLER_APT_CONF_DIR'] = self.workdir if self.buildinfo: f = open(bi, 'w') f.write(self.buildinfo) f.close() else: # disable a system-installed pkgbinarymangler if os.path.exists('/usr/bin/dpkg-deb.pkgbinarymangler'): os.symlink('/usr/bin/dpkg-deb.pkgbinarymangler', os.path.join(self.workdir, 'dpkg-deb')) # make dh_translations available in $PATH os.symlink(os.path.join(self.srcdir, 'dh_translations'), os.path.join(self.workdir, 'dh_translations')) env['PATH'] = self.workdir + ':' + env.get('PATH', '') if extra_env: env.update(extra_env) build = subprocess.Popen(['dpkg-buildpackage', '-us', '-uc', '-b'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, cwd=self.pkgdir, env=env) out = build.communicate()[0].decode() self.assertEqual(build.returncode, 0, '--- dpkg failed with error %i:\n%s\n-----' % (build.returncode, out)) with open(glob(os.path.join(self.workdir, '%s_12*_*.changes' % srcname))[0]) as f: self.changes = f.read() tars = glob(os.path.join(self.workdir, '%s_12*_*_translations.tar.gz' % srcname)) if len(tars) == 0: self.translations_tar = None self.static_translations_tar = None elif len(tars) == 2: # gettext and static tarballs if '_static_' in tars[0]: self.static_translations_tar = tars[0] self.translations_tar = tars[1] else: self.static_translations_tar = tars[1] self.translations_tar = tars[0] else: assert len(tars) == 1 self.translations_tar = tars[0] self.static_translations_tar = None self.check_deb_integrity() def sed_control(self, cmd, files=['control']): '''Apply sed commands to icecream debian/control You can specify different/more files with the "files" list argument. ''' f = [os.path.join(self.pkgdir, 'debian', name) for name in files] subprocess.check_call(['sed', '-i', cmd] + f) def deb_contents(self): '''Return contents for all built binary packages. Returns dictionary: package name -> file -> info, where info is a map with 'size', 'owner', 'mode', 'linkto' (None for non-symlinks). ''' contents_map = {} contents_line_re = re.compile('^([\w-]+)\s+([\w/]+)\s+(\d+)\s+([\d-]+)\s+([\d:]+)\s+(\S+)(?: -> (\S+))?$') for deb in glob(os.path.join(self.workdir, '*_*_*.deb')): deb_map = contents_map.setdefault(os.path.basename(deb).split('_')[0], {}) dpkg = subprocess.Popen(['dpkg', '-c', deb], stdout=subprocess.PIPE) for line in dpkg.stdout: m = contents_line_re.match(line.decode()) info = deb_map.setdefault(m.group(6), {}) info['mode'] = m.group(1) info['owner'] = m.group(2) info['size'] = int(m.group(3)) info['linkto'] = m.group(7) dpkg.communicate() assert dpkg.returncode == 0 return contents_map def check_deb_mo(self, expect_mo): '''Verify the built .deb contents for translations This also checks the validity of the corresponding translation tarball. ''' for pkg in ('vanilla', 'chocolate'): deb = glob(os.path.join(self.workdir, '%s_12_*.deb' % pkg))[0] dpkg = subprocess.Popen(['dpkg', '-c', deb], stdout=subprocess.PIPE, stderr=subprocess.PIPE) out = dpkg.communicate()[0].decode() if expect_mo: self.assertTrue('./usr/share/locale/fr/LC_MESSAGES/%s.mo' % pkg in out) self.assertTrue('./usr/share/locale/de/LC_MESSAGES/%s.mo' % pkg in out) else: self.assertFalse('/usr/share/locale/' in out) self.assertTrue('./usr/share/doc/%s/copyright' % pkg in out) if expect_mo: self.assertEqual(self.translations_tar, None, 'does not build a translation tarball for unstripped packages') else: self.assertTrue('raw-translations - ' + os.path.basename(self.translations_tar) in self.changes) tar = tarfile.open(self.translations_tar) self.assertTrue('./vanilla/usr/share/locale/fr/LC_MESSAGES/vanilla.mo' in tar.getnames()) self.assertTrue('./chocolate/usr/share/locale/de/LC_MESSAGES/chocolate.mo' in tar.getnames()) self.assertTrue('./source/po-vanilla/vanilla.pot' in tar.getnames()) self.assertFalse('./source/po-vanilla/empty.pot' in tar.getnames()) self.assertTrue('./source/po-chocolate/de.po' in tar.getnames()) def check_deb_stripfiles(self, expect_files): '''Verify the built .deb contents for files we want to strip''' for pkg in ('vanilla', 'chocolate'): deb = glob(os.path.join(self.workdir, '%s_12*_*.deb' % pkg))[0] dpkg = subprocess.Popen(['dpkg', '-c', deb], stdout=subprocess.PIPE, stderr=subprocess.PIPE) out = dpkg.communicate()[0].decode() if expect_files: self.assertTrue('./usr/share/doc/%s/buildinfo' % pkg in out, out) self.assertTrue('./usr/share/doc/%s/changelog.gz' % pkg in out or './usr/share/doc/%s/changelog.Debian.gz' % pkg in out) else: self.assertFalse('/buildinfo' in out, out) if 'changelog.Debian.gz' in out: self.assertFalse('changelog.gz' in out) dpkg = subprocess.Popen('ar p %s control.tar.gz | tar xOz ./md5sums' % deb, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) (out, err) = dpkg.communicate() out = out.decode() self.assertEqual(err, b'') if expect_files: self.assertTrue('usr/share/doc/%s/buildinfo' % pkg in out) self.assertTrue('usr/share/doc/%s/changelog.gz' % pkg in out or 'usr/share/doc/%s/changelog.Debian.gz' % pkg in out) else: self.assertFalse('buildinfo' in out) if 'changelog.Debian.gz' in out: self.assertFalse('changelog.gz' in out) def check_maintainer(self, expect_mangle): '''Verify the built .deb for mangled maintainer''' for deb in glob(os.path.join(self.workdir, '*_12_*.deb')): dpkg = subprocess.Popen(['dpkg', '-I', deb], stdout=subprocess.PIPE, stderr=subprocess.PIPE) (out, err) = dpkg.communicate() out = out.decode() self.assertEqual(err, b'') if expect_mangle: self.assertTrue('Maintainer: Ubuntu' in out) self.assertTrue('Original-Maintainer: Joe User ' in out) else: self.assertTrue('Maintainer: Joe User ' in out) self.assertFalse('Original-Maintainer:' in out) def check_deb_integrity(self): '''Check that we can properly unpack the generated .debs This also verifies md5sums. ''' debs = glob(os.path.join(self.workdir, '*.deb')) if not debs: self.fail('No .debs produced') for deb in debs: extractdir = os.path.join(self.workdir, 'deb-' + os.path.splitext(os.path.basename(deb))[0]) env = os.environ.copy() env['PATH'] = self.srcdir + ':' + env.get('PATH', '') dpkg = subprocess.Popen(['dpkg-deb', '-x', deb, extractdir], stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env) (out, err) = dpkg.communicate() # dpkg-deb must not print anything, otherwise apt falls over self.assertEqual(out, b'') self.assertEqual(err, b'') self.assertEqual(dpkg.returncode, 0) # verify md5sums md5sum = subprocess.Popen('ar p %s control.tar.gz | tar xOz ./md5sums | md5sum -c' % deb, shell=True, cwd=extractdir, stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = md5sum.communicate() self.assertEqual(err, b'', out + err) self.assertEqual(md5sum.returncode, 0) # our link to .png file must remain a link foolink = os.path.join(extractdir, 'usr', 'share', 'icecream', 'foolink.png') if os.path.exists(foolink): self.assertTrue(os.path.islink(foolink)) self.assertEqual(os.readlink(foolink), 'foo%.png') # verify permissions are kept d = os.path.join(extractdir, 'usr', 'share', 'icecream') foo_png = os.path.join(d, 'foo%.png') if os.path.exists(foo_png): self.assertEqual(os.stat(foo_png).st_mode & 0o777, 0o600) notapng = os.path.join(d, 'nota.png') if os.path.exists(notapng): self.assertEqual(os.stat(notapng).st_mode & 0o777, 0o644) def test_no_mangler(self): '''No pkgbinarymangler''' self.build(False) self.check_deb_mo(True) self.check_maintainer(False) self.check_deb_stripfiles(True) def test_no_pkg_mangle(self): '''$NO_PKG_MANGLE disables pkgbinarymangler''' self.build(True, {'NO_PKG_MANGLE': '1'}) self.check_deb_mo(True) self.check_maintainer(False) self.check_deb_stripfiles(True) def test_no_buildinfo(self): '''No build info''' # this should always strip self.build() self.check_deb_mo(False) self.check_maintainer(True) self.check_deb_stripfiles(False) def test_main(self): '''Component: main''' self.buildinfo = '''Package: icecream Component: main Suite: lucid Purpose: PRIMARY ''' self.build() # main packages get stripped and produce a tarball self.check_deb_mo(False) self.check_deb_stripfiles(False) self.check_maintainer(True) def test_universe(self): '''Component: universe''' self.buildinfo = '''Package: icecream Component: universe Suite: lucid Purpose: PRIMARY ''' self.build() # universe packages don't get stripped, and don't produce a tarball self.check_deb_mo(True) self.check_maintainer(True) self.check_deb_stripfiles(False) def test_force_stripping(self): '''Component: universe, but with X-Ubuntu-Use-Langpack: yes''' self.buildinfo = '''Package: icecream Component: universe Suite: lucid Purpose: PRIMARY ''' self.sed_control('s/^Section:/X-Ubuntu-Use-Langpack: yes\\n&/') self.build() self.check_deb_mo(False) self.check_deb_stripfiles(False) self.check_maintainer(True) def test_ppa(self): '''Purpose: PPA''' self.buildinfo = '''Package: icecream Component: main Suite: lucid Purpose: PPA ''' # PPA builds are never touched by default self.build() self.check_deb_mo(True) self.check_maintainer(False) self.check_deb_stripfiles(True) def test_partner(self): '''Section: partner''' self.sed_control('s/^Section:.*$/Section: partner/') # partner builds are not touched self.build() self.check_deb_mo(True) self.check_maintainer(False) self.check_deb_stripfiles(True) def test_langpack(self): '''language packs are not stripped''' self.buildinfo = '''Package: language-pack-de Component: main Suite: lucid Purpose: PRIMARY ''' # rename source to langpack self.sed_control('s/icecream/language-pack-de/g', ['control', 'changelog']) self.build(True, srcname='language-pack-de') # should not strip translations, since partner is blacklisted self.check_deb_mo(True) self.check_deb_stripfiles(False) def test_ppa_oem_non_main(self): '''OEM PPA for non-main package''' # these currently look like normal PPAs, we can't yet determine the PPA # name from buildinfo; hack around with checking apt sources self.buildinfo = '''Package: icecream Component: main Suite: lucid Purpose: PPA ''' apt_sources = open(os.path.join(self.workdir, 'sources.list'), 'w') apt_sources.write('''deb http://private-ppa.buildd/oem-archive/myoem/ubuntu lucid main deb https://cesg.canonical.com/canonical myoem public private deb https://cesg.canonical.com/canonical myoem-devel public private deb http://ftpmaster.internal/ubuntu lucid main restricted universe multiverse ''') apt_sources.close() # those should not strip translations, since it's not in main self.build(True, {'PKGBINARYMANGLER_APT_CONF_DIR': self.workdir}) self.check_deb_mo(True) self.check_deb_stripfiles(False) # no maintainer mangling in PPAs, as usual self.check_maintainer(False) def test_ppa_oem_main(self): '''OEM PPA for main package''' # these currently look like normal PPAs, we can't yet determine the PPA # name from buildinfo; hack around with checking apt sources self.buildinfo = '''Package: icecream Component: main Suite: lucid Purpose: PPA ''' apt_sources = open(os.path.join(self.workdir, 'sources.list'), 'w') apt_sources.write('''deb http://private-ppa.buildd/oem-archive/myoem/ubuntu lucid main deb https://cesg.canonical.com/canonical myoem public private deb https://cesg.canonical.com/canonical myoem-devel public private deb http://ftpmaster.internal/ubuntu lucid main restricted universe multiverse ''') apt_sources.close() # rename binaries to two in main self.sed_control('s/vanilla/coreutils/g; s/chocolate/bash/g') os.rename(os.path.join(self.pkgdir, 'debian', 'vanilla.install'), os.path.join(self.pkgdir, 'debian', 'coreutils.install')) os.rename(os.path.join(self.pkgdir, 'debian', 'chocolate.install'), os.path.join(self.pkgdir, 'debian', 'bash.install')) self.build(True, {'PKGBINARYMANGLER_APT_CONF_DIR': self.workdir}) # should strip translations, since the are in Ubuntu main for pkg in ('coreutils', 'bash'): deb = glob(os.path.join(self.workdir, '%s_12_*.deb' % pkg))[0] dpkg = subprocess.Popen(['dpkg', '-c', deb], stdout=subprocess.PIPE, stderr=subprocess.PIPE) out = dpkg.communicate()[0].decode() self.assertFalse('/usr/share/locale/' in out) self.assertTrue('./usr/share/doc/%s/copyright' % pkg in out) tar = tarfile.open(self.translations_tar) self.assertTrue('./coreutils/usr/share/locale/fr/LC_MESSAGES/vanilla.mo' in tar.getnames()) self.assertTrue('./bash/usr/share/locale/de/LC_MESSAGES/chocolate.mo' in tar.getnames()) self.assertTrue('./source/po-vanilla/vanilla.pot' in tar.getnames()) self.assertTrue('./source/po-chocolate/de.po' in tar.getnames()) # no maintainer mangling in PPAs, as usual self.check_maintainer(False) def test_ppa_oem_main_blacklisted(self): '''OEM PPA for main package for blacklisted project''' # these currently look like normal PPAs, we can't yet determine the PPA # name from buildinfo; hack around with checking apt sources self.buildinfo = '''Package: icecream Component: main Suite: lucid Purpose: PPA ''' apt_sources = open(os.path.join(self.workdir, 'sources.list'), 'w') apt_sources.write('''deb http://private-ppa.buildd/oem-archive/partner/ubuntu lucid main deb https://cesg.canonical.com/canonical partner public private deb https://cesg.canonical.com/canonical partner-devel public private deb http://ftpmaster.internal/ubuntu lucid main restricted universe multiverse ''') apt_sources.close() # rename binaries to two in main self.sed_control('s/vanilla/coreutils/g; s/chocolate/bash/g') os.rename(os.path.join(self.pkgdir, 'debian', 'vanilla.install'), os.path.join(self.pkgdir, 'debian', 'coreutils.install')) os.rename(os.path.join(self.pkgdir, 'debian', 'chocolate.install'), os.path.join(self.pkgdir, 'debian', 'bash.install')) self.build(True, {'PKGBINARYMANGLER_APT_CONF_DIR': self.workdir}) # should not strip translations, since partner is blacklisted for pkg in ('coreutils', 'bash'): deb = glob(os.path.join(self.workdir, '%s_12_*.deb' % pkg))[0] dpkg = subprocess.Popen(['dpkg', '-c', deb], stdout=subprocess.PIPE, stderr=subprocess.PIPE) out = dpkg.communicate()[0].decode() if pkg == 'coreutils': self.assertTrue('./usr/share/locale/fr/LC_MESSAGES/vanilla.mo' in out) else: self.assertTrue('./usr/share/locale/de/LC_MESSAGES/chocolate.mo' in out) self.assertTrue('./usr/share/doc/%s/copyright' % pkg in out) self.assertEqual(self.translations_tar, None) # no maintainer mangling in PPAs, as usual self.check_maintainer(False) def test_installed_size(self): '''Installed-Size gets updated''' # add some bloat to the vanilla po to get a recognizable size increase f = open(os.path.join(self.pkgdir, 'po-vanilla', 'de.po'), 'a') for i in range(10000): f.write('\nmsgid "%i"\nmsgstr"%i"\n' % (i, i)) f.close() self.build() dpkg = subprocess.Popen(['dpkg', '-I', os.path.join(self.workdir, 'vanilla_12_all.deb')], stdout=subprocess.PIPE, stderr=subprocess.PIPE) try: for l in dpkg.stdout: l = l.decode().strip() if l.startswith('Installed-Size:'): self.assertTrue(re.match('^Installed-Size: \d+$', l)) self.assertTrue(int(l.split()[1]) < 200) break else: self.fail('No Installed-Size: header') finally: dpkg.communicate() self.assertEqual(dpkg.returncode, 0) def test_empty_pot(self): '''Handling of empty POT''' self.buildinfo = '''Package: icecream Component: main Suite: lucid Purpose: PRIMARY ''' open(os.path.join(self.pkgdir, 'po-vanilla', 'empty.pot'), 'w').close() self.build() self.check_deb_mo(False) self.check_deb_stripfiles(False) self.check_maintainer(True) def test_debian_changelog_truncation(self): '''Long Debian changelog gets truncated''' # change into non-native package cpath = os.path.join(self.pkgdir, 'debian', 'changelog') with open(cpath) as f: contents = f.readlines() contents[0] = contents[0].replace('(12)', '(12-1)') f = open(cpath, 'w') f.write(''.join(contents)) f.close() self.build() self.check_deb_stripfiles(False) deb = glob(os.path.join(self.workdir, 'vanilla_12*_*.deb'))[0] dpkg = subprocess.Popen('dpkg-deb --fsys-tarfile %s | tar xO ./usr/share/doc/vanilla/changelog.Debian.gz | gzip -cd' % deb, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) (out, err) = dpkg.communicate() out = out.decode() self.assertEqual(err, b'') self.assertTrue('icecream (12-1)' in out) self.assertTrue('\n * release 12' in out) self.assertTrue('icecream (3)' in out) self.assertFalse('icecream (2)' in out) self.assertFalse('icecream (1)' in out) self.assertTrue('apt-get changelog' in out) def test_native_changelog_truncation(self): '''Long Debian changelog for native packages gets truncated''' self.build() self.check_deb_stripfiles(False) deb = glob(os.path.join(self.workdir, 'vanilla_12*_*.deb'))[0] dpkg = subprocess.Popen('dpkg-deb --fsys-tarfile %s | tar xO ./usr/share/doc/vanilla/changelog.gz | gzip -cd' % deb, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) (out, err) = dpkg.communicate() out = out.decode() self.assertEqual(err, b'') self.assertTrue('icecream (12)' in out) self.assertTrue('\n * release 12' in out) self.assertTrue('icecream (3)' in out) self.assertFalse('icecream (2)' in out) self.assertFalse('icecream (1)' in out) self.assertTrue('apt-get changelog' in out) def test_native_changelog_truncation_symlink(self): '''Long Debian changelog for native packages with symlinked doc dir''' # perl does a hackery like this rpath = os.path.join(self.pkgdir, 'debian', 'rules') with open(rpath, 'a') as f: f.write(''' override_dh_installdocs: dh_installdocs cp debian/changelog debian/vanilla/usr/share/doc/vanilla/changelog.Debian mv debian/vanilla/usr/share/doc/vanilla debian/vanilla/usr/share/doc/vanilla-base ln -s vanilla-base debian/vanilla/usr/share/doc/vanilla ''') self.build() deb = glob(os.path.join(self.workdir, 'vanilla_12*_*.deb'))[0] dpkg = subprocess.Popen('dpkg-deb --fsys-tarfile %s | tar xO ./usr/share/doc/vanilla-base/changelog.gz | gzip -cd' % deb, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) (out, err) = dpkg.communicate() out = out.decode() self.assertEqual(err, b'') self.assertTrue('icecream (12)' in out) self.assertTrue('\n * release 12' in out) # make no assumption whether this gets truncated or not def test_short_debian_changelog(self): '''Short Debian changelog remains unaltered''' # change into non-native package cpath = os.path.join(self.pkgdir, 'debian', 'changelog') with open(cpath) as f: contents = f.readlines()[:11] contents[0] = contents[0].replace('(12)', '(12-1)') with open(cpath, 'w') as f: f.write(''.join(contents)) self.build() self.check_deb_stripfiles(False) deb = glob(os.path.join(self.workdir, 'vanilla_12*_*.deb'))[0] dpkg = subprocess.Popen('dpkg-deb --fsys-tarfile %s | tar xO ./usr/share/doc/vanilla/changelog.Debian.gz | gzip -cd' % deb, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) (out, err) = dpkg.communicate() out = out.decode() self.assertEqual(err, b'') self.assertTrue('icecream (12-1)' in out) self.assertTrue('icecream (11)' in out) self.assertFalse('icecream (10)' in out) self.assertFalse('apt-get changelog' in out) def test_short_native_changelog(self): '''Short Debian changelog for native packages remains unaltered''' # truncate changelog cpath = os.path.join(self.pkgdir, 'debian', 'changelog') with open(cpath) as f: contents = f.readlines()[:11] with open(cpath, 'w') as f: f.write(''.join(contents)) self.build() self.check_deb_stripfiles(False) deb = glob(os.path.join(self.workdir, 'vanilla_12*_*.deb'))[0] dpkg = subprocess.Popen('dpkg-deb --fsys-tarfile %s | tar xO ./usr/share/doc/vanilla/changelog.gz | gzip -cd' % deb, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) (out, err) = dpkg.communicate() out = out.decode() self.assertEqual(err, b'') self.assertTrue('icecream (12)' in out) self.assertTrue('icecream (11)' in out) self.assertFalse('icecream (10)' in out) self.assertFalse('apt-get changelog' in out) def test_ppa_debian_changelog(self): '''Debian changelog in PPA build remains unaltered''' self.buildinfo = '''Package: icecream Component: main Suite: lucid Purpose: PPA ''' # change into non-native package cpath = os.path.join(self.pkgdir, 'debian', 'changelog') with open(cpath) as f: contents = f.readlines() contents[0] = contents[0].replace('(12)', '(12-1)') with open(cpath, 'w') as f: f.write(''.join(contents)) self.build() self.check_deb_stripfiles(True) deb = glob(os.path.join(self.workdir, 'vanilla_12*_*.deb'))[0] dpkg = subprocess.Popen('dpkg-deb --fsys-tarfile %s | tar xO ./usr/share/doc/vanilla/changelog.Debian.gz | gzip -cd' % deb, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) (out, err) = dpkg.communicate() out = out.decode() self.assertEqual(err, b'') self.assertTrue('icecream (12-1)' in out) self.assertTrue('icecream (11)' in out) self.assertTrue('icecream (1)' in out) self.assertFalse('apt-get changelog' in out) def test_png_shrinking(self): '''PNGs get optimized, and non-PNGs unmodified''' self.build() deb = glob(os.path.join(self.workdir, 'vanilla_12_*.deb'))[0] self.assertEqual(subprocess.call(['dpkg', '-x', deb, self.workdir]), 0) png_orig = os.path.join(self.pkgdir, 'foo%.png') png_ship = os.path.join(self.workdir, 'usr', 'share', 'icecream', 'foo%.png') # shipped PNG should be visually identical to original subprocess.call(['convert', '-depth', '24', '-compress', 'none', png_orig, 'ppm:%s/orig.ppm' % self.workdir]) subprocess.call(['convert', '-depth', '24', '-compress', 'none', png_ship, 'ppm:%s/ship.ppm' % self.workdir]) # we need to filter out comments orig = '' with open(os.path.join(self.workdir, 'orig.ppm')) as f: for l in f: if not l.startswith('#'): orig += l ship = '' with open(os.path.join(self.workdir, 'ship.ppm')) as f: for l in f: if not l.startswith('#'): ship += l self.assertEqual(orig, ship) # shipped PNG should be smaller than original self.assertTrue(os.path.getsize(png_ship) < os.path.getsize(png_orig)) # non-PNG should be unmodified nopng_orig = open(os.path.join(self.pkgdir, 'notapng.png'), 'rb') nopng_ship = open(os.path.join(self.workdir, 'usr', 'share', 'icecream', 'notapng.png'), 'rb') self.assertEqual(nopng_orig.read(), nopng_ship.read()) nopng_orig.close() nopng_ship.close() def test_png_games(self): '''PNGs in Section: games are left unmodified''' self.sed_control('s/^Section:.*$/Section: games/') self.build() deb = glob(os.path.join(self.workdir, 'vanilla_12_*.deb'))[0] self.assertEqual(subprocess.call(['dpkg', '-x', deb, self.workdir]), 0) orig = open(os.path.join(self.pkgdir, 'foo%.png'), 'rb') ship = open(os.path.join(self.workdir, 'usr', 'share', 'icecream', 'foo%.png'), 'rb') self.assertTrue(orig.read() == ship.read(), 'PNG is left unmodified') orig.close() ship.close() orig = open(os.path.join(self.pkgdir, 'notapng.png'), 'rb') ship = open(os.path.join(self.workdir, 'usr', 'share', 'icecream', 'notapng.png'), 'rb') self.assertTrue(orig.read() == ship.read(), 'non-PNG is left unmodified') orig.close() ship.close() def test_png_disable_optimization(self): '''$NO_PNG_PKG_MANGLE disables PNG optimization''' self.build(True, {'NO_PNG_PKG_MANGLE': '1'}) deb = glob(os.path.join(self.workdir, 'vanilla_12_*.deb'))[0] self.assertEqual(subprocess.call(['dpkg', '-x', deb, self.workdir]), 0) orig = open(os.path.join(self.pkgdir, 'foo%.png'), 'rb') ship = open(os.path.join(self.workdir, 'usr', 'share', 'icecream', 'foo%.png'), 'rb') self.assertTrue(orig.read() == ship.read(), 'PNG is left unmodified') orig.close() ship.close() orig = open(os.path.join(self.pkgdir, 'notapng.png'), 'rb') ship = open(os.path.join(self.workdir, 'usr', 'share', 'icecream', 'notapng.png'), 'rb') self.assertTrue(orig.read() == ship.read(), 'non-PNG is left unmodified') orig.close() ship.close() def test_dpkg_deb_argv_handling(self): '''dpkg-deb doesn't split up arguments with whitespace in them''' # Wrap all the scripts that dpkg-deb wants to call with arguments for wrapped_cmd in ['pkgsanitychecks', 'pkgmaintainermangler', 'pkgstripfiles', 'pkgstriptranslations', 'dpkg-deb.pkgbinarymangler']: os.symlink(os.path.join(self.srcdir, 'test', 'pickle_argv'), os.path.join(self.workdir, wrapped_cmd)) # Run dpkg-deb env = os.environ.copy() env['PATH'] = '%s:%s' % (self.workdir, env['PATH']) dpkg_deb = os.path.join(self.srcdir, 'dpkg-deb') argv_test = subprocess.Popen(['pickle_argv', '-b', 'foo bar'], executable=dpkg_deb, env=env, stdout=subprocess.PIPE) # Make the check while True: try: argv = pickle.load(argv_test.stdout) except EOFError: break self.assertEqual(argv[-1], 'foo bar', 'argument with space in it did not make it through dpkg-deb alive (%r)' % (argv,)) argv_test.communicate() def test_doc_symlink_nodep(self): '''doc symlinking: no dependency (no linking)''' with open(os.path.join(self.pkgdir, 'debian', 'vanilla.docs'), 'w') as f: f.write('test.c\n') with open(os.path.join(self.pkgdir, 'debian', 'chocolate.docs'), 'w') as f: f.write('test.c\n') orig_size = os.path.getsize(os.path.join(self.pkgdir, 'test.c')) self.sed_control('/^Architecture:/ s/all/any/g') self.build() c = self.deb_contents() self.assertEqual(c['vanilla']['./usr/share/doc/vanilla/test.c']['size'], orig_size) self.assertEqual(c['vanilla']['./usr/share/doc/vanilla/test.c']['linkto'], None) self.assertEqual(c['vanilla']['./usr/share/doc/vanilla/changelog.gz']['linkto'], None) self.assertEqual(c['chocolate']['./usr/share/doc/chocolate/test.c']['size'], orig_size) self.assertEqual(c['chocolate']['./usr/share/doc/chocolate/test.c']['linkto'], None) self.assertEqual(c['chocolate']['./usr/share/doc/chocolate/changelog.gz']['linkto'], None) def test_doc_symlink_archmismatch(self): '''doc symlinking: different architecture (no linking)''' with open(os.path.join(self.pkgdir, 'debian', 'vanilla.docs'), 'w') as f: f.write('test.c\n') with open(os.path.join(self.pkgdir, 'debian', 'chocolate.docs'), 'w') as f: f.write('test.c\n') self.sed_control('s/^Description: chocolate/Depends: vanilla\\n&/') orig_size = os.path.getsize(os.path.join(self.pkgdir, 'test.c')) self.build() c = self.deb_contents() self.assertEqual(c['vanilla']['./usr/share/doc/vanilla/test.c']['size'], orig_size) self.assertEqual(c['vanilla']['./usr/share/doc/vanilla/test.c']['linkto'], None) self.assertEqual(c['vanilla']['./usr/share/doc/vanilla/changelog.gz']['linkto'], None) self.assertEqual(c['chocolate']['./usr/share/doc/chocolate/test.c']['size'], orig_size) self.assertEqual(c['chocolate']['./usr/share/doc/chocolate/test.c']['linkto'], None) self.assertEqual(c['chocolate']['./usr/share/doc/chocolate/changelog.gz']['linkto'], None) def test_doc_symlink(self): '''doc symlinking: Architecture: any, linking of identical files to dependency''' # install Makefile into all doc dirs, and add some extra binaries, to # also test transitive dependencies with open(os.path.join(self.pkgdir, 'debian', 'rules'), 'a') as f: f.write('\tdh_installdocs --all Makefile\n') with open(os.path.join(self.pkgdir, 'debian', 'control'), 'w') as f: f.write('''Source: icecream Section: utils Priority: extra Maintainer: Joe User Build-Depends: debhelper (>= 7.0.50~) Standards-Version: 3.9.2 Package: vanilla Architecture: all Description: vanilla vanilla Package: libbase1 Architecture: any Description: test Package: libfoo1 Architecture: any Depends: libbase1 Description: test Package: libbar2 Architecture: any Depends: libbase1 Description: test Package: chocolate Architecture: any Depends: libc6 (>= 2.6), libfoo1, libbar2 Description: chocolate chocolate ''') with open(os.path.join(self.pkgdir, 'debian', 'test.c'), 'w') as f: f.write('moo') with open(os.path.join(self.pkgdir, 'debian', 'vanilla.docs'), 'w') as f: f.write('test.c\nnotapng.png') with open(os.path.join(self.pkgdir, 'debian', 'chocolate.docs'), 'w') as f: f.write('debian/test.c') with open(os.path.join(self.pkgdir, 'debian', 'chocolate.links'), 'w') as f: f.write('''usr/share/doc/chocolate/test.c /usr/share/doc/chocolate/test2.c /usr/share/doc/vanilla/changelog.gz /usr/share/doc/chocolate/notapng.png /bin/nonexisting /usr/share/doc/chocolate/nirvana1 /usr/share/doc/chocolate/nonexisting /usr/share/doc/chocolate/nirvana2 ''') test_c_size = os.path.getsize(os.path.join(self.pkgdir, 'test.c')) makefile_size = os.path.getsize(os.path.join(self.pkgdir, 'Makefile')) self.build() c = self.deb_contents() self.assertEqual(c['libbase1']['./usr/share/doc/libbase1/Makefile']['size'], makefile_size) self.assertEqual(c['libbase1']['./usr/share/doc/libbase1/Makefile']['linkto'], None) self.assertEqual(c['libbase1']['./usr/share/doc/libbase1/changelog.gz']['linkto'], None) self.assertEqual(c['libfoo1']['./usr/share/doc/libfoo1/changelog.gz']['linkto'], '../libbase1/changelog.gz') self.assertEqual(c['libfoo1']['./usr/share/doc/libfoo1/Makefile']['linkto'], '../libbase1/Makefile') self.assertEqual(c['libbar2']['./usr/share/doc/libbar2/changelog.gz']['linkto'], '../libbase1/changelog.gz') self.assertEqual(c['libbar2']['./usr/share/doc/libbar2/Makefile']['linkto'], '../libbase1/Makefile') self.assertEqual(c['vanilla']['./usr/share/doc/vanilla/test.c']['size'], test_c_size) self.assertEqual(c['vanilla']['./usr/share/doc/vanilla/test.c']['linkto'], None) self.assertEqual(c['vanilla']['./usr/share/doc/vanilla/Makefile']['size'], makefile_size) self.assertEqual(c['vanilla']['./usr/share/doc/vanilla/Makefile']['linkto'], None) self.assertEqual(c['vanilla']['./usr/share/doc/vanilla/changelog.gz']['linkto'], None) self.assertEqual(c['vanilla']['./usr/share/doc/vanilla/notapng.png']['linkto'], None) self.assertEqual(c['chocolate']['./usr/share/doc/chocolate/test.c']['size'], 3) self.assertEqual(c['chocolate']['./usr/share/doc/chocolate/test.c']['linkto'], None) # link to transitive dependency self.assertEqual(c['chocolate']['./usr/share/doc/chocolate/Makefile']['linkto'], '../libbase1/Makefile') self.assertEqual(c['chocolate']['./usr/share/doc/chocolate/changelog.gz']['linkto'], '../libbase1/changelog.gz') self.assertEqual(c['chocolate']['./usr/share/doc/chocolate/test2.c']['linkto'], 'test.c') # this one was manually created by chocolate.links above self.assertEqual(c['chocolate']['./usr/share/doc/chocolate/notapng.png']['linkto'], '../vanilla/changelog.gz') self.assertEqual(c['chocolate']['./usr/share/doc/chocolate/nirvana1']['linkto'], '/bin/nonexisting') self.assertEqual(c['chocolate']['./usr/share/doc/chocolate/nirvana2']['linkto'], 'nonexisting') def test_doc_symlink_parallel_fixed(self): '''doc symlinking: parallel=4 build''' try: os.environ['DEB_BUILD_OPTIONS'] = 'parallel=4' # as this is a race condition, run it a couple of times for i in range(3): self.test_doc_symlink() # also test "unlimited" case os.environ['DEB_BUILD_OPTIONS'] = 'parallel,nostrip' # as this is a race condition, run it a couple of times self.test_doc_symlink() finally: os.environ['DEB_BUILD_OPTIONS'] = '' def test_doc_symlink_parallel_unlimited(self): '''doc symlinking: unlimited parallel build''' try: os.environ['DEB_BUILD_OPTIONS'] = 'parallel,nostrip' # as this is a race condition, run it a couple of times for i in range(3): self.test_doc_symlink() finally: os.environ['DEB_BUILD_OPTIONS'] = '' def test_doc_symlink_archall(self): '''doc symlinking: Architecture: all, linking of identical files to dependency''' with open(os.path.join(self.pkgdir, 'debian', 'vanilla.docs'), 'w') as f: f.write('test.c') with open(os.path.join(self.pkgdir, 'debian', 'chocolate.docs'), 'w') as f: f.write('test.c') self.sed_control('/^Architecture:/ s/any/all/g; s/^Description: chocolate/Depends: libc6 (>= 2.6), vanilla\\n&/') orig_size = os.path.getsize(os.path.join(self.pkgdir, 'test.c')) self.build() c = self.deb_contents() self.assertEqual(c['vanilla']['./usr/share/doc/vanilla/test.c']['size'], orig_size) self.assertEqual(c['vanilla']['./usr/share/doc/vanilla/test.c']['linkto'], None) self.assertEqual(c['vanilla']['./usr/share/doc/vanilla/changelog.gz']['linkto'], None) self.assertEqual(c['chocolate']['./usr/share/doc/chocolate/test.c']['linkto'], '../vanilla/test.c') self.assertEqual(c['chocolate']['./usr/share/doc/chocolate/changelog.gz']['linkto'], '../vanilla/changelog.gz') def test_doc_symlink_dependency_cycle(self): '''doc symlinking: cyclic dependency''' with open(os.path.join(self.pkgdir, 'debian', 'vanilla.docs'), 'w') as f: f.write('test.c') with open(os.path.join(self.pkgdir, 'debian', 'chocolate.docs'), 'w') as f: f.write('test.c') self.sed_control('/^Architecture:/ s/any/all/g') self.sed_control('s/^Description: vanilla/Depends: chocolate\\n&/') self.sed_control('s/^Description: chocolate/Depends: vanilla\\n&/') orig_size = os.path.getsize(os.path.join(self.pkgdir, 'test.c')) self.build() c = self.deb_contents() vanilla_link = c['vanilla']['./usr/share/doc/vanilla/test.c']['linkto'] chocolate_link = c['chocolate']['./usr/share/doc/chocolate/test.c']['linkto'] # exactly one of them has to be a symlink self.assertTrue(vanilla_link is None or chocolate_link is None) self.assertTrue(vanilla_link is not None or chocolate_link is not None) if vanilla_link is None: file_pkg = "vanilla" link_pkg = "chocolate" else: file_pkg = "chocolate" link_pkg = "vanilla" self.assertEqual(c[file_pkg]['./usr/share/doc/%s/test.c' % (file_pkg,)]['linkto'], None) self.assertEqual(c[file_pkg]['./usr/share/doc/%s/test.c' % (file_pkg,)]['size'], orig_size) self.assertEqual(c[file_pkg]['./usr/share/doc/%s/changelog.gz' % (file_pkg,)]['linkto'], None) self.assertEqual(c[link_pkg]['./usr/share/doc/%s/test.c' % (link_pkg,)]['linkto'], '../%s/test.c' % (file_pkg,)) self.assertEqual(c[link_pkg]['./usr/share/doc/%s/changelog.gz' % (link_pkg,)]['linkto'], '../%s/changelog.gz' % (file_pkg,)) def test_doc_symlink_disable(self): '''doc symlinking: Disabling with $NO_DOC_PKG_MANGLE''' with open(os.path.join(self.pkgdir, 'debian', 'vanilla.docs'), 'w') as f: f.write('test.c') with open(os.path.join(self.pkgdir, 'debian', 'chocolate.docs'), 'w') as f: f.write('test.c') self.sed_control('/^Architecture:/ s/any/all/g; s/^Description: chocolate/Depends: libc6 (>= 2.6), vanilla\\n&/') orig_size = os.path.getsize(os.path.join(self.pkgdir, 'test.c')) self.build(extra_env={'NO_DOC_PKG_MANGLE': '1'}) c = self.deb_contents() self.assertEqual(c['chocolate']['./usr/share/doc/chocolate/test.c']['size'], orig_size) self.assertEqual(c['chocolate']['./usr/share/doc/chocolate/test.c']['linkto'], None) def test_gnome_help(self): '''GNOME help symlinking and static translation tarball''' os.makedirs(os.path.join(self.pkgdir, 'help', 'C', 'figures')) os.makedirs(os.path.join(self.pkgdir, 'help', 'de', 'figures')) os.makedirs(os.path.join(self.pkgdir, 'help', 'es', 'figures')) with open(os.path.join(self.pkgdir, 'help', 'C', 'figures', 'main.png'), 'w') as f: f.write('moo') with open(os.path.join(self.pkgdir, 'help', 'C', 'index.html'), 'w') as f: f.write('htmlC') # "translated" with open(os.path.join(self.pkgdir, 'help', 'de', 'figures', 'main.png'), 'w') as f: f.write('muh!') with open(os.path.join(self.pkgdir, 'help', 'de', 'index.html'), 'w') as f: f.write('htmlde') # "untranslated" with open(os.path.join(self.pkgdir, 'help', 'es', 'figures', 'main.png'), 'w') as f: f.write('moo') with open(os.path.join(self.pkgdir, 'help', 'es', 'index.html'), 'w') as f: f.write('htmlC') # manual symlink os.symlink('../C/index.html', os.path.join(self.pkgdir, 'help', 'de', 'link.html')) with open(os.path.join(self.pkgdir, 'debian', 'vanilla.install'), 'a') as f: f.write('help/* usr/share/gnome/help/vanilla/\n') self.build() self.check_deb_mo(False) c = self.deb_contents() # C always keeps the originals self.assertEqual(c['vanilla']['./usr/share/gnome/help/vanilla/C/index.html']['size'], 5) self.assertEqual(c['vanilla']['./usr/share/gnome/help/vanilla/C/index.html']['linkto'], None) self.assertEqual(c['vanilla']['./usr/share/gnome/help/vanilla/C/figures/main.png']['size'], 3) self.assertEqual(c['vanilla']['./usr/share/gnome/help/vanilla/C/figures/main.png']['linkto'], None) # manual symlink untouched self.assertEqual(c['vanilla']['./usr/share/gnome/help/vanilla/de/link.html']['linkto'], '../C/index.html') # translated de will be replaced with symlink to langpack self.assertEqual(c['vanilla']['./usr/share/gnome/help/vanilla/de/index.html']['linkto'], '../../../help-langpack/vanilla/de/index.html') self.assertEqual(c['vanilla']['./usr/share/gnome/help/vanilla/de/figures/main.png']['linkto'], '../../../../help-langpack/vanilla/de/figures/main.png') # untranslated es will be replace with a symlink to C file self.assertEqual(c['vanilla']['./usr/share/gnome/help/vanilla/es/index.html']['linkto'], '../C/index.html') self.assertEqual(c['vanilla']['./usr/share/gnome/help/vanilla/es/figures/main.png']['linkto'], '../../C/figures/main.png') # translation tarball should not have the C files nor the identical # copies, just the actually translated ones tar = tarfile.open(self.static_translations_tar) names = tar.getnames() tar.close() self.assertTrue('./vanilla/usr/share/gnome/help/vanilla/de/figures/main.png' in names) self.assertTrue('./vanilla/usr/share/gnome/help/vanilla/de/index.html' in names) self.assertFalse('./vanilla/usr/share/gnome/help/vanilla/es/figures/main.png' in names) self.assertFalse('./vanilla/usr/share/gnome/help/vanilla/es/index.html' in names) self.assertFalse('./vanilla/usr/share/gnome/help/vanilla/C/figures/main.png' in names) self.assertFalse('./vanilla/usr/share/gnome/help/vanilla/C/index.html' in names) def test_mallard_help(self): '''Mallard help symlinking and static translation tarball''' os.makedirs(os.path.join(self.pkgdir, 'help', 'C', 'vanilla', 'figures')) os.makedirs(os.path.join(self.pkgdir, 'help', 'de', 'vanilla', 'figures')) os.makedirs(os.path.join(self.pkgdir, 'help', 'es', 'vanilla', 'figures')) with open(os.path.join(self.pkgdir, 'help', 'C', 'vanilla', 'figures', 'main.png'), 'w') as f: f.write('moo') with open(os.path.join(self.pkgdir, 'help', 'C', 'vanilla', 'index.page'), 'w') as f: f.write('htmlC') # "translated" with open(os.path.join(self.pkgdir, 'help', 'de', 'vanilla', 'figures', 'main.png'), 'w') as f: f.write('muh!') with open(os.path.join(self.pkgdir, 'help', 'de', 'vanilla', 'index.page'), 'w') as f: f.write('htmlde') # "untranslated" with open(os.path.join(self.pkgdir, 'help', 'es', 'vanilla', 'figures', 'main.png'), 'w') as f: f.write('moo') with open(os.path.join(self.pkgdir, 'help', 'es', 'vanilla', 'index.page'), 'w') as f: f.write('htmlC') # manual symlink os.symlink('../../C/vanilla/index.page', os.path.join(self.pkgdir, 'help', 'de', 'vanilla', 'link.page')) with open(os.path.join(self.pkgdir, 'debian', 'vanilla.install'), 'a') as f: f.write('help usr/share/\n') self.build() self.check_deb_mo(False) c = self.deb_contents() # C always keeps the originals self.assertEqual(c['vanilla']['./usr/share/help/C/vanilla/index.page']['size'], 5) self.assertEqual(c['vanilla']['./usr/share/help/C/vanilla/index.page']['linkto'], None) self.assertEqual(c['vanilla']['./usr/share/help/C/vanilla/figures/main.png']['size'], 3) self.assertEqual(c['vanilla']['./usr/share/help/C/vanilla/figures/main.png']['linkto'], None) # manual symlink untouched self.assertEqual(c['vanilla']['./usr/share/help/de/vanilla/link.page']['linkto'], '../../C/vanilla/index.page') # translated de will be replaced with symlink to langpack self.assertEqual(c['vanilla']['./usr/share/help/de/vanilla/index.page']['linkto'], '../../../help-langpack/de/vanilla/index.page') self.assertEqual(c['vanilla']['./usr/share/help/de/vanilla/figures/main.png']['linkto'], '../../../../help-langpack/de/vanilla/figures/main.png') # untranslated es will be replace with a symlink to C file self.assertEqual(c['vanilla']['./usr/share/help/es/vanilla/index.page']['linkto'], '../../C/vanilla/index.page') self.assertEqual(c['vanilla']['./usr/share/help/es/vanilla/figures/main.png']['linkto'], '../../../C/vanilla/figures/main.png') # translation tarball should not have the C files nor the identical # copies, just the actually translated ones tar = tarfile.open(self.static_translations_tar) names = tar.getnames() tar.close() self.assertTrue('./vanilla/usr/share/help/de/vanilla/figures/main.png' in names) self.assertTrue('./vanilla/usr/share/help/de/vanilla/index.page' in names) self.assertFalse('./vanilla/usr/share/help/es/vanilla/figures/main.png' in names) self.assertFalse('./vanilla/usr/share/help/es/vanilla/index.page' in names) self.assertFalse('./vanilla/usr/share/help/C/vanilla/figures/main.png' in names) self.assertFalse('./vanilla/usr/share/help/C/vanilla/index.page' in names) def test_dh_translations(self): '''dh_translations''' # this should always strip pot = os.path.join(self.pkgdir, 'po', 'icecream.pot') self.assertFalse(os.path.exists(pot)) self.build() self.assertTrue(os.path.exists(pot)) with open(pot) as f: lines = f.readlines() self.assertTrue('msgid "icecream"\n' in lines) # check *.desktop stripping expected_desktop = {'simple': '''[Desktop Entry] Name=icecream Comment=Yummy! Exec=/usr/bin/vanilla X-Ubuntu-Gettext-Domain=icecream ''', 'translated': '''[Desktop Entry] Name=icecream GenericName=desert X-GNOME-FullName=Vanilla or Chocolate Comment=Yummy! Keywords=Dessert;Sweets; Exec=/usr/bin/vanilla X-Ubuntu-Gettext-Domain=icecream ''', 'leadingspace': ''' [Desktop Entry] Name=icecream Comment=Yummy! Exec=/usr/bin/vanilla X-Ubuntu-Gettext-Domain=icecream ''', 'multisection': '''[Desktop Entry] Name=icecream GenericName=desert X-GNOME-FullName=Vanilla or Chocolate Comment=Yummy! Exec=/usr/bin/vanilla X-Ubuntu-Gettext-Domain=icecream X-Ayatana-Desktop-Shortcuts=Request [Request Shortcut Group] Name=Request some icecream Exec=vanilla request: OnlyShowIn=Messaging Menu ''', 'withdomain': '''[Desktop Entry] Name=icecream Comment=Yummy! X-GNOME-Gettext-Domain=icecream Exec=/usr/bin/vanilla ''', 'withdomain2': '''[Desktop Entry] Name=icecream Comment=Yummy! Exec=/usr/bin/vanilla X-Ubuntu-Gettext-Domain=icecream ''', } for name, expected in expected_desktop.items(): with open(os.path.join(self.pkgdir, 'debian/vanilla/usr/share/applications/%s.desktop' % name)) as f: actual = f.read() self.assertEqual(actual, expected, '%s.desktop mismatch:\n"%s"' % (name, actual)) # check *.server domain addition with open(os.path.join(self.pkgdir, 'debian/vanilla/usr/lib/bonobo/servers/bonobo.server')) as f: self.assertEqual(f.read(), ''' ''') # check *.policy domain addition and stripping with open(os.path.join(self.pkgdir, 'debian/vanilla/usr/share/polkit-1/actions/icecream.policy')) as f: self.assertEqual(f.read(), ''' World Ice, Inc. Get information about ice cream System policy prevents querying icecream info yes ''') # check *.schemas domain addition and stripping with open(os.path.join(self.pkgdir, 'debian/vanilla/usr/share/gconf/schemas/icecream.schemas')) as f: actual = f.read() expected = ''' /apps/icecream/simple icecream bool FALSE icecream Simple bool option Bool doc /apps/icecream/localedefault icecream string xxx icecream CCC Locale dependent default option Locale doc dede ''' self.assertEqual(actual, expected) def test_dh_translations_no_domain(self): '''dh_translations on package without po/Makefile''' os.remove(os.path.join(self.pkgdir, 'po', 'Makefile')) self.build() # should not touch files file_pairs = [ (os.path.join(self.pkgdir, 'data/translated.desktop'), os.path.join(self.pkgdir, 'debian/vanilla/usr/share/applications/translated.desktop')), (os.path.join(self.pkgdir, 'data/icecream.schemas'), os.path.join(self.pkgdir, 'debian/vanilla/usr/share/gconf/schemas/icecream.schemas')), ] for (orig, ship) in file_pairs: with open(orig, encoding='UTF-8') as forig: with open(ship, encoding='UTF-8') as fship: self.assertEqual(forig.read(), fship.read()) def test_dh_translations_python(self): '''dh_translations: Get domain from Python setup.cfg''' os.remove(os.path.join(self.pkgdir, 'po', 'Makefile')) with open(os.path.join(self.pkgdir, 'setup.cfg'), 'w') as f: f.write('[build_i18n]\ndomain=icecream\n') self.build() with open(os.path.join(self.pkgdir, 'debian/vanilla/usr/share/applications/translated.desktop')) as f: self.assertTrue('X-Ubuntu-Gettext-Domain=icecream' in f.read()) def test_dh_translations_cmake(self): '''dh_translations: Get domain from cmake ./CMakeLists.txt''' os.remove(os.path.join(self.pkgdir, 'po', 'Makefile')) with open(os.path.join(self.pkgdir, 'CMakeLists.txt'), 'w') as f: f.write('set (GETTEXT_PACKAGE "icecream")\n') with open(os.path.join(self.pkgdir, 'po', 'POTFILES.in'), 'w') as f: f.write('test.c\n') pot = os.path.join(self.pkgdir, 'po', 'icecream.pot') self.assertFalse(os.path.exists(pot)) self.build() self.assertTrue(os.path.exists(pot)) with open(pot) as f: lines = f.readlines() self.assertTrue('msgid "icecream"\n' in lines) def test_dh_translations_cmake_subfolder(self): '''dh_translations: Get domain from cmake po/CMakeLists.txt''' os.remove(os.path.join(self.pkgdir, 'po', 'Makefile')) with open(os.path.join(self.pkgdir, 'po', 'CMakeLists.txt'), 'w') as f: # also use a different syntax f.write('set(GETTEXT_PACKAGE icecream)\n') with open(os.path.join(self.pkgdir, 'po', 'POTFILES.in'), 'w') as f: f.write('test.c\n') pot = os.path.join(self.pkgdir, 'po', 'icecream.pot') self.assertFalse(os.path.exists(pot)) self.build() self.assertTrue(os.path.exists(pot)) with open(pot) as f: lines = f.readlines() self.assertTrue('msgid "icecream"\n' in lines) # # main # unittest.main() pkgbinarymangler-121/test/pickle_argv0000775000000000000000000000015611560712426015004 0ustar #!/usr/bin/python3 import pickle import sys import os os.write(sys.stdout.fileno(), pickle.dumps(sys.argv)) pkgbinarymangler-121/test/icecream/0000775000000000000000000000000012311774164014340 5ustar pkgbinarymangler-121/test/icecream/po-vanilla/0000775000000000000000000000000012311774164016402 5ustar pkgbinarymangler-121/test/icecream/po-vanilla/de.po0000664000000000000000000000025211426557622017335 0ustar msgid "" msgstr "" "Project-Id-Version: icecream 0.1\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" msgid "vanilla" msgstr "Vanille" pkgbinarymangler-121/test/icecream/po-vanilla/vanilla.pot0000664000000000000000000000024311426557622020557 0ustar msgid "" msgstr "" "Project-Id-Version: icecream 0.1\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" msgid "vanilla" msgstr "" pkgbinarymangler-121/test/icecream/po-vanilla/fr.po0000664000000000000000000000025311426557622017355 0ustar msgid "" msgstr "" "Project-Id-Version: icecream 0.1\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" msgid "vanilla" msgstr "vanillé" pkgbinarymangler-121/test/icecream/po-chocolate/0000775000000000000000000000000012311774164016715 5ustar pkgbinarymangler-121/test/icecream/po-chocolate/de.po0000664000000000000000000000025711426557622017655 0ustar msgid "" msgstr "" "Project-Id-Version: icecream 0.1\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" msgid "chocolate" msgstr "Schokolade" pkgbinarymangler-121/test/icecream/po-chocolate/chocolate.pot0000664000000000000000000000024511426557622021407 0ustar msgid "" msgstr "" "Project-Id-Version: icecream 0.1\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" msgid "chocolate" msgstr "" pkgbinarymangler-121/test/icecream/po-chocolate/fr.po0000664000000000000000000000025511426557622017672 0ustar msgid "" msgstr "" "Project-Id-Version: icecream 0.1\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" msgid "chocolate" msgstr "chocolat" pkgbinarymangler-121/test/icecream/po/0000775000000000000000000000000012311774164014756 5ustar pkgbinarymangler-121/test/icecream/po/de.po0000664000000000000000000000024711540107601015676 0ustar msgid "" msgstr "" "Project-Id-Version: icecream 0.1\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" msgid "icecream" msgstr "Eis" pkgbinarymangler-121/test/icecream/po/Makefile0000664000000000000000000000015511540112162016402 0ustar GETTEXT_PACKAGE=icecream default: $(GETTEXT_PACKAGE).pot: xgettext -o $(GETTEXT_PACKAGE).pot ../test.c -a pkgbinarymangler-121/test/icecream/Makefile0000664000000000000000000000164111624251527016001 0ustar default: install: # install mo files for DOMAIN in vanilla chocolate; do \ for f in po-$$DOMAIN/*.po; do \ D=$$DESTDIR/usr/share/locale/`basename $$f .po`/LC_MESSAGES/; \ install -d -m 755 $$D; \ msgfmt -o $$D/$$DOMAIN.mo $$f; \ done; \ done install -D -m 600 foo%.png $$DESTDIR/usr/share/icecream/foo%.png ln -s foo%.png $$DESTDIR/usr/share/icecream/foolink.png install -D -m 644 notapng.png $$DESTDIR/usr/share/icecream/notapng.png install -d $$DESTDIR/usr/share/applications/ $$DESTDIR/usr/lib/bonobo/servers/ $$DESTDIR/usr/share/polkit-1/actions/ $$DESTDIR/usr/share/gconf/schemas install -m 644 data/*.desktop $$DESTDIR/usr/share/applications/ install -m 644 data/*.server $$DESTDIR/usr/lib/bonobo/servers/ install -m 644 data/*.policy $$DESTDIR/usr/share/polkit-1/actions/ install -m 644 data/*.schemas $$DESTDIR/usr/share/gconf/schemas clean: rm -f test .PHONY: clean pkgbinarymangler-121/test/icecream/data/0000775000000000000000000000000012311774164015251 5ustar pkgbinarymangler-121/test/icecream/data/multisection.desktop0000664000000000000000000000074711540172276021372 0ustar [Desktop Entry] Name=icecream Name[de]=Eiscreme Name[en_GB]=icecream GenericName=desert GenericName[de]=Dessert GenericName[en_GB]=desert X-GNOME-FullName=Vanilla or Chocolate X-GNOME-FullName[de]=Vanille oder Schokolade X-GNOME-FullName[en_GB]=Vanilla or Chocolate Comment=Yummy! Comment[de]=Lecker! Comment[en_GB]=Wonderful! Exec=/usr/bin/vanilla X-Ayatana-Desktop-Shortcuts=Request [Request Shortcut Group] Name=Request some icecream Exec=vanilla request: OnlyShowIn=Messaging Menu pkgbinarymangler-121/test/icecream/data/withdomain2.desktop0000664000000000000000000000014411540355524021066 0ustar [Desktop Entry] Name=icecream Comment=Yummy! Exec=/usr/bin/vanilla X-Ubuntu-Gettext-Domain=icecream pkgbinarymangler-121/test/icecream/data/translated.desktop0000664000000000000000000000063412024003615020773 0ustar [Desktop Entry] Name=icecream Name[de]=Eiscreme Name[en_GB]=icecream GenericName=desert GenericName[de]=Dessert GenericName[en_GB]=desert X-GNOME-FullName=Vanilla or Chocolate X-GNOME-FullName[de]=Vanille oder Schokolade X-GNOME-FullName[en_GB]=Vanilla or Chocolate Comment=Yummy! Comment[de]=Lecker! Comment[en_GB]=Wonderful! Keywords=Dessert;Sweets; Keywords[de]=Nachtisch;Süßigkeiten; Exec=/usr/bin/vanilla pkgbinarymangler-121/test/icecream/data/leadingspace.desktop0000664000000000000000000000010411540121330021236 0ustar [Desktop Entry] Name=icecream Comment=Yummy! Exec=/usr/bin/vanilla pkgbinarymangler-121/test/icecream/data/icecream.policy0000664000000000000000000000103211540201213020215 0ustar World Ice, Inc. Get information about ice cream Informationen über Eiscreme anfordern System policy prevents querying icecream info Die Systemrichtlinien untersagen die Abfrage von Eiscreme-Informationen yes pkgbinarymangler-121/test/icecream/data/withdomain.desktop0000664000000000000000000000014311540355517021005 0ustar [Desktop Entry] Name=icecream Comment=Yummy! X-GNOME-Gettext-Domain=icecream Exec=/usr/bin/vanilla pkgbinarymangler-121/test/icecream/data/icecream.schemas0000664000000000000000000000147311540220705020361 0ustar /apps/icecream/simple icecream bool FALSE Simple bool option Bool doc Einfache bool-Option Bool dok /apps/icecream/localedefault icecream string xxx CCC Locale dependent default option Locale doc dede Locale-abhängige Option Locale dok pkgbinarymangler-121/test/icecream/data/simple.desktop0000664000000000000000000000010311540117636020125 0ustar [Desktop Entry] Name=icecream Comment=Yummy! Exec=/usr/bin/vanilla pkgbinarymangler-121/test/icecream/data/bonobo.server0000664000000000000000000000103611540175143017752 0ustar pkgbinarymangler-121/test/icecream/foo%.png0000664000000000000000000000123711465061525015700 0ustar PNG  IHDRddpTsRGBbKGD pHYs  tIME %kEtEXtCommentCreated with GIMPWIDATxN@E@|qkP;o00C C[:dBüf; 6X3 HB! @B!BNa3$Np%%-$-XHI,pd?G =Bd[ٓ8dǹYB,Biq5!'#T~%E}%\DDOKQ_ {B,]Vb.ԟod_1ŻKQ?}Qdb(dyV Ub鲀. !@B!!COr/ Îׄc*c -~g!G,@B9ַ;d[ܠuB @B!BA !>γ.)BkeCjVBQg\BQBz'ݬmswȶD46j*] int main() { const char* s = gettext("icecream"); } pkgbinarymangler-121/test/icecream/notapng.png0000664000000000000000000000363611463556504016527 0ustar JFIFCreated with GIMPC       C dd" 4!1AaQ $2"#%Rq -!"A1aQ2Bqr ?@3nwyNӬM:N~ZO\gSMZEK`'}NZ*p?s!LV]htl4N~`;6Ә'8ؾ)UJ9F;(e? ~ylDDDDgz,~qq%l?R5C*K˲϶G:O-<ӥSSmg RQ cykjwPI܅Zُ*v'q8:6r{^ciX.lc-JB?)hvOs=m[,ʭ&K΂Es:ɆKa{&]r28[)\6Ta*թ3 ܖ%t-'+2}+xnipb RO"sdɐʉMtJI"#Zώ՜cUxzKcS?u`ZZ6TދIPZSbA/9xW_W+W|a|~V69Zs{g X众^ϑX%23Hg|@97׽5?ƛlFQLT%Uj/s\W-F(LhtBT/_fڧuzZTTUؠB;0͵\sk?9RLN-X3HgPԲ1c)fw3e%>4>[ NSJ4(x3/֥2BY=FX#?x{O7_U+T]@5@q}<ȧuoi}bL5"ONFPiF\)'[) h/me?dUXUH_c#+*/c/.F)WZVLI$҃lҒNc,9/ٔ947M1i7pZSܐfDZ}Y}yahMRO57 dSzJliɿc `)'\r2A'Df+rěNxP%W 1UTE RO#I YVł䱑iHg5N6%E|hm$&R $ДIGiNMJMQ*ZSi M4i6LjXjXo=.Dz{?#Om: 8z`8bV@`J'Y>ջ~,%*VK}O!IJۧ4j؈܋.ɟ% ͡}@VXI:Eqq׍KqxmŴL,ᑚJk%^ө9mgcǩB}Z|Rk&yr$ɐuVRֵԣ3333ə߻i<?~O>W}ORV߄ϱ+c ?@lb|0%r""""""""""""""""pkgbinarymangler-121/test/icecream/debian/0000775000000000000000000000000012311774164015562 5ustar pkgbinarymangler-121/test/icecream/debian/chocolate.install0000664000000000000000000000004011426557622021111 0ustar usr/share/locale/*/*/chocolate* pkgbinarymangler-121/test/icecream/debian/copyright0000664000000000000000000000000411426557622017513 0ustar GPL pkgbinarymangler-121/test/icecream/debian/changelog0000664000000000000000000000277711466273657017464 0ustar icecream (12) testsuite; urgency=low * release 12 -- Martin Pitt Tue, 06 Jul 2010 15:15:58 +0200 icecream (11) testsuite; urgency=low * release 11 -- Martin Pitt Tue, 06 May 2010 15:15:58 +0200 icecream (10) testsuite; urgency=low * release 10 -- Martin Pitt Tue, 06 Apr 2010 15:15:58 +0200 icecream (9) testsuite; urgency=low * release 9 -- Martin Pitt Tue, 06 Mar 2010 15:15:58 +0100 icecream (8) testsuite; urgency=low * release 8 -- Martin Pitt Tue, 06 Feb 2010 15:15:58 +0100 icecream (7) testsuite; urgency=low * release 7 -- Martin Pitt Tue, 06 Jan 2010 15:15:58 +0100 icecream (6) testsuite; urgency=low * release 6 -- Martin Pitt Tue, 06 Dec 2009 15:15:58 +0100 icecream (5) testsuite; urgency=low * release 5 -- Martin Pitt Tue, 06 Nov 2009 15:15:58 +0100 icecream (4) testsuite; urgency=low * release 4 -- Martin Pitt Tue, 06 Oct 2009 15:15:58 +0100 icecream (3) testsuite; urgency=low * release 3 -- Martin Pitt Tue, 06 Sep 2009 15:15:58 +0200 icecream (2) testsuite; urgency=low * release 2 -- Martin Pitt Tue, 06 Aug 2009 15:15:58 +0200 icecream (1) testsuite; urgency=low * Initial release -- Martin Pitt Tue, 06 Jul 2009 15:15:58 +0200 pkgbinarymangler-121/test/icecream/debian/compat0000664000000000000000000000000211426557622016764 0ustar 7 pkgbinarymangler-121/test/icecream/debian/rules0000775000000000000000000000023011712024035016622 0ustar #!/usr/bin/make -f %: dh $@ --with translations --parallel override_dh_fixperms: dh_fixperms -X*.png override_dh_install: dh_install dh_buildinfo pkgbinarymangler-121/test/icecream/debian/control0000664000000000000000000000044011664722772017173 0ustar Source: icecream Section: utils Priority: extra Maintainer: Joe User Build-Depends: debhelper (>= 7.0.50~) Standards-Version: 3.9.1 Package: vanilla Architecture: all Description: vanilla vanilla Package: chocolate Architecture: any Description: chocolate chocolate pkgbinarymangler-121/test/icecream/debian/vanilla.install0000664000000000000000000000020011540217615020564 0ustar usr/share/locale/*/*/vanilla* usr/share/icecream/*.png usr/share/applications usr/share/polkit-1 usr/share/gconf usr/lib/bonobo pkgbinarymangler-121/dh_builddeb0000775000000000000000000000045211665113501013756 0ustar #!/bin/bash # Wrapper around dh_builddeb to disable parallel invocations of dpkg-deb. This # would break predictable documentation symlinking in pkgstripfiles. set -e DEB_BUILD_OPTIONS=$(echo "$DEB_BUILD_OPTIONS" | sed -r 's/parallel(=[0-9]+)?//') exec -a "$0" dh_builddeb.pkgbinarymangler "$@" pkgbinarymangler-121/pkgstripfiles0000775000000000000000000001373512315121522014422 0ustar #!/bin/bash -e CONFFILE=${PKGBINARYMANGLER_CONF_DIR:-/etc/pkgbinarymangler}/stripfiles.conf . ${PKGBINARYMANGLER_COMMON_PATH:-/usr/share/pkgbinarymangler}/common # # Remove buildinfo files and upstream changelogs; take care to keep native changelogs # clean_upstream_changelogs() { # skip if we have symlinked dirs (e. g. Perl, see LP#923430) if [ -L usr/share/doc -o -L usr/share/doc/$PKGNAME ]; then return fi dch=usr/share/doc/$PKGNAME/changelog.Debian.gz if [ ! -e "$dch" ] && [ ! -h "$dch" ]; then dch=usr/share/doc/$PKGNAME/changelog.gz fi if [ -d usr/share/doc ]; then (find usr/share/doc -type f \( -name buildinfo_*.gz -o -iname 'changelog.*' -o -iname changes -o -iname changes.gz -o -iname '*.changes.gz' \) -a ! -name `basename $dch` ) | while read f; do echo ".. removing $f" rm "$f" [ ! -f DEBIAN/md5sums ] || sed -i "\& $f$&d" DEBIAN/md5sums done fi } # # Only keep the topmost ten entries in Debian changelogs. If we truncate, add a # pointer to apt-get changelog. # strip_debian_changelogs() { record_sep="^[^ ]+ (.*) .*; urgency" if [ -e "$dch" -a ! -L "$dch" ]; then record_count=0 changelog="" gzip -cd $dch | (while read; do if [[ "$REPLY" =~ $record_sep ]]; then ((++record_count)) if [ "$record_count" -eq 11 ]; then echo "pkgstripfiles: Truncating $dch to topmost ten records" echo -e "${changelog}# For older changelog entries, run 'apt-get changelog $PKGNAME'" | gzip -9n > $dch if [ -f DEBIAN/md5sums ]; then MD5=`md5sum "$dch"` sed -i "s%^.* $dch\$%$MD5%" DEBIAN/md5sums fi break fi fi changelog="$changelog$REPLY\n" done) fi } # # Optimize PNGs # optimize_pngs() { # skip PNG modification for games; they often rely on their particular image # format if [ "${SECTION%games}" != "$SECTION" ]; then echo "pkgstripfiles: Skipping PNG optimization for package in games section." return fi # skip -doc packages; optimizing them takes a long build time and is not so # important as these are not on the CDs if [ "${PKGNAME%-doc}" != "$PKGNAME" ]; then echo "pkgstripfiles: Disabled PNG optimization for -doc package $PKGNAME (to save build time)" return fi # also skip when disabling explicitly if [ -n "$NO_PNG_PKG_MANGLE" ]; then echo "pkgstripfiles: Disabled PNG optimization for package." return fi time_start=`date +%s` # optipng/advancecomp find -type f -name '*.png' | while read f; do orig_perms=`stat -c %a "$f"` if ! optipng -o4 -preserve "$f"; then echo "WARNING: optipng failed on $f, ignoring" >&2 fi if ! advpng -z4 "$f"; then echo "WARNING: advpng failed on $f, ignoring" >&2 fi # advpng does not keep permissions chmod "$orig_perms" "$f" # update md5sum if [ -f DEBIAN/md5sums ]; then f=${f#./} MD5=`md5sum "$f"` sed -i "s%^.* ${f//%/\\%}\$%${MD5//%/\\%}%" DEBIAN/md5sums fi done time_end=`date +%s` duration=$(($time_end-$time_start)) echo "pkgstripfiles: PNG optimization for package $PKGNAME took $duration s" >&2 } # # Symlink identical documentation to depending packages # symlink_doc() { if [ -n "$CDBS_NO_DOC_SYMLINKING" -o -n "$NO_DOC_PKG_MANGLE" ]; then echo "pkgstripfiles: documentation symlinking disabled" return fi # skip if doc dirs are already symlinks if [ ! -d usr/share/doc -o -h usr/share/doc -o -h usr/share/doc/$PKGNAME ]; then return fi # iterate over all dependencies for dep in `perl -ne 'if (/^(Pre-)?Depends:/) {s/^\w+://; foreach (split /,/) { @f=split; print($f[0], "\n"); } }' DEBIAN/control`; do [ -d ../$dep/usr/share/doc ] || continue # don't replace docs with symlinks to matching files in dependent # packages when the dependent package is arch: all and the depending # package isn't; ensures consistency between packages built with -b vs. # -B, required by multiarch. readctrl ../$dep/DEBIAN/control Architecture DEPARCH=$RET if [ "$ARCHITECTURE" != "$DEPARCH" ] && [ "$DEPARCH" = "all" ]; then echo "Skipping arch: any to arch: all dependency to $dep" continue fi echo "Searching for duplicated docs in dependency $dep..." ( r=`pwd` cd usr/share/doc/$PKGNAME find -type f ! -name copyright | while read f; do f=${f#./} thisfile="$r/usr/share/doc/$PKGNAME/$f" depfile="$r/../$dep/usr/share/doc/$dep/$f" if [ -L $depfile ]; then dep=$(basename $(dirname $(readlink "$depfile"))) depfile="$r/../$dep/usr/share/doc/$dep/$f" fi [ "$dep" != "$PKGNAME" ] || continue [ -f "$depfile" ] || continue # special-case Debian changelog: as we truncate them they may # differ, so only compare the topmost lines if [ "$f" = "`basename $dch`" ]; then if ! cmp <(zcat $thisfile | head -n 20) <(zcat $depfile | head -n 20); then continue fi elif ! zcmp "$thisfile" "$depfile" >/dev/null; then continue fi # files are identical, symlink echo " symlinking $f in $PKGNAME to file in $dep" rm "$thisfile" prefix="../" slashes="${f//[^\/]}" slashcount=${#slashes} while [ $slashcount -gt 0 ]; do prefix="../$prefix" slashcount=$((slashcount - 1)) done ln -s "${prefix}${dep}/$f" "$thisfile"; [ ! -f $r/DEBIAN/md5sums ] || sed -i "\& usr/share/doc/$PKGNAME/$f$&d" $r/DEBIAN/md5sums done ) done } # # main # # don't do anything for PPA builds if [ -f "$BUILDINFO" ]; then if grep -qs '^Purpose: PPA' "$BUILDINFO"; then if grep -q '/oem-archive' ${PKGBINARYMANGLER_APT_CONF_DIR:-/etc/apt}/sources.list; then echo "INFO: Running pkgstripfiles for OEM PPA build" else echo "INFO: Disabling pkgstripfiles for PPA build" exit 0 fi fi fi readctrl $PKGCTL Package PKGNAME=$RET readctrl $PKGCTL Section SECTION=$RET readctrl $PKGCTL Architecture ARCHITECTURE=$RET PKGDIR=$(dirname $(dirname $PKGCTL)) echo "pkgstripfiles: processing control file: $PKGCTL, package $PKGNAME, directory $PKGDIR" cd "$PKGDIR" clean_upstream_changelogs symlink_doc strip_debian_changelogs optimize_pngs pkgbinarymangler-121/dh_translations0000775000000000000000000001547112145421522014733 0ustar #!/usr/bin/perl -w =head1 NAME dh_translations - perform common translation related operations =cut use strict; use File::Find; use Debian::Debhelper::Dh_Lib; =head1 SYNOPSIS B [S>] =head1 DESCRIPTION dh_translations is a debhelper program to perform common translation related operations during package build: =over 4 =item Try to build a current PO template. =item Remove inline translations from *.desktop, *.server, *.schemas, and *.policy files and replace them with a link to the gettext domain, so that strings in them will get translated at runtime from *.mo files. This allows language packs to ship updated translations. =back =cut my ($domain, $use_intltool); # figure out intltool usage and domain sub check_buildsystem { $use_intltool = 0; if (open MAKEFILE, 'po/Makefile') { while () { $use_intltool = 1 if /intltool/; $domain = $1 if /^GETTEXT_PACKAGE\s*=\s*(\S*)/; } close (MAKEFILE); } if (!$domain && open CFGFILE, 'configure.ac') { while () { $use_intltool = 1 if /INTLTOOL/; $domain = $1 if /^GETTEXT_PACKAGE\s*=\s*(\S*)/; } close (CFGFILE); } if (!$domain && open CFGFILE, 'configure.in') { while () { $use_intltool = 1 if /INTLTOOL/; $domain = $1 if /^GETTEXT_PACKAGE\s*=\s*(\S*)/; } close (CFGFILE); } if (open CFGFILE, 'config.h') { while () { $domain = $1 if /^#define GETTEXT_PACKAGE\s*"(\S*)"/; } close (CFGFILE); } if (!$domain && open CFGFILE, 'setup.cfg') { while () { $domain = $1 if /^\s*domain\s*=\s*(\S*)/; } close (CFGFILE); } foreach my $ml ('CMakeLists.txt', 'po/CMakeLists.txt') { if (!$domain && open CMAKELISTSFILE, $ml) { while () { if ( -e 'po/POTFILES.in' ) { $use_intltool = 1; } $domain = $1 if /^set\s*\(GETTEXT_PACKAGE\s*"?([^\s"]*)"?\s*\)/; } close (CMAKELISTSFILE) } } verbose_print "check_buildsystem: got domain '$domain', using intltool: $use_intltool"; } # Try to build a POT sub build_pot { my @cmd; if ($use_intltool) { # use intltool-update if ($domain) { @cmd=('/usr/bin/intltool-update', '-p', '--verbose', '-g', $domain); } else { @cmd=('/usr/bin/intltool-update', '-p', '--verbose'); } } else { return unless -e 'po/Makefile'; if ($domain) { # let the Makefile itself handle it @cmd=('make', $domain . '.pot'); } else { warn 'Does not use intltool and po/Makefile does not define GETTEXT_PACKAGE, cannot build POT automatically'; return; } } verbose_print (escape_shell (@cmd)); chdir 'po'; system @cmd; chdir '..'; # try to build help POT if (-e 'help/Makefile') { chdir 'help'; system ('make', 'pot'); chdir '..'; } } # strip translations and add domain to *.desktop/*.directory sub process_desktop { my @lines = @{$_[0]}; my @result; my $in_desktop_entry = 0; my $added_domain = 0; foreach (@lines) { # filter out translated fields next if (/^(Name|GenericName|Comment|X-GNOME-FullName)\[/); if (/^[A-Za-z-0-9-]*Gettext-Domain\s*=/) { $added_domain = 1; } # catch section headers if (/^\[\s*(.+)\s*\]/) { $in_desktop_entry = ($1 eq 'Desktop Entry'); } # if we are ending the desktop section, append the domain if (/^\s*$/ && $in_desktop_entry && !$added_domain) { push @result, "X-Ubuntu-Gettext-Domain=$domain\n"; $added_domain = 1; } push @result, $_; } # single-section .desktop files without ending empty lines if ($in_desktop_entry && !$added_domain) { push @result, "X-Ubuntu-Gettext-Domain=$domain\n"; } return @result; } # add domain to Bonobo *.server files sub process_server { my @lines = @{$_[0]}; my @result; foreach (@lines) { if (/^ tag if ($in_locale) { if (/^\s*/) { if (!$wrote_locale_tag) { push @result, $locale_tag; $wrote_locale_tag = 1; } push @result, $_; } elsif (/^\s*<\/locale>/) { push @result, $_ if $wrote_locale_tag; $in_locale = 0; } } # case: locale name="C": add and leave alone elsif (/^(\s*)/) { push @result, "$1$domain\n"; push @result, $_; } # case: locale name="something": start $in_locale and purge and elsif (//; # to not kill all whitespace } } return @result; } # strip translations and add domain to *.policy files sub process_polkit { my @lines = @{$_[0]}; my @result; foreach (@lines) { # filter out translated fields next if (/<(message|description)\s+xml:lang=.*\/\1>/); # add domain s/<(message|description)\b/<$1 gettext-domain="$domain"/; push @result, $_; } return @result; } sub strip_file { my $f = $_; return unless $f =~ /\.(desktop|directory|server|policy|schemas)$/; my $ext = $1; return if -l $f or -d $f; # Skip directories and symlinks # See if we were asked to exclude this file. foreach my $x (@{$dh{EXCLUDE}}) { return if ($File::Find::name =~ m/\Q$x\E/); } print " $f\n"; my @lines; open F, $f or die "open $f: $!"; @lines = ; close F; if ($ext eq 'desktop' || $ext eq 'directory') { @lines = process_desktop \@lines; } elsif ($ext eq 'server' && index($File::Find::name, '/bonobo/servers/') > 0) { @lines = process_server \@lines; } elsif ($ext eq 'policy' && index($File::Find::name, '/polkit-1/actions/') > 0) { @lines = process_polkit \@lines; } elsif ($ext eq 'schemas' && index($File::Find::name, '/gconf/') > 0) { @lines = process_gconf \@lines; } # write back modified result open F, ">$f" or die "open $f: $!"; foreach (@lines) { print F $_; } } init(); check_buildsystem(); build_pot(); if ($domain) { print "dh_langpack: processing files to add translation domain '$domain'..\n"; foreach my $package (@{$dh{DOPACKAGES}}) { next if is_udeb($package); find(\&strip_file, tmpdir($package)) } } =head1 SEE ALSO L =head1 AUTHOR Martin Pitt Copyright (C) 2011 Canonical Ltd., licensed under the GNU GPL v2 or later. =cut pkgbinarymangler-121/translations.pm0000664000000000000000000000020011540343660014654 0ustar #!/usr/bin/perl use warnings; use strict; use Debian::Debhelper::Dh_Lib; insert_before("dh_compress", "dh_translations"); 1; pkgbinarymangler-121/debian/0000775000000000000000000000000012315122172013021 5ustar pkgbinarymangler-121/debian/pkgbinarymangler.postrm0000664000000000000000000000056711665115475017652 0ustar #!/bin/sh set -e case "$1" in remove|purge) # Remove our diversions dpkg-divert --remove --rename --package pkgbinarymangler --divert /usr/bin/dpkg-deb.pkgbinarymangler /usr/bin/dpkg-deb > /dev/null dpkg-divert --remove --rename --package pkgbinarymangler --divert /usr/bin/dh_builddeb.pkgbinarymangler /usr/bin/dh_builddeb > /dev/null ;; esac #DEBHELPER# exit 0 pkgbinarymangler-121/debian/copyright0000664000000000000000000000207411426557622014775 0ustar pkgbinarymangler is written and maintained by Martin Pitt and Adam Conrad Initial packaging was on Tue, 14 Dec 2004 18:21:49 +0100. The original source can always be found at: http://archive.ubuntu.com/ubuntu/pool/main/p/pkgbinarymangler/ Copyright (C) 2004 Canonical Ltd. 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 2 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 . On Debian systems, the complete text of the GNU General Public License can be found in `/usr/share/common-licenses/GPL'. pkgbinarymangler-121/debian/source/0000775000000000000000000000000012311774164014333 5ustar pkgbinarymangler-121/debian/source/format0000664000000000000000000000001511426557622015546 0ustar 3.0 (native) pkgbinarymangler-121/debian/changelog0000664000000000000000000013553112315122172014703 0ustar pkgbinarymangler (121) trusty; urgency=medium * pkgstripfiles: Count path components for ../ expansion on symlinks. -- Adam Conrad Thu, 27 Mar 2014 16:20:30 -0600 pkgbinarymangler (120) trusty; urgency=medium * pkgstripfiles: Fix escaping of % characters to also work with bash 4.3. -- Martin Pitt Tue, 18 Mar 2014 08:40:33 +0100 pkgbinarymangler (119) trusty; urgency=medium * Use "dpkg-deb --fsys-tarfile" instead of "ar p" in tests to extract files, to stop depending on gzip compression. Fixes test suite failures/FTBFS in current trusty. * Bump Standards-Version to 3.9.5 (no changes necessary). -- Martin Pitt Wed, 15 Jan 2014 10:28:41 +0100 pkgbinarymangler (118) saucy; urgency=low * dh_translations: If ./CMakeLists.txt does not have the domain, check in po/CMakeLists.txt, too. (first half of LP: #1181187) * dh_translations: Accept more variations (whitespace, quotes or not) of setting GETTEXT_PACKAGE in cmake files. (second half of LP: #1181187) * Bump Standards-Version to 3.9.4, no changes necessary. -- Martin Pitt Fri, 17 May 2013 15:00:23 +0200 pkgbinarymangler (117) quantal; urgency=low * pkgstripfiles: Remove buildinfo_.gz files as well. Update test/run accordingly. -- Martin Pitt Tue, 25 Sep 2012 15:18:49 +0200 pkgbinarymangler (116) precise; urgency=low * pkgstriptranslations: change X-GNOME-Keywords to official Keywords (lp: #949849) -- Sebastien Bacher Thu, 08 Mar 2012 18:59:11 +0100 pkgbinarymangler (115) precise; urgency=low [ Felix Geyer ] * pkgstriptranslations: Fix updating of md5sums in gnome2_help() and mallard_help(). (LP: #930757) -- Martin Pitt Wed, 15 Feb 2012 07:42:22 +0100 pkgbinarymangler (114) precise; urgency=low [ Felix Geyer ] * pkgstripfiles, symlink_doc(): Don't create symlinks that would point to the same package. (LP: #923343) * test/run: Add test_doc_symlink_dependency_cycle() to make sure that pkgstripfiles works correctly when there is a dependency cycle inside a source package. [ Martin Pitt ] * pkgstripfiles: Always update md5sum even if advpng fails. Also call advpng if optipng fails, to at least get some optimization. Thanks Felix Geyer! (LP: #923407) * pkgstripfiles: Do not truncate changelogs when they are in a different directory pointed to a symlink. Add corresponding test case which mimics the perl hack that it applies to its doc files. (LP: #923430) -- Martin Pitt Fri, 03 Feb 2012 06:36:35 +0100 pkgbinarymangler (113) precise; urgency=low * dh_translations: fixes previous issues harder (lp: #913085) -- Sebastien Bacher Fri, 13 Jan 2012 17:06:18 +0100 pkgbinarymangler (112) precise; urgency=low * dh_translations: - strip out quotes from the gettext domain (lp: #913085) -- Sebastien Bacher Fri, 13 Jan 2012 10:23:28 +0100 pkgbinarymangler (111) precise; urgency=low * small improvements to dh_translations: - close the correct file in the configure.ac case - try using configure.in after configure.ac, those are still common - get the gettext domain from config.h if possible, the configure.ac can use variables and reading from it would give the wrong value -- Sebastien Bacher Thu, 05 Jan 2012 15:20:36 +0100 pkgbinarymangler (110) precise; urgency=low [ Martin Pitt ] * pkgstripfiles: Log how many seconds the PNG optimization took. * pkgstripfiles: Skip PNG optimization for -doc packages. They sometimes take an inordinate amount of build time and are much less important as we do not ship them on CD images. [ Evan Broder ] * pkgstriptranslations: Use a copy of the code from dh_link to make sure pkgstriptranslations creates symlinks compliant with Debian Policy. (LP: #899520) * test/run: Adjust tests to expect relative symlinks. -- Martin Pitt Mon, 12 Dec 2011 12:19:21 +0100 pkgbinarymangler (109) precise; urgency=low * striptranslations.blacklist: Fix libapt entries, these are regexps, not globs. * striptranslations.blacklist: Add update-notifier. (LP: #562900) -- Martin Pitt Wed, 30 Nov 2011 07:58:02 +0100 pkgbinarymangler (108) precise; urgency=low * test/run: Fix creation of local diversion "fake" symlink to also work when pkgbinarymangler <= 106 is installed (as on our buildds when we try to build >= 107 the first time). * debian/pkgbinarymangler.preinst: Remove obsolete conffile and diversion migration code. This was last relevant in edgy. -- Martin Pitt Tue, 29 Nov 2011 10:21:32 +0100 pkgbinarymangler (107) precise; urgency=low * test/run, test_doc_symlink(): Simplify installation of "Makefile". * test/run, test_doc_symlink(): Introduce some test library binary packages to check handling of transitive dependencies. * pkgstripfiles, symlink_doc(): If the link destination target is itself a link, resolve it to directly link to the final target instead of not symlinking the file at all. * test/run: Add new test cases test_doc_symlink_parallel_{fixed,unlimited}() which run the symlink test with DEB_BUILD_OPTIONS "parallel=4" and "parallel" respectively. Run through them three times as this is a race condition and does not trigger every time. This reproduces LP #893826. * Add dh_builddeb: Wrapper around the debhelper command which filters out the "parallel" option from $DEB_BUILD_OPTIONS. We must not run dpkg-deb in parallel as this breaks a predictable doc symlink structure which we require for multi-arch. (LP: #893826) * debian/pkgbinarymangler.install: Install dh_builddeb wrapper. * debian/pkgbinarymangler.{preinst,postrm}: Set up diversion for dh_builddeb. -- Martin Pitt Tue, 29 Nov 2011 10:00:54 +0100 pkgbinarymangler (106) precise; urgency=low * Move code for determining the location of the binary package control file, and its existence check into common, and simplify pkgmaintainermangler, pkgsanitychecks, and pkgstripfiles. * pkgstriptranslations: Stop iterating over all binary packages, just process the current one. Update an existing translation tarball if it already exists from a previous run. This greatly speeds up package builds with lots of binary packages. (LP: #890595) Also reorganize the code to put the different tasks into separate functions, so that it becomes easier to read. Drop the now obsolete stripping of XPI files. * With this version, haskell-dummy builds in finite time and succeeds. (LP: #890596) -- Martin Pitt Tue, 15 Nov 2011 16:00:12 +0100 pkgbinarymangler (105) precise; urgency=low * pkgstriptranslations: Also strip X-GNOME-Keywords. Add corresponding test case. * dh_translations: Also check configure.ac for GETTEXT_DOMAIN. (LP: #786632) * pkgstripfiles: First symlink identical doc files, then truncate Debian changelogs. Otherwise truncated changelogs will never be identical due to the added "please see apt-get changelog " line. In oneiric and before this got hidden because of a wrong exit code of zcmp, which has been fixed in gzip 1.4 in precise. * pkgstripfiles: As we truncate long Debian changelogs, and a packages' dependencies may not have been processed by pkgstripfiles yet, Debian changelogs are sometimes different at the tail. Debian changelogs are generally identical between binary packages anyway, but as there is the theoretical possibility of having a binary package specific one, do a comparison still, but only the topmost 20 lines. -- Martin Pitt Thu, 27 Oct 2011 14:54:41 +0200 pkgbinarymangler (104) oneiric; urgency=low * Add libapt-pkg* and libapt-inst* to the blacklist. LP: #855085 -- Gabor Kelemen Thu, 22 Sep 2011 09:02:30 +0200 pkgbinarymangler (103) oneiric; urgency=low * debian/control: Drop Vcs-Bzr:, using ubuntu:pkgbinarymangler branch now (existing history was pushed there). * test/run: Add test_mallard_help() test case for the new-style /usr/share/help layout. Reproduces LP#841340. * pkgstriptranslations: Strip/symlink/save Mallard-style /usr/share/help/// files. (LP: #841340) -- Martin Pitt Mon, 05 Sep 2011 11:44:58 +0200 pkgbinarymangler (102) oneiric; urgency=low * test/icecream/debian/rules, test/icecream/Makefile: Install PNGs with some defined permissions. * test/run, check_deb_integrity(): Verify that PNG permissions in the final debs are as they are expected to be. * pkgstripfiles: Restore permissions of optimized PNG files to their original value; advpng does not preserve them. (LP: #817792) -- Martin Pitt Sun, 21 Aug 2011 21:13:59 +0200 pkgbinarymangler (101) oneiric; urgency=low * pkgstriptranslations: Run apt-cache under env -u LD_PRELOAD to avoid running it under fakeroot. This now fails since fakeroot 1.16.1 (see Debian #629956 and Debian #630591). -- Martin Pitt Wed, 15 Jun 2011 14:48:23 +0200 pkgbinarymangler (100) oneiric; urgency=low * test/run: Add forgotten check_deb_integrity() to documentation symlink tests. This catches the wrong md5sums of symlinked doc files. * pkgstripfiles: Remove doc files from md5sums which get replaced with a symlink. (LP: #795845) * test/run: Call check_deb_integrity() in build(), and remove the explicit call from all the individual tests. There is no situation where we expect broken debs to be created, so this saves us from accidentally forgetting to call it in newly created tests. * test/run: Drop separate check_translation_tarball() test, and integrate it into check_deb_mo(). We now want to move to only building translation tarballs for packages which we actually strip, so it does not make sense any more to check those two individually. * pkgstriptranslations: Do not build a translation tarball if we did not strip the packages. With that, Launchpad does not need to check the component of the package any more, but can just import everything we throw at it. This also allows us to put some selected universe packages under langpack support. (LP: #788685, part 1) * pkgstriptranslations: Force stripping and translation tarball build if debian/control has "X..-Ubuntu-Use-Langpack: yes" header. Add corresponding test case. (LP: #788685, part 2) * test/run: Fix ResourceWarnings for unclosed files. Python 3, you are overly picky! -- Martin Pitt Wed, 15 Jun 2011 09:08:54 +0200 pkgbinarymangler (99) oneiric; urgency=low * dh-translations: - support CMake projects having a make .pot target with GETTEXT_PACKAGE -- Didier Roche Wed, 25 May 2011 20:30:04 +0200 pkgbinarymangler (98) oneiric; urgency=low * pkgstriptranslations: Don't break the build on empty po/pot files. Instead, just print a warning and exclude them from the translation tarball. Add corresponding test case. -- Martin Pitt Mon, 16 May 2011 16:42:50 +0200 pkgbinarymangler (97) oneiric; urgency=low * test/run, test_dh_translations_no_domain(): Explicitly specify UTF-8 encoding for the opened files, so that the test case also succeeds with Python 3 under a C locale (such as on the buildds). * pkgstripfiles: Update dependency parsing code to adapt to the changed behavior of "split" in Perl 5.12. * debian/control: Bump Standards-Version to 3.9.2. No changes needed. -- Martin Pitt Fri, 06 May 2011 10:57:53 +0200 pkgbinarymangler (96) oneiric; urgency=low * pkgstripfiles: Symlink identical documentation to depending packages. This was ported from cdbs' debhelper.mk, but makes more sense here because more packages use dh7 these days, we want to reduce the cdbs delta to Debian, and we want to centralize all our Ubuntu specific package mangling to one place to reduce confusion. This can be suppressed by setting $NO_DOC_PKG_MANGLE, or $CDBS_NO_DOC_SYMLINKING for backwards compatibility. (First part of LP #595008) * pkgstriptranslations: Symlink identical GNOME help files (which often happens for images which are just copied verbatim from C, but are not actually translated). In the new test case for this also check that the static translation tarball is correct. This provides another Ubuntu specific general packaging change which previously was done in cdbs' debhelper.mk. (LP: #595008) * pkgstripfiles: Break down into separate functions, to make the code easier to read and maintain. * test/run: Simplify code with recently introduced sed_control() helper method. * test/run: Replace obsolete assert_() and failIf() calls with assertTrue() and assertFalse(). * test/run, test/pickle_argv: Port to Python 3. Change build dependency from python to python3. -- Martin Pitt Fri, 06 May 2011 09:59:01 +0200 pkgbinarymangler (95) natty; urgency=low * Build-dep on intltool as needed for the testsuite (dh-translations binary package already depends on it) -- Didier Roche Fri, 01 Apr 2011 00:03:47 +0200 pkgbinarymangler (94) natty; urgency=low * dh_translations: - support cmake package as there is no makefile in the po dir neither setup.cfg. Try to grep the domain from CMakeLists.txt and force it in the intltool call. - add the cmake testcase in test/run -- Didier Roche Wed, 30 Mar 2011 20:44:15 +0200 pkgbinarymangler (93) natty; urgency=low * When mangling changelogs, make sure to recompress with gzip -n; otherwise the resulting file is different for each build, so not compatible with multiarch. -- Steve Langasek Fri, 18 Mar 2011 01:41:43 -0700 pkgbinarymangler (92) natty; urgency=low * Add debhelper script for handling translation operations. This makes it possible to have properly i18n'ed packages that don't use cdbs without introducing complicated build system changes. (LP: #735934) - test/icecream: Add po/ dir with an example po/*.po, *.desktop, *.server, *.policy, *.schemas files, and a Makefile which generates the pot. - Add dh_translations: debhelper script. Port the logic from /usr/share/cdbs/1/rules/langpack.mk. - test/run: Add test_dh_translations() test case. - debian/control, debian/dh-translations.install: Install dh_translations. - debian/rules: Build and install manpage from dh_translations POD. * test/icecream/debian/rules: Simplify using an override. * Add translations.pm: debhelper sequencer. Switch test/icecream/debian/rules to use --with translations instead of calling dh_translations directly. Point to local translations.pm in test/run setup. * dh_translations: Try getting domain from Python setup.cfg if po/Makefile does not exist. -- Martin Pitt Thu, 17 Mar 2011 12:25:09 +0100 pkgbinarymangler (91) natty; urgency=low * dpkg-deb: also skip parsing /CurrentlyBuilding and debian/control if NO_PKG_MANGLE is non-empty as e.g. grep-ing control might trigger warnings in some testsuites. -- Loïc Minier Wed, 19 Jan 2011 18:07:33 +0100 pkgbinarymangler (90) natty; urgency=low * test/icecream/debian/rules: Install a "changes" directory below /usr/share/doc/. This reproduces the build failure of texlive-extra. * pkgstripfiles: Only consider files which have a changelog-like name. -- Martin Pitt Wed, 22 Dec 2010 17:08:55 +0100 pkgbinarymangler (89) natty; urgency=low * pkgstripfiles: Games are prone to rely on a particular PNG image format, so skip PNG optimization for "Section: games". Add test case. (LP: #685421) * pkgstripfiles: Also skip PNG squashing if $NO_PNG_PKG_MANGLE is set; this allows packages to selectively disable PNG optimization without disabling the other parts of pkgbinarymangler. Add test case. * debian/control: Bump Standards-Version to 3.9.1 (no changes necessary). -- Martin Pitt Fri, 10 Dec 2010 10:50:46 +0100 pkgbinarymangler (88) natty; urgency=low * test/run: Use "foo%.png" instead of foo.png, to check that file names with percent signs are handled correctly. This reproduces LP #684569. * pkgstripfiles: Escape percent characters in file names, to avoid breaking the sed expression. (LP: #684569) -- Martin Pitt Thu, 09 Dec 2010 12:38:37 +0100 pkgbinarymangler (87) natty; urgency=low * Tweak shell syntax in dpkg-deb and also pass "$@" to pkgstriptranslations to simplify tests a bit. -- Loïc Minier Thu, 25 Nov 2010 15:37:40 +0100 pkgbinarymangler (86) natty; urgency=low [ Soren Hansen ] * Ensure arguments get passed through dpkg-deb wrapper unmangled. -- Martin Pitt Thu, 25 Nov 2010 15:28:14 +0100 pkgbinarymangler (85) natty; urgency=low * pkgstriptranslations: In truncated changelogs, point to "apt-get changelog" instead of the obsolete "apt-changelog". Update test cases accordingly. -- Martin Pitt Thu, 18 Nov 2010 16:15:29 +0100 pkgbinarymangler (84) natty; urgency=low * pkgstripfiles: Don't remove Debian changelogs if they are broken symlinks (as they are with multi-binary packages during build, since they point to the location in an installed system). Thanks Colin Watson! -- Martin Pitt Tue, 16 Nov 2010 13:01:03 +0100 pkgbinarymangler (83) natty; urgency=low * test/icecream: Install an additional symbolic link "foolink.png" to "foo.png". * test/run, check_deb_integrity(): Verify that foolink.png remains a symbolic link. * pkgstripfiles: Ignore symbolic links for PNG compression. They mess up the careful "symlink identical help files" work from pkgstriptranslations and actually lead to bigger packages. -- Martin Pitt Fri, 12 Nov 2010 13:18:49 +0100 pkgbinarymangler (82) natty; urgency=low * test/run: Fix "check for stripped files" test for PPA builds, we expect those to not get modified. * test/run: Check that changelogs in PPAs do not get truncated. * pkgstripfiles: Do not run for non-OEM PPA builds. * test/run: Add the same short/long checks for changelogs of native packages. * pkgstripfiles: For native packages, keep changelog.gz and truncate it like the Debian changelog. -- Martin Pitt Thu, 11 Nov 2010 13:14:09 +0100 pkgbinarymangler (81) natty; urgency=low * pkgstripfiles: Remove more changelog naming variants. * test/icecream/debian/changelog: Add a lot more older changelog entries, for testing the truncation. * test/run: Check that short Debian changelogs remain unaltered, and that long Debian changelogs are truncated to the topmost 10 records. In both cases changelog.Debian.gz must be present in the deb. * pkgstripfiles: Implement Debian changelog truncation as above. If we truncate, add a note at the end to run apt-changelog for the older entries. -- Martin Pitt Tue, 09 Nov 2010 18:43:49 +0100 pkgbinarymangler (80) natty; urgency=low * pkgstripfiles: Remove "ChangeLog.gz", too. * pkgstripfiles: Call advpng on PNG files after optipng, to further reduce their size. Add "advancecomp" build and binary dependencies. * test/run: Refine orig/new image comparison to ignore comments in the PNM files. -- Martin Pitt Fri, 05 Nov 2010 16:16:35 -0400 pkgbinarymangler (79) natty; urgency=low * test/icecream: Add and install a PNG file, and a JPEG file with a wrong .png suffix ("notapng.png"). * debian/control: Add optipng dependency, and optipng/imagemagick build dependencies. (We'll need imagemagick for the test suite.) * test/run: Add test_optipng() for verifying that shipped PNGs are smaller than original and visually identical, and that non-PNGs are shipped unmodified. * pkgstripfiles: Call optipng on all PNG files, update md5sum if successful. * test/run: Move md5sums test from test_optipng() to check_deb_integrity(), so that it's run for all test cases. -- Martin Pitt Mon, 01 Nov 2010 13:11:43 -0400 pkgbinarymangler (78) natty; urgency=low * test/icecream/debian/rules: Enable dh_installchangelogs. * test/run: Verify that changelog.gz gets stripped from packages when mangling. * pkgstripfiles: Remove upstream and Debian changelogs from binary packages. This will save 28 MB on the CDs once all packages get rebuilt against this mangler. (performance-desktop-n-install-footprint blueprint) -- Martin Pitt Mon, 01 Nov 2010 09:02:52 -0400 pkgbinarymangler (77) natty; urgency=low * test/run: If dpkg-buildpackage fails, show the complete output, to ease diagnostics. * Add missing dh-buildinfo build dependency, required for selftests. -- Martin Pitt Tue, 12 Oct 2010 15:37:42 +0200 pkgbinarymangler (76) natty; urgency=low * striptranslations.blacklist: Add language-selector-common. (LP: #654548) * pkgstriptranslations: Fix OEM mode for changed apt-cache madison output in maverick. * test/icecream/debian/rules: Call dh_buildinfo and dh_md5sums, which are both very common in Debian/Ubuntu packages. * Add a new script "pkgstripfiles" for removing files which we don't want in Ubuntu packages: - Add pkgstripfiles: Remove buildinfo.gz from packages. These are now installed by default for cdbs, and for a lot of other packages. However, these just bloat the packages and installed system, and all the information they carry is in Launchpad's build logs. - dpkg-deb: Call pkgstripfiles. - stripfiles.conf: Configuration file for enabling/disabling. - test/run: Add new check_deb_stripfiles() check and integrate it into all existing test cases. - debian/pkgbinarymangler.install: Install script and conf file. -- Martin Pitt Tue, 12 Oct 2010 14:03:36 +0200 pkgbinarymangler (75) maverick; urgency=low * test/run: Add new method check_deb_integrity() which confirms that dpkg-deb can extract the generated debs without messages or errors. This catches the regression introduced in version 71 that broke apt. Call this from various test cases. * pkgstriptranslations: Filter out PPA entries from apt-cache madison entries. If the package is also in this or a depending PPA, that will cause a "main" entry. -- Martin Pitt Fri, 16 Jul 2010 09:04:19 +0200 pkgbinarymangler (74) maverick; urgency=low * pkgstriptranslations: Fix another typo. Bah. -- Martin Pitt Thu, 15 Jul 2010 12:10:22 +0200 pkgbinarymangler (73) maverick; urgency=low * test/run: Check precise format of generated Installed-Size:. * pkgstriptranslations: du splits with a tab, not a space, fix extraction of new size to not contain tabs. -- Martin Pitt Thu, 15 Jul 2010 12:01:16 +0200 pkgbinarymangler (72) maverick; urgency=low * Move identification/version string from dpkg-deb to pkgstriptranslations, having it in dpkg-deb also causes changed apt output (which is confusing). -- Martin Pitt Thu, 15 Jul 2010 11:53:13 +0200 pkgbinarymangler (71) maverick; urgency=low * dpkg-deb: Print identification and version number, to ease debugging of failed builds. * debian/rules: Insert current version number into dpkg-deb script. * test/run: Add test case for building a language pack, which must not be touched by pkgstriptranslations. * test/run: Ignore system apt sources, otherwise we'll break some tests if we run them in an OEM buildd environment. -- Martin Pitt Thu, 15 Jul 2010 09:59:00 +0200 pkgbinarymangler (70) maverick; urgency=low * Move "PPA" check from dpkg-deb to pkgmaintainermangler and pkgstriptranslations. We want to call pkgsanitychecks for PPA builds as well, and also control behaviour for PPAs individually for each mangler. * pkgstriptranslations: Run if we are building in an OEM PPA. If the built package is in Ubuntu main, strip translations from it. However, introduce a blacklist of OEM projects (oem_blacklist in striptranslations.conf) which are close or past release, to not inflict this rather intrusive change on them. * debian/control: Update Maintainer field from myself to Ubuntu Developers. * Add debian/source/format: 3.0 (native). * debian/control: Bump Standards-Version to 3.9.0. * Apply a consistent indentation to all source files (4 spaces, expand tabs). * dpkg-deb: Replace hardcoded paths with "which", to allow local testing. * Replace hardcoded "/CurrentlyBuilding" path with a $BUILDINFO variable set in "common", to allow local testing. * Add test/icecream: Test source package building two binary packages "vanilla" and "chocolate" with two po/mo files each. * Allow changing the path of "common" with $PKGBINARYMANGLER_COMMON_PATH. * Allow changing the configuration file directory path with $PKGBINARYMANGLER_CONF_DIR. * pkgmaintainermangler: Allow changing the path to the override file with $PKMAINTAINERGMANGLER_OVERRIDES. * Add test/run: Test suite for checking the scripts/config files in the local build tree in a sandbox on the "icecream" test package. Cover all current scenarios: main/universe/PPA/OEM/NO_PKG_MANGLE/partner/local/no mangler. * debian/rules: Run tests during build, and have a failed test suite fail the build. Add python and fakeroot build dependencies for this. * Add debian/pkgbinarymangler.lintian-overrides: We divert "dpkg-deb", no need to ship a manpage for it. * striptranslations.blacklist: Drop language-selector. (LP: #570240) * test/run: Add test case for updating of Installed-Size. This reproduces LP #451764. * pkgstriptranslations: Adapt Installed-Size: header in control file if we stripped any files. (LP: #451764) -- Martin Pitt Fri, 09 Jul 2010 09:19:44 +0200 pkgbinarymangler (69) lucid; urgency=low * pkgstriptranslations: Work on all binary packages, not just the first one. If a static tarball already exists, unpack it into our work directory, so that we merge the GNOME help files of all binary packages. (LP: #457027) * debian/control: Bump Standards-Version to 3.8.4 (no changes necessary). -- Martin Pitt Fri, 09 Apr 2010 08:32:14 +0200 pkgbinarymangler (68) lucid; urgency=low * Looks like a .bzrignore in the bzr branch made a few useful files disappear in the last upload. Re-upload the change manually basing on version 66. -- Stéphane Graber Mon, 18 Jan 2010 20:53:18 -0500 pkgbinarymangler (67) lucid; urgency=low * Add ldm to the striptranslations blacklist. (Only installed in a chroot with no langpack but translation wanted) -- Stéphane Graber Mon, 18 Jan 2010 17:28:38 -0500 pkgbinarymangler (66) lucid; urgency=low * Add Vcs-Bzr header; this is now in Bzr at lp:~ubuntu-core-dev/pkgbinarymangler/ubuntu. * Install conffiles, binaries, and data file with dh_install. * List man pages in debian/pkgbinarymangler.manpages instead of the dh_installman command-line. * Switch to dh in rules; bump debhelper build-dep to >= 7. * Make maintainer scripts slightly more robust. * common: skip tests on /CurrentlyBuilding if PKG_IGNORE_CURRENTLY_BUILDING is set to 1; this is particularly useful when a package builds launches an embedded package build, such as the testsuite of pkg-create-dbgsym. Ideally, we'd have a nicer way to sanity check the same information. * Bump up Standards-Version to 3.8.3. * Add ${misc:Depends}. -- Loïc Minier Sat, 16 Jan 2010 13:25:18 +0100 pkgbinarymangler (65) lucid; urgency=low * Add xkb-data-i18n to the striptranslations blacklist. -- Evan Dandrea Mon, 11 Jan 2010 11:35:06 +0000 pkgbinarymangler (64) lucid; urgency=low * pkgstriptranslations: Do not copy .pc/* into the translation tarball. (LP: #410658) -- Martin Pitt Sun, 15 Nov 2009 05:52:17 -0600 pkgbinarymangler (63) karmic; urgency=low * pkgstriptranslations: - Use # instead of @ for the sed delimiter as @ can appear in locale names (lp: #434544) -- Michael Bienia Tue, 22 Sep 2009 11:06:59 +0200 pkgbinarymangler (62) karmic; urgency=low * pkgstriptranslations: - Also store /usr/share/omf/ files in static translation tarball. - Remove GNOME help translation files now, and replace them with symlinks to /usr/share/omf-langpack/* and usr/share/gnome/help-langpack/*. -- Martin Pitt Sun, 30 Aug 2009 12:39:06 +0200 pkgbinarymangler (61) karmic; urgency=low * pkgstriptranslations: Extract GNOME help translations into a new tarball and add them to the upload as raw-translations-static component. Do not strip the files from the .debs just yet, since the upload/download infrastructure in Soyuz still needs to be tested, and the language pack integration bits need to be written. See LP #123020 * debian/compat, debian/control: Bump to debhelper compat 5, 4 is deprecated. * debian/control: Bump Standards-Version to 3.8.2. * debian/control: Drop long-obsolete Replaces. -- Martin Pitt Mon, 03 Aug 2009 12:59:52 +0100 pkgbinarymangler (60) karmic; urgency=low * pkgbinarymangler: Update package's md5sums list for modified .desktop files. (LP: #392149) -- Martin Pitt Thu, 25 Jun 2009 17:55:59 +0200 pkgbinarymangler (59) karmic; urgency=low * Modify Maintainer field overriding to comply with Technical Board resolution of 2009-05-05, with a single override for all components (https://lists.ubuntu.com/archives/ubuntu-devel/2009-May/028213.html). -- Colin Watson Tue, 09 Jun 2009 11:15:13 +0100 pkgbinarymangler (58) karmic; urgency=low * pkgsanitychecks: Skip udebs, since our checks aren't very interesting for them (sysadmin with local changes to the installer environment that they want preserved ...?) and there's one udeb (rootskel-gtk) that currently ships a /usr/local/etc symlink. -- Colin Watson Wed, 06 May 2009 10:07:30 +0100 pkgbinarymangler (57) jaunty; urgency=low * pkgstriptranslations: When grabbing XPIs from Mozilla-ish packages, ensure that the /source/ directory exists in the temporary directory. Fixes xulrunner FTBFS. -- Martin Pitt Fri, 27 Mar 2009 16:17:34 +0100 pkgbinarymangler (56) jaunty; urgency=low * pkgstriptranslations: Remove translations from .desktop files if they have a gettext domain. Not every package with .desktop files uses cdbs with langpack.mk (where this stripping has happened so far), and we are now preferring the language pack translations over the static upstream translations in .desktop files. (LP: #348225) * debian/copyright: Update GPL stanza (previously had old FSF address), thanks lintian. * debian/control: Bump Standards-Version (no changes required). -- Martin Pitt Wed, 25 Mar 2009 10:28:45 +0100 pkgbinarymangler (55) jaunty; urgency=low * pkgsanitychecks: Reject packages which place files in /usr/local. -- Matthias Klose Mon, 02 Mar 2009 11:59:35 +0100 pkgbinarymangler (54) jaunty; urgency=low * pkgsanitychecks: Reject packages which place public python modules for 2.6 or newer in /usr/local/lib/python{2.[67],3.?} instead of /usr/lib. -- Matthias Klose Sun, 22 Feb 2009 13:25:13 +0100 pkgbinarymangler (53) jaunty; urgency=low * common: Do not FTBFS if debian/control does not exist. This is *very* uncommon, but it happens while building with pbuilder (LP: #315101). -- Luca Falavigna Tue, 17 Feb 2009 23:01:40 +0100 pkgbinarymangler (52) jaunty; urgency=low * pkgstriptranslations: Use a lockfile to ensure that only one instance runs at a time. Some packages, such as glib2.0, define MAKEFLAGS=-j if "$DEB_BUILD_OPTIONS=parallel" is set (apparently at the Ubuntu buildds); this makes debian/rules, and in turn pkgstriptranslations run in parallel as well, which produced corrupted translations.tar.gz tarballs. * Add lockfile-progs dependency. * Drop long-obsolete pkgstriptranslations transitional package. -- Martin Pitt Mon, 09 Feb 2009 09:49:17 +0100 pkgbinarymangler (51) jaunty; urgency=low * New binary pkgsanitychecks. - Reject packages which place public python modules for 2.6 or newer in /usr/lib/python{2.[67],3.?}/site-packages instead of dist-packages. -- Matthias Klose Mon, 05 Jan 2009 11:18:27 +0100 pkgbinarymangler (50) hardy; urgency=low * pkgstriptranslations: Copy debian/lp-export-xpis/, for finally getting LP translations love for Mozilla-ish packages. -- Martin Pitt Thu, 27 Mar 2008 12:18:04 +0100 pkgbinarymangler (49) hardy; urgency=low * pkgmaintainermangler: Do not fail the build if DEBIAN/control does not exist. This apparently happens under some conditions, like for openoffice.org on powerpc. (LP: #205923) -- Martin Pitt Wed, 26 Mar 2008 16:46:13 +0100 pkgbinarymangler (48) hardy; urgency=low * striptranslations.conf: Do not strip packages in restricted. Putting the translations into language packs could possibly create a licensing conflict. We do not have any in restricted right now, but we want to be safe. * Bump Standards-Version to 3.7.3 (no changes necessary). -- Martin Pitt Thu, 28 Feb 2008 17:27:14 +0100 pkgbinarymangler (47) hardy; urgency=low * dpkg-deb: Also disable pkgbinarymangler if archive Purpose is PPA. -- Adam Conrad Tue, 18 Dec 2007 15:58:29 -0700 pkgbinarymangler (46) hardy; urgency=low * dpkg-deb: Don't act when doing archive rebuild tests. This change requires a modified sbuild that writes Suite to /CurrentlyBuilding -- Adam Conrad Fri, 14 Dec 2007 15:04:29 -0700 pkgbinarymangler (45) gutsy; urgency=low * maintainermangler.overrides: Do not mangle Maintainer: for Patrick Matthäi. (LP: #134694) -- Martin Pitt Thu, 13 Sep 2007 22:39:30 +0200 pkgbinarymangler (44) gutsy; urgency=low * dpkg-deb: s/commercial/partner/g. -- Fabio M. Di Nitto Mon, 03 Sep 2007 09:54:25 +0200 pkgbinarymangler (43) gutsy; urgency=low * dpkg-deb: Do not do anything for commercial packages. -- Martin Pitt Mon, 20 Aug 2007 11:37:30 +0200 pkgbinarymangler (42) gutsy; urgency=low * debian/rules: Build with NO_PKG_MANGLE to pull ourselves out of the FTBFS swamp version 40 has created. -- Martin Pitt Wed, 08 Aug 2007 19:46:59 +0200 pkgbinarymangler (41) gutsy; urgency=low * dpkg-deb: Use the original arguments for calling pkgmaintainermangler, too. -- Martin Pitt Wed, 08 Aug 2007 19:18:20 +0200 pkgbinarymangler (40) gutsy; urgency=low * Fix the dpkg-deb wrapper to deal with being fed other arguments like, for instance, -Zbzip2 before "--build" or "-b" is supplied. -- Adam Conrad Wed, 8 Aug 2007 20:41:40 +1000 pkgbinarymangler (39) feisty; urgency=low * pkgstriptranslations: Collect .ts files (KDE XML translation source format). (LP: #68959) -- Martin Pitt Tue, 27 Mar 2007 20:24:16 +0200 pkgbinarymangler (38) feisty; urgency=low * pkgmaintainermangler: Never abort if Original-Maintainer is already present, even if Maintainer: does not have an Ubuntuish address. (LP: #91086) -- Martin Pitt Mon, 12 Mar 2007 12:06:54 +0100 pkgbinarymangler (37) feisty; urgency=low * maintainermangler.overrides: Don't mangle @kubuntu.org domain. -- Martin Pitt Fri, 9 Mar 2007 14:52:34 +0100 pkgbinarymangler (36) feisty; urgency=low * maintainermangler.overrides: Use u-devel-discuss@ as default contact for main/restricted. -- Martin Pitt Mon, 19 Feb 2007 13:16:36 +0100 pkgbinarymangler (35) feisty; urgency=low * pkgstriptranslations: Do not complain about empty .po/.pot files in hidden directories (such as quilt's ./.pc). Fixes the shadow FTBFS. -- Martin Pitt Tue, 19 Dec 2006 19:32:58 +0100 pkgbinarymangler (34) feisty; urgency=low The "Make doko love me again" release. * pkgstriptranslations: - Since we can now afford losing *.mo files, only create the translation tarball once, and don't update it if it already exists. This massively speeds up the process especially for large packages like openoffice.org. - Various small optimizations. -- Martin Pitt Tue, 12 Dec 2006 15:57:05 +0100 pkgbinarymangler (33) feisty; urgency=low * Add cjwatson@debian.org to ignore_emails, per request of Colin Watson. -- Adam Conrad Fri, 8 Dec 2006 23:43:30 +1100 pkgbinarymangler (32) feisty; urgency=low * Add ubuntu.com.au to the ignore_domains list, per William Grant. -- Adam Conrad Fri, 8 Dec 2006 23:32:24 +1100 pkgbinarymangler (31) edgy; urgency=low * Add q-funk@iki.fi to ignore_emails, per request of Martin-Éric Racine -- Adam Conrad Wed, 4 Oct 2006 21:09:20 +1000 pkgbinarymangler (30) edgy; urgency=low * Use Original-Maintainer instead of X-Original-Maintainer as if we had specified XB-Original-Maintainer in a policy-compliant fashion. -- Adam Conrad Wed, 20 Sep 2006 00:05:42 +1000 pkgbinarymangler (29) edgy; urgency=low * pkg{maintainermangler,striptranslations}.1: Document NO_PKG_MANGLE environment variable. (one part of LP#40735) * pkgmaintainermangler.1: Fix program name in AUTHOR section. * pkgstriptranslations: Do not strip backports. Closes: LP#58221 -- Martin Pitt Tue, 12 Sep 2006 14:22:33 +0200 pkgbinarymangler (28) edgy; urgency=low * Rename source package to pkgbinarymangler, providing a transitional upgrade path from pkgstriptranslations to the new pkgbinarymangler. * New binary package pkgbinarymangler now provides two distinct scripts, pkgstriptranslations, which does the same thing it always did, and pkgmaintainermangler, which is used to mangle maintainer fields. * Migrate /etc/pkgstriptranslations conffiles to /etc/pkgbinarymangler. * Migrate dpkg diversion from pkgstriptranslations to pkgbinarymangler. * Update debian/copyright to add myself to the list of authors, and update debian/control to add myself to the list of Uploaders. * Re-factor some common code into /usr/share/pkgbinarymangler/common. -- Adam Conrad Wed, 6 Sep 2006 22:27:59 +1000 pkgstriptranslations (27) dapper; urgency=low * If NO_PKG_MANGLE is set and non-empty, don't run pkgstriptranslations for the current dpkg-deb invocation, but print a warning so we know. * Clean up error handling for when /usr/bin/pkgstriptranslations doesn't exist, so we actually get a meaningful error and failure, not silence. -- Adam Conrad Fri, 7 Apr 2006 19:05:21 +1000 pkgstriptranslations (26) dapper; urgency=low * Check for empty PO or POT files and fail the build if any are detected (the translation importer doesn't like them, and in general this is likely to be a bug). Closes: LP#33674 * dpkg-deb: - 'exec -a' is a bashism, so fix the hashbang line. - Activate set -e to actually fail the package build if pkgstriptranslations fails. -- Martin Pitt Thu, 6 Apr 2006 13:28:31 +0200 pkgstriptranslations (25) dapper; urgency=low * Blacklist language-selector, so people can select their language in their own language (I suppose this does make some sense...) -- Adam Conrad Fri, 31 Mar 2006 21:13:06 +1100 pkgstriptranslations (24) dapper; urgency=low * Fix package name for *.sdf stripping: openoffice.org2 -> openoffice.org -- Martin Pitt Tue, 14 Mar 2006 18:32:52 +0100 pkgstriptranslations (23) dapper; urgency=low * Pull the trigger for Soyuz-Rosetta integration: Call dpkg-distaddfile to include the translation tarball into the .changes file. -- Martin Pitt Fri, 24 Feb 2006 22:56:56 +0100 pkgstriptranslations (22) dapper; urgency=low * Strip the epoch from the version number, so that it doesn't appear in the translation tarball file name. -- Martin Pitt Wed, 22 Feb 2006 15:55:10 +0100 pkgstriptranslations (21) dapper; urgency=low * pkgstriptranslations.blacklist: Remove passwd and base-config, with the new single-stage installer they can be stripped again. -- Martin Pitt Mon, 23 Jan 2006 11:25:49 +0100 pkgstriptranslations (20) dapper; urgency=low * Install a dpkg-deb wrapper which calls pkgstriptranslations before calling dpkg-deb, so we can remove our hideous hack from debhelper. * Fix manpage to note the correct arch-in-name tarball naming scheme. -- Adam Conrad Wed, 26 Oct 2005 04:13:45 +1000 pkgstriptranslations (19) dapper; urgency=low * Previous upload was too quick; deactivate dpkg-distaddfile until we switch to launchpad. -- Martin Pitt Tue, 25 Oct 2005 07:19:21 +0200 pkgstriptranslations (18) dapper; urgency=low * Call dpkg-distaddfile to include the translation tarball into the .changes file. -- Martin Pitt Wed, 19 Oct 2005 13:40:27 +0200 pkgstriptranslations (17) breezy; urgency=low * Blacklist apt. -- Martin Pitt Wed, 5 Oct 2005 14:36:06 +0200 pkgstriptranslations (16) breezy; urgency=low * Blacklist debconf-i18n. -- Martin Pitt Wed, 7 Sep 2005 23:05:43 +0200 pkgstriptranslations (15) breezy; urgency=low * Append the architecture to the tarball so that we can export tarballs from all architectures and later sort out the invalid ones. Until now, the latest tarball always won, which overwrote good tarballs with broken ones sometimes. -- Martin Pitt Fri, 26 Aug 2005 16:01:06 +0200 pkgstriptranslations (14) breezy; urgency=low * If we are stripping the openoffice.org2 source package, save debian/*.sdf for later merging of updated translations. -- Martin Pitt Thu, 11 Aug 2005 18:01:48 +0200 pkgstriptranslations (13) breezy; urgency=low * pkgstriptranslations.blacklist: Remove kde-i18n-*, KDE translations will move into language-pack-kde- (LanguagePackRoadmap). -- Martin Pitt Thu, 16 Jun 2005 12:08:29 +0200 pkgstriptranslations (12) breezy; urgency=low * Improved debugging messages to ease future bug fixing. * Fixed preservation of old tarball contents. -- Martin Pitt Mon, 13 Jun 2005 12:43:03 +0200 pkgstriptranslations (11) breezy; urgency=low * Appended an "|| true" to the empty directory cleaning command to work around an annoying find bug (or new feature?) introduced in Breezy. -- Martin Pitt Sat, 11 Jun 2005 20:02:44 +0200 pkgstriptranslations (10) breezy; urgency=low * Separated blacklist from main configuration file to pkgstriptranslations.blacklist. This allows us to update it with uploads rather than manual tweakings. * Blacklist dpkg. * pkgstriptranslations: - Ignore "nostrip" option in pkgstriptranslations.conf and only process the list in pkgstriptranslations.blacklist. - Support regular expressions in the blacklist. This greatly cuts down the size of the list and makes it much more robust with e. g. new kde-i18n-* packages. -- Martin Pitt Thu, 9 Jun 2005 15:41:13 +0200 pkgstriptranslations (9) hoary; urgency=low * Do not overwrite tarballs from previous invocations, add their contents instead. This fixes mo file extraction for multi-binary packages. -- Martin Pitt Sun, 6 Mar 2005 18:07:21 +0100 pkgstriptranslations (8) hoary; urgency=low * Implemented new specification: - Do not produce domains.txt. - Copy po/pot files into tarball subdirectory source/. - Copy per-deb mo files into tarball subdirectory /. * Cleaned up debug messages. * Removed function debug(), it was hardly used any more. * Updated manpage. -- Martin Pitt Thu, 3 Mar 2005 15:29:17 +0100 pkgstriptranslations (7) hoary; urgency=low * Support new configuration option "nostrip" with a blacklist of binary packages (preconfigured for "base-config" and "passwd" which are used at installation time when no langpack is already present). * Bug fix: Only remove the mo files from md5sum files if we actually stripped them. * Also strip packages if there is no /CurrentlyBuilding. -- Martin Pitt Wed, 23 Feb 2005 10:38:33 +0100 pkgstriptranslations (6) hoary; urgency=low * Generate a list of all translation domains and put them as 'domains.txt' into the translation tarball. -- Martin Pitt Thu, 27 Jan 2005 17:11:08 +0100 pkgstriptranslations (5) hoary; urgency=low * Added new option "invalid_currentlybuilding" which configures whether an existing, but invalid /CurrentlyBuilding file is ignored (default) or causes the build to fail (should happen on the buildds). -- Martin Pitt Tue, 25 Jan 2005 12:54:33 +0100 pkgstriptranslations (4) hoary; urgency=low * Do not strip/extract language packs. -- Martin Pitt Wed, 19 Jan 2005 19:07:38 +0100 pkgstriptranslations (3) hoary; urgency=low * Added support for creating a tarball of all pot/po files (with configuration option "posuffix"). * Added configuration option "components" which restricts the mo file deletion to some components only (default: main and restricted) if a file /CurrentlyBuilding is present (as on the buildds). * Remove mo file entries from md5sums files. -- Martin Pitt Fri, 14 Jan 2005 20:15:50 +0100 pkgstriptranslations (2) hoary; urgency=low * Don't strip packages in section 'debian-installer' which cannot be translated using language packs. -- Martin Pitt Wed, 5 Jan 2005 11:39:37 +0100 pkgstriptranslations (1) hoary; urgency=low * Initial Release. -- Martin Pitt Tue, 21 Dec 2004 18:46:54 +0100 pkgbinarymangler-121/debian/compat0000664000000000000000000000000211426557622014235 0ustar 7 pkgbinarymangler-121/debian/rules0000775000000000000000000000114211540224600014075 0ustar #!/usr/bin/make -f VERSION=$(shell dpkg-parsechangelog | sed -n '/^Version:/ { s/^Version: //; p}') # do not mangle ourselves, in case the previous version caused FTBFS export NO_PKG_MANGLE=1 %: dh $* override_dh_install: dh_install sed -i 's/#VERSION#/$(VERSION)/' debian/pkgbinarymangler/usr/bin/pkgstriptranslations mkdir -p debian/dh-translations/usr/share/man/man1/ pod2man -c Debhelper -r "$(VERSION)" dh_translations debian/dh-translations/usr/share/man/man1/dh_translations.1 override_dh_auto_test: ifeq (, $(findstring nocheck, $(DEB_BUILD_OPTIONS))) unset NO_PKG_MANGLE; test/run -v endif pkgbinarymangler-121/debian/pkgbinarymangler.lintian-overrides0000664000000000000000000000007311426557622021753 0ustar pkgbinarymangler: binary-without-manpage usr/bin/dpkg-deb pkgbinarymangler-121/debian/pkgbinarymangler.manpages0000664000000000000000000000010011426557622020077 0ustar pkgstriptranslations.1 pkgmaintainermangler.1 pkgsanitychecks.1 pkgbinarymangler-121/debian/dh-translations.install0000664000000000000000000000012411540344113017520 0ustar dh_translations usr/bin translations.pm /usr/share/perl5/Debian/Debhelper/Sequence/ pkgbinarymangler-121/debian/control0000664000000000000000000000366712265452204014446 0ustar Source: pkgbinarymangler Section: devel Priority: extra Build-Depends: debhelper (>= 7.0.50~), perl, dh-buildinfo, python3, fakeroot, optipng, advancecomp, imagemagick, intltool Maintainer: Ubuntu Developers Standards-Version: 3.9.5 Package: pkgbinarymangler Architecture: all Depends: ${misc:Depends}, lockfile-progs, advancecomp, optipng Description: strips translations and alters maintainers during build pkgbinarymangler consists of a dpkg-deb wrapper that calls the following helper applications while building a debian binary package: . pkgstriptranslations removes all *.mo files in /usr/share/locale from all package build directories. It is used to strip off gettext translations from generated binary packages, because translations are already shipped in the language packs. Its behaviour (which is disabled by default) is configured in /etc/pkgbinarymangler/striptranslations.conf. . pkgmaintainermangler adjusts the maintainer field in binary packages to match a set of rules (including whitelists, mass renames by component, maintainer name, etc) defined in the pkgmaintainermangler configuration file at /etc/pkgbinarymangler/maintainermangler.conf. Package: dh-translations Architecture: all Depends: ${misc:Depends}, debhelper, intltool Description: debhelper extension for translation support This package provides a debhelper extension to perform common translation related operations during package build: . * Try to build a current PO template. . * Remove inline translations from *.desktop, *.server, *.schemas, and *.policy files and replace them with a link to the gettext domain, so that strings in them will get translated at runtime from *.mo files. This allows language packs to ship updated translations. pkgbinarymangler-121/debian/pkgbinarymangler.install0000664000000000000000000000115111665115654017761 0ustar dpkg-deb usr/bin dh_builddeb usr/bin pkgstriptranslations usr/bin pkgmaintainermangler usr/bin pkgsanitychecks usr/bin pkgstripfiles usr/bin common usr/share/pkgbinarymangler striptranslations.conf etc/pkgbinarymangler striptranslations.blacklist etc/pkgbinarymangler maintainermangler.conf etc/pkgbinarymangler maintainermangler.overrides etc/pkgbinarymangler sanitychecks.conf etc/pkgbinarymangler stripfiles.conf etc/pkgbinarymangler pkgbinarymangler-121/debian/pkgbinarymangler.preinst0000664000000000000000000000112611665121640017771 0ustar #! /bin/sh set -e case "$1" in install|upgrade) # make diversions dpkg-divert --add --rename --package pkgbinarymangler --divert /usr/bin/dpkg-deb.pkgbinarymangler /usr/bin/dpkg-deb > /dev/null if [ ! -x /usr/bin/dpkg-deb ]; then # on initial install, we have no dpkg-deb, cause we just # diverted it; this would cause our own package to fail to # unpack cp /usr/bin/dpkg-deb.pkgbinarymangler /usr/bin/dpkg-deb fi dpkg-divert --add --rename --package pkgbinarymangler --divert /usr/bin/dh_builddeb.pkgbinarymangler /usr/bin/dh_builddeb > /dev/null ;; esac #DEBHELPER# exit 0 pkgbinarymangler-121/maintainermangler.overrides0000664000000000000000000000221611426557621017236 0ustar # This file defines overrides for pkgmaintainermangler, which are defined # in simple rfc-822-style pairs. Individual email overrides supersede the # more broad component overrides. Archive components are defined with # a syntax of "%component", while email addresses are defined as "@email" default: Ubuntu Developers #%main: Ubuntu Core Developers #%restricted: Ubuntu Core Developers #%universe: Ubuntu MOTU Developers #%multiverse: Ubuntu MOTU Developers @adconrad@0c3.net: Adam Conrad @mpitt@debian.org: Martin Pitt # The ignore_domains variable is a list of email domains which we will # refuse to act on altogether, if they are found in the Maintainer's email, # while the ignore_emails variable ignores entire email addresses. ignore_domains: ubuntu.com canonical.com lists.ubuntu.com lists.canonical.com ubuntu.com.au kubuntu.org ignore_emails: lamont@debian.org q-funk@iki.fi cjwatson@debian.org patrick.matthaei@web.de