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

Fix unecessary re-download of repo when not using metalink #601

Conversation

sourcejedi
Copy link
Contributor

https://bugzilla.redhat.com/show_bug.cgi?id=1373992

  • Passes existing tests
  • Tested dnf --refresh check-update: it now avoids re-downloading
    repos specified using baseurl (e.g. a mirror on the local network).
  • Includes new test cases.

This is based on dnf-1.1.8-1. The master branch doesn't seem to pass the test suite at the moment. Is that expected?

@ignatenkobrain
Copy link
Contributor

@sourcejedi master branch pass the test suite. Can you rebase it on top of master and we'll see?

return True

def _try_revive(self):
"""Use metalink to check whether our metadata are still current."""
if not self.metadata:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this as it is something what you fixed ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No? It's ok if self.metalink is None, but if metadata is None, then there is nothing for us to verify in the first place :).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uh oh, I need new eyes ;)

@sourcejedi
Copy link
Contributor Author

Rebased, thanks for the quick response :).

The Jenkins build says it finished successfully. I'm not sure what's happened to make GitHub still show pending checks.

@ignatenkobrain
Copy link
Contributor

@sourcejedi there is flow of jobs. Link points to update-gh-status and not to real job. rpm-software-management/ci-dnf-stack#160

@sourcejedi
Copy link
Contributor Author

Thanks, all becomes clear now.

Looks like I'm supposed to develop on a Rawhide system (at least if I want to follow the dnf builddep instructions). I didn't realize my packages were too old, partly because all dnf builddep dnf.spec said was that it didn't like the .spec file.

Let's see if I can set up an environment with systemd-nspawn.

@ignatenkobrain
Copy link
Contributor

It fails: https://copr-be.cloud.fedoraproject.org/results/rpmsoftwaremanagement/rpm-gitoverlay-1473335636.188446/fedora-24-x86_64/00450738-dnf/build.log.gz

1: ======================================================================
1: ERROR: test_reviving_baseurl (tests.test_repo.LocalRepoTest)
1: ----------------------------------------------------------------------
1: Traceback (most recent call last):
1:   File "/builddir/build/BUILD/dnf-2.0.0-0.392gaa2c8a0/tests/mock.py", line 1191, in patched
1:     arg = patching.__enter__()
1:   File "/builddir/build/BUILD/dnf-2.0.0-0.392gaa2c8a0/tests/mock.py", line 1266, in __enter__
1:     original, local = self.get_original()
1:   File "/builddir/build/BUILD/dnf-2.0.0-0.392gaa2c8a0/tests/mock.py", line 1240, in get_original
1:     "%s does not have the attribute %r" % (target, name)
1: AttributeError: <class 'dnf.repo.Metadata'> does not have the attribute u'reset_age'
1: 
1: ======================================================================
1: ERROR: test_reviving_baseurl_404 (tests.test_repo.LocalRepoTest)
1: ----------------------------------------------------------------------
1: Traceback (most recent call last):
1:   File "/builddir/build/BUILD/dnf-2.0.0-0.392gaa2c8a0/tests/mock.py", line 1199, in patched
1:     return func(*args, **keywargs)
1:   File "/builddir/build/BUILD/dnf-2.0.0-0.392gaa2c8a0/tests/test_repo.py", line 446, in test_reviving_baseurl_404
1:     self.repo.md_expire_cache()
1: AttributeError: 'Repo' object has no attribute 'md_expire_cache'
1: 
1: ======================================================================
1: ERROR: test_reviving_baseurl_mismatched (tests.test_repo.LocalRepoTest)
1: ----------------------------------------------------------------------
1: Traceback (most recent call last):
1:   File "/builddir/build/BUILD/dnf-2.0.0-0.392gaa2c8a0/tests/mock.py", line 1191, in patched
1:     arg = patching.__enter__()
1:   File "/builddir/build/BUILD/dnf-2.0.0-0.392gaa2c8a0/tests/mock.py", line 1266, in __enter__
1:     original, local = self.get_original()
1:   File "/builddir/build/BUILD/dnf-2.0.0-0.392gaa2c8a0/tests/mock.py", line 1240, in get_original
1:     "%s does not have the attribute %r" % (target, name)
1: AttributeError: <class 'dnf.repo.Metadata'> does not have the attribute u'reset_age'
1: 
1: ----------------------------------------------------------------------
1: Ran 557 tests in 6.194s
1: 
1: FAILED (errors=3)

@sourcejedi
Copy link
Contributor Author

Sorry, yeah, I found that. I'm shaving some yaks on my way to a rawhide chroot, so I should actually be able to run the tests. I probably found all the updated field names already, but I don't want to spam the build server in case there's a few I missed

@ignatenkobrain
Copy link
Contributor

@sourcejedi btw, you will need latest libdnf as well. You can get all latest components from COPR repository: https://copr.fedorainfracloud.org/coprs/rpmsoftwaremanagement/dnf-nightly/

@sourcejedi
Copy link
Contributor Author

Thanks for that. This update should pass, apart from the test that also fails in master test_fit_lock_dir (tests.test_lock.LockTest).

@ignatenkobrain
Copy link
Contributor

@sourcejedi there are no tests which are failing in master now. I think it's just not supposed to run on real system.

https://bugzilla.redhat.com/show_bug.cgi?id=1373992

 * Passes existing tests

 * Tested `dnf --refresh check-update` now avoids re-downloading
   repos specified using baseurl (e.g. for mirror on local network).

 * Includes new test cases.

   The test for a new repomd.xml just uses an empty file...
   there doesn't seem much point writing a whole fake one.
@ignatenkobrain
Copy link
Contributor

@dnf-bot r+

@dnf-bot
Copy link
Member

dnf-bot commented Sep 12, 2016

📌 Commit 170aacc has been approved by ignatenkobrain

@dnf-bot
Copy link
Member

dnf-bot commented Sep 12, 2016

⌛ Testing commit 170aacc with merge 8da4640...

@dnf-bot
Copy link
Member

dnf-bot commented Sep 12, 2016

☀️ Test successful - status-jenkins
Approved by: ignatenkobrain
Pushing 8da4640 to master...

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.

3 participants