Commit e8a83cfa authored by Tomas Krizek's avatar Tomas Krizek

scripts: distrofiles, build-in obs

Add utility scripts for creating distribution-specific files
and to trigger build in OBS.
parent b8bcca67
#!/bin/bash -e
# Example usage:
# 1. place tarball to be released in git root dir
# 2. scripts/make-distrofiles.sh -s
# 3. scripts/build-in-obs.sh knot-dns-latest
project=home:CZ-NIC:$1
package=knot
if ! [[ "$1" == *-devel ]]; then
read -p "Pushing to '$project', are you sure? [y/N]: " yn
case $yn in
[Yy]* ) break;;
* ) exit 1; break;;
esac
fi
osc co "${project}" "${package}"
pushd "${project}/${package}"
osc del * ||:
cp ../../*.tar.xz ./
cp -rL ../../distro/rpm/* ./
cp -rL ../../distro/arch/* ./
cp ../../distro/deb/*.debian.tar.xz ./
cp "../../distro/deb/${package}.dsc" ./
osc addremove
osc ci -n
popd
#!/bin/bash -e
# Run with -s to include *.symbols files.
package=knot
withsymbols=false
while getopts "s" o; do
case "${o}" in
s)
withsymbols=true
;;
*)
;;
esac
done
shift $((OPTIND-1))
cd "$(git rev-parse --show-toplevel)"
version=$(ls ${package}*.tar.xz | sed "s/${package}-\(.*\).tar.xz/\1/")
# Check version for invalid characters
if [[ $(echo "${version}" | grep '^[[:alnum:].]$') -ne 0 ]]; then
echo "Invalid version number: may contain only alphanumeric characters and dots"
exit 1
fi
# Fill in VERSION field in distribution specific files
files="distro/rpm/${package}.spec distro/deb/debian/changelog distro/deb/${package}.dsc distro/arch/PKGBUILD"
for file in ${files}; do
sed -i "s/__VERSION__/${version}/g" "${file}"
done
# Optionally remove symbols file
if [ "$withsymbols" = false ]; then
rm distro/deb/debian/*.symbols
fi
# Rename archive to debian format
mv "${package}-${version}.tar.xz" "${package}_${version}.orig.tar.xz"
# Create debian archive and dsc
pushd distro/deb
tar -chaf "${package}_${version}-1.debian.tar.xz" debian
archive=${package}_${version}-1.debian.tar.xz
echo " $(md5sum ${archive} | cut -d' ' -f1) $(wc -c ${archive})" >> ${package}.dsc
popd
archive=${package}_${version}.orig.tar.xz
echo " $(md5sum ${archive} | cut -d' ' -f1) $(wc -c ${archive})" >> distro/deb/${package}.dsc
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment