Patchwork [3/6] auto-packager: Add mktar.sh to make the release tarball

login
register
mail settings
Submitter Keng-Yu Lin
Date July 26, 2012, 9:34 a.m.
Message ID <1343295300-17440-4-git-send-email-kengyu@canonical.com>
Download mbox | patch
Permalink /patch/173382/
State Accepted
Headers show

Comments

Keng-Yu Lin - July 26, 2012, 9:34 a.m.
The script makes the tarball for release and generate the checksum.

Signed-off-by: Keng-Yu Lin <kengyu@canonical.com>
---
 auto-packager/mktar.sh |  100 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 100 insertions(+)
 create mode 100755 auto-packager/mktar.sh
Colin King - July 27, 2012, 8:39 a.m.
On 26/07/12 10:34, Keng-Yu Lin wrote:
> The script makes the tarball for release and generate the checksum.
>
> Signed-off-by: Keng-Yu Lin <kengyu@canonical.com>
> ---
>   auto-packager/mktar.sh |  100 ++++++++++++++++++++++++++++++++++++++++++++++++
>   1 file changed, 100 insertions(+)
>   create mode 100755 auto-packager/mktar.sh
>
> diff --git a/auto-packager/mktar.sh b/auto-packager/mktar.sh
> new file mode 100755
> index 0000000..364ab12
> --- /dev/null
> +++ b/auto-packager/mktar.sh
> @@ -0,0 +1,100 @@
> +#!/bin/bash
> +
> +#
> +# Copyright (C) 2010-2012 Canonical
> +#
> +# 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 02110-1301, USA.
> +#
> +
> +
> +#
> +# Get fwts sources, strip out .git directory, add in necessary debian packaging
> +# files, build source package ready for upload.
> +#
> +REPO=git://kernel.ubuntu.com/hwe/fwts.git
> +FWTS=fwts
> +
> +#
> +#  Clone the repo
> +#
> +get_source()
> +{
> +	echo "Getting source"
> +	pushd "$version" >& /dev/null
> +	git clone $REPO
> +	popd >& /dev/null
> +}
> +
> +#
> +#  Checkout version
> +#
> +checkout_version()
> +{
> +	echo "Checking out version"
> +	pushd "$version/$FWTS" >& /dev/null
> +	git checkout -b latest $version
> +	popd >& /dev/null
> +}
> +
> +#
> +#  Remove the source
> +#
> +rm_source()
> +{
> +	rm -rf "$version/$FWTS"
> +}
> +
> +#
> +#  Create source package ready for upload and build
> +#
> +mk_tarball()
> +{
> +	pushd "$version/$FWTS" >& /dev/null
> +	git archive --format tar -o ../fwts-$version.tar $version
> +	gzip ../fwts-$version.tar
> +	popd >& /dev/null
> +}
> +
> +#
> +# Create checksums
> +#
> +
> +mk_checksums()
> +{
> +	pushd "$version" >& /dev/null
> +	sha256sum fwts-$version.tar.gz >> SHA256SUMS
> +	popd >& /dev/null
> +}
> +
> +#
> +#  Here we go..
> +#
> +if [ $# -eq 1 ]; then
> +	version=$1
> +	mkdir $version
> +else
> +	echo "Please specify a version"
> +	exit
> +fi
> +
> +rm_source
> +get_source
> +
> +checkout_version
> +
> +mk_tarball
> +mk_checksums
> +
> +rm_source
>

OK for a first cut. I suspect we should re-visit this and ensure all the 
commands don't fail, e.g. the git clone, and handle any errors more 
cleanly.  But for now, lets get the script in and we can improve it later.

Acked-by: Colin Ian King <colin.king@canonical.com>
Ivan Hu - July 30, 2012, 2:44 a.m.
On 07/26/2012 05:34 PM, Keng-Yu Lin wrote:
> The script makes the tarball for release and generate the checksum.
>
> Signed-off-by: Keng-Yu Lin <kengyu@canonical.com>
> ---
>   auto-packager/mktar.sh |  100 ++++++++++++++++++++++++++++++++++++++++++++++++
>   1 file changed, 100 insertions(+)
>   create mode 100755 auto-packager/mktar.sh
>
> diff --git a/auto-packager/mktar.sh b/auto-packager/mktar.sh
> new file mode 100755
> index 0000000..364ab12
> --- /dev/null
> +++ b/auto-packager/mktar.sh
> @@ -0,0 +1,100 @@
> +#!/bin/bash
> +
> +#
> +# Copyright (C) 2010-2012 Canonical
> +#
> +# 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 02110-1301, USA.
> +#
> +
> +
> +#
> +# Get fwts sources, strip out .git directory, add in necessary debian packaging
> +# files, build source package ready for upload.
> +#
> +REPO=git://kernel.ubuntu.com/hwe/fwts.git
> +FWTS=fwts
> +
> +#
> +#  Clone the repo
> +#
> +get_source()
> +{
> +	echo "Getting source"
> +	pushd "$version" >& /dev/null
> +	git clone $REPO
> +	popd >& /dev/null
> +}
> +
> +#
> +#  Checkout version
> +#
> +checkout_version()
> +{
> +	echo "Checking out version"
> +	pushd "$version/$FWTS" >& /dev/null
> +	git checkout -b latest $version
> +	popd >& /dev/null
> +}
> +
> +#
> +#  Remove the source
> +#
> +rm_source()
> +{
> +	rm -rf "$version/$FWTS"
> +}
> +
> +#
> +#  Create source package ready for upload and build
> +#
> +mk_tarball()
> +{
> +	pushd "$version/$FWTS" >& /dev/null
> +	git archive --format tar -o ../fwts-$version.tar $version
> +	gzip ../fwts-$version.tar
> +	popd >& /dev/null
> +}
> +
> +#
> +# Create checksums
> +#
> +
> +mk_checksums()
> +{
> +	pushd "$version" >& /dev/null
> +	sha256sum fwts-$version.tar.gz >> SHA256SUMS
> +	popd >& /dev/null
> +}
> +
> +#
> +#  Here we go..
> +#
> +if [ $# -eq 1 ]; then
> +	version=$1
> +	mkdir $version
> +else
> +	echo "Please specify a version"
> +	exit
> +fi
> +
> +rm_source
> +get_source
> +
> +checkout_version
> +
> +mk_tarball
> +mk_checksums
> +
> +rm_source
>

Acked-by: Ivan Hu <ivan.hu@canonical.com>

Patch

diff --git a/auto-packager/mktar.sh b/auto-packager/mktar.sh
new file mode 100755
index 0000000..364ab12
--- /dev/null
+++ b/auto-packager/mktar.sh
@@ -0,0 +1,100 @@ 
+#!/bin/bash
+
+#
+# Copyright (C) 2010-2012 Canonical
+#
+# 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 02110-1301, USA.
+#
+
+
+#
+# Get fwts sources, strip out .git directory, add in necessary debian packaging
+# files, build source package ready for upload.
+#
+REPO=git://kernel.ubuntu.com/hwe/fwts.git
+FWTS=fwts
+
+#
+#  Clone the repo
+#
+get_source()
+{
+	echo "Getting source"
+	pushd "$version" >& /dev/null
+	git clone $REPO
+	popd >& /dev/null
+}
+
+#
+#  Checkout version
+#
+checkout_version()
+{
+	echo "Checking out version"
+	pushd "$version/$FWTS" >& /dev/null
+	git checkout -b latest $version
+	popd >& /dev/null
+}
+
+#
+#  Remove the source
+#
+rm_source()
+{
+	rm -rf "$version/$FWTS"
+}
+
+#
+#  Create source package ready for upload and build
+#
+mk_tarball()
+{
+	pushd "$version/$FWTS" >& /dev/null
+	git archive --format tar -o ../fwts-$version.tar $version
+	gzip ../fwts-$version.tar
+	popd >& /dev/null
+}
+
+#
+# Create checksums
+#
+
+mk_checksums()
+{
+	pushd "$version" >& /dev/null
+	sha256sum fwts-$version.tar.gz >> SHA256SUMS
+	popd >& /dev/null
+}
+
+#
+#  Here we go..
+#
+if [ $# -eq 1 ]; then
+	version=$1
+	mkdir $version
+else
+	echo "Please specify a version"
+	exit
+fi
+
+rm_source
+get_source
+
+checkout_version
+
+mk_tarball
+mk_checksums
+
+rm_source