-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
give option to disable regex mode #79
Comments
Yeah, I'm just going to eliminate the regex feature. The issue is I thought package names in AUR were restricted to |
Damn, reverting 0e5bc0f isn't a clean fix. |
Checking out |
Yay! I started from aabec06 and cherry-picked. The result applies to 9c58d5f (which is, as of this moment, current apacman master). 0001-Feature-69-added-testing-hooks-and-WIP-unit-test-wit.patch
0002-Minor-fixes-for-testing-hooks.patch
0003-Fix-52-install-cached-packages-without-Internet-conn.patch
0004-Fix-9-check-umask.patch
0005-Fix-51-install-groups.-Add-more-exit-codes.patch
0006-Fix-70-parse-config-flag-early.-Update-help-and-verb.patch
0007-Ver-3.0-Fix-71-flag-parameter-syntax.-Add-savedir-fl.patch
0008-Improved-exit-codes-see-man-page-and-fix-72.patch
0009-Fixes-for-gendb-testing-exit-code-8.-Update-unit-tes.patch
0010-Fix-75-clean-build-dir.-Also-check-tmpfs-free-space-.patch
0011-Misc.-fixes-and-temp-file-cleanup.patch
0012-Minor-function-cleanup.patch
0013-Use-the-same-behavior-of-pacman-s-progress-bar.patch
0014-Expand-G-to-fetch-old-AUR-versions-pkgname-ver-or-pk.patch
0015-Syntax-changes-from-master-to-make-the-patch-smaller.patch
diff --git a/apacman b/apacman
index 3a31551..ef504a4 100755
--- a/apacman
+++ b/apacman
@@ -12,8 +12,6 @@ version="3.1"
# * --savedir <dir>, --savedir=<dir>
# * Install AUR packages offline
# * --testing for unit testing purposes only
-# * Regex matching for searching packages
-# * Regex matching for installing packages
# * -P patched AUR passthrough for pkgfile
# * Save installed AUR package metadata to database
# * Enabled --progress by default
@@ -352,32 +350,16 @@ getlistpackages() {
exit $?
}
-# Tests whether package exists on the aur ($1 is name, $2 is dereferenced variable)
+# Tests whether $1 exists on the aur
existsinaur() {
chosenpkg=$(echo "$1" | sed 's/\~$//' | awk -F "==" '{print $1}')
- val="${!2}"
-
- regexmatch="$(echo $val | tr -dc '0-9a-z-.\n')"
- if [[ $val != $regexmatch ]]; then
- matches=$(aurpkglist "$val")
- selectprovider "$val" $matches
- if [[ $providepkg ]]; then
- eval "$2=\"$providepkg\"" 2>/dev/null
- chosenpkg="$providepkg"
- fi
- fi
-
rpcinfo "$chosenpkg"
[[ "$(jshon -Qe resultcount -u < "$tmpdir/$chosenpkg.info")" != "0" ]]
}
# Tests whether $1 exists in pacman
existsinpacman() {
- chosenpkg=$1
- if [[ $regex = 1 ]]; then
- chosenpkg=$(selectprovider)
- fi
-
+ chosenpkg="$1"
$pacmanbin -Si -- "$chosenpkg" &>/dev/null
}
@@ -433,9 +415,7 @@ selectprovider() {
providepkg="$virtual"
elif [[ $# -gt 1 ]]; then
# Multiple providers
- provmsg="provide"
- [[ $regex = 1 ]] && provmsg="match" && unset regex
- echo -e "${COLOR5}:: ${COLOR1}There are $virtnum packages that $provmsg $virtpkg:${ENDCOLOR}"
+ echo -e "${COLOR5}:: ${COLOR1}There are $virtnum packages that provide $virtpkg:${ENDCOLOR}"
providepkg=$(pickone $virtnum ${virtual[@]})
fi
}
@@ -535,7 +515,7 @@ finddeps() {
fi
if existsinpacman "$dep"; then
pacmandeps+=("$dep")
- elif existsinaur "$dep" "dep"; then
+ elif existsinaur "$dep"; then
if [[ $aurdeps ]]; then
aurdeps=("$dep" "${aurdeps[@]}")
else
@@ -610,14 +590,6 @@ aurbar() {
printf "%s %3s%%\r" ${endbar} ${perc}
}
-aurpkglist() {
- if ! [[ -f "$tmpdir/packages.lst" ]]; then
- curl -Lfs "$PKGURL/packages.gz" | gunzip > "$tmpdir/packages.lst"
- fi
-
- grep -E "$1" "$tmpdir/packages.lst" | sort
-}
-
rpcinfo() {
if ! [[ -f "$tmpdir/$1.info" ]]; then
curl -LfGs --data-urlencode "arg=$1" "$RPCURL=info" > "$tmpdir/$1.info"
@@ -693,7 +665,7 @@ aurversionisnewer() {
package="$1"
rpcinfo "$package"
unset aurversion
- if existsinaur "$package" "package"; then
+ if existsinaur "$package"; then
aurversion="$(jshon -Q -e results -a -e Version -u < "$tmpdir/$package.info")"
if [[ "$(LC_ALL=C vercmp "$aurversion" "$2")" -gt 0 ]]; then
return 0
@@ -1164,7 +1136,7 @@ installhandling() {
pacmanpackages+=("$package")
elif ! [[ $auronly ]] && providedinpacman "$package"; then
pacmanpackages+=("$providepkg")
- elif ! [[ $noaur ]] && existsinaur "$package" "package"; then
+ elif ! [[ $noaur ]] && existsinaur "$package"; then
if finddeps "$package"; then
# here is where dep dupes are created
aurpackages+=("$package")
@@ -1533,14 +1505,8 @@ fi
# Install (-S) handling
if [[ $option = install ]]; then
for pkg in ${packageargs[@]}; do
- regexmatch="$(echo $pkg | tr -dc '0-9a-z-.\n')"
if [[ "$pkg" =~ ^/ ]]; then
err "${COLOR7}error:${ENDCOLOR} invalid package name $pkg"
- elif [[ $regex = 1 ]]; then
- true
- elif [[ "$pkg" != "$regexmatch" ]]; then
- regex='1'
- echo -e "${COLOR6}notice:${ENDCOLOR} enabling regex mode ($pkg)"
fi
done
installhandling "${packageargs[@]}"
@@ -1575,7 +1541,7 @@ if [[ $option = update ]]; then
if isignored "$pkg"; then
checkignores+=("${packages[i]}")
continue
- elif ! existsinaur "$pkg" "pkg"; then
+ elif ! existsinaur "$pkg"; then
extinctpkgs+=("${packages[i]}")
continue
fi
@@ -1613,7 +1579,7 @@ if [[ $option = update ]]; then
ver="${packages[i]##* }"
if isignored "$pkg"; then
checkignores+=("${packages[i]}")
- elif ! existsinaur "$pkg" "pkg"; then
+ elif ! existsinaur "$pkg"; then
extinctpkgs+=("${packages[i]}")
elif aurversionisnewer "$pkg" "$ver"; then
newpackages+=("$pkg")
@@ -1655,7 +1621,7 @@ if [[ $option = download ]]; then
cd "$olddir"
for package in "${packageargs[@]}"; do
- if ! [[ $noaur ]] && existsinaur "$package" "package"; then
+ if ! [[ $noaur ]] && existsinaur "$package"; then
pkglist+=("$package")
elif ! [[ $auronly ]] && existsinpacman "$package"; then
abslist+=("$package")
@@ -1751,13 +1717,7 @@ if [[ $option = search || $option = searchinstall ]]; then
wait
cp "$tmpdir/${packageargs[0]}.search" "$tmpdir/search.results"
for ((i=1 ; i<${#packageargs[@]} ; i++)); do
- regexmatch="$(echo ${packageargs[$i]} | tr -dc '0-9A-Za-z-.\n')"
- if [[ ${packageargs[$i]} != $regexmatch ]]; then
- echo -e "${COLOR6}notice:${ENDCOLOR} enabling regex mode (${packageargs[$i]})"
- grep --color=always -E "${packageargs[$i]}" "$tmpdir/search.results" > "$tmpdir/search.results-2"
- else
- grep -xFf "$tmpdir/search.results" "$tmpdir/${packageargs[$i]}.search" > "$tmpdir/search.results-2"
- fi
+ grep -xFf "$tmpdir/search.results" "$tmpdir/${packageargs[$i]}.search" > "$tmpdir/search.results-2"
mv "$tmpdir/search.results-2" "$tmpdir/search.results"
done
sed -i '/^$/d' "$tmpdir/search.results"
@@ -1843,7 +1803,6 @@ if [[ $option = search || $option = searchinstall ]]; then
# Remove the tmpfiles
rm -f "$tmpdir/*search" &>/dev/null
rm -f "$tmpdir/search.result" &>/dev/null
- rm -f "$tmpdir/packages.lst" &>/dev/null
exit
fi
|
@oshazard any ideas when the removal of regex mode might be included in a release?. |
Deleted my fork pull request #91 was based on. Posting the patch here because relevant issue. |
got bitten by this bug, could you please remove the regex feature? @oshazard |
It also prints the selections after selecting one in regex mode:
ENTER
|
I have the same issue as @Sekuraz. |
I also have the same issue (Discord package depending on libc++, which breaks everything....) |
FYI:
|
@oshazard At the top of this issue you said you wanted to remove the regex feature completely, but that was nearly a year ago. I hope you'll consider pull #101. Instead of removing regex entirely, it makes minimal changes. Specifically, it adds support for the valid characters listed here, and changes the regex mode to basic instead of extended. IMHO, it's a working compromise; you can still use wildcards, and packages like For those trying to install I occasionally use discord. To avoid the
|
My workaround was to use another "package manager" for aur packages until all these problems get fixed; regex breaking, not being able to select if a package is provided by multiple ones etc... Apacman is completly useless for me atm :< |
Hopefully we can change that :) I wanted to resolve the smaller issues before tackling some of the unsupported PKGBUILD features. So far, with the changes I made, the following should be working:
You're welcome to test the updated script from my fork. |
for example, there is a package in [community] called bonnie++:
(which pacman installs just fine, of course.)
As we know, + is a regex special character that denotes "one or more of the preceding pattern/character/set/etc."
However:
Single quoting and SINGLE-escaping the +'s do nothing.
DOUBLE-escaping at least allows it to install:
Perhaps this should be documented in the man page as well?
The text was updated successfully, but these errors were encountered: