mirror of
https://github.com/ModOrganizer2/mob.git
synced 2026-07-27 14:07:05 -07:00
release official now requires the branch name
disabled shallow git for installer added zlib license fixed some whitespace
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
/* zlib.h -- interface of the 'zlib' general purpose compression library
|
||||
version 1.2.11, January 15th, 2017
|
||||
|
||||
Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Jean-loup Gailly Mark Adler
|
||||
jloup@gzip.org madler@alumni.caltech.edu
|
||||
|
||||
*/
|
||||
@@ -37,6 +37,9 @@ git_shallow = false
|
||||
[usvfs:task]
|
||||
git_shallow = false
|
||||
|
||||
[installer:task]
|
||||
git_shallow = false
|
||||
|
||||
[translations:task]
|
||||
enabled = false
|
||||
|
||||
@@ -62,7 +65,7 @@ vcvars =
|
||||
|
||||
[transifex]
|
||||
enabled = true
|
||||
key =
|
||||
key =
|
||||
team = mod-organizer-2-team
|
||||
project = mod-organizer-2
|
||||
url = https://www.transifex.com
|
||||
|
||||
+56
-18
@@ -63,19 +63,19 @@ clipp::group command::common_options_group()
|
||||
% "path to the ini file",
|
||||
|
||||
(clipp::option("--dry") >> o.dry)
|
||||
% "simulates filesystem operations",
|
||||
% "simulates filesystem operations",
|
||||
|
||||
(clipp::option("-l", "--log-level")
|
||||
& clipp::value("LEVEL") >> o.output_log_level)
|
||||
% "0 is silent, 6 is max",
|
||||
& clipp::value("LEVEL") >> o.output_log_level)
|
||||
% "0 is silent, 6 is max",
|
||||
|
||||
(clipp::option("--file-log-level")
|
||||
& clipp::value("LEVEL") >> o.file_log_level)
|
||||
% "overrides --log-level for the log file",
|
||||
& clipp::value("LEVEL") >> o.file_log_level)
|
||||
% "overrides --log-level for the log file",
|
||||
|
||||
(clipp::option("--log-file")
|
||||
& clipp::value("FILE") >> o.log_file)
|
||||
% "path to log file",
|
||||
& clipp::value("FILE") >> o.log_file)
|
||||
% "path to log file",
|
||||
|
||||
(clipp::option("-d", "--destination")
|
||||
& clipp::value("DIR") >> o.prefix)
|
||||
@@ -856,25 +856,27 @@ clipp::group release_command::do_group()
|
||||
|
|
||||
|
||||
"official" %
|
||||
(clipp::command("official").set(mode_, modes::official)
|
||||
|
||||
(clipp::command("official").set(mode_, modes::official),
|
||||
(clipp::value("branch") >> branch_)
|
||||
% "use this branch in the super repos"
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
void release_command::convert_cl_to_conf()
|
||||
{
|
||||
command::convert_cl_to_conf();
|
||||
command::convert_cl_to_conf();
|
||||
|
||||
if (mode_ == modes::official)
|
||||
{
|
||||
common.options.push_back("translations:task/enabled=true");
|
||||
common.options.push_back("installer:task/enabled=true");
|
||||
if (mode_ == modes::official)
|
||||
{
|
||||
common.options.push_back("task/mo_branch=" + branch_);
|
||||
common.options.push_back("translations:task/enabled=true");
|
||||
common.options.push_back("installer:task/enabled=true");
|
||||
|
||||
common.options.push_back("transifex/force=true");
|
||||
common.options.push_back("transifex/configure=true");
|
||||
common.options.push_back("transifex/pull=true");
|
||||
}
|
||||
common.options.push_back("transifex/force=true");
|
||||
common.options.push_back("transifex/configure=true");
|
||||
common.options.push_back("transifex/pull=true");
|
||||
}
|
||||
}
|
||||
|
||||
int release_command::do_run()
|
||||
@@ -922,6 +924,42 @@ int release_command::do_official()
|
||||
{
|
||||
set_sigint_handler();
|
||||
|
||||
u8cout << "checking repos for branch " << branch_ << "...\n";
|
||||
|
||||
thread_pool tp;
|
||||
std::atomic<bool> failed = false;
|
||||
|
||||
for (const auto* t : find_tasks("super"))
|
||||
{
|
||||
if (!t->enabled())
|
||||
continue;
|
||||
|
||||
tp.add([this, t, &failed]
|
||||
{
|
||||
const auto* o = dynamic_cast<const modorganizer*>(t);
|
||||
|
||||
if (!git::branch_exists(o->git_url(), branch_))
|
||||
{
|
||||
gcx().error(context::generic,
|
||||
"branch {} doesn't exist in the {} repo",
|
||||
branch_, o->name());
|
||||
|
||||
failed = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
tp.join();
|
||||
|
||||
if (failed)
|
||||
{
|
||||
gcx().bail_out(context::generic,
|
||||
"either fix the branch name, create a remote branch for the "
|
||||
"repos that don't have it, or disable tasks with "
|
||||
"`-s TASKNAME:task/enabled=false`");
|
||||
}
|
||||
|
||||
|
||||
if (fs::exists(paths::prefix()))
|
||||
{
|
||||
u8cout
|
||||
|
||||
@@ -206,6 +206,7 @@ private:
|
||||
fs::path rc_path_;
|
||||
bool force_ = false;
|
||||
std::string suffix_;
|
||||
std::string branch_;
|
||||
|
||||
|
||||
int do_devbuild();
|
||||
|
||||
+8
-8
@@ -641,18 +641,18 @@ fs::path find_vs()
|
||||
|
||||
if (lines.empty())
|
||||
{
|
||||
gcx().bail_out(context::conf, "vswhere didn't output anything");
|
||||
gcx().bail_out(context::conf, "vswhere didn't output anything");
|
||||
}
|
||||
else if (lines.size() > 1)
|
||||
{
|
||||
gcx().error(context::conf, "vswhere returned multiple installations:");
|
||||
gcx().error(context::conf, "vswhere returned multiple installations:");
|
||||
|
||||
for (auto&& line : lines)
|
||||
gcx().error(context::conf, " - {}", line);
|
||||
for (auto&& line : lines)
|
||||
gcx().error(context::conf, " - {}", line);
|
||||
|
||||
gcx().bail_out(context::conf,
|
||||
"specify the `vs` path in the `[paths]` section of the INI, or pass "
|
||||
"-s paths/vs=PATH` to pick an installation");
|
||||
gcx().bail_out(context::conf,
|
||||
"specify the `vs` path in the `[paths]` section of the INI, or "
|
||||
"pass -s paths/vs=PATH` to pick an installation");
|
||||
}
|
||||
|
||||
if (!fs::exists(path))
|
||||
@@ -1044,7 +1044,7 @@ fs::path find_iscc()
|
||||
|
||||
fs::path p = find_in_path(path_to_utf8(iscc));
|
||||
if (fs::exists(p))
|
||||
return fs::canonical(fs::absolute(p));
|
||||
return fs::canonical(fs::absolute(p));
|
||||
|
||||
for (int v : {5, 6, 7, 8})
|
||||
{
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ HANDLE get_bit_bucket()
|
||||
}
|
||||
|
||||
async_pipe::async_pipe(const context& cx)
|
||||
: cx_(cx), pending_(false), closed_(true)
|
||||
: cx_(cx), pending_(false), closed_(true)
|
||||
{
|
||||
buffer_ = std::make_unique<char[]>(buffer_size);
|
||||
std::memset(buffer_.get(), 0, buffer_size);
|
||||
|
||||
+11
-11
@@ -13,26 +13,26 @@ class url;
|
||||
class async_pipe
|
||||
{
|
||||
public:
|
||||
async_pipe(const context& cx);
|
||||
async_pipe(const context& cx);
|
||||
|
||||
handle_ptr create();
|
||||
handle_ptr create();
|
||||
std::string_view read(bool finish);
|
||||
bool closed() const;
|
||||
|
||||
private:
|
||||
static const std::size_t buffer_size = 50'000;
|
||||
static const std::size_t buffer_size = 50'000;
|
||||
|
||||
const context& cx_;
|
||||
handle_ptr stdout_;
|
||||
handle_ptr event_;
|
||||
std::unique_ptr<char[]> buffer_;
|
||||
OVERLAPPED ov_;
|
||||
bool pending_;
|
||||
handle_ptr stdout_;
|
||||
handle_ptr event_;
|
||||
std::unique_ptr<char[]> buffer_;
|
||||
OVERLAPPED ov_;
|
||||
bool pending_;
|
||||
bool closed_;
|
||||
|
||||
HANDLE create_pipe();
|
||||
std::string_view try_read();
|
||||
std::string_view check_pending();
|
||||
HANDLE create_pipe();
|
||||
std::string_view try_read();
|
||||
std::string_view check_pending();
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -75,6 +75,11 @@ fs::path modorganizer::super_path()
|
||||
return paths::build() / "modorganizer_super";
|
||||
}
|
||||
|
||||
url modorganizer::git_url() const
|
||||
{
|
||||
return task_conf().make_git_url(task_conf().mo_org(), repo_);
|
||||
}
|
||||
|
||||
void modorganizer::do_clean(clean c)
|
||||
{
|
||||
instrument<times::clean>([&]
|
||||
@@ -103,7 +108,7 @@ void modorganizer::do_fetch()
|
||||
instrument<times::fetch>([&]
|
||||
{
|
||||
run_tool(task_conf().make_git()
|
||||
.url(task_conf().make_git_url(task_conf().mo_org(), repo_))
|
||||
.url(git_url())
|
||||
.branch(task_conf().mo_branch())
|
||||
.root(this_source_path()));
|
||||
});
|
||||
@@ -113,7 +118,7 @@ void modorganizer::do_build_and_install()
|
||||
{
|
||||
git_submodule_adder::instance().queue(std::move(
|
||||
task_conf().make_git(git::ops::add_submodule)
|
||||
.url(task_conf().make_git_url(task_conf().mo_org(), repo_))
|
||||
.url(git_url())
|
||||
.branch(task_conf().mo_branch())
|
||||
.submodule_name(name())
|
||||
.root(super_path())));
|
||||
|
||||
@@ -66,6 +66,23 @@ std::vector<task*> find_tasks(const std::string& pattern)
|
||||
return tasks;
|
||||
}
|
||||
|
||||
task* find_task(const std::string& pattern)
|
||||
{
|
||||
for (auto&& t : g_all_tasks)
|
||||
{
|
||||
if (pattern == "super" && t->is_super())
|
||||
return t;
|
||||
|
||||
for (auto&& n : t->names())
|
||||
{
|
||||
if (mob::glob_match(pattern, n))
|
||||
return t;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void run_all_tasks()
|
||||
{
|
||||
try
|
||||
|
||||
@@ -24,6 +24,7 @@ Task& add_task(Args&&... args)
|
||||
void run_all_tasks();
|
||||
bool is_super_task(const std::string& name);
|
||||
std::vector<task*> find_tasks(const std::string& pattern);
|
||||
task* find_task(const std::string& pattern);
|
||||
|
||||
std::vector<task*> get_all_tasks();
|
||||
std::vector<task*> get_top_level_tasks();
|
||||
|
||||
@@ -306,6 +306,7 @@ public:
|
||||
|
||||
bool is_super() const override;
|
||||
bool is_gamebryo_plugin() const;
|
||||
url git_url() const;
|
||||
|
||||
protected:
|
||||
void do_clean(clean c) override;
|
||||
|
||||
@@ -95,6 +95,14 @@ bool git::is_git_repo(const fs::path& p)
|
||||
return g.is_repo();
|
||||
}
|
||||
|
||||
bool git::branch_exists(const mob::url& u, const std::string& name)
|
||||
{
|
||||
git g(no_op);
|
||||
g.url(u);
|
||||
g.branch(name);
|
||||
return g.branch_exists();
|
||||
}
|
||||
|
||||
void git::init_repo(const fs::path& p)
|
||||
{
|
||||
git g(no_op);
|
||||
@@ -505,6 +513,19 @@ bool git::is_repo()
|
||||
return (execute_and_join() == 0);
|
||||
}
|
||||
|
||||
bool git::branch_exists()
|
||||
{
|
||||
process_ = make_process()
|
||||
.flags(process::allow_failure)
|
||||
.arg("ls-remote")
|
||||
.arg("--exit-code")
|
||||
.arg("--heads")
|
||||
.arg(url_)
|
||||
.arg(branch_);
|
||||
|
||||
return (execute_and_join() == 0);
|
||||
}
|
||||
|
||||
bool git::has_uncommitted_changes()
|
||||
{
|
||||
process_ = make_process()
|
||||
|
||||
@@ -180,6 +180,7 @@ public:
|
||||
bool push_default);
|
||||
|
||||
static bool is_git_repo(const fs::path& p);
|
||||
static bool branch_exists(const mob::url& u, const std::string& name);
|
||||
static void init_repo(const fs::path& p);
|
||||
|
||||
|
||||
@@ -237,6 +238,7 @@ private:
|
||||
void set_remote_push(const std::string& remote, const std::string& url);
|
||||
void set_assume_unchanged(const fs::path& relative_file, bool on);
|
||||
bool is_repo();
|
||||
bool branch_exists();
|
||||
bool has_uncommitted_changes();
|
||||
bool has_stashed_changes();
|
||||
void init();
|
||||
|
||||
Reference in New Issue
Block a user