From 56e82963b465116af32231aa531e8f6344826eab Mon Sep 17 00:00:00 2001 From: kitsunyan Date: Sat, 9 Jun 2018 06:55:50 +0300 Subject: Allow to change the name of fake AUR repo --- doc/pakku.conf.5.txt | 4 ++++ pakku.conf | 1 + src/aur.nim | 18 +++++++++--------- src/common.nim | 31 +++++++++++++++++-------------- src/config.nim | 23 ++++++++++++++++------- src/feature/syncinfo.nim | 16 ++++++++-------- src/feature/syncinstall.nim | 38 ++++++++++++++++++++------------------ src/feature/syncsearch.nim | 4 ++-- src/feature/syncsource.nim | 10 +++++----- src/pacman.nim | 4 ---- 10 files changed, 82 insertions(+), 67 deletions(-) diff --git a/doc/pakku.conf.5.txt b/doc/pakku.conf.5.txt index 830f212..3357aa8 100644 --- a/doc/pakku.conf.5.txt +++ b/doc/pakku.conf.5.txt @@ -24,6 +24,10 @@ Options Set the temporary directory in which pakku will perform all building operations. The default value is +/tmp/pakku-$\{USER\}+. +*AurRepo =* name:: + Set the fake AUR repository name. This name should not conflict with + names of declared repositories. The default value is +aur+. + *AurComments*:: Download and display comments for AUR packages. diff --git a/pakku.conf b/pakku.conf index d6e78e9..c09f454 100644 --- a/pakku.conf +++ b/pakku.conf @@ -3,6 +3,7 @@ [options] #UserCacheDir = ${HOME}/.cache/pakku #TmpDir = /tmp/pakku-${USER} +#AurRepo = aur AurComments CheckIgnored diff --git a/src/aur.nim b/src/aur.nim index 07949c3..f86600f 100644 --- a/src/aur.nim +++ b/src/aur.nim @@ -16,7 +16,7 @@ const template gitUrl(base: string): string = aurUrl & base & ".git" -proc parseRpcPackageInfo(obj: JsonNode): Option[RpcPackageInfo] = +proc parseRpcPackageInfo(obj: JsonNode, repo: string): Option[RpcPackageInfo] = template optInt64(i: int64): Option[int64] = if i > 0: some(i) else: none(int64) @@ -33,7 +33,7 @@ proc parseRpcPackageInfo(obj: JsonNode): Option[RpcPackageInfo] = let popularity = obj["Popularity"].getFloat(0) if base.len > 0 and name.len > 0: - some(RpcPackageInfo(repo: "aur", base: base, name: name, version: version, + some(RpcPackageInfo(repo: repo, base: base, name: name, version: version, description: description, maintainer: maintainer, firstSubmitted: firstSubmitted, lastModified: lastModified, votes: votes, popularity: popularity, gitUrl: gitUrl(base), gitSubdir: none(string))) @@ -54,7 +54,7 @@ proc obtainPkgBaseSrcInfo(base: string): (string, Option[string]) = except CurlError: ("", some(getCurrentException().msg)) -proc getRpcPackageInfos*(pkgs: seq[string]): (seq[RpcPackageInfo], Option[string]) = +proc getRpcPackageInfos*(pkgs: seq[string], repo: string): (seq[RpcPackageInfo], Option[string]) = if pkgs.len == 0: (@[], none(string)) else: @@ -68,7 +68,7 @@ proc getRpcPackageInfos*(pkgs: seq[string]): (seq[RpcPackageInfo], Option[string let response = performString(url) let results = parseJson(response)["results"] - let table = lc[(x.name, x) | (y <- results, x <- parseRpcPackageInfo(y)), + let table = lc[(x.name, x) | (y <- results, x <- parseRpcPackageInfo(y, repo)), (string, RpcPackageInfo)].toTable (lc[x | (p <- pkgs, x <- table.opt(p)), RpcPackageInfo], none(string)) except CurlError: @@ -76,13 +76,13 @@ proc getRpcPackageInfos*(pkgs: seq[string]): (seq[RpcPackageInfo], Option[string except JsonParsingError: (@[], some(tr"failed to parse server response")) -proc getAurPackageInfos*(pkgs: seq[string], arch: string): +proc getAurPackageInfos*(pkgs: seq[string], repo: string, arch: string): (seq[PackageInfo], seq[PackageInfo], seq[string]) = if pkgs.len == 0: (@[], @[], @[]) else: withAur(): - let (rpcInfos, error) = getRpcPackageInfos(pkgs) + let (rpcInfos, error) = getRpcPackageInfos(pkgs, repo) if error.isSome: (@[], @[], @[error.unsafeGet]) @@ -101,7 +101,7 @@ proc getAurPackageInfos*(pkgs: seq[string], arch: string): if operror.isSome: (@[], operror) else: - let pkgInfos = parseSrcInfo("aur", srcInfo, arch, + let pkgInfos = parseSrcInfo(repo, srcInfo, arch, gitUrl(base), none(string), rpcInfos) (pkgInfos, none(string)) @@ -117,7 +117,7 @@ proc getAurPackageInfos*(pkgs: seq[string], arch: string): (pkgInfos, additionalPkgInfos, errors) -proc findAurPackages*(query: seq[string]): (seq[RpcPackageInfo], Option[string]) = +proc findAurPackages*(query: seq[string], repo: string): (seq[RpcPackageInfo], Option[string]) = if query.len == 0 or query[0].len <= 2: (@[], none(string)) else: @@ -129,7 +129,7 @@ proc findAurPackages*(query: seq[string]): (seq[RpcPackageInfo], Option[string]) let response = performString(url) let results = parseJson(response)["results"] - let rpcInfos = lc[x | (y <- results, x <- parseRpcPackageInfo(y)), RpcPackageInfo] + let rpcInfos = lc[x | (y <- results, x <- parseRpcPackageInfo(y, repo)), RpcPackageInfo] let filteredRpcInfos = if query.len > 1: (block: let queryLow = query[1 .. ^1].map(q => q.toLowerAscii) diff --git a/src/common.nim b/src/common.nim index 36aae38..f2fb155 100644 --- a/src/common.nim +++ b/src/common.nim @@ -80,37 +80,40 @@ proc packageTargets*(args: seq[Argument], parseDestination: bool): seq[PackageTa let reference = parsePackageReference(nameConstraint, false) PackageTarget(reference: reference, repo: repo, destination: destination))) -proc isAurTargetSync*(target: SyncPackageTarget): bool = - target.foundInfos.len == 0 and (target.repo.isNone or target.repo == some("aur")) +proc isAurTargetSync*(target: SyncPackageTarget, aurRepo: string): bool = + target.foundInfos.len == 0 and (target.repo.isNone or target.repo == some(aurRepo)) -proc isAurTargetFull*[T: RpcPackageInfo](target: FullPackageTarget[T]): bool = - target.foundInfos.len > 0 and target.foundInfos[0].repo == "aur" +proc isAurTargetFull*[T: RpcPackageInfo](target: FullPackageTarget[T], aurRepo: string): bool = + target.foundInfos.len > 0 and target.foundInfos[0].repo == aurRepo proc filterNotFoundSyncTargetsInternal(syncTargets: seq[SyncPackageTarget], pkgInfoReferencesTable: Table[string, PackageReference], - upToDateNeededTable: Table[string, PackageReference]): seq[SyncPackageTarget] = + upToDateNeededTable: Table[string, PackageReference], + aurRepo: string): seq[SyncPackageTarget] = # collect packages which were found neither in sync DB nor in AUR syncTargets.filter(t => not (upToDateNeededTable.opt(t.reference.name) .map(r => t.reference.isProvidedBy(r, true)).get(false)) and t.foundInfos.len == 0 and - not (t.isAurTargetSync and pkgInfoReferencesTable.opt(t.reference.name) + not (t.isAurTargetSync(aurRepo) and pkgInfoReferencesTable.opt(t.reference.name) .map(r => t.reference.isProvidedBy(r, true)).get(false))) proc filterNotFoundSyncTargets*[T: RpcPackageInfo](syncTargets: seq[SyncPackageTarget], - pkgInfos: seq[T], upToDateNeededTable: Table[string, PackageReference]): seq[SyncPackageTarget] = + pkgInfos: seq[T], upToDateNeededTable: Table[string, PackageReference], + aurRepo: string): seq[SyncPackageTarget] = let pkgInfoReferencesTable = pkgInfos.map(i => (i.name, i.toPackageReference)).toTable - filterNotFoundSyncTargetsInternal(syncTargets, pkgInfoReferencesTable, upToDateNeededTable) + filterNotFoundSyncTargetsInternal(syncTargets, + pkgInfoReferencesTable, upToDateNeededTable, aurRepo) proc printSyncNotFound*(config: Config, notFoundTargets: seq[SyncPackageTarget]) = let dbs = config.dbs.toSet for target in notFoundTargets: - if target.repo.isNone or target.repo == some("aur") or target.repo.unsafeGet in dbs: + if target.repo.isNone or target.repo == some(config.aurRepo) or target.repo.unsafeGet in dbs: printError(config.color, trp("target not found: %s\n") % [$target.reference]) else: printError(config.color, trp("database not found: %s\n") % [target.repo.unsafeGet]) proc findSyncTargets*(handle: ptr AlpmHandle, dbs: seq[ptr AlpmDatabase], - targets: seq[PackageTarget], allowGroups: bool, checkProvides: bool): + targets: seq[PackageTarget], aurRepo: string, allowGroups: bool, checkProvides: bool): (seq[SyncPackageTarget], seq[string]) = let dbTable = dbs.map(d => ($d.name, d)).toTable @@ -168,18 +171,18 @@ proc findSyncTargets*(handle: ptr AlpmHandle, dbs: seq[ptr AlpmDatabase], let syncTargets = targets.map(t => SyncPackageTarget(reference: t.reference, repo: t.repo, destination: t.destination, foundInfos: findSync(t))) - let checkAurNames = syncTargets.filter(isAurTargetSync).map(t => t.reference.name) + let checkAurNames = syncTargets.filter(t => t.isAurTargetSync(aurRepo)).map(t => t.reference.name) (syncTargets, checkAurNames) proc mapAurTargets*[T: RpcPackageInfo](targets: seq[SyncPackageTarget], - pkgInfos: seq[T]): seq[FullPackageTarget[T]] = + pkgInfos: seq[T], aurRepo: string): seq[FullPackageTarget[T]] = let aurTable = pkgInfos.map(i => (i.name, i)).toTable targets.map(proc (target: SyncPackageTarget): FullPackageTarget[T] = let res = if target.foundInfos.len == 0 and aurTable.hasKey(target.reference.name): (block: let pkgInfo = aurTable[target.reference.name] if target.reference.isProvidedBy(pkgInfo.toPackageReference, true): - some((("aur", some((pkgInfo.base, pkgInfo.version, none(string)))), pkgInfo)) + some(((aurRepo, some((pkgInfo.base, pkgInfo.version, none(string)))), pkgInfo)) else: none((SyncFoundInfo, T))) else: @@ -716,7 +719,7 @@ proc cloneAurReposWithPackageInfos*(config: Config, rpcInfos: seq[RpcPackageInfo except: "" - let addPkgInfos = parseSrcInfo("aur", srcInfos, config.arch, + let addPkgInfos = parseSrcInfo(config.aurRepo, srcInfos, config.arch, bases[index].gitUrl, none(string), rpcInfos) if keepRepos: cloneNext(index + 1, addPkgInfos ^& pkgInfos, repoPath ^& paths, errors) diff --git a/src/config.nim b/src/config.nim index f391884..7daaa53 100644 --- a/src/config.nim +++ b/src/config.nim @@ -41,6 +41,7 @@ type tmpRootInitial*: string tmpRootCurrent*: string color*: bool + aurRepo*: string aurComments*: bool checkIgnored*: bool printAurNotFound*: bool @@ -147,6 +148,7 @@ proc obtainConfig*(config: PacmanConfig): Config = let userCacheCurrent = obtainUserCacheDir(currentUser) let tmpRootInitial = obtainTmpDir(initialOrCurrentUser) let tmpRootCurrent = obtainTmpDir(currentUser) + let aurRepo = options.opt("AurRepo").get("aur") let aurComments = options.hasKey("AurComments") let checkIgnored = options.hasKey("CheckIgnored") let printAurNotFound = options.hasKey("PrintAurNotFound") @@ -157,16 +159,23 @@ proc obtainConfig*(config: PacmanConfig): Config = .optLast.get(PreserveBuilt.disabled) let preBuildCommand = options.opt("PreBuildCommand") - Config(root: root, db: db, cache: cache, - userCacheInitial: userCacheInitial, userCacheCurrent: userCacheCurrent, - tmpRootInitial: tmpRootInitial, tmpRootCurrent: tmpRootCurrent, color: color, - dbs: config.dbs, arch: config.arch, debug: config.debug, progressBar: config.progressBar, + if config.dbs.find(aurRepo) >= 0: + raise commandError(tr"repo '$#' can not be used as fake AUR repository" % [aurRepo], + colorNeeded = some(color)) + + if aurRepo.find('/') >= 0: + raise commandError(trp("could not register '%s' database (%s)\n") % + [aurRepo, tra"wrong or NULL argument passed"], colorNeeded = some(color)) + + Config(dbs: config.dbs, arch: config.arch, debug: config.debug, progressBar: config.progressBar, verbosePkgList: config.verbosePkgList, pgpKeyserver: config.pgpKeyserver, defaultRoot: config.defaultRoot and config.sysrootOption.isNone, ignorePkgs: config.ignorePkgs, ignoreGroups: config.ignoreGroups, - aurComments: aurComments, checkIgnored: checkIgnored, printAurNotFound: printAurNotFound, - sudoExec: sudoExec, viewNoDefault: viewNoDefault, preserveBuilt: preserveBuilt, - preBuildCommand: preBuildCommand) + root: root, db: db, cache: cache, userCacheInitial: userCacheInitial, + userCacheCurrent: userCacheCurrent, tmpRootInitial: tmpRootInitial, + tmpRootCurrent: tmpRootCurrent, color: color, aurRepo: aurRepo, aurComments: aurComments, + checkIgnored: checkIgnored, printAurNotFound: printAurNotFound, sudoExec: sudoExec, + viewNoDefault: viewNoDefault, preserveBuilt: preserveBuilt, preBuildCommand: preBuildCommand) template withAlpmConfig*(config: Config, passDbs: bool, handle: untyped, alpmDbs: untyped, errors: untyped, body: untyped): untyped = diff --git a/src/feature/syncinfo.nim b/src/feature/syncinfo.nim index 2de5bda..483df3c 100644 --- a/src/feature/syncinfo.nim +++ b/src/feature/syncinfo.nim @@ -62,11 +62,11 @@ proc formatDate(date: Option[int64]): seq[string] = proc handleTarget(config: Config, padding: int, args: seq[Argument], target: FullPackageTarget[PackageInfo]): int = if target.foundInfos.len > 0: - if isAurTargetFull[PackageInfo](target): + if isAurTargetFull[PackageInfo](target, config.aurRepo): let pkgInfo = target.pkgInfo.unsafeGet printPackageInfo(padding, config.color, - (trp"Repository", @["aur"], false), + (trp"Repository", @[config.aurRepo], false), (trp"Name", @[pkgInfo.name], false), (trp"Version", @[pkgInfo.version], false), (trp"Description", toSeq(pkgInfo.description.items), false), @@ -93,7 +93,7 @@ proc handleTarget(config: Config, padding: int, args: seq[Argument], pacmanRun(false, config.color, args & ($target, none(string), ArgumentType.target)) else: - if target.repo == some("aur"): + if target.repo == some(config.aurRepo): printError(config.color, trp("package '%s' was not found\n") % [$target]) 1 else: @@ -108,16 +108,16 @@ proc handleSyncInfo*(args: seq[Argument], config: Config): int = let (syncTargets, checkAurNames) = withAlpmConfig(config, true, handle, dbs, errors): for e in errors: printError(config.color, e) - findSyncTargets(handle, dbs, targets, false, false) + findSyncTargets(handle, dbs, targets, config.aurRepo, false, false) - let (pkgInfos, _, aerrors) = getAurPackageInfos(checkAurNames, config.arch) + let (pkgInfos, _, aerrors) = getAurPackageInfos(checkAurNames, config.aurRepo, config.arch) for e in aerrors: printError(config.color, e) - let fullTargets = mapAurTargets[PackageInfo](syncTargets, pkgInfos) + let fullTargets = mapAurTargets[PackageInfo](syncTargets, pkgInfos, config.aurRepo) let code = min(aerrors.len, 1) - if fullTargets.filter(t => isAurTargetFull[PackageInfo](t) or t.repo == some("aur") or - t.reference.constraint.isSome).len == 0: + if fullTargets.filter(t => isAurTargetFull[PackageInfo](t, config.aurRepo) or + t.repo == some(config.aurRepo) or t.reference.constraint.isSome).len == 0: if code == 0: pacmanExec(false, config.color, callArgs) else: diff --git a/src/feature/syncinstall.nim b/src/feature/syncinstall.nim index 7d638cc..b583fe6 100644 --- a/src/feature/syncinstall.nim +++ b/src/feature/syncinstall.nim @@ -200,11 +200,12 @@ proc findDependencies(config: Config, handle: ptr AlpmHandle, dbs: seq[ptr AlpmD withAur(): let (pkgInfos, additionalPkgInfos, paths) = if printMode: (block: let (pkgInfos, additionalPkgInfos, aerrors) = - getAurPackageInfos(aurCheck.map(r => r.name), config.arch) + getAurPackageInfos(aurCheck.map(r => r.name), config.aurRepo, config.arch) for e in aerrors: printError(config.color, e) (pkgInfos, additionalPkgInfos, newSeq[string]())) else: (block: - let (rpcInfos, aerrors) = getRpcPackageInfos(aurCheck.map(r => r.name)) + let (rpcInfos, aerrors) = getRpcPackageInfos(aurCheck.map(r => r.name), + config.aurRepo) for e in aerrors: printError(config.color, e) let (pkgInfos, additionalPkgInfos, paths, cerrors) = cloneAurReposWithPackageInfos(config, rpcInfos, not printMode, update, true) @@ -351,7 +352,7 @@ proc editLoop(config: Config, repo: string, base: string, repoPath: string, else: res - let (hasChanges, noTag) = if repo == "aur": (block: + let (hasChanges, noTag) = if repo == config.aurRepo: (block: let revisions = forkWaitRedirect(() => (block: dropPrivilegesAndChdir(none(string)): execResult(gitCmd, "-C", repoPath, "rev-list", tag & "..@"))) @@ -609,7 +610,7 @@ proc installGroupFromSources(config: Config, commonArgs: seq[Argument], let cachePath = config.userCacheInitial.cache(CacheKind.repositories) for pkgInfos in basePackages: let repo = pkgInfos[0].repo - if repo == "aur": + if repo == config.aurRepo: let base = pkgInfos[0].base let fullName = bareFullName(BareKind.pkg, base) let bareRepoPath = repoPath(cachePath, fullName) @@ -696,7 +697,7 @@ proc confirmViewAndImportKeys(config: Config, basePackages: seq[seq[seq[PackageI let base = pkgInfos[0].base let repoPath = repoPath(config.tmpRootInitial, base) - let aur = repo == "aur" + let aur = repo == config.aurRepo if not skipEdit and aur and not noconfirm and config.aurComments: echo(tr"downloading comments from AUR...") @@ -975,7 +976,7 @@ proc handlePrint(args: seq[Argument], config: Config, printFormat: string, echo(printFormat .replace("%n", pkgInfo.name) .replace("%v", pkgInfo.version) - .replace("%r", "aur") + .replace("%r", config.aurRepo) .replace("%s", "0") .replace("%l", pkgInfo.gitUrl)) @@ -1003,7 +1004,7 @@ proc printAllWarnings(config: Config, installed: seq[Installed], rpcInfos: seq[R if upgradeCount == 1: for localIsNewer in localIsNewerSeq: printWarning(config.color, tra("%s: local (%s) is newer than %s (%s)\n") % - [localIsNewer.name, localIsNewer.version, "aur", localIsNewer.aurVersion]) + [localIsNewer.name, localIsNewer.version, config.aurRepo, localIsNewer.aurVersion]) for inst in upToDateNeeded: printWarning(config.color, tra("%s-%s is up to date -- skipping\n") % @@ -1030,7 +1031,7 @@ proc printAllWarnings(config: Config, installed: seq[Installed], rpcInfos: seq[R [pkgInfo.name, installedVersion, newVersion]) else: printWarning(config.color, trp("skipping target: %s\n") % [pkgInfo.name]) - elif pkgInfo.repo == "aur": + elif pkgInfo.repo == config.aurRepo: if pkgInfo.maintainer.isNone: printWarning(config.color, tr"$# is orphaned" % [pkgInfo.name]) if installedTable.hasKey(pkgInfo.name): @@ -1135,10 +1136,10 @@ proc obtainAurPackageInfos(config: Config, rpcInfos: seq[RpcPackageInfo], let (pkgInfos, additionalPkgInfos, paths, errors) = if printMode: (block: let (pkgInfos, additionalPkgInfos, aerrors) = - getAurPackageInfos(fullRpcInfos.map(i => i.name), config.arch) + getAurPackageInfos(fullRpcInfos.map(i => i.name), config.aurRepo, config.arch) (pkgInfos, additionalPkgInfos, newSeq[string](), aerrors.deduplicate)) else: (block: - let (rpcInfos, aerrors) = getRpcPackageInfos(fullRpcInfos.map(i => i.name)) + let (rpcInfos, aerrors) = getRpcPackageInfos(fullRpcInfos.map(i => i.name), config.aurRepo) let (pkgInfos, additionalPkgInfos, paths, cerrors) = cloneAurReposWithPackageInfos(config, rpcInfos, not printMode, update, true) (pkgInfos, additionalPkgInfos, paths, (toSeq(aerrors.items) & cerrors).deduplicate)) @@ -1194,7 +1195,7 @@ proc findSyncTargetsWithInstalled(config: Config, targets: seq[PackageTarget], u withAlpmConfig(config, true, handle, dbs, errors): for e in errors: printError(config.color, e) - let (syncTargets, checkAurNames) = findSyncTargets(handle, dbs, targets, + let (syncTargets, checkAurNames) = findSyncTargets(handle, dbs, targets, config.aurRepo, not build, not build) proc checkReplaceable(name: string): bool = @@ -1247,18 +1248,19 @@ proc resolveBuildTargets(config: Config, targets: seq[PackageTarget], if checkAurNames.len > 0: echo(tr"checking AUR database...") - let (rpcInfos, rerrors) = getRpcPackageInfos(checkAurNames) + let (rpcInfos, rerrors) = getRpcPackageInfos(checkAurNames, config.aurRepo) for e in rerrors: printError(config.color, e) let rpcNotFoundTargets = filterNotFoundSyncTargets(syncTargets, - rpcInfos, initTable[string, PackageReference]()) + rpcInfos, initTable[string, PackageReference](), config.aurRepo) if rpcNotFoundTargets.len > 0: printSyncNotFound(config, rpcNotFoundTargets) errorResult else: let installedTable = installed.map(i => (i.name, i)).toTable - let rpcAurTargets = mapAurTargets(syncTargets, rpcInfos).filter(isAurTargetFull) + let rpcAurTargets = mapAurTargets(syncTargets, rpcInfos, config.aurRepo) + .filter(t => t.isAurTargetFull(config.aurRepo)) let (aurPkgInfos, additionalPkgInfos, aurPaths, upToDateNeeded, localIsNewerSeq, aperrors) = obtainAurPackageInfos(config, rpcInfos, rpcAurTargets, installedTable, @@ -1268,7 +1270,7 @@ proc resolveBuildTargets(config: Config, targets: seq[PackageTarget], let upToDateNeededTable: Table[string, PackageReference] = upToDateNeeded.map(i => (i.name, (i.name, none(string), some((ConstraintOperation.eq, i.version, false))))).toTable let notFoundTargets = filterNotFoundSyncTargets(syncTargets, - aurPkgInfos, upToDateNeededTable) + aurPkgInfos, upToDateNeededTable, config.aurRepo) if notFoundTargets.len > 0: clearPaths(aurPaths) @@ -1277,9 +1279,9 @@ proc resolveBuildTargets(config: Config, targets: seq[PackageTarget], else: let fullTargets = mapAurTargets(syncTargets .filter(t => not (upToDateNeededTable.opt(t.reference.name) - .map(r => t.reference.isProvidedBy(r, true)).get(false))), aurPkgInfos) - let pacmanTargets = fullTargets.filter(t => not isAurTargetFull(t)) - let aurTargets = fullTargets.filter(isAurTargetFull) + .map(r => t.reference.isProvidedBy(r, true)).get(false))), aurPkgInfos, config.aurRepo) + let pacmanTargets = fullTargets.filter(t => not isAurTargetFull(t, config.aurRepo)) + let aurTargets = fullTargets.filter(t => isAurTargetFull(t, config.aurRepo)) let (checkPacmanBuildPkgInfos, buildPkgInfos, buildUpToDateNeeded, buildPaths, obtainBuildErrorMessages) = obtainPacmanBuildTargets(config, pacmanTargets, installedTable, diff --git a/src/feature/syncsearch.nim b/src/feature/syncsearch.nim index 0b1aeae..7a9199d 100644 --- a/src/feature/syncsearch.nim +++ b/src/feature/syncsearch.nim @@ -11,7 +11,7 @@ proc handleSyncSearch*(args: seq[Argument], config: Config): int = else: let quiet = args.check(%%%"quiet") - let (aurPackages, aerrors) = findAurPackages(args.targets) + let (aurPackages, aerrors) = findAurPackages(args.targets, config.aurRepo) for e in aerrors: printError(config.color, e) type Package = tuple[rpcInfo: RpcPackageInfo, installedVersion: Option[string]] @@ -49,7 +49,7 @@ proc handleSyncSearch*(args: seq[Argument], config: Config): int = if quiet: echo(pkg.rpcInfo.name) else: - printPackageSearch(config.color, "aur", pkg.rpcInfo.name, + printPackageSearch(config.color, config.aurRepo, pkg.rpcInfo.name, pkg.rpcInfo.version, pkg.installedVersion, pkg.rpcInfo.description, some(formatPkgRating(pkg.rpcInfo.votes, pkg.rpcInfo.popularity))) 0 diff --git a/src/feature/syncsource.nim b/src/feature/syncsource.nim index 5c3f35a..df543c7 100644 --- a/src/feature/syncsource.nim +++ b/src/feature/syncsource.nim @@ -113,7 +113,7 @@ proc cloneAndCopy(config: Config, quiet: bool, fullTargets: seq[FullPackageTarget[RpcPackageInfo]]): int = let baseTargets = fullTargets.foldl(block: let bases = a.map(x => x.base) - if b.isAurTargetFull: + if b.isAurTargetFull(config.aurRepo): let rpcInfo = b.pkgInfo.get if rpcInfo.base in bases: a @@ -166,17 +166,17 @@ proc handleSyncSource*(args: seq[Argument], config: Config): int = else: let (syncTargets, checkAurNames) = withAlpmConfig(config, true, handle, dbs, errors): for e in errors: printError(config.color, e) - findSyncTargets(handle, dbs, targets, false, false) + findSyncTargets(handle, dbs, targets, config.aurRepo, false, false) - let (rpcInfos, aerrors) = getRpcPackageInfos(checkAurNames) + let (rpcInfos, aerrors) = getRpcPackageInfos(checkAurNames, config.aurRepo) for e in aerrors: printError(config.color, e) let notFoundTargets = filterNotFoundSyncTargets(syncTargets, - rpcInfos, initTable[string, PackageReference]()) + rpcInfos, initTable[string, PackageReference](), config.aurRepo) if notFoundTargets.len > 0: printSyncNotFound(config, notFoundTargets) 1 else: - let fullTargets = mapAurTargets[RpcPackageInfo](syncTargets, rpcInfos) + let fullTargets = mapAurTargets[RpcPackageInfo](syncTargets, rpcInfos, config.aurRepo) cloneAndCopy(config, quiet, fullTargets) diff --git a/src/pacman.nim b/src/pacman.nim index c9f2cc8..7303eec 100644 --- a/src/pacman.nim +++ b/src/pacman.nim @@ -393,10 +393,6 @@ proc obtainPacmanConfig*(args: seq[Argument]): PacmanConfig = ignorePkgs: ignorePkgs + defaultConfig.ignorePkgs, ignoreGroups: ignoreGroups + defaultConfig.ignoreGroups) - if config.dbs.find("aur") >= 0: - raise commandError(tr"repo '$#' is reserved by this program" % ["aur"], - colorNeeded = some(color.get)) - pacmanValidateAndThrow((("sysroot", sysroot, ArgumentType.long), sysroot.isSome), (("root", some(config.pacmanRootRel), ArgumentType.long), not defaultRoot), (("dbpath", some(config.pacmanDbRel), ArgumentType.long), true), -- cgit v1.2.3-70-g09d2