#52 Add option to copy crate to current working directory
Merged 5 years ago by ignatenkobrain. Opened 5 years ago by ngompa.
fedora-rust/ ngompa/rust2rpm obs-crate-in-cwd  into  master

file modified
+11
@@ -6,6 +6,7 @@ 

  import os

  import shlex

  import shutil

+ import sys

not needed

  import tarfile

  import tempfile

  import time
@@ -90,6 +91,8 @@ 

                          help="Distribution target")

      parser.add_argument("-p", "--patch", action="store_true",

                          help="Do initial patching of Cargo.toml")

+     parser.add_argument("-s", "--store-crate", action="store_true",

+                         help="Store crate in spec directory")

      parser.add_argument("crate", help="crates.io name")

      parser.add_argument("version", nargs="?", help="crates.io version")

      args = parser.parse_args()
@@ -144,6 +147,14 @@ 

  

          metadata = Metadata.from_file(toml)

  

+         if args.store_crate:

+             try:

+                 shutil.copy2(cratef, os.path.join(os.getcwd(), cratef_base))

+             except shutil.Error as e:

+                 print('Error: %s' % e, file=sys.stderr)

this won't stop execution. just leave exception as is.

+             except IOError as e:

+                 print('Error: %s' % e.strerror, file=sys.stderr)

+ 

      template = JINJA_ENV.get_template("main.spec")

  

      if args.patch and len(diff) > 0:

This is needed to support the rust2rpm OBS source service.

Signed-off-by: Neal Gompa ngompa13@gmail.com

rebased onto 802b841fe975be02f308b32f02cfbd46fedd93db

5 years ago

rebased onto 3c9b6c7

5 years ago

this won't stop execution. just leave exception as is.

Commit 4f234e0 fixes this pull-request

Pull-Request has been merged by ignatenkobrain

5 years ago
Metadata