Safely downgrade from ALA

I know downgrading of a package is only used as a last resort and should be avoided as clearly stated here

Still, if i need to downgrade, the biggest problem is that not everything is in my cache… and the downgrade tool is actually pulling from ARCH. So it should work “fine” (except the partial upgrade) for packages, that are directly copied from ARCH, but will produce a even greater disaster if by mistake used on an “overlayed” package. So my question:

Is there any reliable way to check which package is arch package and which is manjaro-customized and therefore no-go for downgrade?
I made a small script to parse the web pages of manjaro and arch, but there must be a better way? Or not? My concept was, if arch stable= manjaro unstable, i can compare versions, for example this
and this and if the versions match than most probably that package was not customized by manjaro.
Here is the script:

#!/usr/bin/env bash

#check if the user entered a package name
if [ -z "$1" ]; then
	echo "Please specify a package name as argument.";
	exit 1
fi

#check if lynx is available
if ! [[ "$(which lynx)" =~ (lynx) ]]; then
	echo ":: lynx console browser not found but is required, please install with sudo pacman -Syu lynx"
	exit 1
fi

#check the package version in the manjaro x86_64 unstable repo
echo "The current version of $1 in the manjaro unstable x86_64 repo is:"
lynx -dump https://packages.manjaro.org/?query=$1 |grep unstable | awk -F "unstable" '{ print $2; exit; }'

#check the package version in the arch stable repo
echo "The current version of $1 in the arch stable x86_64 repo is:"
lynx -dump https://archlinux.org/packages/core/x86_64/$1/ |grep $1 | awk '{ print $2; exit; }'
lynx -dump https://archlinux.org/packages/extra/x86_64/$1/ |grep $1 | awk '{ print $2; exit; }'
lynx -dump https://archlinux.org/packages/multilib/x86_64/$1/ |grep $1 | awk '{ print $2; exit; }'
#lynx -dump https://archlinux.org/packages/?sort=&repo=Core&repo=Extra&repo=Multilib&q=rclone
echo "If the version numbers match, it is probably safe to downgrade, but do at your own risk. If not, do not downgrade!"

And a sample output

[teo@teo-lenovo-v15 ~]$ safedowngrade.sh rclone
The current version of rclone in the manjaro unstable x86_64 repo is:
1.63.1-1
The current version of rclone in the arch stable x86_64 repo is:
1.63.1-1
If the version numbers match, it is probably safe to downgrade, but do at your own risk. If not, do not downgrade!

But this method is rather error prone, maybe there is a better way?

There are.
At one point I forked downgrade and made MLA.
It appears that work was recently duplicated.
See manjaro-downgrade package. :wink:

Sure, by the email in info for example:

for x in $(pacman -Qq); do 
y="$(pacman -Qi $x | grep -Eo "@archlinux.org|@manjaro.org")"
[[ $y == '@archlinux.org' ]] && echo "$x"
done
for x in $(pacman -Qq); do 
y="$(pacman -Qi $x | grep -Eo "@archlinux.org|@manjaro.org")"
[[ $y == '@manjaro.org' ]] && echo "$x"
done

Oh that’s a nice thing. Didn’t know it exists. Works with Manjaro packages.

Thanks, i didn’t know there is MLA. I guess that answers the question. But the method with the packager’s email is super creative too…

For the sake of completeness i corrected my script, although now maybe useless:

#!/usr/bin/env bash

#check if the user entered a package name
if [ -z "$1" ]; then
	echo "Please specify a package name as argument.";
	exit 1
fi

#check if lynx is available
if ! [[ "$(which lynx)" =~ (lynx) ]]; then
	echo ":: lynx console browser not found but is required, please install with sudo pacman -Syu lynx"
	exit 1
fi

#check the package version in the manjaro x86_64 unstable repo
echo "The current version of $1 in the manjaro unstable x86_64 repo is:"
lynx -dump https://packages.manjaro.org/?query=$1 |grep unstable | awk -F "unstable" '{ print $2; exit; }'

#check the package version in the arch stable repo
echo "The current version of $1 in the arch stable x86_64 repo is:"
lynx -dump https://archlinux.org/packages/core/x86_64/$1/ |grep $1 | awk '{ print $2; exit; }'
lynx -dump https://archlinux.org/packages/extra/x86_64/$1/ |grep $1 | awk '{ print $2; exit; }'
lynx -dump https://archlinux.org/packages/multilib/x86_64/$1/ |grep $1 | awk '{ print $2; exit; }'
#lynx -dump https://archlinux.org/packages/?sort=&repo=Core&repo=Extra&repo=Multilib&q=rclone
echo "If the version numbers match, it is probably safe to downgrade, but do at your own risk. If not, do not downgrade!"

echo "============================"

echo "Alternative check - if the packager was from arch or manjaro team, if it is arch it is probably safe to downgrade:"
y="$(pacman -Qi $1 | grep -Eo "@archlinux.org|@manjaro.org")"
[[ $y == '@manjaro.org' ]] && echo "$1 was packaged from manjaro"
[[ $y == '@archlinux.org' ]] && echo "$1 was packaged from arch"

p.s. i know - one can use arrays, and case if, etc…but this was just a one time experiment, i didn’t need it to be perfect.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.