Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Defer yumlock creation until runtime. #73

Merged
merged 2 commits into from

2 participants

@ralphbean
Owner

At import time, the tg.config hasn't yet been populated, so our config
value has no effect.

Tested in staging.

ralphbean added some commits
@ralphbean ralphbean Defer yumlock creation until runtime.
At import time, the tg.config hasn't yet been populated, so our config
value has no effect.

Tested in staging.
1f35458
@ralphbean ralphbean Quick release. 3ba73f9
@lmacken
Owner

:+1:

@ralphbean ralphbean merged commit 15b74ec into develop

1 check failed

Details default PEP8bot detected 1242 errors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 10, 2014
  1. @ralphbean

    Defer yumlock creation until runtime.

    ralphbean authored
    At import time, the tg.config hasn't yet been populated, so our config
    value has no effect.
    
    Tested in staging.
  2. @ralphbean

    Quick release.

    ralphbean authored
This page is out of date. Refresh to see the latest.
Showing with 17 additions and 11 deletions.
  1. +7 −1 fedora-packages.spec
  2. +10 −10 fedoracommunity/connectors/yumconnector.py
View
8 fedora-packages.spec
@@ -5,12 +5,14 @@
Name: fedora-packages
Version: 2.0.14
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: A modular framework for consolidating Fedora Infrastructure
Group: Applications/Internet
License: AGPLv3
URL: https://fedorahosted.org/fedoracommunity
Source0: fedoracommunity-%{version}.tar.gz
+# https://github.com/fedora-infra/fedora-packages/pull/73
+Patch0: fedora-packages-yumlock-fix.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
@@ -85,6 +87,7 @@ Fedora Community is a set of web applications for consolidating Fedora Infrastru
%prep
%setup -q -n fedoracommunity-%{version}
+%patch0 -p1
%if %{?rhel}%{!?rhel:0} >= 6
# Make sure that epel/rhel picks up the correct version of webob
@@ -159,6 +162,9 @@ cp fedoracommunity/widgets/static/javascript/jquery.jstree.js %{buildroot}%{_dat
%changelog
+* Mon Mar 10 2014 Ralph Bean <rbean@redhat.com> - 2.0.14-2
+- Patch to fix a bug with the new yumlock stuff.
+
* Mon Mar 10 2014 Ralph Bean <rbean@redhat.com> - 2.0.14-1
- Add typeahead plugin from relrod.
- Make datagrepper icons square.
View
20 fedoracommunity/connectors/yumconnector.py
@@ -31,9 +31,6 @@
import yum
import re
-yumlock_file = config.get('yumlock', os.getcwd() + "/yumlock")
-yumlock = lockfile.FileLock(yumlock_file)
-
class YumConnector(IConnector, ICall, ISearch, IQuery):
_method_paths = {}
@@ -44,7 +41,10 @@ def __init__(self, environ=None, request=None):
super(YumConnector, self).__init__(environ, request)
self._yum_client = yum.YumBase()
- with yumlock:
+ yumlock_file = config.get('yumlock', os.getcwd() + "/yumlock")
+ self.yumlock = lockfile.FileLock(yumlock_file)
+
+ with self.yumlock:
self._yum_client.doConfigSetup(
fn=self._conf_file,
root=os.getcwd(),
@@ -111,7 +111,7 @@ def search_packages(self, search_term):
search_term = search_term.split()
- with yumlock:
+ with self.yumlock:
search = self._yum_client.searchGenerator(
searchlist, search_term, showdups=False)
@@ -133,7 +133,7 @@ def search_packages(self, search_term):
results.append(row)
seen.add(pkg.name)
- with yumlock:
+ with self.yumlock:
self._yum_client.close()
return results
@@ -158,7 +158,7 @@ def _setup_repo(self, repo, arch):
enable_repos.append('%s-updates-%s' % (repo_id, arch_id))
# enable repos we care about
- with yumlock:
+ with self.yumlock:
for r in self._yum_client.repos.findRepos('*'):
if r.id in enable_repos:
r.enable()
@@ -167,14 +167,14 @@ def _setup_repo(self, repo, arch):
def _get_required_by(self, package, repo, arch):
self._setup_repo(repo, arch)
- with yumlock:
+ with self.yumlock:
pkgs = self._yum_client.pkgSack.getRequires(package)
return pkgs
def _get_pkg_object(self, package, repo, arch):
self._setup_repo(repo, arch)
- with yumlock:
+ with self.yumlock:
try:
pkg = self._yum_client.getPackageObject(
(package, arch, None, None, None))
@@ -223,7 +223,7 @@ def _pkgtuples_to_rows(self,
provided_by = None
if find_provided_by:
- with yumlock:
+ with self.yumlock:
p = [pkg[0]]
provided_by_pkg = self._yum_client.searchPackageProvides(p)
Something went wrong with that request. Please try again.