summaryrefslogtreecommitdiff
path: root/lib/spack/spack/cmd/restage.py
blob: 3078f59cdded7c8671f923ae9a8d23a12a1410d0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

import llnl.util.tty as tty

import spack.cmd
import spack.repo
from spack.cmd.common import arguments

description = "revert checked out package source code"
section = "build"
level = "long"


def setup_parser(subparser):
    arguments.add_common_arguments(subparser, ["specs"])


def restage(parser, args):
    if not args.specs:
        tty.die("spack restage requires at least one package spec.")

    specs = spack.cmd.parse_specs(args.specs, concretize=True)
    for spec in specs:
        spec.package.do_restage()