Update the entire repository to match LE5 standard

- <package>/pacote renamed to <package>/package
- Package version stored inside <package>/package/DEBIAN/control, instead of
  <package>/VERSAO.
- Added script bin/build_package.sh, to centralize the script to build
  packages. In consequence, all gerar.sh were deleted*.
- COPYING and AUTHORS were centralized inside newly created doc/ directory.
  These files are copied into the package being build every time
  build_package.sh is called.

* If the gerar.sh had some special behavior on a specific package, this
extra computing can be made using a prebuild/postbuild script, which must be
located inside the <package>/ root directory.
Signed-off-by: 's avatarDiego Giovane Pasqualin <dpasqualin@c3sl.ufpr.br>
parent 5dc4a840

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

#!/bin/bash
PREFIX="$(dirname $0)"
REPOROOT="$PREFIX/.."
PACKAGESDEST="$REPOROOT/pkgs"
AUTHORS="$REPOROOT/doc/AUTHORS"
COPYING="$REPOROOT/doc/COPYING"
function showHelp() {
echo "$0 <package> [major|minor|revision]"
echo ""
echo -n "Generate <package> passed as argument, increment the package"
echo -n " version according to the second argument (unless -n is"
echo " supplied). Version is formatted as 'major.minor.revision'."
echo "If the second argument is empty, revision is assumed."
echo "The generated packages will be stored in $PACKAGESDEST"
echo ""
echo "Options are:"
echo -e "-n\tDoes not increment the package version."
}
# This function is used to keep all the packages with their AUTHORS and
# COPYING files up to date.
function copyDoc() {
local pkg=$1
local copyDir="$REPOROOT/$pkg/package/usr/local/share/doc/$pkg/"
if ! test -d "$copyDir"; then
mkdir -p "$copyDir"
fi
cp "$AUTHORS" "$copyDir"
cp "$COPYING" "$copyDir"
}
# Update the package ($1) version based on $kind ($2), where $kind can be
# revision, minor, or major.
function updatePackageVersion () {
local pkg=$1
local kind=$2
local controlFile="$REPOROOT/$pkg/package/DEBIAN/control"
local version=""
local newVersion=""
local major=""
local minor=""
local revision=""
version=$(grep "^Version:" $controlFile | awk '{print $2}')
major=$(echo $version | cut -d. -f1)
minor=$(echo $version | cut -d. -f2)
revision=$(echo $version | cut -d. -f3)
case $kind in
major)
((major++))
minor=0
revision=0
;;
minor)
((minor++))
revision=0
;;
*)
((revision++))
;;
esac
newVersion="${major}.${minor}.${revision}"
sed -i -e "s/Version:.*/Version: $newVersion/" $controlFile
}
# Generate a debian package for $pkg ($1)
function createPackage() {
local pkg=$1
local ret=0
fakeroot dpkg -b $REPOROOT/$pkg/package/ $PACKAGESDEST/
return $?
}
# ------------- main
# Check arguments
if test $# -lt 1 -o $# -gt 3; then
showHelp
exit 1
fi
# Args
PKG=""
KIND=""
UPDATEVERSION=true
while test $# -gt 0; do
arg=$1
case $arg in
-n)
UPDATEVERSION=false
;;
*)
if test -z "$PKG"; then
PKG=$arg
elif test -z "$KIND"; then
KIND=$arg
else
echo "Unrecognized parameter $arg"
showHelp
exit 1
fi
;;
esac
shift
done
if ! which fakeroot &>/dev/null; then
echo "ERROR: make sure you have the fakeroot package installed."
exit 1
fi
if test -z "$PKG"; then
echo "Error: The package to build must be specified"
exit 2
fi
if ! test -d $REPOROOT/$PKG; then
echo "Package $PKG not found in $REPOROOT"
exit 3
fi
if ! mkdir -p $PACKAGESDEST; then
echo "Error while creating directory to store packages ($PACKAGESDEST)"
exit 4
fi
# Updating the revision is the default behavior
if test -z "$KIND"; then
KIND="revision"
fi
# Run prebuild script
prebuild="$REPOROOT/$PKG/prebuild"
if test -x "$prebuild"; then
echo "Running prebuild script..."
if ! $prebuild; then
echo "ERROR while running prebuild script."
exit 5
fi
fi
# Update package doc (authors and license)
copyDoc "$PKG"
# Update Version
if test "$UPDATEVERSION" = "true"; then
updatePackageVersion "$PKG" "$KIND"
fi
# Build Package
if ! createPackage "$PKG"; then
echo "ERROR while building package"
exit 6
fi
# Run postbuild script
postbuild="$REPOROOT/$PKG/postbuild"
if test -x "$postbuild"; then
echo "Running postbuild script..."
if ! $postbuild; then
echo "ERROR while running postbuild script."
exit 7
fi
fi
exit 0
C3SL - Centro de Computacao Cientifica e Software Livre
LE - Linux Educacional 4.0
Adriano da Luz
Aryane Ast dos Santos
Bruno Cesar Ribas
Carlos Carvalho
Cleide Luzia Bonfim Possamai
Daniel Weingaertner
Danilo Kiyoshi Simizu Yorinori
Diego Giovane Pasqualin
Eduardo Luis Buratti
Eduardo Todt
Erik Alexandre Pucci
Fabiano Silva
Felipe Cys Laskoski
Guilherme Zasyeki Machado
Josiney de Souza
Juliana Bueno
Klismann Smoger Mottin