Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-04-03 14:50:41 +0200
committerErich Eckner <git@eckner.net>2018-04-03 14:50:41 +0200
commit9a46844693909ac5c82298d98ec81a75304e1e5a (patch)
tree00f6adb2c3a0b7c84d44f904e32ee231183a4ed2
parent23f88d71aba0052357641e5704cd3d19a59f07c1 (diff)
substitute bin/wtf by pkgfile
-rw-r--r--README.md3
-rwxr-xr-xbin/ii-connect7
-rwxr-xr-xbin/wtf59
-rw-r--r--conf/pkgfile.pacman32.conf37
4 files changed, 42 insertions, 64 deletions
diff --git a/README.md b/README.md
index d2dbfd2..1c1b211 100644
--- a/README.md
+++ b/README.md
@@ -14,7 +14,8 @@ This includes scripts to be run on the build master as well as scripts to be run
* some mysql-server
* `nginx` or equivalent
* `php-gd`
-* `php-fpm` or quivalent
+* `php-fpm` or equivalent
+* `pkgfile`
* `rsync`
* `screen`
* some ssh-server
diff --git a/bin/ii-connect b/bin/ii-connect
index 7ac589c..bb775a9 100755
--- a/bin/ii-connect
+++ b/bin/ii-connect
@@ -94,10 +94,9 @@ if [ "$1" = 'watch' ]; then
p
' "${out_file}" | \
while read -r line; do
- reason=$(
- echo "${line}" | \
- xargs "${base_dir}/bin/wtf" 2>&1
- )
+ if ! reason=$(pkgfile "${line}"); then
+ reason="Huh, I don't know that one."
+ fi
if [ "$(echo "${reason}" | wc -l)" -le 5 ]; then
echo "${reason}"
else
diff --git a/bin/wtf b/bin/wtf
deleted file mode 100755
index 4c03103..0000000
--- a/bin/wtf
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/bin/sh
-
-# usage: wtf $file
-
-# Find out what package provides the given file.
-# $file may be a single file name or an absolute path.
-
-# shellcheck source=../conf/default.conf
-. "${0%/*}/../conf/default.conf"
-
-hash=$(
- printf '%d' "0x$(
- printf '%s' "$*" | \
- sed '
- s,/$,,
- s,.*/,,
- ' | \
- sha224sum | \
- awk '{print $1}' | \
- cut -c 1-4
- )"
-)
-
-partition=$((hash % mysql_files_table_partitions))
-
-result=$(
- # shellcheck disable=SC2016
- {
- printf 'SELECT DISTINCT CONCAT(`repositories`.`name`,"/",'
- mysql_package_name_query
- printf ')'
- printf ' FROM `binary_packages`'
- mysql_join_binary_packages_architectures
- mysql_join_binary_packages_repositories
- printf ' JOIN `file_providers` PARTITION (p%s) ON `file_providers`.`package`=`binary_packages`.`id`' \
- "${partition}"
- printf ' JOIN `files` PARTITION (p%s) ON `files`.`id`=`file_providers`.`file` AND `files`.`name_hash`=`file_providers`.`file_name_hash`' \
- "${partition}"
- printf ' WHERE `files`.`name_hash`=%s' \
- "${hash}"
- printf ' AND (`files`.`name`=from_base64("%s")' \
- "$(
- printf '%s' "$*" | \
- base64 -w0
- )"
- printf ' OR CONCAT(`files`.`path`,`files`.`name`)=from_base64("%s"))' \
- "$(
- printf '%s' "$*" | \
- base64 -w0
- )"
- } | \
- mysql_run_query
-)
-
-if [ -z "${result}" ]; then
- printf 'Huh, I don'"'"'t know that one.\n'
-else
- printf '%s\n' "${result}"
-fi
diff --git a/conf/pkgfile.pacman32.conf b/conf/pkgfile.pacman32.conf
new file mode 100644
index 0000000..cb73152
--- /dev/null
+++ b/conf/pkgfile.pacman32.conf
@@ -0,0 +1,37 @@
+# pacman.conf for pkgfile to search through i686 repositories
+
+[staging]
+Server = https://mirror.archlinux32.org/i686/$repo
+
+[community-staging]
+Server = https://mirror.archlinux32.org/i686/$repo
+
+[testing]
+Server = https://mirror.archlinux32.org/i686/$repo
+
+[community-testing]
+Server = https://mirror.archlinux32.org/i686/$repo
+
+[core]
+Server = https://mirror.archlinux32.org/i686/$repo
+
+[extra]
+Server = https://mirror.archlinux32.org/i686/$repo
+
+[community]
+Server = https://mirror.archlinux32.org/i686/$repo
+
+# If you want to run 32 bit applications on your x86_64 system,
+# enable the multilib repositories as required here.
+
+#[multilib-testing]
+#Include = /etc/pacman.d/mirrorlist
+
+#[multilib]
+#Include = /etc/pacman.d/mirrorlist
+
+# An example of a custom package repository. See the pacman manpage for
+# tips on creating your own repositories.
+#[custom]
+#SigLevel = Optional TrustAll
+#Server = file:///home/custompkgs