From 35e3a0be26aac7862d1d384a1e9b670ed2e7f78f Mon Sep 17 00:00:00 2001 From: "Siegfried-Angel Gevatter Pujals (RainCT)" Date: Fri, 3 Aug 2007 21:17:31 +0200 Subject: [PATCH] Improved check-symbols. More slighly changes on what-patch. Added pbuilder-template. Updated AUTHORS and README. --- AUTHORS | 2 ++ README | 14 ++++++--- check-symbols | 72 +++++++++++++++++++++++++++++------------------ pbuilder-template | 36 ++++++++++++++++++++++++ what-patch | 8 +++--- 5 files changed, 97 insertions(+), 35 deletions(-) create mode 100644 pbuilder-template diff --git a/AUTHORS b/AUTHORS index ac64f37..33f46e2 100644 --- a/AUTHORS +++ b/AUTHORS @@ -4,3 +4,5 @@ Albin Tonnerre Michael Bienia Kees Cook Martin Pitt +Siegfried-A. Gevatter +Jamin W. Collins diff --git a/README b/README index ae6007b..c643e00 100644 --- a/README +++ b/README @@ -1,6 +1,12 @@ -Ubuntu Development Tools +===================== +== Ubuntu Development Tools == +===================== check-symbols [] -... will compare and give you a diff of the exported symbols of all -.so files in all binary packages of . - is not mandatory and /var/cache/pbuilder/result by default. + ... will compare and give you a diff of the exported symbols of all .so + files in all binary packages of . + is not mandatory and set to /var/cache/pbuilder/result by default. + +what-patch + ... will check what patching system is used by a package. + You need to be in it's source directory in order that it works. diff --git a/check-symbols b/check-symbols index 6a8ef4c..d27e038 100755 --- a/check-symbols +++ b/check-symbols @@ -1,41 +1,59 @@ #!/bin/bash -# (C) Daniel Holbach (2006-2007), Licensed under the GPL 2 +# Copyright 2006-2007 (C) Daniel Holbach +# Modified by Siegfried-A. Gevatter +# License: GPLv2 PACKAGES="`apt-cache showsrc $1 | grep ^Binary | sed 's/Binary\:\ //g;s/\,//g' | sort -u`" DEBLINE="" +DEBUG=False -if [ -z $1 ]; then \ - echo "Missing argument: source package name."; \ - exit; \ +if [[ -z $1 ]]; then + echo "Missing argument: source package name."; + exit; fi -if [ -z $2 ]; then \ - DEBDIR="/var/cache/pbuilder/result"; \ -else \ - DEBDIR="$2"; \ +if [[ -z $2 ]]; then + DEBDIR="/var/cache/pbuilder/result"; +else + DEBDIR="$2"; fi -for pack in $PACKAGES; \ -do \ - for lib in `dpkg -L $pack | grep -E "\.so$" | sort -u`; \ - do \ - LIBNAME=$(basename $lib); \ - nm -D $lib | cut -d' ' -f3 | sort -u > /tmp/$LIBNAME.1; \ - done; \ - DEBLINE="$DEBLINE $DEBDIR/$pack*.deb "; +for pack in $PACKAGES; +do + for lib in `dpkg -L $pack | grep -E "\.so$" | sort -u`; + do + LIBNAME=$(basename $lib); + nm -D $lib | cut -d' ' -f3 | sort -u > /tmp/$LIBNAME.1; + done; + DEBLINE="$DEBLINE $DEBDIR/$pack*.deb "; done +if [[ -z $DEBLINE ]]; then + echo "Package doesn't exist: $1."; exit +fi + +NOFILE=True +for filename in $DEBLINE; do + if [[ ${filename: -5} != "*.deb" ]]; then + NOFILE=False + [[ $DEBUG != True ]] || echo "Found binary file: $filename" + fi +done + +if [[ $NOFILE == True ]]; then + echo "No matching binary files found in «$DEBDIR»."; exit +fi + sudo dpkg -i $DEBLINE; -for pack in $PACKAGES; \ -do \ - for lib in `dpkg -L $pack | grep -E "\.so$" | sort -u`; \ - do \ - LIBNAME=$(basename $lib); \ - nm -D $lib | cut -d' ' -f3 | sort -u > /tmp/$LIBNAME.2; \ - echo "Checking: $lib"; \ - diff -u /tmp/$LIBNAME.{1,2}; \ - rm /tmp/$LIBNAME.{1,2}; \ - done; \ +for pack in $PACKAGES; +do + for lib in `dpkg -L $pack | grep -E "\.so$" | sort -u`; + do + LIBNAME=$(basename $lib); + nm -D $lib | cut -d' ' -f3 | sort -u > /tmp/$LIBNAME.2; + echo "Checking: $lib"; + diff -u /tmp/$LIBNAME.{1,2}; + rm /tmp/$LIBNAME.{1,2}; + done; done - diff --git a/pbuilder-template b/pbuilder-template new file mode 100644 index 0000000..b9d0904 --- /dev/null +++ b/pbuilder-template @@ -0,0 +1,36 @@ +#!/bin/sh +# Script from Jamin W. Collins BTS: #255165 +# Name this script 'pbuilder-dapper', 'pbuilder-edgy', 'pbuilder-feisty', etc. +# +# The only variable you really might need to change is BASE_DIR if you don't want pbuilder stuff in ~/ + +OPERATION=$1 +DISTRIBUTION=`basename $0 | cut -f2 -d '-'` +PROCEED=false +BASE_DIR="$HOME/pbuilder" +case $OPERATION in + create|update|build|clean|login|execute ) + PROCEED=true + ;; +esac +if ( $PROCEED == true ) then + shift + if [ ! -d $BASE_DIR/${DISTRIBUTION}_result ] + then mkdir -p $BASE_DIR/${DISTRIBUTION}_result/ + fi + sudo pbuilder $OPERATION \ + --basetgz $BASE_DIR/$DISTRIBUTION-base.tgz \ + --distribution $DISTRIBUTION \ + --buildresult $BASE_DIR/$DISTRIBUTION_result \ + --othermirror "deb http://archive.ubuntu.com/ubuntu $DISTRIBUTION universe multiverse" $@ +else + echo "Invalid command..." + echo "Valid commands are:" + echo " create" + echo " update" + echo " build" + echo " clean" + echo " login" + echo " execute" + exit 1 +fi diff --git a/what-patch b/what-patch index f8d0565..7f12c5b 100755 --- a/what-patch +++ b/what-patch @@ -1,13 +1,13 @@ #!/bin/bash -# Copyright 2006, 2007 (C) Kees Cook +# Copyright 2006-2007 (C) Kees Cook # Modified by Siegfried-A. Gevatter # License: GPLv2 -if [[ -e debian ]]; then +if [[ -d debian ]]; then cd . # pass -elif [[ -e ../debian ]]; then +elif [[ -d ../debian ]]; then cd .. -elif [[ -e ../patches ]]; then +elif [[ -d ../patches ]]; then cd ../.. else echo "Can't find debian/rules."; exit