util: Add function to generate a filename from the package info given

This commit is contained in:
Fatih Aşıcı
2010-10-07 07:15:41 +00:00
parent 9d4342bc52
commit c0ec957842
+14
View File
@@ -639,6 +639,20 @@ def partition_freespace(directory):
# Package/Repository Related Functions #
########################################
def package_filename(name, version, release, distro_id=None, arch=None):
"""Return a filename for a package with the given information. """
if distro_id is None:
distro_id = ctx.config.values.general.distribution_id
if arch is None:
arch = ctx.config.values.general.architecture
fn = "-".join((name, version, release, distro_id, arch))
fn += ctx.const.package_suffix
return fn
def parse_package_name_legacy(package_name):
"""Separate package name and version string for package formats <= 1.1.