Commits

Jan Borsodi committed 0c5e0ae

hob.repo: Service files are now copied with EOL filtering to ensure they are always using Unix EOL.

Comments (0)

Files changed (2)

         for err in message_manager.errors:
             pretext = "%s: " % (".".join(err.message.path()))
             self.error(None, err.errid, args=err.args, text=pretext + err.text)
+
+def copy_service_file(src, dest):
+    "Copies contents of service file `src` to `dest`. Makes sure it has Unix EOL only"
+    text = open(src, "r").read()
+    text = text.replace("\r\n", "\n")
+    open(dest, "wb").write(text)
         conf_dir = os.path.abspath(os.path.dirpath(path))
     remote.read([conf_path])
 
-    from hob.repo import RepoManager, ReleaseManager, CompareResult
+    from hob.repo import RepoManager, ReleaseManager, CompareResult, copy_service_file
 
     remote = RepoManager(remote, path=conf_path, target="all", include_services=services)
     local = RepoManager(ui.config, include_services=services)
             return 1
 
     from hob.utils import split_camelcase, join_underscore
-    from shutil import copyfile
 
     new_config_entries = []
     new_commit_entries = []
             print "  %s ->\n  %s" % (src, dest)
             new_config_entries.append((service, dest, basename, version))
             new_commit_entries.append((service, dest, version))
-            shutil.copyfile(src, dest_path)
+            copy_service_file(src, dest_path)
 
     for service in result.upgradeable:
         version = ".".join(service.options["version"].value.split(".")[0:2])
         if copy:
             print "  %s ->\n  %s" % (src, dest)
             modified_commit_entries.append((service, dest, version))
-            shutil.copyfile(src, dest_path)
+            copy_service_file(src, dest_path)
 
     # Update hob.conf with new entries
     target_section = "target.all"