Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
upnames = pkgbuilder.upgrade.auto_upgrade(
dodowngrade, DS.vcsupgrade, DS.fetch, ignorelist)
pkgnames = upnames + pkgnames
if DS.fetch and pkgnames:
pkgbuilder.build.fetch_runner(pkgnames)
if quit:
exit(0)
if args.userfetch:
tofetch = []
print(':: ' + _('Fetching package information...'))
for u in args.userfetch:
try:
tofetch += pkgbuilder.utils.msearch(u)
except pkgbuilder.exceptions.AURError as e:
print(_('Error while processing {0}: {1}').format(u, e))
pkgbuilder.build.fetch_runner(tofetch, preprocessed=True)
if quit:
exit(0)
# If we didn't quit, we should build the packages.
if pkgnames:
DS.root_crash()
DS.log.info('Starting build...')
toinstall = []
sigs = []
tovalidate = set(pkgnames)
for pkgname in pkgnames:
asdeps=True,
filename=pkgbuilder.transaction.generate_filename(),
delete=True)
tx.run(standalone=False, validate=DS.validation)
return auto_build(pkgname, performdepcheck, pkginstall,
completelist)
return build_result
# Non-critical exceptions that shouldn’t crash PKGBUILDer as a whole are
# handled here. Some are duplicated for various reasons.
except pkgbuilder.exceptions.MakepkgError as e:
DS.fancy_error(_('makepkg (or someone else) failed and '
'returned {0}.').format(e.retcode))
return []
except pkgbuilder.exceptions.AURError as e:
DS.fancy_error(str(e))
return []
except pkgbuilder.exceptions.PackageError as e:
DS.fancy_error(str(e))
return []
tx = pkgbuilder.transaction.Transaction(
pkgnames=build_result[1],
pkgpaths=toinstall2,
sigpaths=sigs2,
asdeps=True,
filename=pkgbuilder.transaction.generate_filename(),
delete=True)
tx.run(standalone=False, validate=DS.validation)
return auto_build(pkgname, performdepcheck, pkginstall,
completelist)
return build_result
# Non-critical exceptions that shouldn’t crash PKGBUILDer as a whole are
# handled here. Some are duplicated for various reasons.
except pkgbuilder.exceptions.MakepkgError as e:
DS.fancy_error(_('makepkg (or someone else) failed and '
'returned {0}.').format(e.retcode))
return []
except pkgbuilder.exceptions.AURError as e:
DS.fancy_error(str(e))
return []
except pkgbuilder.exceptions.PackageError as e:
DS.fancy_error(str(e))
return []
if not depmatch:
raise pkgbuilder.exceptions.PackageError(
_('Failed to fulfill package dependency '
'requirement: {0}').format(fdep),
req=fdep, source=pkgobj)
if dep not in parseddeps:
if pyalpm.find_satisfier(localpkgs, dep):
parseddeps[dep] = 0
elif pyalpm.find_satisfier(syncpkgs, dep):
parseddeps[dep] = 1
elif pkgbuilder.utils.info([dep]):
parseddeps[dep] = 2
else:
raise pkgbuilder.exceptions.PackageNotFoundError(
dep, 'depcheck')
return parseddeps
raise pkgbuilder.exceptions.CloneError(e.returncode)
finally:
os.chdir('..')
else:
raise pkgbuilder.exceptions.ClonePathExists(pkgbase)
else:
repo_url = pkgbuilder.aur.AUR.base + '/' + pkgbase + '.git'
if DS.deepclone:
cloneargs = []
else:
cloneargs = ['--depth', '1']
try:
subprocess.check_call(['git', 'clone'] + cloneargs +
[repo_url, pkgbase])
except subprocess.CalledProcessError as e:
raise pkgbuilder.exceptions.CloneError(e.returncode)
"""Clone or update a git repo.
.. versionadded:: 4.0.0
"""
if os.path.exists('./{0}/'.format(pkgbase)):
if os.path.exists('./{0}/.git'.format(pkgbase)):
# git repo, pull
try:
os.chdir(pkgbase)
subprocess.check_call(['git', 'pull', '--no-rebase'])
except subprocess.CalledProcessError as e:
raise pkgbuilder.exceptions.CloneError(e.returncode)
finally:
os.chdir('..')
else:
raise pkgbuilder.exceptions.ClonePathExists(pkgbase)
else:
repo_url = pkgbuilder.aur.AUR.base + '/' + pkgbase + '.git'
if DS.deepclone:
cloneargs = []
else:
cloneargs = ['--depth', '1']
try:
subprocess.check_call(['git', 'clone'] + cloneargs +
[repo_url, pkgbase])
except subprocess.CalledProcessError as e:
raise pkgbuilder.exceptions.CloneError(e.returncode)
def clone(pkgbase):
"""Clone or update a git repo.
.. versionadded:: 4.0.0
"""
if os.path.exists('./{0}/'.format(pkgbase)):
if os.path.exists('./{0}/.git'.format(pkgbase)):
# git repo, pull
try:
os.chdir(pkgbase)
subprocess.check_call(['git', 'pull', '--no-rebase'])
except subprocess.CalledProcessError as e:
raise pkgbuilder.exceptions.CloneError(e.returncode)
finally:
os.chdir('..')
else:
raise pkgbuilder.exceptions.ClonePathExists(pkgbase)
else:
repo_url = pkgbuilder.aur.AUR.base + '/' + pkgbase + '.git'
if DS.deepclone:
cloneargs = []
else:
cloneargs = ['--depth', '1']
try:
subprocess.check_call(['git', 'clone'] + cloneargs +
[repo_url, pkgbase])
except subprocess.CalledProcessError as e:
raise pkgbuilder.exceptions.CloneError(e.returncode)
.. note::
This function returns a list of packages to install with pacman -U.
Please take care of it. Running PKGBUILDer/PBWrapper standalone or
.__main__.main() will do that.
"""
if completelist is None:
completelist = []
build_result = build_runner(pkgname, performdepcheck, pkginstall, pkgbuild_edit)
try:
if build_result[0] == 0:
DS.fancy_msg(_('The build succeeded.'))
elif build_result[0] >= 0 and build_result[0] < 256:
raise pkgbuilder.exceptions.MakepkgError(build_result[0])
elif build_result[0] == RES_ABORT:
DS.fancy_warning(_('Installation aborted by user.'))
elif build_result[0] == RES_EXISTING:
# existing package, do nothing
pass
elif build_result[0] == RES_AURDEPS:
DS.fancy_warning(_('Building more AUR packages is required.'))
if not pkginstall:
raise pkgbuilder.exceptions.PBException(
_('Cannot install dependencies and continue building '
'because -w, --buildonly was specified. Please run '
'without -w, --buildonly or install dependencies '
'manually and try again.'),
'auto_build deps')
toinstall2 = []