Use lowercase hashed directories

On case-insensitive filesystems it is not such a good idea to have
directories that only differ in case. Packages should be always split
into lowercased directories.

The test data is modified to include some packages starting with
uppercase letters. The example in code can be verified by running
`nosetests --with-doctest`.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2015-12-03 08:39:33 +01:00
parent e9699b7327
commit 539736a11e
4 changed files with 16 additions and 6 deletions

View File

@ -39,8 +39,18 @@ def _get_src_nevra(compose, pkg_obj, srpm_map):
def get_package_path(filename, hashed_directory=False):
"""Get path for filename. If ``hashed_directory`` is ``True``, the path
will include a prefix based on the initial letter.
>>> get_package_path('my-package.rpm')
'my-package.rpm'
>>> get_package_path('my-package.rpm', True)
'm/my-package.rpm'
>>> get_package_path('My-Package.rpm', True)
'm/My-Package.rpm'
"""
if hashed_directory:
prefix = filename[0]
prefix = filename[0].lower()
return os.path.join(prefix, filename)
return filename

View File

@ -45,7 +45,7 @@
<default>false</default>
<uservisible>false</uservisible>
<packagelist>
<packagereq>dummy-firefox</packagereq>
<packagereq>Dummy-firefox</packagereq>
<packagereq>dummy-icedtea-web</packagereq>
</packagelist>
</group>

View File

@ -1,11 +1,11 @@
Name: dummy-firefox
Name: Dummy-firefox
Version: 16.0.1
Release: 1
License: LGPLv2
Summary: A dummy firefox package
BuildRequires: dummy-krb5-devel
BuildRequires: dummy-xulrunner
Requires: dummy-xulrunner
BuildRequires: Dummy-xulrunner
Requires: Dummy-xulrunner
%description
A dummy firefox package

View File

@ -1,4 +1,4 @@
Name: dummy-xulrunner
Name: Dummy-xulrunner
Version: 16.0.1
Release: 1
License: LGPLv2