/pcr/packer-git/pur-support.patch
Patch | 531 lines | 503 code | 28 blank | 0 comment | 0 complexity | 8818f9d741539da4fadf9dfb1a1c02c6 MD5 | raw file
- diff -Nur a/packer b/packer
- --- a/packer 2015-08-28 16:26:27.878307880 -0300
- +++ b/packer 2015-08-28 16:35:43.554089893 -0300
- @@ -24,9 +24,9 @@
- usermakepkgconf="$HOME/.makepkg.conf"
- pacmanconf='/etc/pacman.conf'
-
- -RPCURL="https://aur.archlinux.org/rpc.php?type"
- -PKGURL="https://aur.archlinux.org"
- -PKGBURL="https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h"
- +RPCURL="https://pur.parabola.nu/rpc.php?type"
- +PKGURL="https://pur.parabola.nu"
- +PKGBURL="https://pur.parabola.nu/cgit/pur.git/plain/PKGBUILD?h"
-
- if [[ -t 1 && ! $COLOR = "NO" ]]; then
- COLOR1='\e[1;39m'
- @@ -59,14 +59,14 @@
- echo ' -Syu|-Su - updates all packages, also takes -uu and -yy options'
- echo ' -Ss|-Ssq - searches for package'
- echo ' -Si - outputs info for package'
- - echo ' -G - download and extract aur tarball only'
- + echo ' -G - download and extract pur tarball only'
- echo
- echo ' --quiet - only output package name for searches'
- echo ' --ignore - takes a comma-separated list of packages to ignore'
- echo ' --noconfirm - do not prompt for any confirmation'
- echo ' --noedit - do not prompt to edit files'
- echo ' --quickcheck - check for updates and exit'
- - echo ' --auronly - only do actions for aur'
- + echo ' --puronly - only do actions for pur'
- echo ' --devel - update devel packages during -Su'
- echo ' --skipinteg - when using makepkg, do not check md5s'
- echo ' --preview - edit pkgbuild before sourcing'
- @@ -103,8 +103,8 @@
- [[ " ${ignoredpackages[@]} " =~ " $1 " ]]
- }
-
- -# Tests whether $1 exists on the aur
- -existsinaur() {
- +# Tests whether $1 exists on the pur
- +existsinpur() {
- rpcinfo "$1"
- [[ "$(jshon -Qe resultcount -u < "$tmpdir/$1.info")" != "0" ]]
- }
- @@ -131,8 +131,8 @@
- pacman -Qq -- "$1" &>/dev/null
- }
-
- -# Scrapes the aur deps from PKGBUILDS and puts in globally available dependencies array
- -scrapeaurdeps() {
- +# Scrapes the pur deps from PKGBUILDS and puts in globally available dependencies array
- +scrapepurdeps() {
- pkginfo "$1" "$preview"
- . "$tmpdir/$1.PKGBUILD"
- IFS=$'\n'
- @@ -141,26 +141,26 @@
- }
-
- # Finds dependencies of package $1
- -# Sets pacmandeps and aurdeps array, which can be accessed globally after function runs
- +# Sets pacmandeps and purdeps array, which can be accessed globally after function runs
- finddeps() {
- - # loop through dependencies, if not installed, determine if pacman or aur deps
- + # loop through dependencies, if not installed, determine if pacman or pur deps
- pacmandeps=()
- - aurdeps=()
- - scrapeaurdeps "$1"
- + purdeps=()
- + scrapepurdeps "$1"
- missingdeps=( $(pacman -T "${dependencies[@]}") )
- while [[ $missingdeps ]]; do
- checkdeps=()
- for dep in "${missingdeps[@]}"; do
- - if [[ " $1 ${aurdeps[@]} ${pacmandeps[@]} " =~ " $dep " ]]; then
- + if [[ " $1 ${purdeps[@]} ${pacmandeps[@]} " =~ " $dep " ]]; then
- continue
- fi
- if existsinpacman "$dep"; then
- pacmandeps+=("$dep")
- - elif existsinaur "$dep"; then
- - if [[ $aurdeps ]]; then
- - aurdeps=("$dep" "${aurdeps[@]}")
- + elif existsinpur "$dep"; then
- + if [[ $purdeps ]]; then
- + purdeps=("$dep" "${purdeps[@]}")
- else
- - aurdeps=("$dep")
- + purdeps=("$dep")
- fi
- checkdeps+=("$dep")
- elif providedinpacman "$dep"; then
- @@ -173,7 +173,7 @@
- done
- missingdeps=()
- for dep in "${checkdeps[@]}"; do
- - scrapeaurdeps "$dep"
- + scrapepurdeps "$dep"
- for depdep in "${dependencies[@]}"; do
- [[ $(pacman -T "$depdep") ]] && missingdeps+=("$depdep")
- done
- @@ -183,12 +183,12 @@
- }
-
- # Displays a progress bar ($1 is numerator, $2 is denominator, $3 is candy/normal)
- -aurbar() {
- +purbar() {
- # Delete line
- printf "\033[0G"
-
- # Get vars for output
- - beginline=" aur"
- + beginline=" pur"
- beginbar="["
- endbar="] "
- perc="$(($1*100/$2))"
- @@ -252,13 +252,13 @@
- fi
- }
-
- -# Checks if package is newer on aur ($1 is package name, $2 is local version)
- -aurversionisnewer() {
- +# Checks if package is newer on pur ($1 is package name, $2 is local version)
- +purversionisnewer() {
- rpcinfo "$1"
- - unset aurversion
- - if existsinaur "$1"; then
- - aurversion="$(jshon -Q -e results -e Version -u < "$tmpdir/$1.info")"
- - if [[ "$(LC_ALL=C vercmp "$aurversion" "$2")" -gt 0 ]]; then
- + unset purversion
- + if existsinpur "$1"; then
- + purversion="$(jshon -Q -e results -e Version -u < "$tmpdir/$1.info")"
- + if [[ "$(LC_ALL=C vercmp "$purversion" "$2")" -gt 0 ]]; then
- return 0
- fi
- fi
- @@ -281,14 +281,14 @@
- fi
- }
-
- -# Installs packages from aur ($1 is package, $2 is dependency or explicit)
- -aurinstall() {
- +# Installs packages from pur ($1 is package, $2 is dependency or explicit)
- +purinstall() {
- dir="${TMPDIR:-/tmp}/packerbuild-$UID/$1"
- sourcemakepkgconf
-
- # Prepare the installation directory
- - # If there is an old directory and aurversion is not newer, use old directory
- - if . "$dir/$1/PKGBUILD" &>/dev/null && ! aurversionisnewer "$1" "$pkgver-$pkgrel"; then
- + # If there is an old directory and purversion is not newer, use old directory
- + if . "$dir/$1/PKGBUILD" &>/dev/null && ! purversionisnewer "$1" "$pkgver-$pkgrel"; then
- cd "$dir/$1"
- else
- [[ -d "$dir" ]] && rm -rf "$dir"
- @@ -354,15 +354,15 @@
- # Figure out all of the packages that need to be installed
- for package in "${packageargs[@]}"; do
- # Determine whether package is in pacman repos
- - if ! [[ $auronly ]] && existsinpacman "$package"; then
- + if ! [[ $puronly ]] && existsinpacman "$package"; then
- pacmanpackages+=("$package")
- - elif ! [[ $auronly ]] && existsinpacmangroup "$package"; then
- + elif ! [[ $puronly ]] && existsinpacmangroup "$package"; then
- pacmanpackages+=("$package")
- - elif existsinaur "$package"; then
- + elif existsinpur "$package"; then
- if finddeps "$package"; then
- # here is where dep dupes are created
- - aurpackages+=("$package")
- - aurdepends=("${aurdeps[@]}" "${aurdepends[@]}")
- + purpackages+=("$package")
- + purdepends=("${purdeps[@]}" "${purdepends[@]}")
- pacmandepends+=("${pacmandeps[@]}")
- fi
- else
- @@ -370,8 +370,8 @@
- fi
- done
-
- - # Check if any aur target packages are ignored
- - for package in "${aurpackages[@]}"; do
- + # Check if any pur target packages are ignored
- + for package in "${purpackages[@]}"; do
- if isignored "$package"; then
- echo -ne "${COLOR5}:: ${COLOR1}$package is in IgnorePkg/IgnoreGroup. Install anyway?${ENDCOLOR} [Y/n] "
- if ! [[ $noconfirm ]]; then
- @@ -380,17 +380,17 @@
- echo
- fi
- fi
- - aurtargets+=("$package")
- + purtargets+=("$package")
- done
-
- - # Check if any aur dependencies are ignored
- - for package in "${aurdepends[@]}"; do
- + # Check if any pur dependencies are ignored
- + for package in "${purdepends[@]}"; do
- if isignored "$package"; then
- echo -ne "${COLOR5}:: ${COLOR1}$package is in IgnorePkg/IgnoreGroup. Install anyway?${ENDCOLOR} [Y/n] "
- if ! [[ $noconfirm ]]; then
- if ! proceed; then
- echo "Unresolved dependency \`$package'"
- - unset aurtargets
- + unset purtargets
- break
- fi
- else
- @@ -403,33 +403,33 @@
- if [[ $pacmanpackages ]]; then
- runasroot $PACMAN "${PACOPTS[@]}" -S -- "${pacmanpackages[@]}"
- fi
- - if [[ -z $aurtargets ]]; then
- + if [[ -z $purtargets ]]; then
- exit
- fi
- - # Test if aurpackages are already installed; echo warning if so
- - for pkg in "${aurtargets[@]}"; do
- + # Test if purpackages are already installed; echo warning if so
- + for pkg in "${purtargets[@]}"; do
- if existsinlocal "$pkg"; then
- localversion="$(pacman -Qs "$pkg" | grep -F "local/$pkg" | cut -d ' ' -f 2)"
- - if ! aurversionisnewer "$pkg" "$localversion"; then
- + if ! purversionisnewer "$pkg" "$localversion"; then
- echo -e "${COLOR6}warning:$ENDCOLOR $pkg-$localversion is up to date -- reinstalling"
- fi
- fi
- done
-
- # Echo warning if packages are out of date
- - for pkg in "${aurtargets[@]}" "${aurdepends[@]}"; do
- + for pkg in "${purtargets[@]}" "${purdepends[@]}"; do
- if isoutofdate "$pkg"; then
- echo -e "${COLOR6}warning:$ENDCOLOR $pkg is flagged out of date"
- fi
- done
-
- - # Prompt for aur packages and their dependencies
- + # Prompt for pur packages and their dependencies
- echo
- - if [[ $aurdepends ]]; then
- - num="$((${#aurdepends[@]}+${#aurtargets[@]}))"
- - echo -e "${COLOR6}Aur Targets ($num):${ENDCOLOR} ${aurdepends[@]} ${aurtargets[@]}"
- + if [[ $purdepends ]]; then
- + num="$((${#purdepends[@]}+${#purtargets[@]}))"
- + echo -e "${COLOR6}Pur Targets ($num):${ENDCOLOR} ${purdepends[@]} ${purtargets[@]}"
- else
- - echo -e "${COLOR6}Aur Targets ($((${#aurtargets[@]}))):${ENDCOLOR} ${aurtargets[@]}"
- + echo -e "${COLOR6}Pur Targets ($((${#purtargets[@]}))):${ENDCOLOR} ${purtargets[@]}"
- fi
- if [[ $pacmandepends ]]; then
- IFS=$'\n' read -rd '' -a pacmandepends < \
- @@ -450,18 +450,18 @@
- runasroot $PACMAN --noconfirm --asdeps -S -- "${pacmandepends[@]}" || err "Installation failed."
- fi
-
- - # Install aur dependencies
- - if [[ $aurdepends ]]; then
- - for dep in "${aurdepends[@]}"; do
- - aurinstall "$dep" "dependency"
- + # Install pur dependencies
- + if [[ $purdepends ]]; then
- + for dep in "${purdepends[@]}"; do
- + purinstall "$dep" "dependency"
- done
- fi
-
- - # Install the aur packages
- - for package in "${aurtargets[@]}"; do
- - scrapeaurdeps "$package"
- + # Install the pur packages
- + for package in "${purtargets[@]}"; do
- + scrapepurdeps "$package"
- if pacman -T "${dependencies[@]}" &>/dev/null; then
- - aurinstall "$package" "explicit"
- + purinstall "$package" "explicit"
- else
- echo "Dependencies for \`$package' are not met, not building..."
- fi
- @@ -469,16 +469,16 @@
- }
-
- run_quick_check() {
- - bigurl="https://aur.archlinux.org/rpc.php?type=multiinfo"
- + bigurl="https://pur.parabola.nu/rpc.php?type=multiinfo"
- for p in $(pacman -Qqm); do
- bigurl="$bigurl&arg\[\]=$p"
- done
- - parsed_aur="$(curl -s "$bigurl" | \
- + parsed_pur="$(curl -s "$bigurl" | \
- jshon -e results -a -e Name -u -p -e Version -u | \
- sed 's/^$/-/' | paste -s -d '\t\n' | sort)"
- packages="$(expac -Q '%n\t%v' | sort)"
- - comm -23 <(echo "$parsed_aur") <(echo "$packages") | cut -f 1
- - if [[ $auronly == 1 ]]; then
- + comm -23 <(echo "$parsed_pur") <(echo "$packages") | cut -f 1
- + if [[ $puronly == 1 ]]; then
- return
- fi
- # see https://mailman.archlinux.org/pipermail/pacman-dev/2011-October/014673.html
- @@ -527,7 +527,7 @@
- '--ignore') ignorearg="$2" ; PACOPTS+=("--ignore" "$2") ; shift ;;
- '--noconfirm') noconfirm='1' PACOPTS+=("--noconfirm");;
- '--noedit') noedit='1' ;;
- - '--auronly') auronly='1' ;;
- + '--puronly') puronly='1' ;;
- '--quickcheck') quickcheck='1' ;;
- '--devel') devel='1' ;;
- '--skipinteg') MAKEPKGOPTS="--skipinteg" ;;
- @@ -560,12 +560,12 @@
- getignoredpackages
- sourcemakepkgconf
- # Pacman update
- - if ! [[ $auronly ]]; then
- + if ! [[ $puronly ]]; then
- runasroot $PACMAN "${PACOPTS[@]}" "$pacmanarg"
- fi
-
- - # Aur update
- - echo -e "${COLOR5}:: ${COLOR1}Synchronizing aur database...${ENDCOLOR}"
- + # Pur update
- + echo -e "${COLOR5}:: ${COLOR1}Synchronizing pur database...${ENDCOLOR}"
- IFS=$'\n' read -rd '' -a packages < <(pacman -Qm)
- newpackages=()
- checkignores=()
- @@ -574,7 +574,7 @@
-
- if [[ $devel ]]; then
- for ((i=0; i<$total; i++)); do
- - aurbar "$((i+1))" "$total" "$bartype"
- + purbar "$((i+1))" "$total" "$bartype"
- pkg="${packages[i]%% *}"
- if isignored "$pkg"; then
- checkignores+=("${packages[i]}")
- @@ -603,7 +603,7 @@
- done
- else
- for ((i=0; i<$total; i++)); do
- - aurbar "$((i+1))" "$total" "$bartype"
- + purbar "$((i+1))" "$total" "$bartype"
- pkg="${packages[i]%% *}"
- rpcinfo "$pkg" &
- nap
- @@ -614,25 +614,25 @@
- ver="${packages[i]##* }"
- if isignored "$pkg"; then
- checkignores+=("${packages[i]}")
- - elif aurversionisnewer "$pkg" "$ver"; then
- + elif purversionisnewer "$pkg" "$ver"; then
- newpackages+=("$pkg")
- fi
- done
- fi
- echo
-
- - echo -e "${COLOR5}:: ${COLOR1}Starting full aur upgrade...${ENDCOLOR}"
- + echo -e "${COLOR5}:: ${COLOR1}Starting full pur upgrade...${ENDCOLOR}"
-
- # Check and output ignored package update info
- for package in "${checkignores[@]}"; do
- - if aurversionisnewer "${package%% *}" "${package##* }"; then
- - echo -e "${COLOR6}warning:${ENDCOLOR} ${package%% *}: ignoring package upgrade (${package##* } => $aurversion)"
- + if purversionisnewer "${package%% *}" "${package##* }"; then
- + echo -e "${COLOR6}warning:${ENDCOLOR} ${package%% *}: ignoring package upgrade (${package##* } => $purversion)"
- fi
- done
-
- # Now for the installation part
- if [[ $newpackages ]]; then
- - auronly='1'
- + puronly='1'
- installhandling "${newpackages[@]}"
- fi
- echo " local database is up to date"
- @@ -641,10 +641,10 @@
- # Download (-G) handling
- if [[ $option = download ]]; then
- for package in "${packageargs[@]}"; do
- - if existsinaur "$package"; then
- + if existsinpur "$package"; then
- pkglist+=("$package")
- else
- - err "Package \`$package' does not exist on aur."
- + err "Package \`$package' does not exist on pur."
- fi
- done
-
- @@ -658,7 +658,7 @@
- # Search (-Ss) handling
- if [[ $option = search || $option = searchinstall ]]; then
- # Pacman searching
- - if ! [[ $auronly ]]; then
- + if ! [[ $puronly ]]; then
- if [[ $quiet ]]; then
- results="$(pacman -Ssq -- "${packageargs[@]}")"
- else
- @@ -677,7 +677,7 @@
- pactotal=0
- fi
-
- - # Aur searching and tmpfile preparation
- + # Pur searching and tmpfile preparation
- for package in "${packageargs[@]}"; do
- curl -LfGs --data-urlencode "arg=$package" "$RPCURL=search" | \
- jshon -Q -e results -a -e Name -u -p -e Version -u -p -e NumVotes -u -p -e Description -u | \
- @@ -692,24 +692,24 @@
- sed -i '/^$/d' "$tmpdir/search.results"
-
- # Prepare tmp file and arrays
- - IFS=$'\n' read -rd '' -a aurname < <(cut -f 1 "$tmpdir/search.results")
- - aurtotal="${#aurname[@]}"
- - alltotal="$(($pactotal+$aurtotal))"
- + IFS=$'\n' read -rd '' -a purname < <(cut -f 1 "$tmpdir/search.results")
- + purtotal="${#purname[@]}"
- + alltotal="$(($pactotal+$purtotal))"
- # Echo out the -Ss formatted package information
-
- IFS=$'\t\n'
- if [[ $option = search ]]; then
- if [[ $quiet ]]; then
- - printf "%s\n" ${aurname[@]}
- + printf "%s\n" ${purname[@]}
- elif [[ -s "$tmpdir/search.results" ]]; then
- - printf "${COLOR3}aur/${COLOR1}%s ${COLOR2}%s${ENDCOLOR} (%s)\n %s\n" $(cat "$tmpdir/search.results")
- + printf "${COLOR3}pur/${COLOR1}%s ${COLOR2}%s${ENDCOLOR} (%s)\n %s\n" $(cat "$tmpdir/search.results")
- fi
- else
- # interactive
- if [[ $quiet ]]; then
- nl -v ${pactotal:-0} -w 1 -s ' ' <(cut -f 1 "$tmpdir/search.results")
- elif [[ -s "$tmpdir/search.results" ]]; then
- - printf "%d ${COLOR3}aur/${COLOR1}%s ${COLOR2}%s${ENDCOLOR} (%s)\n %s\n" $(nl -v ${pactotal:-0} -w 1 < "$tmpdir/search.results")
- + printf "%d ${COLOR3}pur/${COLOR1}%s ${COLOR2}%s${ENDCOLOR} (%s)\n %s\n" $(nl -v ${pactotal:-0} -w 1 < "$tmpdir/search.results")
- fi
- fi | fmt -"$_WIDTH" -s
- unset IFS
- @@ -717,7 +717,7 @@
- # Prompt and install selected numbers
- if [[ $option = searchinstall ]]; then
- pkglist=()
- - allpackages=( "${pacname[@]}" "${aurname[@]}" )
- + allpackages=( "${pacname[@]}" "${purname[@]}" )
-
- # Exit if there are no matches
- [[ $allpackages ]] || exit
- @@ -754,7 +754,7 @@
- # Pacman info check
- sourcemakepkgconf
- for package in "${packageargs[@]}"; do
- - if ! [[ $auronly ]] && existsinpacman "$package"; then
- + if ! [[ $puronly ]] && existsinpacman "$package"; then
- results="$(pacman -Si -- "$package")"
- results="$(sed -r "s|^(Repository[^:]*:)(.*)$|\1$S${COLOR3}\2$S${ENDCOLOR}|" <<< "$results")"
- results="$(sed -r "s|^(Name[^:]*:)(.*)$|\1$S${COLOR1}\2$S${ENDCOLOR}|" <<< "$results")"
- @@ -763,14 +763,14 @@
- results="$(sed -r "s|^[^ ][^:]*:|$S${COLOR1}&$S${ENDCOLOR}|" <<< "$results")"
- echo -e "$results"
- exit
- - else # Check to see if it is in the aur
- + else # Check to see if it is in the pur
- pkginfo "$package" "$preview"
- [[ -s "$tmpdir/$package.PKGBUILD" ]] || err "${COLOR7}error:${ENDCOLOR} package '$package' was not found"
- . "$tmpdir/$package.PKGBUILD"
-
- # Echo out the -Si formatted package information
- # Retrieve each element in order and echo them immediately
- - echo -e "${COLOR1}Repository : ${COLOR3}aur"
- + echo -e "${COLOR1}Repository : ${COLOR3}pur"
- echo -e "${COLOR1}Name : $pkgname"
- echo -e "${COLOR1}Version : ${COLOR2}$pkgver-$pkgrel"
- echo -e "${COLOR1}URL : ${COLOR4}$url"
- diff -Nur a/packer.8 b/packer.8
- --- a/packer.8 2015-08-28 16:26:27.881641047 -0300
- +++ b/packer.8 2015-08-28 16:28:32.232156389 -0300
- @@ -19,13 +19,13 @@
- .\" * MAIN CONTENT STARTS HERE *
- .\" -----------------------------------------------------------------
- .SH "NAME"
- -packer \- package manager utility for pacman repositories and the AUR
- +packer \- package manager utility for pacman repositories and the PUR
- .SH "SYNOPSIS"
- .sp
- \fIpacman\fR <operation> [options] [packages]
- .SH "DESCRIPTION"
- .sp
- -Packer is a bash wrapper for pacman and the AUR\&. It was designed to be a simple and very fast replacement for the basic functionality of yaourt\&. It allows you to install, update, search, and show information for any package in the main repositories and in the AUR\&. For other commands, such as removing packages, use pacman\&.
- +Packer is a bash wrapper for pacman and the PUR\&. It was designed to be a simple and very fast replacement for the basic functionality of yaourt\&. It allows you to install, update, search, and show information for any package in the main repositories and in the PUR\&. For other commands, such as removing packages, use pacman\&.
- .SH "OPERATIONS"
- .PP
- \fB\-Ss\fR
- @@ -50,7 +50,7 @@
- .PP
- \fB\-G\fR
- .RS 4
- -Download and extract AUR package tarballs, but don\(cqt install anything\&.
- +Download and extract PUR package tarballs, but don\(cqt install anything\&.
- .RE
- .PP
- \fB\-h\fR
- @@ -79,9 +79,9 @@
- Check for updates and exit\&.
- .RE
- .PP
- -\fB\-\-auronly\fR
- +\fB\-\-puronly\fR
- .RS 4
- -Only perform commands for the AUR\&.
- +Only perform commands for the PUR\&.
- .RE
- .PP
- \fB\-\-devel\fR
- @@ -91,7 +91,7 @@
- .PP
- \fB\-\-skipinteg\fR
- .RS 4
- -Skip the integrity check by ignoring AUR package MD5 sums\&.
- +Skip the integrity check by ignoring PUR package MD5 sums\&.
- .RE
- .PP
- \fB\-\-preview\fR
- @@ -123,8 +123,8 @@
- .sp -1
- .IP \(bu 2.3
- .\}
- -Update only AUR packages:
- -packer \-Syu \-\-auronly
- +Update only PUR packages:
- +packer \-Syu \-\-puronly
- .RE
- .sp
- .RS 4