Skip to content

Commit 4928c9f

Browse files
Joshua Harlowharlowja
Joshua Harlow
authored andcommitted
Cleanups after new changes/features.
- Some style adjustments. - Use SRC_REPOS for mapping repo name to source repository name. - Split the build_binary into individual tiny functions. - Fix up the progress bars and iterable logging. - Ensure that we log that we wrote to /etc/yum.repos.d and leave a trace for later cleanup. - Quiet some of the new executes (and put there output to files). - Add a smithy clean_pip() function that will help avoid hitting pypa/pip#982 - Further cleanup of smithy after it being partially rewritten. - Instead of hard coding 'conf/distros/rhel.yaml' in smithy, take this from the sourced file. - Ensure that we can't remove packages smithy requires to operate. - Ensure the package version that py2rpm is building is also trimmed of zeros. Change-Id: I2df8a47f0115de2684777b64db42e08d50ef4115
1 parent b89d74e commit 4928c9f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

py2rpm

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,10 +412,15 @@ def build_rpm(options, filename):
412412
archive_name = "%s/dist/%s-%s.tar.gz" % (source_dir, pkg_name, version)
413413
shutil.copy(archive_name, os.path.join(build_dir, "SOURCES"))
414414

415+
# We need to do this so that when a package such as hacking depends on
416+
# flake8 v2 that we don't go ahead and build a v2.0 version.
417+
#
418+
# Note(harlowja): Not sure why rpm seems to not understand these are the same...
419+
cleaned_version = trim_zeroes(version.replace('-','_'))
415420
with open(spec_name, "w") as spec_file:
416421
print >> spec_file, "%define pkg_name", pkg_name
417422
print >> spec_file, "%define rpm_name", rpm_name
418-
print >> spec_file, "%define version", version.replace('-','_')
423+
print >> spec_file, "%define version", cleaned_version
419424
print >> spec_file, "%define release", options.release
420425
print >> spec_file, "%define unmangled_version", version
421426
print >> spec_file, ""
@@ -434,7 +439,7 @@ def build_rpm(options, filename):
434439
tags.append(("Source0", archive_name))
435440
tags.append(("License", info["license"]))
436441
tags.append(("Group", "Development/Libraries"))
437-
tags.append(("BuildRoot", "%{_tmppath}/%{pkg_name}-%{version}-%{release}-buildroot"))
442+
tags.append(("BuildRoot", "%{_tmppath}/%{pkg_name}-%{unmangled_version}-%{release}-buildroot"))
438443
tags.append(("Prefix", "%{_prefix}"))
439444
if pkg_key not in arch_dependent:
440445
if not os.path.exists(egg_info_path(source_dir, "ext_modules.txt")):

0 commit comments

Comments
 (0)