pungi-koji: add option for not creating latest symbol link

Fixes: #53
Signed-off-by: Qixiang Wan <qwan@redhat.com>
This commit is contained in:
Qixiang Wan 2016-10-25 12:34:36 +08:00
parent e02ed6c04b
commit 1345eb87a4

View File

@ -119,6 +119,13 @@ def main():
"--notification-script", "--notification-script",
help="script for sending progress notification messages" help="script for sending progress notification messages"
) )
parser.add_option(
"--no-latest-link",
action="store_true",
default=False,
dest="no_latest_link",
help="don't create latest symbol link to this compose"
)
opts, args = parser.parse_args() opts, args = parser.parse_args()
import pungi.notifier import pungi.notifier
@ -160,6 +167,8 @@ def main():
abort("please specify a config") abort("please specify a config")
opts.config = os.path.abspath(opts.config) opts.config = os.path.abspath(opts.config)
create_latest_link = not opts.no_latest_link
import kobo.conf import kobo.conf
import kobo.log import kobo.log
import productmd.composeinfo import productmd.composeinfo
@ -210,13 +219,13 @@ def main():
notifier.compose = compose notifier.compose = compose
COMPOSE = compose COMPOSE = compose
try: try:
run_compose(compose) run_compose(compose, create_latest_link)
except Exception, ex: except Exception, ex:
compose.log_error("Compose run failed: %s" % ex) compose.log_error("Compose run failed: %s" % ex)
raise raise
def run_compose(compose): def run_compose(compose, create_latest_link=True):
import pungi.phases import pungi.phases
import pungi.metadata import pungi.metadata
@ -390,6 +399,7 @@ def run_compose(compose):
test_phase.start() test_phase.start()
test_phase.stop() test_phase.stop()
if create_latest_link:
# create a latest symlink # create a latest symlink
compose_dir = os.path.basename(compose.topdir) compose_dir = os.path.basename(compose.topdir)
if len(compose.conf["release_version"].split(".")) == 1: if len(compose.conf["release_version"].split(".")) == 1: