2022-02-18 14:50:37 -05:00
|
|
|
#!/bin/sh
|
|
|
|
# Run this to create a distribution tarball from a git checkout
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
PKG_NAME="Irssi"
|
|
|
|
|
|
|
|
repo_root="$(git rev-parse --show-toplevel)"
|
|
|
|
dist_tmp="$repo_root/${PKG_NAME}-Dist"
|
|
|
|
|
|
|
|
if [ -z "$repo_root" ]; then
|
|
|
|
echo "**Error**: ${PKG_NAME} make-dist.sh must be run in a git clone, cannot proceed."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -f "$repo_root"/irssi.conf ]; then
|
|
|
|
echo -n "**Error**: Directory \`$repo_root' does not look like the"
|
|
|
|
echo " top-level $PKG_NAME directory"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
cd "$repo_root"
|
|
|
|
./utils/check-perl-hash.sh
|
|
|
|
|
2022-02-20 12:06:55 -05:00
|
|
|
if [ -f pyproject.toml ] || [ -f setup.cfg ]; then
|
|
|
|
echo "**Error**: ${PKG_NAME} make-dist.sh cannot be run in Dist directory, cannot proceed."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2022-02-18 14:50:37 -05:00
|
|
|
rm -fr "$dist_tmp"
|
2022-02-20 12:06:55 -05:00
|
|
|
echo "Cloning to \`$dist_tmp'..."
|
|
|
|
git clone --quiet --no-local "$repo_root" "$dist_tmp"
|
2022-02-18 14:50:37 -05:00
|
|
|
cd "$dist_tmp"
|
|
|
|
if [ ! -f meson.build ]; then
|
|
|
|
echo "**Error**: ${PKG_NAME} make-dist.sh could not find meson.build, cannot proceed."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
name=$(perl -0777 -n -e "m{project\\(\\s*'(.*?)'}s and print \$1 and exit" meson.build)
|
|
|
|
version=$(perl -0777 -n -e "m{project\\(.*?,\\s*version\\s*:\\s*'(.*?)'}s and print \$1 and exit" meson.build)
|
|
|
|
if [ -z "$name" ] || [ -z "$version" ]; then
|
|
|
|
echo "**Error**: ${PKG_NAME} make-dist.sh could not find either name or version, cannot proceed."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2022-02-20 12:06:55 -05:00
|
|
|
git log > ChangeLog
|
|
|
|
|
|
|
|
cat <<PYPROJECT_TOML >pyproject.toml
|
|
|
|
[build-system]
|
|
|
|
requires = ["setuptools", "wheel"]
|
|
|
|
build-backend = "setuptools.build_meta"
|
|
|
|
|
|
|
|
PYPROJECT_TOML
|
|
|
|
|
2022-02-18 14:50:37 -05:00
|
|
|
cat <<SETUP_CFG >setup.cfg
|
|
|
|
[metadata]
|
|
|
|
name = $name
|
|
|
|
version = $version
|
2022-06-06 15:47:19 -04:00
|
|
|
url = https://irssi.org/
|
|
|
|
maintainer = The Irssi team
|
2022-02-20 12:06:55 -05:00
|
|
|
maintainer_email = @
|
2022-02-18 14:50:37 -05:00
|
|
|
license = GNU General Public License v2 or later (GPLv2+)
|
|
|
|
|
2022-02-20 12:06:55 -05:00
|
|
|
[check-manifest]
|
|
|
|
ignore =
|
|
|
|
pyproject.toml
|
|
|
|
$(perl -a -l -n -e '$F[0] eq "#" and $F[1] eq "ignore" and print " @F[2..$#F]"' MANIFEST.in)
|
|
|
|
|
2022-02-18 14:50:37 -05:00
|
|
|
SETUP_CFG
|
2022-02-20 12:06:55 -05:00
|
|
|
|
|
|
|
if command -v check-manifest >/dev/null; then
|
|
|
|
echo "Checking MANIFEST.in..."
|
|
|
|
check-manifest --ignore ChangeLog
|
|
|
|
else
|
|
|
|
echo "**Warning**: check-manifest not found, did not check MANIFEST.in"
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Creating sdist..."
|
|
|
|
python3 -W ignore -c 'from setuptools import *;setup()' --quiet sdist --formats=tar
|
2022-02-18 14:50:37 -05:00
|
|
|
|
|
|
|
tar --delete --file "dist/$name-$version.tar" \
|
|
|
|
"$name-$version/setup.cfg" \
|
2022-02-20 12:06:55 -05:00
|
|
|
"$name-$version/pyproject.toml" \
|
2022-02-18 14:50:37 -05:00
|
|
|
"$name-$version/$name.egg-info" \
|
|
|
|
"$name-$version/PKG-INFO"
|
|
|
|
|
2022-02-20 12:06:55 -05:00
|
|
|
echo "Zipping..."
|
2022-02-18 14:50:37 -05:00
|
|
|
xz -k "dist/$name-$version.tar"
|
|
|
|
gzip -k "dist/$name-$version.tar"
|
|
|
|
|
|
|
|
mv -v dist/*.tar.* "$repo_root"
|
|
|
|
cd "$repo_root"
|
|
|
|
# rm -fr "$dist_tmp"
|