Commit a67e2d5b authored by Seblu's avatar Seblu
Browse files

Retrive first pkgname insteaf of pkgbase by default

To keep the rules of using binary name of the package in the config file,
we grab the pkgname[0] of the bash array. This is done to stay compatible with
archweb.

As bash 4.2.x doesn't export array to env (well know bug). We add a custom
export as string the first field of pkgname array as pkgname0.
parent 292734a9
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -126,7 +126,7 @@ def command_update(args, vctrl):
    if os.getresuid()[1] == 0:
        logging.warn("Warning: You should not run this as root")
    pkgdict = parse_pkgbuild(args.path)
    pkgname = pkgdict.get("pkgbase", pkgdict.get("pkgname", None))
    pkgname = pkgdict.get("pkgname0", pkgdict.get("pkgbase", None))
    pkgver = pkgdict.get("pkgver", None)
    # some sanity checks
    if "pkgname" is None:
+1 −1
Original line number Diff line number Diff line
@@ -34,7 +34,7 @@ def parse_pkgbuild(path, shell="bash"):
    WARNING: CODE IS EXECUTED
    '''
    # use shell sourcing to resolve custom bashism into PKGBUILD
    argv = [shell, "-c", "set -a; source '%s'; exec printenv -0" % path]
    argv = [shell, "-c", 'set -a; source "%s"; pkgname0="${pkgname[0]}"; exec printenv -0' % path]
    # Log it as warn because it's dangerous
    logging.warn("Running bash to source file %s" % path)
    proc = subprocess.Popen(argv, stdout=subprocess.PIPE, shell=False)