#!/bin/bash # # make_kicad_tarball.sh # # Copyright 2010 Rafael G. Martins # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above # copyright notice, this list of conditions and the following disclaimer # in the documentation and/or other materials provided with the # distribution. # * Neither the name of the author nor the names of its contributors may # be used to endorse or promote products derived from this software # without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # script based on: http://dev.gentoo.org/~calchan/scripts/make-kicad-tarball # works for kicad-20100505_p2356 . /etc/init.d/functions.sh bzr_src='lp:kicad/stable' bzr_doc='lp:~kicad-developers/kicad/doc' bzr_lib='lp:~kicad-lib-committers/kicad/library' revision="${1-$(bzr revno -q ${bzr_src} 2> /dev/null)}" timestamp="$(bzr log -q -c $revision ${bzr_src} 2> /dev/null | grep 'timestamp')" date="$(echo $timestamp | cut -f3 -d' ')" bzrdate="$(echo $date | sed 's/-//g')" time="$(echo $timestamp | cut -f4 -d' ')" einfo 'Revision info' einfo '' einfo "Revision number: ${revision}" einfo "Date: ${date}" einfo "Time: ${time}" echo einfo "Fetching source (revision: ${revision})" bzr export -r revno:${revision} kicad ${bzr_src} einfo "Fetching documentation (date: ${date},${time})" bzr export -r date:${date},${time} kicad-doc ${bzr_doc} einfo "Fetching libraries (date: ${date},${time})" bzr export -r date:${date},${time} kicad-library ${bzr_lib} mv kicad-doc kicad mv kicad-library kicad sed -i -e '/add_subdirectory(template)/ a \ add_subdirectory(kicad-doc)\ add_subdirectory(kicad-library)' \ -e 's/create_svn_version_header()/#create_svn_version_header()/' \ -e 's/ -O2 / /' \ kicad/CMakeLists.txt || echo "sed error" sed -i -e 's/Scientific;Development/Engineering;Electronics/' \ kicad/resources/linux/opendesktop/*.desktop || echo "sed error" einfo "Creating file kicad-doc-${bzrdate}_p${revision}.tar.xz" tar cvfJ kicad-doc-${bzrdate}_p${revision}.tar.xz kicad/kicad-doc rm -rf kicad/kicad-doc einfo "Creating file kicad-library-${bzrdate}_p${revision}.tar.xz" tar cvfJ kicad-library-${bzrdate}_p${revision}.tar.xz kicad/kicad-library rm -rf kicad/kicad-library einfo "Creating file kicad-examples-${bzrdate}_p${revision}.tar.xz" tar cvfJ kicad-examples-${bzrdate}_p${revision}.tar.xz kicad/demos rm -rf kicad/demos einfo "Creating file kicad-sources-${bzrdate}_p${revision}.tar.xz" tar cvfJ kicad-sources-${bzrdate}_p${revision}.tar.xz kicad rm -rf kicad