Extract script to generate origtar

This commit is contained in:
Ben Wiederhake 2016-03-04 14:36:50 +01:00
parent 7439a68b09
commit 70340d7b55
2 changed files with 45 additions and 13 deletions

View file

@ -216,19 +216,7 @@ check-clean: .git
# Feel free to remove the "check-clean" dependency if you know what you're doing.
.PHONY: dist
dist: check-clean .git create_dirs
# Abuse the "bin" dir for temporary files.
@rm -f bin/tgl_tl-parser.tar bin/tgl.tar bin/result.tar bin/result.tar.gz
( cd tgl/tl-parser && git archive --prefix=telegram-purple/tgl/tl-parser/ --output=../../bin/tgl_tl-parser.tar HEAD )
( cd tgl && git archive --prefix=telegram-purple/tgl/ --output=../bin/tgl.tar HEAD )
git archive --prefix=telegram-purple/ --output=bin/result.tar HEAD
tar --concatenate -f bin/result.tar bin/tgl.tar
tar --concatenate -f bin/result.tar bin/tgl_tl-parser.tar
gzip -n bin/result.tar
# CAREFUL WHEN EDITING: Lots of black magic.
# "mv -f" means "overwrite, if necessary"
@TARNAME="telegram-purple_`git describe --tags | sed s/^v// `.orig.tar.gz" ; \
echo mv -f bin/result.tar.gz $$TARNAME ; \
mv -f bin/result.tar.gz $$TARNAME
./gen-origtar
### == Cleaning in various flavors == ###

44
gen-origtar Executable file
View file

@ -0,0 +1,44 @@
#!/bin/sh
# This file is part of telegram-purple
#
# This program 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 2 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, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
#
# Copyright Matthias Jentsch, Ben Wiederhake 2016
set -e
# -- Cleanup possibly left-over artifacts
rm -f bin/tgl_tl-parser.tar bin/tgl.tar bin/result.tar bin/result.tar.gz
# -- Create parts
# Abuse the "bin" dir for temporary files.
( cd tgl/tl-parser && git archive --prefix=telegram-purple/tgl/tl-parser/ --output=../../bin/tgl_tl-parser.tar HEAD )
( cd tgl && git archive --prefix=telegram-purple/tgl/ --output=../bin/tgl.tar HEAD )
git archive --prefix=telegram-purple/ --output=bin/result.tar HEAD
# -- Concatenate it all
tar --concatenate -f bin/result.tar bin/tgl.tar
tar --concatenate -f bin/result.tar bin/tgl_tl-parser.tar
gzip -n bin/result.tar
# -- Determine name and move
TARNAME="telegram-purple_`git describe --tags | sed s/^v// `.orig.tar.gz"
# "mv -f" means "overwrite, if necessary"
echo mv -f bin/result.tar.gz $TARNAME
mv -f bin/result.tar.gz $TARNAME
# -- Cleanup (never fail)
rm -f bin/tgl_tl-parser.tar bin/tgl.tar bin/result.tar bin/result.tar.gz || true