[PATCH setup 03/11] Factor out the iteration over archive files to install
Jon Turney
jon.turney@dronecode.org.uk
Tue Aug 10 17:02:20 GMT 2021
---
install.cc | 53 +++++++++++++++++++++++++++++++++++++----------------
1 file changed, 37 insertions(+), 16 deletions(-)
diff --git a/install.cc b/install.cc
index 51ec4b5..cec31a9 100644
--- a/install.cc
+++ b/install.cc
@@ -93,7 +93,13 @@ class Installer
private:
bool extract_replace_on_reboot(archive *, const std::string&,
const std::string&, std::string);
-
+ bool _installOne (packagemeta &pkgm,
+ const std::string& prefixURL,
+ const std::string& prefixPath,
+ HWND owner,
+ io_stream *pkgfile,
+ archive *tarstream,
+ io_stream *lst);
};
Installer::Installer() : errors(0)
@@ -529,13 +535,39 @@ Installer::installOne (packagemeta &pkgm, const packageversion &ver,
}
}
+ package_bytes = source.size;
+ Log (LOG_PLAIN) << "Extracting from " << source.Cached () << endLog;
+
+ bool error_in_this_package = _installOne(pkgm, prefixURL, prefixPath, owner,
+ pkgfile, tarstream, lst);
+
+ if (lst)
+ delete lst;
+ delete tarstream;
+
+ total_bytes_sofar += package_bytes;
+ progress (0);
+
+ int df = diskfull (get_root_dir ().c_str ());
+ Progress.SetBar3 (df);
+
+ if (ver.Type () == package_binary && !error_in_this_package)
+ pkgm.installed = ver;
+}
+
+bool
+Installer::_installOne (packagemeta &pkgm,
+ const std::string& prefixURL,
+ const std::string& prefixPath,
+ HWND owner,
+ io_stream *pkgfile,
+ archive *tarstream,
+ io_stream *lst)
+{
bool error_in_this_package = false;
bool ignoreInUseErrors = false;
bool ignoreExtractErrors = unattended_mode;
- package_bytes = source.size;
- Log (LOG_PLAIN) << "Extracting from " << source.Cached () << endLog;
-
std::string fn;
while ((fn = tarstream->next_file_name ()).size ())
{
@@ -725,18 +757,7 @@ Installer::installOne (packagemeta &pkgm, const packageversion &ver,
num_installs++;
}
- if (lst)
- delete lst;
- delete tarstream;
-
- total_bytes_sofar += package_bytes;
- progress (0);
-
- int df = diskfull (get_root_dir ().c_str ());
- Progress.SetBar3 (df);
-
- if (ver.Type () == package_binary && !error_in_this_package)
- pkgm.installed = ver;
+ return error_in_this_package;
}
static void
--
2.32.0
More information about the Cygwin-apps
mailing list