]> git.tdb.fi Git - builder.git/commitdiff
Drop support for generic tarball components
authorMikko Rasa <tdb@tdb.fi>
Mon, 6 Oct 2014 20:43:34 +0000 (23:43 +0300)
committerMikko Rasa <tdb@tdb.fi>
Mon, 6 Oct 2014 21:00:13 +0000 (00:00 +0300)
I originally envisioned using them for creating binary release tarballs,
but that turns out to be a less than spectacular idea.  Tarballs only
really work as a distribution format on Linux.  Other platforms either
use a different archive format or require more complicated preparations.

Build
source/buildgraph.cpp
source/component.h
source/sourcearchivecomponent.cpp [new file with mode: 0644]
source/sourcearchivecomponent.h [new file with mode: 0644]
source/sourcepackage.cpp
source/sourcepackage.h
source/tarballcomponent.cpp [deleted file]
source/tarballcomponent.h [deleted file]

diff --git a/Build b/Build
index 9e7ee86f035ffd7c7c51d3cbc3e51cfba34141ef..fff39a950ec39d84d72f8224968026b90ed8eed1 100644 (file)
--- a/Build
+++ b/Build
@@ -15,7 +15,7 @@ package "builder"
                install true;
        };
 
-       source_tarball
+       source_archive
        {
                source "bootstrap.sh";
                source "Readme.txt";
index 94b5ed6ffd2dcfe578249dc2739a39c2a0014191..6ae13dcdf304cd5396b02b2a9b3a68bf5af3da0e 100644 (file)
@@ -14,7 +14,7 @@ BuildGraph::BuildGraph(Builder &b):
        Target *world = new VirtualTarget(builder, "world");
        world->add_dependency(*new VirtualTarget(builder, "default"));
        world->add_dependency(*new VirtualTarget(builder, "install"));
-       world->add_dependency(*new VirtualTarget(builder, "tarballs"));
+       world->add_dependency(*new VirtualTarget(builder, "archives"));
 }
 
 BuildGraph::~BuildGraph()
index d33ca25ae47900d9f156f6c24ec73fcf5ad1c578..1fbe3def1ae54bcc5aaf48c23c60f81595a9ac04 100644 (file)
@@ -48,8 +48,8 @@ protected:
        InstallMap install_map;
        std::list<std::string> problems;
 
-public:
        Component(SourcePackage &, const std::string &);
+public:
        virtual ~Component() { }
 
        const SourcePackage &get_package() const { return package; }
diff --git a/source/sourcearchivecomponent.cpp b/source/sourcearchivecomponent.cpp
new file mode 100644 (file)
index 0000000..6dc5fe6
--- /dev/null
@@ -0,0 +1,41 @@
+#include <algorithm>
+#include "builder.h"
+#include "file.h"
+#include "sourcearchivecomponent.h"
+#include "sourcepackage.h"
+#include "tool.h"
+
+using namespace std;
+
+SourceArchiveComponent::SourceArchiveComponent(SourcePackage &p):
+       Component(p, p.get_name()+"-source")
+{ }
+
+void SourceArchiveComponent::create_targets() const
+{
+       Builder &builder = package.get_builder();
+
+       list<Target *> files;
+       files.insert(files.begin(), &package.get_build_file());
+
+       SourceList source_filenames = collect_source_files();
+       for(SourceList::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, package, *i);
+               files.push_back(file);
+       }
+
+       BuildGraph &build_graph = builder.get_build_graph();
+       const BuildGraph::TargetMap &targets = build_graph.get_targets();
+       for(BuildGraph::TargetMap::const_iterator i=targets.begin(); i!=targets.end(); ++i)
+               if(i->second->get_package()==&package && !i->second->is_buildable())
+                       if(find(files.begin(), files.end(), i->second)==files.end())
+                               files.push_back(i->second);
+
+       const Toolchain &toolchain = builder.get_toolchain();
+       string archive_name = package.get_name()+"-"+package.get_version()+"-source";
+       Target *result = toolchain.get_tool("TAR").create_target(files, archive_name);
+       build_graph.get_target("archives")->add_dependency(*result);
+}
diff --git a/source/sourcearchivecomponent.h b/source/sourcearchivecomponent.h
new file mode 100644 (file)
index 0000000..cfef56e
--- /dev/null
@@ -0,0 +1,14 @@
+#ifndef TARBALLCOMPONENT_H_
+#define TARBALLCOMPONENT_H_
+
+#include "component.h"
+
+class SourceArchiveComponent: public Component
+{
+public:
+       SourceArchiveComponent(SourcePackage &);
+
+       virtual void create_targets() const;
+};
+
+#endif
index 1dd7dbd1062263b91f71bc7fd0cd007cd28e8f97..9738146423de46bc9152b7bdfac60f6734a8b639 100644 (file)
 #include "file.h"
 #include "installcomponent.h"
 #include "pkgconfigfile.h"
-#include "tarballcomponent.h"
-#include "tool.h"
+#include "sourcearchivecomponent.h"
 #include "sourcegenerator.h"
 #include "sourcepackage.h"
+#include "tool.h"
 
 using namespace std;
 using namespace Msp;
@@ -33,8 +33,8 @@ SourcePackage::SourcePackage(Builder &b, const string &n, const FS::Path &f):
        build_file = builder.get_vfs().get_target(f);
        if(!build_file)
                build_file = new File(builder, *this, f);
-       source_tarball = new TarballComponent(*this, "@src");
-       components.push_back(source_tarball);
+       source_archive = new SourceArchiveComponent(*this);
+       components.push_back(source_archive);
 }
 
 SourcePackage::~SourcePackage()
@@ -169,7 +169,8 @@ void SourcePackage::Loader::init(const Config::InputOptions *o)
        add("install",     &Loader::component<InstallComponent>);
        add("interface_version", &Loader::interface_version);
        add("datapack",    &Loader::component<DataPackComponent>);
-       add("source_tarball", &Loader::source_tarball);
+       add("source_archive", &Loader::source_archive);
+       add("source_tarball", &Loader::source_archive);
        add("tarball",     &Loader::tarball);
        add("version",     &Loader::version);
 }
@@ -178,7 +179,7 @@ void SourcePackage::Loader::finish()
 {
        /* Make sure the source tarball is last in the list so targets from all
        other components wil be created first */
-       ComponentList::iterator i = find(obj.components.begin(), obj.components.end(), obj.source_tarball);
+       ComponentList::iterator i = find(obj.components.begin(), obj.components.end(), obj.source_archive);
        if(i!=obj.components.end())
                obj.components.splice(obj.components.end(), obj.components, i);
 }
@@ -243,15 +244,14 @@ void SourcePackage::Loader::interface_version(const string &v)
                obj.version = v;
 }
 
-void SourcePackage::Loader::source_tarball()
+void SourcePackage::Loader::source_archive()
 {
-       load_sub(*obj.source_tarball);
+       load_sub(*obj.source_archive);
 }
 
-void SourcePackage::Loader::tarball(const string &n)
+void SourcePackage::Loader::tarball(const string &)
 {
-       TarballComponent trbl(obj, n);
-       load_sub(trbl);
+       IO::print("%s: Deprecated tarball component ignored\n", get_source());
 }
 
 void SourcePackage::Loader::version(const string &v)
index 66296001e44229265753f3c52056cef6a2652b02..ed8ad40f7275f9d5ac364a3f7971cf805b31b050 100644 (file)
@@ -14,7 +14,7 @@
 class Builder;
 class BuildType;
 class FileTarget;
-class TarballComponent;
+class SourceArchiveComponent;
 
 /**
 A package that can be built by Builder.
@@ -42,7 +42,7 @@ public:
                void generate(const std::string &);
                void if_feature(const std::string &);
                void interface_version(const std::string &);
-               void source_tarball();
+               void source_archive();
                void tarball(const std::string &);
                void version(const std::string &);
        };
@@ -63,7 +63,7 @@ private:
        FeatureList features;
        BuildInfo build_info;
        ComponentList components;
-       TarballComponent *source_tarball;
+       SourceArchiveComponent *source_archive;
        Config config;
        mutable Cache cache;
 
diff --git a/source/tarballcomponent.cpp b/source/tarballcomponent.cpp
deleted file mode 100644 (file)
index c94103c..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-#include <algorithm>
-#include "builder.h"
-#include "file.h"
-#include "sourcepackage.h"
-#include "tarballcomponent.h"
-#include "tool.h"
-
-using namespace std;
-
-TarballComponent::TarballComponent(SourcePackage &p, const string &n):
-       Component(p, n)
-{ }
-
-void TarballComponent::create_targets() const
-{
-       Builder &builder = package.get_builder();
-
-       list<Target *> files;
-       SourceList source_filenames = collect_source_files();
-       for(SourceList::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, package, *i);
-               files.push_back(file);
-       }
-
-       BuildGraph &build_graph = builder.get_build_graph();
-
-       string tarname = name;
-       if(name=="@src")
-       {
-               tarname = package.get_name()+"-"+package.get_version();
-               files.insert(files.begin(), &package.get_build_file());
-
-               const BuildGraph::TargetMap &targets = build_graph.get_targets();
-               for(BuildGraph::TargetMap::const_iterator i=targets.begin(); i!=targets.end(); ++i)
-                       if(i->second->get_package()==&package && !i->second->is_buildable())
-                               if(find(files.begin(), files.end(), i->second)==files.end())
-                                       files.push_back(i->second);
-       }
-
-       const Toolchain &toolchain = builder.get_toolchain();
-       Target *result = toolchain.get_tool("TAR").create_target(files, tarname);
-       build_graph.get_target("tarballs")->add_dependency(*result);
-}
diff --git a/source/tarballcomponent.h b/source/tarballcomponent.h
deleted file mode 100644 (file)
index d54f95e..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef TARBALLCOMPONENT_H_
-#define TARBALLCOMPONENT_H_
-
-#include "component.h"
-
-class TarballComponent: public Component
-{
-public:
-       TarballComponent(SourcePackage &, const std::string &);
-
-       virtual void create_targets() const;
-};
-
-#endif