#249 hotfixes for custom method
Merged 6 years ago by clime. Opened 6 years ago by praiskup.
Unknown source custom-hotfixes  into  master

@@ -4,10 +4,7 @@

          form.script,

          rows=5,

          style='font-family: monospace;',

-         placeholder="""#! /bin/sh -x

- curl https://example.com/package.spec -O

- curl https://example.com/tarball.tar.gz -O

- """,

+         placeholder="#! /bin/sh -x",

          info="write a script that generates spec and sources... (Internet ON, non-root UID)"

    )}}

    {{ render_field(

@@ -274,10 +274,23 @@

      url_on_success = helpers.copr_url('coprs_ns.copr_add_build_custom', copr)

  

      def factory(**build_options):

+         def cleanup_script(string):

+             # Keep this function in @copr_ns only, to not touch the contents of

+             # script specified through api or copr-cli.  But from web-ui form,

+             # the script usually has unintentional '\r\n' EOLs, so drop them to

+             # not have broken shebang.

+             string = string.replace('\r\n', '\n')

+ 

+             # And append newline to have a valid unix file.

+             if not string.endswith('\n'):

+                 string += '\n'

+ 

+             return string

+ 

          BuildsLogic.create_new_from_custom(

              flask.g.user,

              copr,

-             form.script.data,

+             cleanup_script(form.script.data),

              form.chroot.data,

              form.builddeps.data,

              form.resultdir.data,

no initial comment

Pull-Request has been merged by clime

6 years ago