]> mj.ucw.cz Git - libucw.git/blob - debian/pkg-lib
Packages: The version number appended to names of libraries is detected from ucw...
[libucw.git] / debian / pkg-lib
1 # A library of shell functions for building of Debian packages
2 # (c) 2008--2009 Martin Mares <mj@ucw.cz>
3 # (c) 2009--2013 Pavel Charvat <pchar@ucw.cz>
4
5 # Expects:
6 # PKG           name of the package
7 # ROOT          absolute path to the root of the source tree
8 # PKGVER        custom package version
9
10 unset PKG ROOT SRCVER VER
11
12 function pkg-git-version {
13         TREEVER=`git describe --tags | sed 's/^v//;s/[a-f]$/&-0/'`
14         TREEHASH=`git rev-parse --verify HEAD`
15         VER=${PKGVER:-$TREEVER}
16         SRCVER=${PKGVER:-$VER}
17         cat <<EOF
18 ###
19 ### Source tree version: $TREEVER
20 ### Source tree hash: $TREEHASH
21 ### Debian binary package version: $VER
22 ### Debian source package version: $SRCVER
23 ###
24 ### Hey, did you commit everything? Or added it to the index?
25 ###
26
27 EOF
28 }
29
30 function pkg-git-checkout {
31         BUILDDIR=debian-tmp/$PKG-$SRCVER
32         rm -rf debian-tmp
33         mkdir -p $BUILDDIR
34         git checkout-index -a --prefix=$BUILDDIR/
35 }
36
37 function pkg-fake-changelog {
38         echo "Creating automatic changelogs for package $PKG version $VER"
39         (
40                 export EDITOR=true
41                 CL=debian/changelog
42                 rm -f $CL
43                 dch --changelog $CL --create --package $PKG --newversion $VER "Automatic release. See /usr/share/doc/$PKG/changelog for the true story."
44                 dch --changelog $CL --release
45                 sed -i '/Initial release/d' $CL
46         )
47 }
48
49 function pkg-cleanup {
50         echo -n "Press return to delete temp files... "
51         read YES
52         rm -rf $ROOT/debian-tmp
53 }
54
55 function pkg-get-files {
56         echo
57         echo "Generated files:"
58         FILES=
59         unset FILES_ARY[@]
60         for F in "$@" ; do
61                 if [ -f "$F" ] ; then
62                         FILES="$FILES${FILES:+,}$F"
63                         FILES_ARY[${#FILES_ARY[@]}]="$F"
64                         echo "$F"
65                 fi
66         done
67         if [ -z "$FILES" ] ; then
68                 echo "No files found"
69                 return 1
70         fi
71 }