From 92ab07ba1704c3d66dcc5e3e6a1c78e5d2738515 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Thu, 19 Jul 2012 15:51:32 +0300 Subject: [PATCH] Make tarballs work again --- source/component.cpp | 25 ++++++++++--------------- source/tar.cpp | 2 ++ 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/source/component.cpp b/source/component.cpp index 5a735d0..b486c6c 100644 --- a/source/component.cpp +++ b/source/component.cpp @@ -93,38 +93,33 @@ void Component::create_targets() const string inst_loc; if(type==TARBALL) { - //const Tool &tar = toolchain.get_tool("TAR"); - - string tarname = name; - if(name=="@src") - { - tarname = package.get_name()+"-"+package.get_version(); - source_filenames.push_back(package.get_source_directory()/"Build"); - } + const Tool &tar = toolchain.get_tool("TAR"); list files; for(PathList::const_iterator i=source_filenames.begin(); i!=source_filenames.end(); ++i) { FileTarget *file = builder.get_vfs().get_target(*i); if(!file) - file = new File(builder, *i); + file = new File(builder, package, *i); files.push_back(file); } + string tarname = name; if(name=="@src") { + tarname = package.get_name()+"-"+package.get_version(); + files.insert(files.begin(), &package.get_build_file()); + const Builder::TargetMap &targets = builder.get_targets(); for(Builder::TargetMap::const_iterator i=targets.begin(); i!=targets.end(); ++i) if(i->second->get_package()==&package && !i->second->is_buildable()) - files.push_back(i->second); + if(find(files.begin(), files.end(), i->second)==files.end()) + files.push_back(i->second); } - /* XXX The source files don't have a package at the moment, so we can't - create the tarball target until things get fixed up a bit */ - /*Target *result = tar.create_target(files, tarname); + Target *result = tar.create_target(files, tarname); - Target *tarballs_tgt = builder.get_target("tarballs"); - tarballs_tgt->add_dependency(*result);*/ + builder.get_target("tarballs")->add_dependency(*result); return; } diff --git a/source/tar.cpp b/source/tar.cpp index b4ba71e..ac2f9e8 100644 --- a/source/tar.cpp +++ b/source/tar.cpp @@ -24,6 +24,8 @@ Target *Tar::create_target(const list &sources, const string &arg) con for(list::const_iterator i=sources.begin(); i!=sources.end(); ++i) tarball->add_dependency(**i); + tarball->set_tool(*this); + return tarball; } -- 2.45.2