diff --git a/src/tools/hardlink_packages.py b/src/tools/hardlink_packages.py index 125287b389..701b618b95 100755 --- a/src/tools/hardlink_packages.py +++ b/src/tools/hardlink_packages.py @@ -46,7 +46,7 @@ for filename in os.listdir(args_src): pattern = re.compile("^[a-z0-9]") newFileForJam = [] packageFiles = [] -filesNotFound = False +errorsOccurred = False with open(args_jamf) as f: for line in f: pkg = line.strip() @@ -75,14 +75,16 @@ with open(args_jamf) as f: if (greatestVersion == None): print("not found: " + pkg) newFileForJam.append(line) - filesNotFound = True + errorsOccurred = True continue else: # found it, so hardlink it if not (os.path.exists(args_dst_packages + greatestVersion)): os.link(args_src + greatestVersion, args_dst_packages + greatestVersion) - if ('packages/' + greatestVersion) not in packageFiles: - packageFiles.append('packages/' + greatestVersion) + if ('packages/' + greatestVersion) in packageFiles: + print("error: duplicated package: " + pkgname) + errorsOccurred = True + packageFiles.append('packages/' + greatestVersion) # also hardlink the source package, if one exists srcpkg = greatestVersion.replace("-" + args_arch + ".hpkg", "-source.hpkg").replace('-', '_source-', 1) @@ -93,7 +95,7 @@ with open(args_jamf) as f: packageFiles.append('packages/' + srcpkg) newFileForJam.append("\t" + greatestVersion[:greatestVersion.rfind('-')] + "\n"); -if filesNotFound: +if errorsOccurred: sys.exit(1) finalizedNewFile = "".join(newFileForJam).encode('UTF-8')