Stop using deprecated pipes.quote
Instead use the definition from python-six. Once we drop Py 2 support completely, we'll just swap underscores with dots. Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
parent
797b13b34a
commit
f3806f7c77
@ -11,7 +11,7 @@ import locale
|
|||||||
import datetime
|
import datetime
|
||||||
import getpass
|
import getpass
|
||||||
import socket
|
import socket
|
||||||
import pipes
|
from six.moves import shlex_quote
|
||||||
import json
|
import json
|
||||||
|
|
||||||
here = sys.path[0]
|
here = sys.path[0]
|
||||||
@ -266,7 +266,7 @@ def run_compose(compose, create_latest_link=True, latest_link_status=None):
|
|||||||
compose.log_info("Pungi version: %s" % get_full_version())
|
compose.log_info("Pungi version: %s" % get_full_version())
|
||||||
compose.log_info("User name: %s" % getpass.getuser())
|
compose.log_info("User name: %s" % getpass.getuser())
|
||||||
compose.log_info("Working directory: %s" % os.getcwd())
|
compose.log_info("Working directory: %s" % os.getcwd())
|
||||||
compose.log_info("Command line: %s" % " ".join([pipes.quote(arg) for arg in sys.argv]))
|
compose.log_info("Command line: %s" % " ".join([shlex_quote(arg) for arg in sys.argv]))
|
||||||
compose.log_info("Compose top directory: %s" % compose.topdir)
|
compose.log_info("Compose top directory: %s" % compose.topdir)
|
||||||
compose.log_info("Current timezone offset: %s" % pungi.util.get_tz_offset())
|
compose.log_info("Current timezone offset: %s" % pungi.util.get_tz_offset())
|
||||||
compose.read_variants()
|
compose.read_variants()
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import pipes
|
|
||||||
import six
|
import six
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
from six.moves import shlex_quote
|
||||||
|
|
||||||
from .wrappers import iso
|
from .wrappers import iso
|
||||||
from .wrappers.jigdo import JigdoWrapper
|
from .wrappers.jigdo import JigdoWrapper
|
||||||
@ -22,8 +22,8 @@ def quote(str):
|
|||||||
expanded.
|
expanded.
|
||||||
"""
|
"""
|
||||||
if str.startswith('$TEMPLATE'):
|
if str.startswith('$TEMPLATE'):
|
||||||
return '$TEMPLATE%s' % pipes.quote(str.replace('$TEMPLATE', '', 1))
|
return '$TEMPLATE%s' % shlex_quote(str.replace('$TEMPLATE', '', 1))
|
||||||
return pipes.quote(str)
|
return shlex_quote(str)
|
||||||
|
|
||||||
|
|
||||||
def emit(f, cmd):
|
def emit(f, cmd):
|
||||||
|
@ -17,13 +17,13 @@
|
|||||||
import errno
|
import errno
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
import pipes
|
|
||||||
import shutil
|
import shutil
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from kobo.threads import ThreadPool, WorkerThread
|
from kobo.threads import ThreadPool, WorkerThread
|
||||||
from kobo.shortcuts import run
|
from kobo.shortcuts import run
|
||||||
from productmd.images import Image
|
from productmd.images import Image
|
||||||
|
from six.moves import shlex_quote
|
||||||
|
|
||||||
from pungi.arch import get_valid_arches
|
from pungi.arch import get_valid_arches
|
||||||
from pungi.util import get_volid, get_arch_variant_data
|
from pungi.util import get_volid, get_arch_variant_data
|
||||||
@ -100,8 +100,8 @@ class BuildinstallPhase(PhaseBase):
|
|||||||
add_arch_template_var=add_arch_template_var,
|
add_arch_template_var=add_arch_template_var,
|
||||||
noupgrade=noupgrade,
|
noupgrade=noupgrade,
|
||||||
log_dir=log_dir)
|
log_dir=log_dir)
|
||||||
return 'rm -rf %s && %s' % (pipes.quote(output_dir),
|
return 'rm -rf %s && %s' % (shlex_quote(output_dir),
|
||||||
' '.join([pipes.quote(x) for x in lorax_cmd]))
|
' '.join([shlex_quote(x) for x in lorax_cmd]))
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
lorax = LoraxWrapper()
|
lorax = LoraxWrapper()
|
||||||
@ -276,7 +276,7 @@ def tweak_buildinstall(compose, src, dst, arch, variant, label, volid, kickstart
|
|||||||
|
|
||||||
# copy src to temp
|
# copy src to temp
|
||||||
# TODO: place temp on the same device as buildinstall dir so we can hardlink
|
# TODO: place temp on the same device as buildinstall dir so we can hardlink
|
||||||
cmd = "cp -av --remove-destination %s/* %s/" % (pipes.quote(src), pipes.quote(tmp_dir))
|
cmd = "cp -av --remove-destination %s/* %s/" % (shlex_quote(src), shlex_quote(tmp_dir))
|
||||||
run(cmd)
|
run(cmd)
|
||||||
|
|
||||||
found_configs = tweak_configs(tmp_dir, volid, kickstart_file)
|
found_configs = tweak_configs(tmp_dir, volid, kickstart_file)
|
||||||
@ -300,10 +300,10 @@ def tweak_buildinstall(compose, src, dst, arch, variant, label, volid, kickstart
|
|||||||
run(cmd)
|
run(cmd)
|
||||||
|
|
||||||
# HACK: make buildinstall files world readable
|
# HACK: make buildinstall files world readable
|
||||||
run("chmod -R a+rX %s" % pipes.quote(tmp_dir))
|
run("chmod -R a+rX %s" % shlex_quote(tmp_dir))
|
||||||
|
|
||||||
# copy temp to dst
|
# copy temp to dst
|
||||||
cmd = "cp -av --remove-destination %s/* %s/" % (pipes.quote(tmp_dir), pipes.quote(dst))
|
cmd = "cp -av --remove-destination %s/* %s/" % (shlex_quote(tmp_dir), shlex_quote(dst))
|
||||||
run(cmd)
|
run(cmd)
|
||||||
|
|
||||||
shutil.rmtree(tmp_dir)
|
shutil.rmtree(tmp_dir)
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
import pipes
|
|
||||||
import random
|
import random
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
@ -24,6 +23,7 @@ import productmd.treeinfo
|
|||||||
from productmd.images import Image
|
from productmd.images import Image
|
||||||
from kobo.threads import ThreadPool, WorkerThread
|
from kobo.threads import ThreadPool, WorkerThread
|
||||||
from kobo.shortcuts import run, relative_path
|
from kobo.shortcuts import run, relative_path
|
||||||
|
from six.moves import shlex_quote
|
||||||
|
|
||||||
from pungi.wrappers import iso
|
from pungi.wrappers import iso
|
||||||
from pungi.wrappers.createrepo import CreaterepoWrapper
|
from pungi.wrappers.createrepo import CreaterepoWrapper
|
||||||
@ -415,7 +415,7 @@ def prepare_iso(compose, arch, variant, disc_num=1, disc_count=None, split_iso_d
|
|||||||
|
|
||||||
if file_list_content:
|
if file_list_content:
|
||||||
# write modified repodata only if there are packages available
|
# write modified repodata only if there are packages available
|
||||||
run("cp -a %s/repodata %s/" % (pipes.quote(tree_dir), pipes.quote(iso_dir)))
|
run("cp -a %s/repodata %s/" % (shlex_quote(tree_dir), shlex_quote(iso_dir)))
|
||||||
with open(file_list, "w") as f:
|
with open(file_list, "w") as f:
|
||||||
f.write("\n".join(file_list_content))
|
f.write("\n".join(file_list_content))
|
||||||
cmd = repo.get_createrepo_cmd(tree_dir, update=True, database=True, skip_stat=True, pkglist=file_list, outputdir=iso_dir, workers=3, checksum=createrepo_checksum)
|
cmd = repo.get_createrepo_cmd(tree_dir, update=True, database=True, skip_stat=True, pkglist=file_list, outputdir=iso_dir, workers=3, checksum=createrepo_checksum)
|
||||||
|
@ -17,12 +17,12 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import pipes
|
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
from kobo.threads import ThreadPool, WorkerThread
|
from kobo.threads import ThreadPool, WorkerThread
|
||||||
from kobo.shortcuts import run, save_to_file, force_list
|
from kobo.shortcuts import run, save_to_file, force_list
|
||||||
from productmd.images import Image
|
from productmd.images import Image
|
||||||
|
from six.moves import shlex_quote
|
||||||
|
|
||||||
from pungi.wrappers.kojiwrapper import KojiWrapper
|
from pungi.wrappers.kojiwrapper import KojiWrapper
|
||||||
from pungi.wrappers import iso
|
from pungi.wrappers import iso
|
||||||
@ -254,7 +254,7 @@ class CreateLiveImageThread(WorkerThread):
|
|||||||
:param iso_path: (str) absolute path to the ISO
|
:param iso_path: (str) absolute path to the ISO
|
||||||
"""
|
"""
|
||||||
dir, filename = os.path.split(iso_path)
|
dir, filename = os.path.split(iso_path)
|
||||||
run("cd %s && %s" % (pipes.quote(dir), iso.get_manifest_cmd(filename)))
|
run("cd %s && %s" % (shlex_quote(dir), iso.get_manifest_cmd(filename)))
|
||||||
|
|
||||||
def _sign_image(self, koji_wrapper, compose, cmd, koji_task_id):
|
def _sign_image(self, koji_wrapper, compose, cmd, koji_task_id):
|
||||||
signing_key_id = compose.conf.get("signing_key_id")
|
signing_key_id = compose.conf.get("signing_key_id")
|
||||||
|
@ -4,7 +4,7 @@ import os
|
|||||||
from kobo.threads import ThreadPool, WorkerThread
|
from kobo.threads import ThreadPool, WorkerThread
|
||||||
import shutil
|
import shutil
|
||||||
from productmd import images
|
from productmd import images
|
||||||
import pipes
|
from six.moves import shlex_quote
|
||||||
from kobo import shortcuts
|
from kobo import shortcuts
|
||||||
|
|
||||||
from .base import ConfigGuardedPhase, PhaseLoggerMixin
|
from .base import ConfigGuardedPhase, PhaseLoggerMixin
|
||||||
@ -99,7 +99,7 @@ class OstreeInstallerThread(WorkerThread):
|
|||||||
boot_iso = os.path.join(output_dir, 'images', 'boot.iso')
|
boot_iso = os.path.join(output_dir, 'images', 'boot.iso')
|
||||||
|
|
||||||
shortcuts.run('cp -av %s/* %s/' %
|
shortcuts.run('cp -av %s/* %s/' %
|
||||||
(pipes.quote(output_dir), pipes.quote(os_path)))
|
(shlex_quote(output_dir), shlex_quote(os_path)))
|
||||||
try:
|
try:
|
||||||
os.link(boot_iso, iso_path)
|
os.link(boot_iso, iso_path)
|
||||||
except OSError:
|
except OSError:
|
||||||
@ -164,8 +164,8 @@ class OstreeInstallerThread(WorkerThread):
|
|||||||
is_final=compose.supported,
|
is_final=compose.supported,
|
||||||
log_dir=self.logdir,
|
log_dir=self.logdir,
|
||||||
)
|
)
|
||||||
cmd = 'rm -rf %s && %s' % (pipes.quote(output_dir),
|
cmd = 'rm -rf %s && %s' % (shlex_quote(output_dir),
|
||||||
' '.join([pipes.quote(x) for x in lorax_cmd]))
|
' '.join([shlex_quote(x) for x in lorax_cmd]))
|
||||||
|
|
||||||
runroot_channel = compose.conf.get("runroot_channel")
|
runroot_channel = compose.conf.get("runroot_channel")
|
||||||
runroot_tag = compose.conf["runroot_tag"]
|
runroot_tag = compose.conf["runroot_tag"]
|
||||||
|
@ -39,7 +39,7 @@ run/install/product/pyanaconda/installclasses -> ../installclasses
|
|||||||
import os
|
import os
|
||||||
import fnmatch
|
import fnmatch
|
||||||
import shutil
|
import shutil
|
||||||
import pipes
|
from six.moves import shlex_quote
|
||||||
|
|
||||||
from kobo.shortcuts import run
|
from kobo.shortcuts import run
|
||||||
|
|
||||||
@ -134,24 +134,24 @@ def create_product_img(compose, arch, variant):
|
|||||||
mount_tmp = compose.mkdtemp(prefix="product_img_mount_")
|
mount_tmp = compose.mkdtemp(prefix="product_img_mount_")
|
||||||
cmds = [
|
cmds = [
|
||||||
# allocate image
|
# allocate image
|
||||||
"dd if=/dev/zero of=%s bs=1k count=5760" % pipes.quote(image),
|
"dd if=/dev/zero of=%s bs=1k count=5760" % shlex_quote(image),
|
||||||
# create file system
|
# create file system
|
||||||
"mke2fs -F %s" % pipes.quote(image),
|
"mke2fs -F %s" % shlex_quote(image),
|
||||||
# use guestmount to mount the image, which doesn't require root privileges
|
# use guestmount to mount the image, which doesn't require root privileges
|
||||||
# LIBGUESTFS_BACKEND=direct: running qemu directly without libvirt
|
# LIBGUESTFS_BACKEND=direct: running qemu directly without libvirt
|
||||||
"LIBGUESTFS_BACKEND=direct guestmount -a %s -m /dev/sda %s" % (pipes.quote(image), pipes.quote(mount_tmp)),
|
"LIBGUESTFS_BACKEND=direct guestmount -a %s -m /dev/sda %s" % (shlex_quote(image), shlex_quote(mount_tmp)),
|
||||||
"mkdir -p %s/run/install/product" % pipes.quote(mount_tmp),
|
"mkdir -p %s/run/install/product" % shlex_quote(mount_tmp),
|
||||||
"cp -rp %s/* %s/run/install/product/" % (pipes.quote(product_tmp), pipes.quote(mount_tmp)),
|
"cp -rp %s/* %s/run/install/product/" % (shlex_quote(product_tmp), shlex_quote(mount_tmp)),
|
||||||
"mkdir -p %s/run/install/product/pyanaconda" % pipes.quote(mount_tmp),
|
"mkdir -p %s/run/install/product/pyanaconda" % shlex_quote(mount_tmp),
|
||||||
# compat symlink: installclasses -> run/install/product/installclasses
|
# compat symlink: installclasses -> run/install/product/installclasses
|
||||||
"ln -s run/install/product/installclasses %s" % pipes.quote(mount_tmp),
|
"ln -s run/install/product/installclasses %s" % shlex_quote(mount_tmp),
|
||||||
# compat symlink: locale -> run/install/product/locale
|
# compat symlink: locale -> run/install/product/locale
|
||||||
"ln -s run/install/product/locale %s" % pipes.quote(mount_tmp),
|
"ln -s run/install/product/locale %s" % shlex_quote(mount_tmp),
|
||||||
# compat symlink: run/install/product/pyanaconda/installclasses -> ../installclasses
|
# compat symlink: run/install/product/pyanaconda/installclasses -> ../installclasses
|
||||||
"ln -s ../installclasses %s/run/install/product/pyanaconda/installclasses" % pipes.quote(mount_tmp),
|
"ln -s ../installclasses %s/run/install/product/pyanaconda/installclasses" % shlex_quote(mount_tmp),
|
||||||
"fusermount -u %s" % pipes.quote(mount_tmp),
|
"fusermount -u %s" % shlex_quote(mount_tmp),
|
||||||
# tweak last mount path written in the image
|
# tweak last mount path written in the image
|
||||||
"tune2fs -M /run/install/product %s" % pipes.quote(image),
|
"tune2fs -M /run/install/product %s" % shlex_quote(image),
|
||||||
]
|
]
|
||||||
run(" && ".join(cmds))
|
run(" && ".join(cmds))
|
||||||
shutil.rmtree(mount_tmp)
|
shutil.rmtree(mount_tmp)
|
||||||
@ -188,7 +188,7 @@ def rebuild_boot_iso(compose, arch, variant, package_sets):
|
|||||||
tmp_dir = compose.mkdtemp(prefix="boot_iso_")
|
tmp_dir = compose.mkdtemp(prefix="boot_iso_")
|
||||||
mount_dir = compose.mkdtemp(prefix="boot_iso_mount_")
|
mount_dir = compose.mkdtemp(prefix="boot_iso_mount_")
|
||||||
|
|
||||||
cmd = "mount -o loop %s %s" % (pipes.quote(buildinstall_boot_iso), pipes.quote(mount_dir))
|
cmd = "mount -o loop %s %s" % (shlex_quote(buildinstall_boot_iso), shlex_quote(mount_dir))
|
||||||
run(cmd, logfile=log_file, show_cmd=True)
|
run(cmd, logfile=log_file, show_cmd=True)
|
||||||
|
|
||||||
images_dir = os.path.join(tmp_dir, "images")
|
images_dir = os.path.join(tmp_dir, "images")
|
||||||
@ -219,19 +219,19 @@ def rebuild_boot_iso(compose, arch, variant, package_sets):
|
|||||||
mkisofs_cmd = iso.get_mkisofs_cmd(boot_iso, None, volid=volume_id, exclude=["./lost+found"], graft_points=graft_points_path, **mkisofs_kwargs)
|
mkisofs_cmd = iso.get_mkisofs_cmd(boot_iso, None, volid=volume_id, exclude=["./lost+found"], graft_points=graft_points_path, **mkisofs_kwargs)
|
||||||
run(mkisofs_cmd, logfile=log_file, show_cmd=True)
|
run(mkisofs_cmd, logfile=log_file, show_cmd=True)
|
||||||
|
|
||||||
cmd = "umount %s" % pipes.quote(mount_dir)
|
cmd = "umount %s" % shlex_quote(mount_dir)
|
||||||
run(cmd, logfile=log_file, show_cmd=True)
|
run(cmd, logfile=log_file, show_cmd=True)
|
||||||
|
|
||||||
if arch == "x86_64":
|
if arch == "x86_64":
|
||||||
isohybrid_cmd = "isohybrid --uefi %s" % pipes.quote(boot_iso)
|
isohybrid_cmd = "isohybrid --uefi %s" % shlex_quote(boot_iso)
|
||||||
run(isohybrid_cmd, logfile=log_file, show_cmd=True)
|
run(isohybrid_cmd, logfile=log_file, show_cmd=True)
|
||||||
elif arch == "i386":
|
elif arch == "i386":
|
||||||
isohybrid_cmd = "isohybrid %s" % pipes.quote(boot_iso)
|
isohybrid_cmd = "isohybrid %s" % shlex_quote(boot_iso)
|
||||||
run(isohybrid_cmd, logfile=log_file, show_cmd=True)
|
run(isohybrid_cmd, logfile=log_file, show_cmd=True)
|
||||||
|
|
||||||
# implant MD5SUM to iso
|
# implant MD5SUM to iso
|
||||||
isomd5sum_cmd = iso.get_implantisomd5_cmd(boot_iso, compose.supported)
|
isomd5sum_cmd = iso.get_implantisomd5_cmd(boot_iso, compose.supported)
|
||||||
isomd5sum_cmd = " ".join([pipes.quote(i) for i in isomd5sum_cmd])
|
isomd5sum_cmd = " ".join([shlex_quote(i) for i in isomd5sum_cmd])
|
||||||
run(isomd5sum_cmd, logfile=log_file, show_cmd=True)
|
run(isomd5sum_cmd, logfile=log_file, show_cmd=True)
|
||||||
|
|
||||||
if boot_files:
|
if boot_files:
|
||||||
|
@ -22,14 +22,13 @@ import string
|
|||||||
import sys
|
import sys
|
||||||
import hashlib
|
import hashlib
|
||||||
import errno
|
import errno
|
||||||
import pipes
|
|
||||||
import re
|
import re
|
||||||
import contextlib
|
import contextlib
|
||||||
import traceback
|
import traceback
|
||||||
import tempfile
|
import tempfile
|
||||||
import time
|
import time
|
||||||
import functools
|
import functools
|
||||||
from six.moves import urllib, range
|
from six.moves import urllib, range, shlex_quote
|
||||||
|
|
||||||
from kobo.shortcuts import run, force_list
|
from kobo.shortcuts import run, force_list
|
||||||
from productmd.common import get_major_version
|
from productmd.common import get_major_version
|
||||||
@ -166,7 +165,7 @@ def explode_rpm_package(pkg_path, target_dir):
|
|||||||
"""Explode a rpm package into target_dir."""
|
"""Explode a rpm package into target_dir."""
|
||||||
pkg_path = os.path.abspath(pkg_path)
|
pkg_path = os.path.abspath(pkg_path)
|
||||||
makedirs(target_dir)
|
makedirs(target_dir)
|
||||||
run("rpm2cpio %s | cpio -iuvmd && chmod -R a+rX ." % pipes.quote(pkg_path), workdir=target_dir)
|
run("rpm2cpio %s | cpio -iuvmd && chmod -R a+rX ." % shlex_quote(pkg_path), workdir=target_dir)
|
||||||
|
|
||||||
|
|
||||||
def pkg_is_rpm(pkg_obj):
|
def pkg_is_rpm(pkg_obj):
|
||||||
|
@ -16,10 +16,10 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import pipes
|
|
||||||
from fnmatch import fnmatch
|
from fnmatch import fnmatch
|
||||||
import contextlib
|
import contextlib
|
||||||
from functools import cmp_to_key
|
from functools import cmp_to_key
|
||||||
|
from six.moves import shlex_quote
|
||||||
|
|
||||||
from kobo.shortcuts import force_list, relative_path, run
|
from kobo.shortcuts import force_list, relative_path, run
|
||||||
from pungi import util
|
from pungi import util
|
||||||
@ -230,7 +230,8 @@ def get_isohybrid_cmd(iso_path, arch):
|
|||||||
|
|
||||||
|
|
||||||
def get_manifest_cmd(iso_name):
|
def get_manifest_cmd(iso_name):
|
||||||
return "isoinfo -R -f -i %s | grep -v '/TRANS.TBL$' | sort >> %s.manifest" % (pipes.quote(iso_name), pipes.quote(iso_name))
|
return "isoinfo -R -f -i %s | grep -v '/TRANS.TBL$' | sort >> %s.manifest" % (
|
||||||
|
shlex_quote(iso_name), shlex_quote(iso_name))
|
||||||
|
|
||||||
|
|
||||||
def get_volume_id(path):
|
def get_volume_id(path):
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import pipes
|
|
||||||
import re
|
import re
|
||||||
import time
|
import time
|
||||||
import threading
|
import threading
|
||||||
@ -24,7 +23,7 @@ import contextlib
|
|||||||
import koji
|
import koji
|
||||||
from kobo.shortcuts import run
|
from kobo.shortcuts import run
|
||||||
import six
|
import six
|
||||||
from six.moves import configparser
|
from six.moves import configparser, shlex_quote
|
||||||
|
|
||||||
from .. import util
|
from .. import util
|
||||||
from ..arch_utils import getBaseArch
|
from ..arch_utils import getBaseArch
|
||||||
@ -106,7 +105,7 @@ class KojiWrapper(object):
|
|||||||
cmd.append(arch)
|
cmd.append(arch)
|
||||||
|
|
||||||
if isinstance(command, list):
|
if isinstance(command, list):
|
||||||
command = " ".join([pipes.quote(i) for i in command])
|
command = " ".join([shlex_quote(i) for i in command])
|
||||||
|
|
||||||
# HACK: remove rpmdb and yum cache
|
# HACK: remove rpmdb and yum cache
|
||||||
command = "rm -f /var/lib/rpm/__db*; rm -rf /var/cache/yum/*; set -x; " + command
|
command = "rm -f /var/lib/rpm/__db*; rm -rf /var/cache/yum/*; set -x; " + command
|
||||||
|
@ -17,9 +17,9 @@ from __future__ import absolute_import
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import pipes
|
|
||||||
import glob
|
import glob
|
||||||
import six
|
import six
|
||||||
|
from six.moves import shlex_quote
|
||||||
|
|
||||||
import kobo.log
|
import kobo.log
|
||||||
from kobo.shortcuts import run, force_list
|
from kobo.shortcuts import run, force_list
|
||||||
@ -113,12 +113,12 @@ class GitWrapper(ScmBase):
|
|||||||
self.log_debug("Exporting directory %s from git %s (branch %s)..."
|
self.log_debug("Exporting directory %s from git %s (branch %s)..."
|
||||||
% (scm_dir, scm_root, scm_branch))
|
% (scm_dir, scm_root, scm_branch))
|
||||||
cmd = ("/usr/bin/git archive --remote=%s %s %s | tar xf -"
|
cmd = ("/usr/bin/git archive --remote=%s %s %s | tar xf -"
|
||||||
% (pipes.quote(scm_root), pipes.quote(scm_branch), pipes.quote(scm_dir)))
|
% (shlex_quote(scm_root), shlex_quote(scm_branch), shlex_quote(scm_dir)))
|
||||||
# git archive is not supported by http/https
|
# git archive is not supported by http/https
|
||||||
# or by smart http https://git-scm.com/book/en/v2/Git-on-the-Server-Smart-HTTP
|
# or by smart http https://git-scm.com/book/en/v2/Git-on-the-Server-Smart-HTTP
|
||||||
if scm_root.startswith("http") or self.command:
|
if scm_root.startswith("http") or self.command:
|
||||||
cmd = ("/usr/bin/git clone --depth 1 --branch=%s %s %s"
|
cmd = ("/usr/bin/git clone --depth 1 --branch=%s %s %s"
|
||||||
% (pipes.quote(scm_branch), pipes.quote(scm_root), pipes.quote(tmp_dir)))
|
% (shlex_quote(scm_branch), shlex_quote(scm_root), shlex_quote(tmp_dir)))
|
||||||
self.retry_run(cmd, workdir=tmp_dir, show_cmd=True)
|
self.retry_run(cmd, workdir=tmp_dir, show_cmd=True)
|
||||||
self.run_process_command(tmp_dir)
|
self.run_process_command(tmp_dir)
|
||||||
|
|
||||||
@ -137,12 +137,12 @@ class GitWrapper(ScmBase):
|
|||||||
self.log_debug("Exporting file %s from git %s (branch %s)..."
|
self.log_debug("Exporting file %s from git %s (branch %s)..."
|
||||||
% (scm_file, scm_root, scm_branch))
|
% (scm_file, scm_root, scm_branch))
|
||||||
cmd = ("/usr/bin/git archive --remote=%s %s %s | tar xf -"
|
cmd = ("/usr/bin/git archive --remote=%s %s %s | tar xf -"
|
||||||
% (pipes.quote(scm_root), pipes.quote(scm_branch), pipes.quote(scm_file)))
|
% (shlex_quote(scm_root), shlex_quote(scm_branch), shlex_quote(scm_file)))
|
||||||
# git archive is not supported by http/https
|
# git archive is not supported by http/https
|
||||||
# or by smart http https://git-scm.com/book/en/v2/Git-on-the-Server-Smart-HTTP
|
# or by smart http https://git-scm.com/book/en/v2/Git-on-the-Server-Smart-HTTP
|
||||||
if scm_root.startswith("http") or self.command:
|
if scm_root.startswith("http") or self.command:
|
||||||
cmd = ("/usr/bin/git clone --depth 1 --branch=%s %s %s"
|
cmd = ("/usr/bin/git clone --depth 1 --branch=%s %s %s"
|
||||||
% (pipes.quote(scm_branch), pipes.quote(scm_root), pipes.quote(tmp_dir)))
|
% (shlex_quote(scm_branch), shlex_quote(scm_root), shlex_quote(tmp_dir)))
|
||||||
self.retry_run(cmd, workdir=tmp_dir, show_cmd=True)
|
self.retry_run(cmd, workdir=tmp_dir, show_cmd=True)
|
||||||
self.run_process_command(tmp_dir)
|
self.run_process_command(tmp_dir)
|
||||||
|
|
||||||
@ -168,8 +168,8 @@ class RpmScmWrapper(ScmBase):
|
|||||||
if scm_dir.endswith("/"):
|
if scm_dir.endswith("/"):
|
||||||
copy_all(os.path.join(tmp_dir, scm_dir), target_dir)
|
copy_all(os.path.join(tmp_dir, scm_dir), target_dir)
|
||||||
else:
|
else:
|
||||||
run("cp -a %s %s/" % (pipes.quote(os.path.join(tmp_dir, scm_dir)),
|
run("cp -a %s %s/" % (shlex_quote(os.path.join(tmp_dir, scm_dir)),
|
||||||
pipes.quote(target_dir)))
|
shlex_quote(target_dir)))
|
||||||
|
|
||||||
def export_file(self, scm_root, scm_file, target_dir, scm_branch=None):
|
def export_file(self, scm_root, scm_file, target_dir, scm_branch=None):
|
||||||
for rpm in self._list_rpms(scm_root):
|
for rpm in self._list_rpms(scm_root):
|
||||||
|
@ -16,10 +16,7 @@ from kobo import shortcuts
|
|||||||
import os
|
import os
|
||||||
import productmd
|
import productmd
|
||||||
import tempfile
|
import tempfile
|
||||||
try:
|
from six.moves import shlex_quote
|
||||||
from shlex import quote
|
|
||||||
except ImportError:
|
|
||||||
from pipes import quote
|
|
||||||
|
|
||||||
from pungi import util
|
from pungi import util
|
||||||
from pungi.phases.buildinstall import tweak_configs
|
from pungi.phases.buildinstall import tweak_configs
|
||||||
@ -27,7 +24,7 @@ from pungi.wrappers import iso
|
|||||||
|
|
||||||
|
|
||||||
def sh(log, cmd, *args, **kwargs):
|
def sh(log, cmd, *args, **kwargs):
|
||||||
log.info('Running: %s', ' '.join(quote(x) for x in cmd))
|
log.info('Running: %s', ' '.join(shlex_quote(x) for x in cmd))
|
||||||
ret, out = shortcuts.run(cmd, *args, universal_newlines=True, **kwargs)
|
ret, out = shortcuts.run(cmd, *args, universal_newlines=True, **kwargs)
|
||||||
if out:
|
if out:
|
||||||
log.debug('%s', out)
|
log.debug('%s', out)
|
||||||
|
Loading…
Reference in New Issue
Block a user