From 539736a11e9a5837b9b2d48724f55b2776f6bb74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Thu, 3 Dec 2015 08:39:33 +0100 Subject: [PATCH] Use lowercase hashed directories MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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ář --- pungi/phases/gather/link.py | 12 +++++++++++- tests/data/dummy-comps.xml | 2 +- .../specs/{dummy-firefox.spec => Dummy-firefox.spec} | 6 +++--- .../{dummy-xulrunner.spec => Dummy-xulrunner.spec} | 2 +- 4 files changed, 16 insertions(+), 6 deletions(-) rename tests/data/specs/{dummy-firefox.spec => Dummy-firefox.spec} (85%) rename tests/data/specs/{dummy-xulrunner.spec => Dummy-xulrunner.spec} (94%) diff --git a/pungi/phases/gather/link.py b/pungi/phases/gather/link.py index d2af6779..4eba3c12 100644 --- a/pungi/phases/gather/link.py +++ b/pungi/phases/gather/link.py @@ -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 diff --git a/tests/data/dummy-comps.xml b/tests/data/dummy-comps.xml index 9bb65950..179635e7 100644 --- a/tests/data/dummy-comps.xml +++ b/tests/data/dummy-comps.xml @@ -45,7 +45,7 @@ false false - dummy-firefox + Dummy-firefox dummy-icedtea-web diff --git a/tests/data/specs/dummy-firefox.spec b/tests/data/specs/Dummy-firefox.spec similarity index 85% rename from tests/data/specs/dummy-firefox.spec rename to tests/data/specs/Dummy-firefox.spec index 8c161696..29457ec7 100644 --- a/tests/data/specs/dummy-firefox.spec +++ b/tests/data/specs/Dummy-firefox.spec @@ -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 diff --git a/tests/data/specs/dummy-xulrunner.spec b/tests/data/specs/Dummy-xulrunner.spec similarity index 94% rename from tests/data/specs/dummy-xulrunner.spec rename to tests/data/specs/Dummy-xulrunner.spec index 3a7f0fab..d5c5a762 100644 --- a/tests/data/specs/dummy-xulrunner.spec +++ b/tests/data/specs/Dummy-xulrunner.spec @@ -1,4 +1,4 @@ -Name: dummy-xulrunner +Name: Dummy-xulrunner Version: 16.0.1 Release: 1 License: LGPLv2