Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

nbyouri
Copy link
Contributor

@nbyouri nbyouri commented Mar 1, 2016

No description provided.

@nbyouri
Copy link
Contributor Author

nbyouri commented Apr 17, 2016

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
Copy link
Contributor Author

nbyouri commented Apr 17, 2016

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
Copy link
Contributor Author

nbyouri commented Jun 21, 2016

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