summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid P <megver83@parabola.nu>2018-05-16 15:01:05 -0400
committerDavid P <megver83@parabola.nu>2018-05-16 15:01:05 -0400
commitc226400096eb5ed87a7a5da47478ef616d3b5079 (patch)
tree689f99f9ead7946689550b2196042f3af92f05ea
parentcdb8acc41529f032de72dbafb3edc9f28903e53f (diff)
add find-deprecated-pkgs script
Signed-off-by: David P <megver83@parabola.nu>
-rw-r--r--.gitignore1
-rwxr-xr-xfind-deprecated-pkgs108
2 files changed, 109 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index 2a7bcad..1acfe1f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,6 +5,7 @@
!check.sh
!COPYING
!find-replacements
+!find-deprecated-pkgs
!README
!SYNTAX
!your-freedom_emu-blacklist.txt
diff --git a/find-deprecated-pkgs b/find-deprecated-pkgs
new file mode 100755
index 0000000..c2e599c
--- /dev/null
+++ b/find-deprecated-pkgs
@@ -0,0 +1,108 @@
+#!/bin/bash
+# Copyright (C) 2018 David P. <megver83@parabola.nu>
+# Find deprecated Arch packages that are still in our blacklists.
+
+set -e
+
+# Repositories for specific arch'es.
+# Common repos are in 'repos' variable.
+repos="core extra community"
+repos_x86_64="$repos testing multilib multilib-testing"
+repos_i686="$repos testing build-support"
+repos_armv7h="$repos alarm"
+
+# Parabola repos for checking blacklists like your-privacy,
+# which sometimes block [libre] and [pcr] packages.
+# [nonprism] and [nonsystemd] are not listened because
+# we do not blacklists those packages
+repos_parabola="pcr pcr-multilib pcr-multilib-testing pcr-testing libre libre-multilib libre-multilib-testing libre-testing"
+
+# Set the blacklist files
+# aur-blacklist.txt is not here since we want to check Arch's official repos
+blacklists="blacklist.txt"
+
+# List here file that may also blacklist Parabola packages
+blacklists_parabola="your-initfreedom-blacklist.txt your-privacy-blacklist.txt your-freedom_emu-blacklist.txt"
+
+# Mirrors. Please choose HTTPS over HTTP when possible
+# x86_64 mirror
+for r in $repos_x86_64; do
+ mirrors+=(https://mirrors.edge.kernel.org/archlinux/$r/os/x86_64/)
+done
+# i686 mirror
+for r in $repos_i686; do
+ mirrors+=(https://mirror.archlinux32.org/i686/$r/)
+done
+# armv7h mirror
+for r in $repos_armv7h; do
+ mirrors+=(https://fl.us.mirror.archlinuxarm.org/armv7h/$r/)
+done
+
+# Parabola mirrors, used to check [libre] and [pcr] packages
+if [ $1 = parabola ]; then
+for r in $repos_parabola; do
+ mirrors+=(https://mirror.grapentin.org/parabola/$r/os/x86_64/)
+ mirrors+=(https://mirror.grapentin.org/parabola/$r/os/i686/)
+ mirrors+=(https://mirror.grapentin.org/parabola/$r/os/armv7h/)
+done
+fi
+
+# Sed expresion tested on Nginx, change if needed
+sedexp='s/.*href="//;s/\-any.pkg.tar.xz.*//;s/\-x86_64.pkg.tar.xz.*//;s/\-i686.pkg.tar.xz.*//;s/\-armv7h.pkg.tar.xz.*//'
+# extra sedexps for symbols
+sedexp+=';s/%2B/+/g;s/%3A/:/g;s/%40/@/g'
+
+usage() {
+cat <<EOM
+Usage: ${0##*/} [arch|parabola]
+Check if there are inexistent packages in the blacklists.
+
+Arguments:
+ arch Compares ArchLinux{32,ARM} blacklists
+ with their repositories
+ parabola Compares Arch/Parabola blacklists (e.g.
+ your-privacy) with Parabola's and Arch's
+ repos
+
+The 'parabola' argument compares with our repositories and Arch's
+since in blacklists like your-privacy and your-initfreedom we also block
+some packages from [pcr] (like jitsi) and [libre] (like icedove), and
+probably also from their -multilib, -testing and -multilib-testing derivatives.
+
+This program only takes one argument, meaning that (for example) if you run
+\`${0##*/} parabola arch' only 'parabola' is considered
+EOM
+}
+
+mkpkglist() {
+ parabola_pkgs=$(mktemp)
+ arch_pkgs=$(mktemp)
+ case $1 in
+ parabola) curl -s ${mirrors[@]} | grep '".*.pkg.tar.xz"' | sed $sedexp > $parabola_pkgs
+ ;;
+ arch) curl -s ${mirrors[@]} | grep '".*.pkg.tar.xz"' | sed $sedexp > $arch_pkgs
+ ;;
+ esac
+}
+
+check(){
+ mkpkglist $1
+ case $1 in
+ parabola) pkgs=$(cut -d ":" -f 1 $blacklists_parabola | grep -v ^#)
+ for p in $pkgs; do
+ grep ^$p $parabola_pkgs &> /dev/null || printf '%s was not found\n' "$p"
+ done
+ ;;
+ arch) pkgs=$(cut -d ":" -f 1 $blacklists | grep -v ^#)
+ for p in $pkgs; do
+ grep ^$p $arch_pkgs &> /dev/null || printf '%s was not found\n' "$p"
+ done
+ ;;
+ esac
+}
+
+if [ -s $1 ]; then
+ usage
+else
+ check $1
+fi