Advertisement
Shnatsel

shdebuild

Jul 30th, 2014
507
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.72 KB | None | 0 0
  1. #!/bin/bash
  2. set -e
  3.  
  4. # "debuild" variant for rapid iteration.
  5. # Keeps your source code directory intact and provides
  6. # detailed informaion from Lintian.
  7.  
  8. if ! [ -f debian/control ]; then
  9.     echo 'Could not find debian/control anywhere! Are you in the source tree?' >&2
  10.     exit 1
  11. fi
  12.  
  13. copy_source() {
  14.     # Copies source code and all *.orig.tar.* files above it
  15.     # Usage: copy_source TARGET_DIR
  16.     # The target directory should not exist.
  17.  
  18.     ( # isolate working directory changes
  19.     TARGET_DIR="$1"
  20.     mkdir "$TARGET_DIR"
  21.     cp -r . "$TARGET_DIR"
  22.     cd ..
  23.     for file in *.orig.tar.*; do
  24.         ln -s --target-directory="$BUILD_DIR" "$(pwd)/$file"
  25.     done
  26.     )
  27. }
  28.  
  29. ( # isolate working directory changes
  30. BUILD_DIR="$(mktemp -d)"
  31. copy_source "$BUILD_DIR"/source
  32. cd "$BUILD_DIR"/source
  33. debuild --no-lintian -us -uc
  34. lintian -E -i -I --pedantic ../*.changes || :
  35. echo "Your binary packages can be found at $BUILD_DIR"
  36. )
  37.  
  38. ( # isolate working directory changes
  39. if [ "$1" = "-S" ]; then
  40.     BUILD_DIR=$(mktemp -d)
  41.     copy_source "$BUILD_DIR"/source
  42.     cd "$BUILD_DIR"/source
  43.     debuild -S
  44.     echo "Your source package can be found at $BUILD_DIR"
  45. fi
  46. )
  47.  
  48. # Copyright (c) 2014, Sergey "Shnatsel" Davidoff <shnatsel@gmail.com>
  49. #All rights reserved.
  50. #
  51. #Redistribution and use in source and binary forms, with or without
  52. #modification, are permitted provided that the following conditions are met:
  53. #    * Redistributions of source code must retain the above copyright
  54. #      notice, this list of conditions and the following disclaimer.
  55. #    * Redistributions in binary form must reproduce the above copyright
  56. #      notice, this list of conditions and the following disclaimer in the
  57. #      documentation and/or other materials provided with the distribution.
  58. #    * Neither the name of the <organization> nor the
  59. #      names of its contributors may be used to endorse or promote products
  60. #      derived from this software without specific prior written permission.
  61. #
  62. #THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  63. #ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  64. #WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  65. #DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
  66. #DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  67. #(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  68. #LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  69. #ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  70. #(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  71. #SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement