Initial commit

This commit is contained in:
Juan Ferrer Toribio 2017-05-03 13:47:34 +02:00
commit aba1fd0f7e
15 changed files with 473 additions and 0 deletions

68
aclocal/dev-tools.m4 Normal file
View File

@ -0,0 +1,68 @@
dnl
dnl Copyright (C) 2012 - Juan Ferrer Toribio
dnl
dnl This program is free software: you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation, either version 3 of the License, or
dnl (at your option) any later version.
dnl
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
dnl
# serial 3 dev-tools
AC_DEFUN([VN_BUILD_OPTIONS],
[
case $CFLAGS in
*-W*) ;;
*)CFLAGS+=" -Wall ";;
esac
# Check for debug mode
AC_MSG_CHECKING([whether to build with debug information...])
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug],
[Enable debug data generation [default = no]])],
[ENABLE_DEBUG="$enableval"],
[ENABLE_DEBUG=no])
AC_MSG_RESULT([$ENABLE_DEBUG])
case $CFLAGS in
*-g*) ;;
*)
if test x"$ENABLE_DEBUG" = x"yes"; then
CFLAGS+=" -ggdb "
fi
;;
esac
# Check if the package must be configured to be installed
AC_MSG_CHECKING([whether to configure to install...])
AC_ARG_ENABLE([install],
[AS_HELP_STRING([--enable-install],
[Enable install configuration [default = yes]])],
[ENABLE_INSTALL="$enableval"],
[ENABLE_INSTALL=yes])
AC_MSG_RESULT([$installit])
AM_CONDITIONAL(ENABLE_INSTALL, [test x"$ENABLE_INSTALL" = x"yes"])
case $CFLAGS in
*-O*) ;;
*)
if test x"$ENABLE_INSTALL" = x"yes"; then
CFLAGS+=" -O3"
fi
;;
esac
AC_SUBST([ENABLE_DEBUG])
AC_SUBST([ENABLE_INSTALL])
AC_SUBST([CFLAGS])
])

23
bin/dev-autoclean Executable file
View File

@ -0,0 +1,23 @@
#!/bin/bash
dir=$1
if [ -z "$dir" ]
then
echo "Usage: $0 source_directory"
exit 1
fi
if [ ! -r $dir/configure.ac ]
then
echo "$0: Invalid source directory: $dir"
exit 2
fi
rm -rf $dir/build
rm -rf $dir/configure
rm -rf $dir/gtk-doc.make
rm -rf $dir/aclocal.m4
rm -rf $dir/autom4te.cache
rm -rf $dir/po/Makefile.in.in
rm -rf `find $dir -name Makefile.in`

118
bin/dev-debuild Executable file
View File

@ -0,0 +1,118 @@
#!/bin/bash
usage ()
{
echo "Usage: $0 [-c codename] [-f] [-k] source_directory"
exit 1
}
. /usr/share/dev-tools/load-config
forceDebuild=0
while getopts ":c:fk" option
do
case $option in
f)
forceDebuild=1
;;
k)
keep=1
;;
\?|:)
usage
;;
esac
done
shift $(($OPTIND - 1))
dir=$1
if [ ! $dir ]
then
usage
fi
if [ -r $dir/debian/rules ]
then
packageDir=$dir/..
if [ "$forceDebuild" -eq "0" ]
then
if [ -r $dir/debian/files ]
then
cut -d" " -f1 $dir/debian/files |
while read package
do
if [ -z "$package" ]
then
continue
fi
if [ ! -r $packageDir/$package ]
then
forceDebuild=1
break
fi
done
else
forceDebuild=1
fi
fi
if [ "$forceDebuild" -ne "0" ]
then
(cd $dir && debuild -uc -us -b)
if [ "$?" -ne "0" ]
then
echo "$0: Error while generating debian packages"
exit 3
fi
fi
cut -d" " -f1 $dir/debian/files |
while read package
do
if [[ ! $package =~ .*\.deb$ ]]
then
continue
fi
/usr/bin/dev-upload -c $codename $packageDir/$package
if [ "$keep" -eq "0" ]
then
rm -f $packageDir/$package
fi
done
if [ "$keep" -eq "0" ]
then
rm -f $packageDir/*.build
rm -f $packageDir/*.changes
(cd $dir && fakeroot debian/rules clean)
fi
elif [ -r $dir/DEBIAN/control ]
then
tmpDir=$dir/..
fakeroot dpkg -b $dir $tmpDir
package=`ls $tmpDir/*.deb`
if [ "$?" -eq "0" ]
then
/usr/bin/dev-upload -c $codename $package
if [ "$keep" -eq "0" ]
then
rm -f $package
fi
fi
else
echo "$0: Invalid source directory: $dir"
exit 2
fi

16
bin/dev-mkconfig Executable file
View File

@ -0,0 +1,16 @@
#!/bin/bash
configDir=$HOME/.config/dev-tools
configFile=$configDir/config
configTemplate=/usr/share/dev-tools/config.template
if [ ! -d $configDir ]
then
mkdir -p $configDir
fi
if [ ! -r $configFile ]
then
cp $configTemplate $configFile
echo "Configuration generated: $configFile"
fi

67
bin/dev-upload Executable file
View File

@ -0,0 +1,67 @@
#!/bin/bash
# Checking the input arguments.
usage ()
{
echo "Usage: $0 [-c codename] packages"
exit 1
}
. /usr/share/dev-tools/load-config
while getopts ":c:" option
do
case $option in
\?|:)
usage
;;
esac
done
shift $(($OPTIND - 1))
if [ ! $1 ]
then
usage
fi
# Checking that all files exist.
for package in $@
do
if [ ! -r $package ]
then
echo "$0: File doesn't exists: $package"
exit 2
fi
done
# Checking that SSH key file exists.
if [ ! -r $sshKeyFile ]
then
echo "$0: Can't find the SSH key file: $sshKeyFile"
exit 3
fi
# Uploading and adding the packages to the repository.
for package in $@
do
dest=/tmp/`basename $package`
scp -i $sshKeyFile $package $sshUser@$sshHost:$dest
if [ "$?" -eq "0" ]
then
ssh $sshHost -n -i $sshKeyFile -l $sshUser \
"reprepro -b $repoDir includedeb $codename $dest; rm -f $dest"
else
echo "An error occurred uploading the package $package"
exit 4
fi
done
#echo "Press any key to continue..."
#read -n 0 -ers

17
copyright.txt Executable file
View File

@ -0,0 +1,17 @@
Copyright (C) 2017 - Juan Ferrer Toribio
This package 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 3 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 <http://www.gnu.org/licenses/>.
On Debian systems, the complete text of the GNU General Public
License can be found in "/usr/share/common-licenses/GPL-3".

20
data/config.template Normal file
View File

@ -0,0 +1,20 @@
#!/bin/bash
# The respository hostname to access via SSH
sshHost=localhost
# The SSH user to access to the repository
sshUser=$USER
# Location of the SSH private key used for authentication
sshKeyFile=$HOME/.ssh/id_rsa
# The directory where repository is allocated on the remote host
repoDir=/var/cache/reprepro
# The default codename if none is specified
codename=stable
# Whether to keep generated files
keep=0

43
data/load-config Executable file
View File

@ -0,0 +1,43 @@
#!/bin/bash
. /usr/bin/dev-mkconfig
. $configFile
while getopts ":c:" option
do
case $option in
c)
codename=$OPTARG
;;
esac
done
OPTIND=1
# Setting default values for undefined variables.
if [ -z "$sshHost" ]
then
sshHost=localhost
fi
if [ -z "$sshUser" ]
then
sshUser=$USER
fi
if [ -z "$sshKeyFile" ]
then
sshKeyFile=$HOME/.ssh/id_rsa
fi
if [ -z "$repoDir" ]
then
repoDir=/var/cache/reprepro
fi
if [ -z "$codename" ]
then
codename=testing
fi
if [ -z "$keep" ]
then
keep=0
fi

5
debian/changelog vendored Normal file
View File

@ -0,0 +1,5 @@
dev-tools (2.0.2) stable; urgency=low
* Initial Release.
-- Juan Ferrer Toribio <juan@verdnatura.es> Wed, 19 Aug 2015 12:00:00 +0200

1
debian/compat vendored Normal file
View File

@ -0,0 +1 @@
9

16
debian/control vendored Normal file
View File

@ -0,0 +1,16 @@
Source: dev-tools
Priority: optional
Maintainer: Juan Ferrer Toribio <juan@verdnatura.es>
Build-Depends: build-essential, debhelper
Standards-Version: 3.9.3
Section: misc
Homepage: http://verdnatura.es
Vcs-Git: git://git.verdnatura.es/var/git/dev-tools
Package: dev-tools
Architecture: all
Depends: coreutils, openssh-client, devscripts
Section: misc
Priority: optional
Description: Tools for developers of Debian packages
Tools and scripts for developers of Debian packages.

24
debian/copyright vendored Normal file
View File

@ -0,0 +1,24 @@
Format: http://dep.debian.net/deps/dep5
Name: dev-tools
Source: git://git.verdnatura.es/var/git/dev-tools
Files: *
Copyright: 2011-2015 Juan Ferrer Toribio <juan@verdnatura.es>
License: GPL-3.0+
License: GPL-3.0+
This package 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 3 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 <http://www.gnu.org/licenses/>.
.
On Debian systems, the complete text of the GNU General Public
License can be found in "/usr/share/common-licenses/GPL-3".

4
debian/install vendored Normal file
View File

@ -0,0 +1,4 @@
bin/* usr/bin
git-hooks/* usr/bin
data/* usr/share/dev-tools
aclocal/* usr/share/aclocal

5
debian/rules vendored Executable file
View File

@ -0,0 +1,5 @@
#!/usr/bin/make -f
%:
dh $@

46
git-hooks/hook-debuild Executable file
View File

@ -0,0 +1,46 @@
#!/bin/bash
repreproDir="/var/cache/reprepro"
codename="stable"
while read oldrev newrev ref
do
if [[ ! $ref =~ .*/master$ ]]
then
echo "Ref $ref received. Doing nothing."
continue
fi
echo "Master ref received. Deploying master branch to production."
buildDir="/tmp/git-deploy/$newrev"
srcDir="$buildDir/src"
echo "Exporting to a temporary directory."
rm -rf "$buildDir"
mkdir -p "$srcDir"
git --work-tree="$srcDir" --git-dir="$PWD" checkout -f
echo "Building Debian packages."
(cd $srcDir && debuild -uc -us -b)
echo "Uploading Debian packages."
cut -d" " -f1 $srcDir/debian/files |
while read debFile
do
if [[ ! $debFile =~ .*\.deb$ ]]
then
continue
fi
echo "Uploading $debFile."
reprepro -b $repreproDir includedeb $codename "$buildDir/$debFile"
done
echo "Cleaning temporary directory."
rm -rf "$buildDir"
done