Skip to content

Commit

Permalink
Cleanups after new changes/features.
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
Joshua Harlow authored and harlowja committed Jan 4, 2014
1 parent b89d74e commit 4928c9f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions py2rpm
Original file line number Diff line number Diff line change
Expand Up @@ -412,10 +412,15 @@ def build_rpm(options, filename):
archive_name = "%s/dist/%s-%s.tar.gz" % (source_dir, pkg_name, version)
shutil.copy(archive_name, os.path.join(build_dir, "SOURCES"))

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

0 comments on commit 4928c9f

Please sign in to comment.