Open ghost opened 7 years ago
Yeah, I'm just going to eliminate the regex feature.
The issue is I thought package names in AUR were restricted to [a-z]
, [0-9]
, -
but apparently +
, _
and more are in use.
Damn, reverting 0e5bc0fbf06576b6fd48063344fa26de3da90707 isn't a clean fix.
Same problem just reverting 062812bf1f575cf37278d15af3d2fae4aa36e13e..0e5bc0fbf06576b6fd48063344fa26de3da90707
/usr/bin/apacman: line 1898: syntax error: unexpected end of file
Checking out v2.9
works fine. (Though that's a huge and ridiculous patch)
Yay! I still get an error UPDATE: It wasn't /usr/bin/apacman: line 362: aurpkglist: command not found
, but it actually fucking works! When I put aurpkglist()
back, it hangs at :: There are 117 packages that provide libc++:
, but that was happening on master anyway. Do not recommend.aurpkglist()
's fault.
I started from aabec069be27141356c79194b8352725ffc7cc6a and cherry-picked. The result applies to 9c58d5f21a762b3c4d44fafb453b6a4a560284a0 (which is, as of this moment, current apacman master). This is not a pull request for obvious reason, please do not merge it to master. UPDATE: Now a merge request.
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
Result:
Copy of the patch from the 0473e35 ("Remove regex mode"):
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:
> sudo apacman -S 'libc\\+\\+'
notice: enabling regex mode (libc\+\+)
:: There are 4 packages that match libc\+\+:
ENTER
> sudo apacman -S 'libc\\+\\+'
notice: enabling regex mode (libc\+\+)
:: There are 4 packages that match libc\+\+:
Package `1) libc++
2) libc++abi
3) libc++experimental
4) libc++-msan
Enter a selection (default=1): libc++' does not exist.
I have the same issue as @Sekuraz.
I also have the same issue (Discord package depending on libc++, which breaks everything....)
FYI:
The name(s) of the package(s) [...] should consist of lowercase alphanumerics and any of the following characters: @ . _ + - (at symbol, dot, underscore, plus, hyphen). Names are not allowed to start with hyphens or dots.
@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 bonnie++
are supported again. It also addresses a couple other smaller issues. Please let me know if you want anything changed.
For those trying to install libc++
:
libc++
seems to have a couple different issues. One is the plus sign used in the name (fixed with the changes I've submitted). The other issue has to do with split packages.
I occasionally use discord. To avoid the libc++
issue while using apacman
I'm currently using flatpak
to install and update it (not a solution, but it's a workaround for the interim).
sudo apacman -S flatpak
sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
sudo flatpak install -y flathub com.discordapp.Discord
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:
sudo apacman -S atari++
)sudo apacman -S apacm.*
)sudo apacman -S linux-headers
)yes|sudo apacman -Syu --noedit
)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?