From ed0474259b52f9109b1dd319d1a21b7a8852d77b Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 28 Sep 2017 15:09:01 +1000 Subject: [PATCH] release.sh: add support for meson projects Signed-off-by: Peter Hutterer --- release.sh | 155 +++++++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 99 insertions(+), 56 deletions(-) diff --git a/release.sh b/release.sh index 04c78cc..783b2ce 100755 --- a/release.sh +++ b/release.sh @@ -125,6 +125,7 @@ git tag: $tag_name RELEASE for tarball in $tarbz2 $targz $tarxz; do + tarball=`basename $tarball` cat </dev/null - if [ $? -ne 0 ]; then - echo "Error: failed to configure module." - cd $top_src - return 1 - fi + # Worktree removal is intentionally left to the user, due to: + # - currently we cannot select only one worktree to prune + # - requires to removal of $build_dir which might contradict with the + # user decision to keep some artefacts like tarballs or other + echo "Info: creating new git worktree." + git worktree add $build_dir + if [ $? -ne 0 ]; then + echo "Error: failed to create a git worktree." + cd $top_src + return 1 + fi - # Run 'make dist/distcheck' to ensure the tarball matches the git module content - # Important to run make dist/distcheck before looking in Makefile, may need to reconfigure - echo "Info: running \"make $MAKE_DIST_CMD\" to create tarballs:" - ${MAKE} $MAKEFLAGS $MAKE_DIST_CMD > /dev/null - if [ $? -ne 0 ]; then - echo "Error: \"$MAKE $MAKEFLAGS $MAKE_DIST_CMD\" failed." - cd $top_src - return 1 + cd $build_dir + if [ $? -ne 0 ]; then + echo "Error: failed to cd to $MODULE_RPATH/$build_dir." + cd $top_src + return 1 + fi + + echo "Info: running autogen.sh" + ./autogen.sh >/dev/null + + if [ $? -ne 0 ]; then + echo "Error: failed to configure module." + cd $top_src + return 1 + fi + + # Run 'make dist/distcheck' to ensure the tarball matches the git module content + # Important to run make dist/distcheck before looking in Makefile, may need to reconfigure + echo "Info: running \"make $MAKE_DIST_CMD\" to create tarballs:" + ${MAKE} $MAKEFLAGS $MAKE_DIST_CMD > /dev/null + if [ $? -ne 0 ]; then + echo "Error: \"$MAKE $MAKEFLAGS $MAKE_DIST_CMD\" failed." + cd $top_src + return 1 + fi + + # Find out the tarname from the makefile + pkg_name=`$GREP '^PACKAGE = ' Makefile | sed 's|PACKAGE = ||'` + pkg_version=`$GREP '^VERSION = ' Makefile | sed 's|VERSION = ||'` + tar_root="." + else + # meson sets up ninja dist so we don't have to do worktrees and it + # has the builddir enabled by default + build_dir="builddir" + meson $build_dir + if [ $? -ne 0 ]; then + echo "Error: failed to configure module." + cd $top_src + return 1 + fi + + echo "Info: running \"ninja dist\" to create tarballs:" + ninja -C $build_dir dist + if [ $? -ne 0 ]; then + echo "Error: ninja dist failed" + cd $top_src + return 1 + fi + + # Find out the package name from the meson.build file + pkg_name=`$GREP '^project(' meson.build | sed "s|project([\'\"]\([^\'\"]\+\)[\'\"].*|\1|"` + pkg_version=`git describe` + tar_root="$build_dir/meson-dist" fi - # Find out the tarname from the makefile - pkg_name=`$GREP '^PACKAGE = ' Makefile | sed 's|PACKAGE = ||'` - pkg_version=`$GREP '^VERSION = ' Makefile | sed 's|VERSION = ||'` tar_name="$pkg_name-$pkg_version" - targz=$tar_name.tar.gz - tarbz2=$tar_name.tar.bz2 - tarxz=$tar_name.tar.xz + targz="$tar_root/$tar_name.tar.gz" + tarbz2="$tar_root/$tar_name.tar.bz2" + tarxz="$tar_root/$tar_name.tar.xz" [ -e $targz ] && ls -l $targz || unset targz [ -e $tarbz2 ] && ls -l $tarbz2 || unset tarbz2 @@ -716,7 +757,9 @@ process_module() { else tag_range=$tag_name fi + pushd "$tar_root" generate_announce > "$tar_name.announce" + popd echo "Info: [ANNOUNCE] template generated in \"$build_dir/$tar_name.announce\" file." echo " Please pgp sign and send it." -- 2.11.4.GIT