Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Attempt to copy local Sources during releases.

For releasers copying into a build system SCM, we now extract the
SourceX filenames from the spec file, and anything we see in the
relative directory matching those exactly will be copied. (i.e. if you
store additional sources for your package at the same level as your spec
file, these will now be copied)
  • Loading branch information...
commit 2486ed3327b4d91eca1555374fdad540d514ebd2 1 parent c0844f7
@dgoodwin authored
Showing with 29 additions and 0 deletions.
  1. +17 −0 src/tito/common.py
  2. +12 −0 src/tito/release.py
View
17 src/tito/common.py
@@ -33,6 +33,23 @@
}
+def extract_sources(spec_file_lines):
+ """
+ Returns a list of sources from the given spec file.
+
+ Some of these will be URL's, which is fine they will be ignored.
+ We're really just after relative filenames that might live in the same
+ location as the spec file, mostly used with NoTgzBuilder packages.
+ """
+ filenames = []
+ source_pattern = re.compile('^Source\d+?:\s*(.*)')
+ for line in spec_file_lines:
+ match = source_pattern.match(line)
+ if match:
+ filenames.append(match.group(1))
+ return filenames
+
+
def extract_bzs(output):
"""
Parses the output of CVS diff or a series of git commit log entries,
View
12 src/tito/release.py
@@ -152,6 +152,12 @@ def _list_files_to_copy(self):
# we modify and then use a spec file copy from a different location.
files_to_copy = [self.builder.spec_file] # full paths
+ f = open(self.builder.spec_file, 'r')
+ lines = f.readlines()
+ f.close()
+ source_filenames = extract_sources(lines)
+ debug("Watching for source filenames: %s" % source_filenames)
+
for filename in os.listdir(self.builder.rpmbuild_gitcopy):
full_filepath = os.path.join(self.builder.rpmbuild_gitcopy, filename)
if os.path.isdir(full_filepath):
@@ -166,6 +172,12 @@ def _list_files_to_copy(self):
# builder is in use.
continue
+ # Check if file looks like it matches a Source line in the spec file:
+ if filename in source_filenames:
+ debug(" copying: %s" % filename)
+ files_to_copy.append(full_filepath)
+ continue
+
# Check if file ends with something this builder subclass wants
# to copy:
copy_it = False
Please sign in to comment.
Something went wrong with that request. Please try again.