module PreparePackageBuildDir

Copyright (C) 2018 Franz Flasch <franz.flasch@gmx.at>

This file is part of REM - Rake for EMbedded Systems and Microcontrollers.

REM 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 3 of the License, or (at your option) any later version.

REM 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 REM. If not, see <www.gnu.org/licenses/>.

Private Instance Methods

do_prepare_builddir() click to toggle source
# File scripts/prepare_tasks/prepare.rb, line 58
def do_prepare_builddir
    case uri[0].uri_type
        when "local"
            print_debug "LOCAL package"
        when "zip"
            print_debug "ZIP package"
            prepare_zip()
        when "gz"
            print_debug "GZ package"
            prepare_gz();
        when "git"
            print_debug "GIT repo"
            prepare_clone_git()
        when "svn"
            print_debug "SVN repo"
            prepare_checkout_svn()
        else
            print_abort('No valid URI type!')
    end
    # files need to be copied in every case:
    prepare_copy()
end
do_prepare_clean() click to toggle source
# File scripts/prepare_tasks/prepare.rb, line 54
def do_prepare_clean
    FileUtils.rm_rf(pkg_build_dir)
end
prepare_checkout_svn() click to toggle source
# File scripts/prepare_tasks/prepare.rb, line 38
def prepare_checkout_svn
    execute "svn co --non-interactive --trust-server-cert #{uri[0].uri} #{pkg_build_dir}"
    if(uri[0].uri_src_rev != "undefined")
        # TODO: add possibilty to checkout specific revision
    end
end
prepare_clone_git() click to toggle source
# File scripts/prepare_tasks/prepare.rb, line 31
def prepare_clone_git
    execute "git clone #{uri[0].uri} #{pkg_build_dir}"
    if(uri[0].uri_src_rev != "undefined")
        execute "git --git-dir=#{pkg_build_dir}/.git --work-tree=#{pkg_build_dir} checkout #{uri[0].uri_src_rev}"
    end
end
prepare_copy() click to toggle source
# File scripts/prepare_tasks/prepare.rb, line 25
def prepare_copy
    base_dir.each do |dir|
        FileUtils.cp_r("#{dir}/.", pkg_build_dir, {:remove_destination => true, :verbose => false})
    end
end
prepare_gz() click to toggle source
# File scripts/prepare_tasks/prepare.rb, line 49
def prepare_gz
    FileUtils.mkdir_p("#{pkg_build_dir}")
    execute "tar -xvf #{pkg_dl_dir}/#{get_filename_from_uri(uri[0].uri)} -C #{pkg_build_dir}"
end
prepare_zip() click to toggle source
# File scripts/prepare_tasks/prepare.rb, line 45
def prepare_zip
    execute "unzip -qq #{pkg_dl_dir}/#{get_filename_from_uri(uri[0].uri)} -d #{pkg_build_dir}"
end