[arch-projects] [dbscripts] checkpkg, find-libdeps, finddeps, lddd: Use libremessages to add help text

2018-08-26 Thread Luke Shumaker
From: Luke Shumaker 

---
On Sat, 25 Aug 2018 07:14:34 -0400,
Jelle van der Waa wrote:
> This patch series intends to be an RFC for adding man pages for every
> tool provided by devtools. The first man page for lddd is written in
> mdoc and is lacking a way to reduce duplication of common headers such
> as BUGS/AUTHORS.

I've written more detailed usage-text for several of the commands.  I
haven't submitted it upstream to you before; because you don't have
the `print`, `prose`, and `flag` localization & formatting functions
that I used.

However, feel free to steal some of the language I used :)

 checkpkg.in | 27 +--
 find-libdeps.in | 28 
 finddeps.in | 18 --
 lddd.in | 18 +-
 4 files changed, 78 insertions(+), 13 deletions(-)

diff --git a/checkpkg.in b/checkpkg.in
index e0e1f83..cfec71e 100644
--- a/checkpkg.in
+++ b/checkpkg.in
@@ -3,7 +3,28 @@
 
 shopt -s extglob
 
-m4_include(lib/common.sh)
+. "$(librelib messages)"
+
+usage() {
+   print 'Usage: %s [-h]' "${0##*/}"
+   print 'Compare a locally built a package with the one in the 
repositories.'
+   echo
+   prose 'This should be run from a directory containing a
+  PKGBUILD.  It searches for a locally built package
+  corresponding to the PKGBUILD, and downloads the last
+  version of that package from the pacman repositories.
+  It then compares the list of .so files provided by each
+  version of the package.  It does this for each part of
+  a split package.'
+}
+
+if [[ $1 = '-h' ]]; then
+   usage
+   exit 0
+elif [[ $# -gt 0 ]]; then
+   usage >&2
+   exit 1
+fi
 
 # Source makepkg.conf; fail if it is not found
 if [[ -r '/etc/makepkg.conf' ]]; then
@@ -23,7 +44,9 @@ elif [[ -r "$HOME/.makepkg.conf" ]]; then
 fi
 
 if [[ ! -f PKGBUILD ]]; then
-   die 'This must be run in the directory of a built package.'
+   error 'This must be run in the directory of a built package.'
+   usage >&2
+   exit 1
 fi
 
 # shellcheck source=PKGBUILD.proto
diff --git a/find-libdeps.in b/find-libdeps.in
index 1fb1fdf..cb68237 100644
--- a/find-libdeps.in
+++ b/find-libdeps.in
@@ -1,7 +1,7 @@
 #!/bin/bash
 # License: Unspecified
 
-m4_include(lib/common.sh)
+. "$(librelib messages)"
 
 set -e
 shopt -s extglob
@@ -20,12 +20,32 @@ case $script_mode in
*) die "Unknown mode %s" "$script_mode" ;;
 esac
 
+usage() {
+   print "Usage: find-lib(deps|provides) [options] "
+   print "Find library dependencies or provides of a package."
+   echo
+   prose 'Prints a list of library dependencies in the format:'
+   echo
+   print '=-'
+   echo
+   prose "Where  is the shared library version, or
+  repeated if there is no version attached; and
+  is the architecture of the library (either \`32\`
+ or \`64\`, based on the ELF Class)."
+   echo
+   print "Options:"
+   flag "--ignore-internal" "Ignore internal libraries; libraries
+ without a version attached"
+   flag "-h""Show this message"
+}
 if [[ -z $1 ]]; then
-   echo "${0##*/} [options] "
-   echo "Options:"
-   echo "--ignore-internal  ignore internal libraries"
+   usage >&2
exit 1
 fi
+if [[ $1 = '-h' ]]; then
+   usage
+   exit 0
+fi
 
 if [[ -d $1 ]]; then
pushd "$1" >/dev/null
diff --git a/finddeps.in b/finddeps.in
index 2a085e5..5f89b55 100644
--- a/finddeps.in
+++ b/finddeps.in
@@ -4,18 +4,24 @@
 #
 # License: Unspecified
 
-m4_include(lib/common.sh)
+. "$(librelib messages)"
 
 match=$1
 
+usage() {
+   print 'Usage: %s ' "${0##*/}"
+   print 'Find packages that depend on a given depname.'
+   echo
+   prose 'Run this script from the top-level directory of your ABS tree.'
+}
 if [[ -z $match ]]; then
-   echo 'Usage: finddeps '
-   echo ''
-   echo 'Find packages that depend on a given depname.'
-   echo 'Run this script from the top-level directory of your ABS tree.'
-   echo ''
+   usage >&2
exit 1
 fi
+if [[ $match = '-h' ]]; then
+   usage
+   exit 0
+fi
 
 find . -type d | while read -r d; do
if [[ -f "$d/PKGBUILD" ]]; then
diff --git a/lddd.in b/lddd.in
index 908923b..4c6871c 100644
--- a/lddd.in
+++ b/lddd.in
@@ -4,7 +4,23 @@
 #
 # License: Unspecified
 
-m4_include(lib/common.sh)
+. "$(librelib messages)"
+
+usage() {
+   print "Usage: %s [-h]" "${0##*/}"
+   print "Find broken library links on your machine."
+   echo
+   prose "Scans \$PATH and library directories for ELF files with
+  references to missing shared libraries."
+}
+
+if [[ $1 = '-h' ]]; then
+   usage
+   exit 0
+elif [[ $# -gt 0 ]]; then
+   usage >&2
+   exit 1
+fi
 
 ifs=$IFS
 IFS="${IFS}:"
-- 
Happy hacking,
~ Luke 

[arch-projects] [dbscripts] [GIT] Official repo DB scripts branch master updated. 20180603-1-gc53352c

2018-08-26 Thread Eli Schwartz via arch-projects
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Official repo DB scripts".

The branch, master has been updated
   via  c53352c103e023727ce31e98ca9647bb918a9a5d (commit)
  from  08995618eb606523b7d05ac987b1243981290839 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -
commit c53352c103e023727ce31e98ca9647bb918a9a5d
Author: Jelle van der Waa 
Date:   Sun Aug 26 14:52:59 2018 +0200

cron-jobs: remove unused cron jobs

Updating the archweb database is now handled by archweb itself and
deployed on the server using a systemd unit/service. These scripts are
no longer used.

Signed-off-by: Jelle van der Waa 

---

Summary of changes:
 README.md |  6 +---
 cron-jobs/update-web-db   | 78 ---
 cron-jobs/update-web-files-db |  1 -
 3 files changed, 1 insertion(+), 84 deletions(-)
 delete mode 100755 cron-jobs/update-web-db
 delete mode 12 cron-jobs/update-web-files-db


hooks/post-receive
-- 
Official repo DB scripts


[arch-projects] [dbscripts] [PATCH] cron-jobs: remove unused cron jobs

2018-08-26 Thread Jelle van der Waa
Updating the archweb database is now handled by archweb itself and
deployed on the server using a systemd unit/service. These scripts are
no longer used.

Signed-off-by: Jelle van der Waa 
---
 README.md |  6 +--
 cron-jobs/update-web-db   | 78 ---
 cron-jobs/update-web-files-db |  1 -
 3 files changed, 1 insertion(+), 84 deletions(-)
 delete mode 100755 cron-jobs/update-web-db
 delete mode 12 cron-jobs/update-web-files-db

diff --git a/README.md b/README.md
index c672998..925cca7 100644
--- a/README.md
+++ b/README.md
@@ -11,9 +11,7 @@ The executables that you (might) care about are:
 │   ├── devlist-mailer
 │   ├── ftpdir-cleanup
 │   ├── integrity-check
-│   ├── sourceballs
-│   ├── update-web-db
-│   └── update-web-files-db
+│   └── sourceballs
 ├── db-move
 ├── db-remove
 ├── db-repo-add
@@ -56,8 +54,6 @@ Things that haven't been mentioned yet:
 
  - `cron-jobs/devlist-mailer`
  - `cron-jobs/sourceballs`
- - `cron-jobs/update-web-db`
- - `cron-jobs/update-web-files-db`
 ## Testing
 * Install the `make` and `docker` packages. Start the docker daemon by issuing 
`systemctl start docker`.
 * The test suite can now be run with `make test`.
diff --git a/cron-jobs/update-web-db b/cron-jobs/update-web-db
deleted file mode 100755
index 39ed765..000
--- a/cron-jobs/update-web-db
+++ /dev/null
@@ -1,78 +0,0 @@
-#!/bin/bash
-
-. "$(dirname "$(readlink -e "$0")")/../config"
-. "$(dirname "$(readlink -e "$0")")/../db-functions"
-
-# setup paths
-SPATH="/srv/http/archweb"
-ENVPATH="/srv/http/archweb-env/bin/activate"
-
-# having "more important repos" last should make [core] trickle to the top of
-# the updates list each hour rather than being overwhelmed by big [extra] and
-# [community] updates
-REPOS=('community-testing' 'multilib-testing' 'multilib' 'community' 'extra' 
'testing' 'core')
-LOGOUT="/tmp/archweb_update.log"
-
-# figure out what operation to perform
-cmd="${0##*/}"
-if [[ $cmd != "update-web-db" && $cmd != "update-web-files-db" ]]; then
-   die "Invalid command name '%s' specified!" "$cmd"
-fi
-
-script_lock
-
-# run at nice 5. it can churn quite a bit of cpu after all.
-renice +5 -p $$ > /dev/null
-
-echo "%s: Updating DB at %s" "$cmd" "$(date)" >> "${LOGOUT}"
-
-# source our virtualenv if it exists
-if [[ -f "$ENVPATH" ]]; then
-   . "$ENVPATH"
-fi
-
-case "$cmd" in
-   update-web-db)
-   dbfileext="${DBEXT}"
-   flags=""
-   ;;
-   update-web-files-db)
-   dbfileext="${FILESEXT}"
-   flags="--filesonly"
-   ;;
-esac
-
-# Lock the repos and get a copy of the db files to work on
-for repo in "${REPOS[@]}"; do
-   for arch in "${ARCHES[@]}"; do
-   repo_lock "${repo}" "${arch}" || exit 1
-   dbfile="/srv/ftp/${repo}/os/${arch}/${repo}${dbfileext}"
-   if [[ -f ${dbfile} ]]; then
-   mkdir -p "${WORKDIR}/${repo}/${arch}"
-   cp "${dbfile}" 
"${WORKDIR}/${repo}/${arch}/${repo}${dbfileext}"
-   fi
-   repo_unlock "${repo}" "${arch}"
-   done
-done
-
-# Run reporead on our db copy
-pushd "$SPATH" >/dev/null
-for repo in "${REPOS[@]}"; do
-   for arch in "${ARCHES[@]}"; do
-   dbcopy="${WORKDIR}/${repo}/${arch}/${repo}${dbfileext}"
-   if [[ -f ${dbcopy} ]]; then
-   echo "Updating ${repo}-${arch}" >> "${LOGOUT}"
-   ./manage.py reporead "${flags}" "${arch}" "${dbcopy}" 
>> "${LOGOUT}" 2>&1
-   echo "" >> "${LOGOUT}"
-   fi
-   done
-done
-popd >/dev/null
-echo "" >> "${LOGOUT}"
-
-# rotate the file if it is getting big (> 10M), overwriting any old backup
-if [[ $(stat -c%s "${LOGOUT}") -gt 10485760 ]]; then
-   mv "${LOGOUT}" "${LOGOUT}.old"
-fi
-
-script_unlock
diff --git a/cron-jobs/update-web-files-db b/cron-jobs/update-web-files-db
deleted file mode 12
index 0c2c4fa..000
--- a/cron-jobs/update-web-files-db
+++ /dev/null
@@ -1 +0,0 @@
-update-web-db
\ No newline at end of file
-- 
2.18.0