Re: [RFU]: guile-1.8.7-2
On Nov 25 20:27, Jan Nieuwenhuizen wrote: Bugfix release, please update and remove the problematic 1.8.7-1, thanks! wget --force-directories --no-host-directories --cut-dirs=2 \ http://lilypond.org/cygwin/release/guile/guile-1.8.7-2-src.tar.bz2 \ http://lilypond.org/cygwin/release/guile/guile-1.8.7-2.tar.bz2 [...] Uploaded and 1.8.7-1 removed. Thanks, Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat
[PATCH 0/4] setup.exe patches for improvements in mirror URL handling
Revised patches with some small improvements to the way setup.exe handles mirror URLs. I'm really not that keen on patches 3 4. It changes a lot of stuff around just to change the name of a directory from e.g. 'http%3a%2f%2fmirrors.kernel.org%2fsourceware%2fcygwin%2f' to 'http%3a%2f%2fmirrors.kernel.org%2fsourceware%2fcygwin'. Jon TURNEY (4): Add the last element of URL path to site chooser, if interesting. Canonicalize mirror URLs to ensure they end with a '/' Make io_stream::exists() directory aware Use site download directory without trailing %2f if it doesn't already exist IOStreamProvider.h |2 +- download.cc | 11 --- ini.cc |5 ++--- install.cc |2 +- io_stream.cc |2 +- io_stream.h | 10 +- io_stream_cygfile.cc | 23 +-- io_stream_cygfile.h |2 +- io_stream_file.cc| 15 ++- io_stream_file.h |2 +- package_source.cc| 36 +++- package_source.h |7 ++- script.cc|2 +- site.cc | 33 +++-- 14 files changed, 120 insertions(+), 32 deletions(-) -- 1.7.2.3
[PATCH 1/4] Add the last element of URL path to site chooser, if interesting.
Currently, for example, if I manually add the site http://mirrors.kernel.org/sources.redhat.com/cygwinports/ to setup's mirror list, I get two indistinguishable entries named http://mirrors.kernel.org. Furthermore, because the code to ensure the site just added is selected uses the string inside the list control to locate elements, we end up with a random one of those two indistinguishable entries selected (usually the previously existing one). This problem also prevents the selected sites being correctly saved and restored for the next setup run. So, to make the site chooser list entries unique and distinguishable, add the last element of the URL path to the site chooser, if it exists and isn't 'cygwin' (or some other alternatives used by current mirrors) (Also fix the logic for identifying protocol and site name part of the URL to find the first '/' after a '//', rather than the first '/' after a '.', to handle sitenames which aren't FQDNs correctly) (Also use LB_FINDSTRINGEXACT rather than LB_FINDSTRING so selected sites are restored correctly if they have a common initial substring) 2010-11-26 Jon TURNEY jon.tur...@dronecode.org.uk * site.cc (init): If interesting, show the last element of URL, as well as the protocol and sitename in the site chooser. (PopulateListBox) Use LB_FINDSTRINGEXACT. Signed-off-by: Jon TURNEY jon.tur...@dronecode.org.uk --- site.cc | 29 +++-- 1 files changed, 27 insertions(+), 2 deletions(-) diff --git a/site.cc b/site.cc index 2e58c2f..42839f3 100644 --- a/site.cc +++ b/site.cc @@ -140,8 +140,13 @@ site_list_type::init (const string _url, const string _servername, servername = _servername; area = _area; location = _location; - displayed_url = url.substr (0, url.find (/, url.find (.))); + /* displayed_url is protocol and site name part of url */ + string::size_type path_offset = url.find (/, url.find (//) + 2); + displayed_url = url.substr(0, path_offset); + + /* the sorting key is hostname components in reverse order (to sort by country code) + plus the url (to ensure uniqueness) */ key = string(); string::size_type last_idx = displayed_url.length () - 1; string::size_type idx = url.find_last_of(./, last_idx); @@ -160,6 +165,26 @@ site_list_type::init (const string _url, const string _servername, idx = 0; } while (idx 0); key += url; + + /* add last element of url if it exists, and isn't cygwin to displayed_url */ + if (path_offset+1 url.length()) +{ + string url_path = url.substr(path_offset+1); + + /* trim any trailing / */ + if (url_path.at(url_path.length()-1) == '/') +url_path.erase(url_path.length()-1); + + /* add the last path element, if it exists, and isn't cygwin + (or some aliases used by existing sites) */ + string::size_type pos = url_path.rfind('/'); + string lpe = url_path.substr(pos+1); + if ((pos != string::npos) (lpe.compare(cygwin) != 0) (lpe.compare(cygwin.com) != 0) + (lpe.compare(cygwin32) != 0) (lpe.compare(gnu-win32) != 0)) +{ + displayed_url.append( ( + lpe + )); +} +} } site_list_type::site_list_type (const string _url, @@ -627,7 +652,7 @@ SitePage::PopulateListBox () for (SiteList::const_iterator n = site_list.begin (); n != site_list.end (); ++n) { - int index = SendMessage (listbox, LB_FINDSTRING, (WPARAM) - 1, + int index = SendMessage (listbox, LB_FINDSTRINGEXACT, (WPARAM) - 1, (LPARAM) n-displayed_url.c_str()); if (index != LB_ERR) { -- 1.7.2.3
[PATCH 2/4] Canonicalize mirror URLs to ensure they end with a '/'
This prevents a mirror URL being added twice (with and without a terminal '/') This ensures that the download directory is consistently named, avoiding downloading everything again, even if an additional mirror URL is added in a form which differs in the presence of a terminal '/' from last time. 2010-11-26 Jon TURNEY jon.tur...@dronecode.org.uk * site.cc (init): Canonicalize mirror URLs to ensure the end with a '/'. Signed-off-by: Jon TURNEY jon.tur...@dronecode.org.uk --- site.cc |4 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/site.cc b/site.cc index 42839f3..ff617b5 100644 --- a/site.cc +++ b/site.cc @@ -141,6 +141,10 @@ site_list_type::init (const string _url, const string _servername, area = _area; location = _location; + /* Canonicalize URL to ensure it ends with a '/' */ + if (url.at(url.length()-1) != '/') +url.append(/); + /* displayed_url is protocol and site name part of url */ string::size_type path_offset = url.find (/, url.find (//) + 2); displayed_url = url.substr(0, path_offset); -- 1.7.2.3
[PATCH 4/4] Use site download directory without trailing %2f if it doesn't already exist
Centralize where download directory is chosen Use site download directory without trailing %2f if it doesn't already exist 2010-11-26 Jon TURNEY jon.tur...@dronecode.org.uk * package_source.h (site): Add get_local_path() method and storage * package_source.cc (get_local_path): Implement get_local_path() method, to determine local directory to use for downloads from site. * ini.cc (do_remote_ini): Use get_local_path() * download.cc (check_for_cached, download_one): Use get_local_path() Signed-off-by: Jon TURNEY jon.tur...@dronecode.org.uk --- download.cc |7 ++- ini.cc|5 ++--- package_source.cc | 36 +++- package_source.h |7 ++- 4 files changed, 45 insertions(+), 10 deletions(-) diff --git a/download.cc b/download.cc index 3567715..e9b4048 100644 --- a/download.cc +++ b/download.cc @@ -108,8 +108,7 @@ check_for_cached (packagesource pkgsource) for (packagesource::sitestype::const_iterator n = pkgsource.sites.begin(); n != pkgsource.sites.end(); ++n) { -std::string fullname = prefix + rfc1738_escape_part (n-key) + / + - pkgsource.Canonical (); +std::string fullname = file:// + n-get_local_path() + / + pkgsource.Canonical (); if (io_stream::exists(fullname) == IO_STREAM_EXISTS_FILE) { if (validateCachedPackage (fullname, pkgsource)) @@ -150,9 +149,7 @@ download_one (packagesource pkgsource, HWND owner) for (packagesource::sitestype::const_iterator n = pkgsource.sites.begin(); n != pkgsource.sites.end() !success; ++n) { - const std::string local = local_dir + / + - rfc1738_escape_part (n-key) + / + - pkgsource.Canonical (); + const std::string local = n-get_local_path() + / + pkgsource.Canonical (); io_stream::mkpath_p (PATH_TO_FILE, file:// + local, 0); if (get_url_to_file(n-key + / + pkgsource.Canonical (), diff --git a/ini.cc b/ini.cc index b983438..b9e256d 100644 --- a/ini.cc +++ b/ini.cc @@ -262,9 +262,8 @@ do_remote_ini (HWND owner) else { /* save known-good setup.ini locally */ - const std::string fp = file:// + local_dir + / + - rfc1738_escape_part (n-url) + - / + SETUP_INI_FILENAME; + site parse_site(n-url); + const std::string fp = file:// + parse_site.get_local_path() + / + SETUP_INI_FILENAME; io_stream::mkpath_p (PATH_TO_FILE, fp, 0); if (io_stream *out = io_stream::open (fp, wb, 0)) { diff --git a/package_source.cc b/package_source.cc index 8accb1f..5248cb8 100644 --- a/package_source.cc +++ b/package_source.cc @@ -25,11 +25,45 @@ static const char *cvsid = #include stdlib.h #include strings.h #include package_source.h +#include LogSingleton.h +#include state.h +#include io_stream.h +#include csu_util/rfc1738.h site::site (const std::string newkey) : key(newkey) { }; - + +const std::string +site::get_local_path(void) const +{ + /* if we haven't already determined the local_path for this site... */ + if (local_path.empty()) +{ + /* check for preexisting directory, if so use that... */ + local_path = local_dir + / + rfc1738_escape_part(key); + + if (!io_stream::exists(file:// + local_path)) +{ + std::string temp = key; + + /* ... otherwise, strip any terminal '/' (which should always be present in canonical URL) */ + if (temp.at(temp.length()-1) == '/') +temp.erase(temp.length()-1); + + local_path = local_dir + / + rfc1738_escape_part(temp); + + log (LOG_BABBLE) Will use local_pathfor storing downloads endLog; +} + else +{ + log (LOG_BABBLE) Found local_path , will use for storing downloads endLog; +} +} + + return local_path; +} + void packagesource::set_canonical (char const *fn) { diff --git a/package_source.h b/package_source.h index 9dea667..45a4a3c 100644 --- a/package_source.h +++ b/package_source.h @@ -47,11 +47,16 @@ class site public: site (const std::string newkey); ~site () {} - std::string key; + bool operator == (site const rhs) { return casecompare(key, rhs.key) == 0; } + + const std::string get_local_path() const; + + std::string key; + mutable std::string local_path; }; class packagesource -- 1.7.2.3
[PATCH 3/4] Make io_stream::exists() directory aware
At the moment io_stream::exists() returns FALSE for file:// paths which refer to an existing directory. Inconsistently, for cygfile:// paths which refer to an existing directory, it returns TRUE. Return a new state, IO_STREAM_EXISTS_DIRECTORY, to indicate if pathname exists as a directory and update all uses appropriately Not sure if the use of access() in the legacy branch of io_stream_cygfile::exists() is correct, looks like it's inverted Not sure if current exists() implementation deals correctly when other attributes are set for a file, e.g. FILE_ATTRIBUTE_COMPRESSED or FILE_ATTRIBUTE_ENCRYPTED, since it checks attributes against an expected value rather than checking for bits being set? 2010-11-26 Jon TURNEY jon.tur...@dronecode.org.uk * io_stream.h (io_stream_exists_t, io_stream::exists): Change io_stream::exists return type to new enum io_stream_exists_t. * io_stream.cc (exists): Ditto. * IOStreamProvider.h (IOStreamProvider): Ditto. * io_stream_file.h (io_stream): Ditto. * io_stream_file.cc (IOStreamProvider, exists): Ditto. * io_stream_cygfile.h (io_stream): Ditto. * io_stream_cygfile.cc (IOStreamProvider, exists): Ditto. * script.cc (try_run_script): Update use of io_stream::exists(). * install.cc (installOne): Ditto. * download.cc (check_for_cached): Ditto. Signed-off-by: Jon TURNEY jon.tur...@dronecode.org.uk --- IOStreamProvider.h |2 +- download.cc |4 ++-- install.cc |2 +- io_stream.cc |2 +- io_stream.h | 10 +- io_stream_cygfile.cc | 23 +-- io_stream_cygfile.h |2 +- io_stream_file.cc| 15 ++- io_stream_file.h |2 +- script.cc|2 +- 10 files changed, 44 insertions(+), 20 deletions(-) diff --git a/IOStreamProvider.h b/IOStreamProvider.h index b30362e..1c12f42 100644 --- a/IOStreamProvider.h +++ b/IOStreamProvider.h @@ -25,7 +25,7 @@ class IOStreamProvider { public: - virtual int exists (const std::string ) const = 0; + virtual io_stream_exists_t exists (const std::string ) const = 0; virtual int remove (const std::string ) const = 0; virtual int mklink (const std::string, const std::string, io_stream_link_t) const = 0; diff --git a/download.cc b/download.cc index 86723f6..3567715 100644 --- a/download.cc +++ b/download.cc @@ -91,7 +91,7 @@ check_for_cached (packagesource pkgsource) * std::string-ified, and doesn't use overcomplex semantics. */ std::string fullname = prefix + (pkgsource.Canonical() ? pkgsource.Canonical() : ); - if (io_stream::exists(fullname)) + if (io_stream::exists(fullname) == IO_STREAM_EXISTS_FILE) { if (validateCachedPackage (fullname, pkgsource)) pkgsource.set_cached (fullname); @@ -110,7 +110,7 @@ check_for_cached (packagesource pkgsource) { std::string fullname = prefix + rfc1738_escape_part (n-key) + / + pkgsource.Canonical (); -if (io_stream::exists(fullname)) +if (io_stream::exists(fullname) == IO_STREAM_EXISTS_FILE) { if (validateCachedPackage (fullname, pkgsource)) pkgsource.set_cached (fullname); diff --git a/install.cc b/install.cc index 51c20d9..f77b52b 100644 --- a/install.cc +++ b/install.cc @@ -261,7 +261,7 @@ Installer::installOne (packagemeta pkgm, const packageversion ver, io_stream *pkgfile = NULL; - if (!source.Cached() || !io_stream::exists (source.Cached ()) + if (!source.Cached() || (io_stream::exists (source.Cached ()) != IO_STREAM_EXISTS_FILE) || !(pkgfile = io_stream::open (source.Cached (), rb, 0))) { note (NULL, IDS_ERR_OPEN_READ, source.Cached (), No such file); diff --git a/io_stream.cc b/io_stream.cc index 08ecae4..23c7e36 100644 --- a/io_stream.cc +++ b/io_stream.cc @@ -241,7 +241,7 @@ io_stream::gets (char *buffer, size_t length) return buffer; } -int +io_stream_exists_t io_stream::exists (const std::string name) { IOStreamProvider const *p = findProvider (name); diff --git a/io_stream.h b/io_stream.h index 3968acc..97528a8 100644 --- a/io_stream.h +++ b/io_stream.h @@ -74,6 +74,14 @@ typedef enum } io_stream_seek_t; +typedef enum +{ + IO_STREAM_EXISTS_NO = 0, + IO_STREAM_EXISTS_FILE, + IO_STREAM_EXISTS_DIRECTORY, +} +io_stream_exists_t; + class io_stream { public: @@ -103,7 +111,7 @@ public: */ static io_stream *open (const std::string, const std::string, mode_t); static int remove (const std::string ); - static int exists (const std::string ); + static io_stream_exists_t exists (const std::string ); /* moves physical stream source to dest. A copy will be attempted if a * pointer flip fails. */ diff --git a/io_stream_cygfile.cc b/io_stream_cygfile.cc index 8da97e7..7b768b6 100644 --- a/io_stream_cygfile.cc +++ b/io_stream_cygfile.cc @@ -27,6 +27,7 @@ static const char *cvsid = #include stdio.h #include stdlib.h #include
Re: [PATCH] A setup.exe performance enhancement
On 20/11/2010 09:43, Corinna Vinschen wrote: On Nov 19 14:49, Christopher Faylor wrote: On Fri, Nov 19, 2010 at 04:07:23PM +, Jon TURNEY wrote: Change package_db collection of packages from vector to a map so we can look things up in it quickly This allows packagedb::findBinary() and packagedb::findSource() to be re-written to locate packages by name rather than searching the entire set, which makes a big difference to total execution time. [snip] I was just marvelling today at the inexplicable pauses in setup.exe. Will this reduce the amount of time that setup.exe takes parsing setup.ini? Yes, it should do. Assuming that the answer is ok, I'm happy with this change but I'd like to get Corinna's ok, too since it is sort of invasive. I have no objections at all. Go for it. Ok, committed. I've also uploaded a setup snapshot at [1], I would be much obliged if that received some testing. [1] http://cygwin.com/setup/snapshots/setup-2.738.exe
Re: [PATCH] A setup.exe performance enhancement
On 26 November 2010 15:22, Jon TURNEY wrote: On 20/11/2010 09:43, Corinna Vinschen wrote: On Nov 19 14:49, Christopher Faylor wrote: On Fri, Nov 19, 2010 at 04:07:23PM +, Jon TURNEY wrote: Change package_db collection of packages from vector to a map so we can look things up in it quickly This allows packagedb::findBinary() and packagedb::findSource() to be re-written to locate packages by name rather than searching the entire set, which makes a big difference to total execution time. [snip] I was just marvelling today at the inexplicable pauses in setup.exe. Will this reduce the amount of time that setup.exe takes parsing setup.ini? Yes, it should do. Assuming that the answer is ok, I'm happy with this change but I'd like to get Corinna's ok, too since it is sort of invasive. I have no objections at all. Go for it. Ok, committed. I've also uploaded a setup snapshot at [1], I would be much obliged if that received some testing. [1] http://cygwin.com/setup/snapshots/setup-2.738.exe Wow, what a difference. It's so fast that the new progress bars can hardly be seen. Setup.ini parsing, switching between Keep/Curr/Exp, and dependency checking are all pretty much instantaneous, even with Cygwin Ports. Give that man a bag of gold stars! Andy