Skip to content

Add progress information during package download and install phases.#69

Open
nbyouri wants to merge 3 commits into
NetBSDfr:masterfrom
nbyouri:master
Open

Add progress information during package download and install phases.#69
nbyouri wants to merge 3 commits into
NetBSDfr:masterfrom
nbyouri:master

Conversation

@nbyouri

@nbyouri nbyouri commented Mar 1, 2016

Copy link
Copy Markdown
Contributor

No description provided.

@nbyouri

nbyouri commented Apr 17, 2016

Copy link
Copy Markdown
Contributor Author

Hello,
I changed the code a bit to use global variables like iMil asked. There's one during the download phase issue when packages are already in the cache it looks a bit bad:
[1/3] gettext-m4-0.19.7.tgz ...
[2/2] gettext-0.19.7.tgz ...
To fix this I'd have to iterate over the list of packages to download to first know the amount of packages to actually download, which sounds a bit inefficient..
Comments? I'll squash commits when ready.

@nbyouri

nbyouri commented Apr 17, 2016

Copy link
Copy Markdown
Contributor Author

The inefficient code I was talking about would look like this:

diff --git a/actions.c b/actions.c
index 6bfbb13..7c18818 100644
--- a/actions.c
+++ b/actions.c
@@ -76,6 +76,17 @@ pkg_download(Plisthead *installhead)
        snprintf(pkg_fs, BUFSIZ,
            "%s/%s%s", pkgin_cache, pinstall->depend, PKG_EXT);

+       /* already fully downloaded */
+       if (stat(pkg_fs, &st) == 0 &&
+           st.st_size == pinstall->file_size &&
+           pinstall->file_size != 0)
+           total_download--;
+   }
+
+   SLIST_FOREACH(pinstall, installhead, next) {
+       snprintf(pkg_fs, BUFSIZ,
+           "%s/%s%s", pkgin_cache, pinstall->depend, PKG_EXT);
+
        /* pkg_info -X -a produces pkg_summary with empty FILE_SIZE,
         * people could spend some time blaming on pkgin before finding
         * what's really going on.
@@ -86,10 +97,8 @@ pkg_download(Plisthead *installhead)
        /* already fully downloaded */
        if (stat(pkg_fs, &st) == 0 && 
            st.st_size == pinstall->file_size &&
-           pinstall->file_size != 0 ) {
-           total_download--;
+           pinstall->file_size != 0)
            continue;
-       }

        snprintf(query, BUFSIZ, PKG_URL, pinstall->depend);
        /* retrieve repository for package  */

@nbyouri

nbyouri commented Jun 21, 2016

Copy link
Copy Markdown
Contributor Author

I just committed that as Riadstradth@netbsd approved the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant