From a2967f2ea2eaa8e4140e8ba4bea05ab3407a3826 Mon Sep 17 00:00:00 2001 From: Matthew Johnson Date: Thu, 19 Oct 2017 17:07:51 -0700 Subject: [PATCH] Add --prep-only option to run preparatory work only For non-autospec enabled packages this option can be used to download the upstream tarball, any specified archives, extract them and put the archives at their destination, and update the upstream file, but not actually attempt to build a specfile. Signed-off-by: Matthew Johnson --- autospec/autospec.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/autospec/autospec.py b/autospec/autospec.py index c8a8494..9a5154a 100644 --- a/autospec/autospec.py +++ b/autospec/autospec.py @@ -153,6 +153,9 @@ def main(): default=False, help="Search for package signature from source URL and " "attempt to verify package") + parser.add_argument("-p", "--prep-only", action="store_true", + default=False, + help="Only perform preparatory work on package") parser.add_argument("--non_interactive", action="store_true", default=False, help="Disable interactive mode for package verification") @@ -175,6 +178,14 @@ def main(): "-a/--archives or options.conf['package']['archives'] requires an " "even number of arguments")) + if args.prep_only: + package(args, url, name, archives, "./workingdir") + else: + with tempfile.TemporaryDirectory() as workingdir: + package(args, url, name, archives, workingdir) + + +def package(args, url, name, archives, workingdir): check_requirements(args.git) build.setup_workingdir(workingdir) @@ -186,6 +197,11 @@ def main(): tarball.process(url, name, args.version, args.target, archives, filemanager) _dir = tarball.path + if args.prep_only: + print("Exiting after prep due to --prep-only flag") + print("Results under './workingdir'") + exit(0) + if args.license_only: try: with open(os.path.join(build.download_path, @@ -268,5 +284,4 @@ def main(): if __name__ == '__main__': - with tempfile.TemporaryDirectory() as workingdir: - main() + main()