From 0c99eabd50752310f42ec808c8734a338122ec86 Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Sun, 9 Oct 2016 22:52:27 +1000 Subject: Remove contrib The contrib directory takes too much of the pacman developer's limited time, which could be better spent developing and reviewing patches for the primary projects. The community can pick this up in a separate repository if wanted. Signed-off-by: Allan McRae --- Makefile.am | 2 +- configure.ac | 2 - contrib/.gitignore | 12 - contrib/Makefile.am | 95 -------- contrib/PKGBUILD.vim | 320 -------------------------- contrib/README | 41 ---- contrib/bacman.sh.in | 391 -------------------------------- contrib/checkupdates.sh.in | 59 ----- contrib/doc/.gitignore | 2 - contrib/doc/Makefile.am | 60 ----- contrib/doc/asciidoc.conf | 1 - contrib/doc/bacman.8.txt | 67 ------ contrib/doc/footer.txt | 1 - contrib/doc/verify-pacman-repo-db.1.txt | 60 ----- contrib/paccache.sh.in | 366 ------------------------------ contrib/pacdiff.sh.in | 194 ---------------- contrib/paclist.sh.in | 68 ------ contrib/paclog-pkglist.sh.in | 99 -------- contrib/pacscripts.sh.in | 140 ------------ contrib/pacsearch.in | 125 ---------- contrib/rankmirrors.sh.in | 234 ------------------- contrib/updpkgsums.sh.in | 115 ---------- contrib/verify-pacman-repo-db.pl | 259 --------------------- contrib/vimprojects | 25 -- 24 files changed, 1 insertion(+), 2737 deletions(-) delete mode 100644 contrib/.gitignore delete mode 100644 contrib/Makefile.am delete mode 100644 contrib/PKGBUILD.vim delete mode 100644 contrib/README delete mode 100644 contrib/bacman.sh.in delete mode 100644 contrib/checkupdates.sh.in delete mode 100644 contrib/doc/.gitignore delete mode 100644 contrib/doc/Makefile.am delete mode 120000 contrib/doc/asciidoc.conf delete mode 100644 contrib/doc/bacman.8.txt delete mode 120000 contrib/doc/footer.txt delete mode 100644 contrib/doc/verify-pacman-repo-db.1.txt delete mode 100644 contrib/paccache.sh.in delete mode 100644 contrib/pacdiff.sh.in delete mode 100644 contrib/paclist.sh.in delete mode 100644 contrib/paclog-pkglist.sh.in delete mode 100644 contrib/pacscripts.sh.in delete mode 100644 contrib/pacsearch.in delete mode 100644 contrib/rankmirrors.sh.in delete mode 100644 contrib/updpkgsums.sh.in delete mode 100755 contrib/verify-pacman-repo-db.pl delete mode 100644 contrib/vimprojects diff --git a/Makefile.am b/Makefile.am index a676878e..f4ff187b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,7 +3,7 @@ if WANT_DOC SUBDIRS += doc endif -DIST_SUBDIRS = $(SUBDIRS) contrib src/common +DIST_SUBDIRS = $(SUBDIRS) src/common ACLOCAL_AMFLAGS = -I m4 --install AM_MAKEFLAGS = --no-print-directory diff --git a/configure.ac b/configure.ac index ae017d1d..f6b87e5a 100644 --- a/configure.ac +++ b/configure.ac @@ -523,8 +523,6 @@ test/pacman/Makefile test/pacman/tests/Makefile test/scripts/Makefile test/util/Makefile -contrib/Makefile -contrib/doc/Makefile Makefile ]) AC_OUTPUT diff --git a/contrib/.gitignore b/contrib/.gitignore deleted file mode 100644 index 8a32b419..00000000 --- a/contrib/.gitignore +++ /dev/null @@ -1,12 +0,0 @@ -bacman -bash_completion -checkupdates -paccache -pacdiff -paclist -paclog-pkglist -pacscripts -pacsearch -rankmirrors -updpkgsums -zsh_completion diff --git a/contrib/Makefile.am b/contrib/Makefile.am deleted file mode 100644 index 73df92ed..00000000 --- a/contrib/Makefile.am +++ /dev/null @@ -1,95 +0,0 @@ -# enforce that all scripts have a --help and --version option -AUTOMAKE_OPTIONS = std-options -SUBDIRS= -if WANT_DOC -SUBDIRS += doc -endif - -DIST_SUBDIRS = $(SUBDIRS) - -bin_SCRIPTS = \ - $(OURSCRIPTS) - -BASHSCRIPTS = \ - bacman \ - checkupdates \ - paccache \ - pacdiff \ - paclist \ - paclog-pkglist \ - pacscripts \ - rankmirrors \ - updpkgsums - -OTHERSCRIPTS = \ - pacsearch - -OURSCRIPTS = \ - $(BASHSCRIPTS) \ - $(OTHERSCRIPTS) - -EXTRA_DIST = \ - PKGBUILD.vim \ - bacman.sh.in \ - checkupdates.sh.in \ - paccache.sh.in \ - paclog-pkglist.sh.in \ - pacdiff.sh.in \ - paclist.sh.in \ - pacscripts.sh.in \ - pacsearch.in \ - rankmirrors.sh.in \ - updpkgsums.sh.in \ - vimprojects \ - README - -# Files that should be removed, but which Automake does not know. -MOSTLYCLEANFILES = $(OURSCRIPTS) *.tmp - -if USE_GIT_VERSION -GIT_VERSION := $(shell sh -c 'git describe --abbrev=4 --dirty | sed s/^v//') -REAL_PACKAGE_VERSION = $(GIT_VERSION) -else -REAL_PACKAGE_VERSION = $(PACKAGE_VERSION) -endif - -edit = sed \ - -e 's|@sysconfdir[@]|$(sysconfdir)|g' \ - -e 's|@localstatedir[@]|$(localstatedir)|g' \ - -e 's|@PACKAGE_VERSION[@]|$(REAL_PACKAGE_VERSION)|g' \ - -e 's|@SIZECMD[@]|$(SIZECMD)|g' \ - -e 's|@SCRIPTNAME[@]|$@|g' \ - -e '1s|!/bin/bash|!$(BASH_SHELL)|g' - -$(OTHERSCRIPTS): Makefile - $(AM_V_at)$(RM) $@ $@.tmp - $(AM_V_GEN)$(edit) $(srcdir)/$@.in >$@.tmp - $(AM_V_at)chmod +x,a-w $@.tmp - $(AM_V_at)mv $@.tmp $@ - -$(BASHSCRIPTS): Makefile - $(AM_V_at)$(RM) $@ - $(AM_V_GEN)test -f $(srcdir)/$@.sh.in && m4 -P -I $(srcdir) $(srcdir)/$@.sh.in | $(edit) >$@ - $(AM_V_at)chmod +x,a-w $@ - @$(BASH_SHELL) -O extglob -n $@ - -$(OURFILES): Makefile - $(AM_V_at)$(RM) $@ $@.tmp - $(AM_V_GEN)$(edit) $(srcdir)/$@.in >$@.tmp - $(AM_V_at)chmod a-w $@.tmp - $(AM_V_at)mv $@.tmp $@ - -all-am: $(OURSCRIPTS) - -bacman: $(srcdir)/bacman.sh.in -checkupdates: $(srcdir)/checkupdates.sh.in -paccache: $(srcdir)/paccache.sh.in $(top_srcdir)/scripts/library/parseopts.sh $(top_srcdir)/scripts/library/size_to_human.sh -pacdiff: $(srcdir)/pacdiff.sh.in -paclist: $(srcdir)/paclist.sh.in -paclog-pkglist: $(srcdir)/paclog-pkglist.sh.in -pacscripts: $(srcdir)/pacscripts.sh.in -pacsearch: $(srcdir)/pacsearch.in -rankmirrors: $(srcdir)/rankmirrors.sh.in -updpkgsums: $(srcdir)/updpkgsums.sh.in - -# vim:set noet: diff --git a/contrib/PKGBUILD.vim b/contrib/PKGBUILD.vim deleted file mode 100644 index 110bbc71..00000000 --- a/contrib/PKGBUILD.vim +++ /dev/null @@ -1,320 +0,0 @@ -" Vim syntax file -" Language: PKGBUILD -" Maintainer: Alessio 'mOLOk' Bolognino -" Last Change: 2007/05/08 -" Version Info: PKGBUILD-0.2 (colorphobic) - -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") - finish -endif - -let b:main_syntax = "sh" -let b:is_bash = 1 -runtime! syntax/sh.vim - -" case on -syn case match - -" pkgname -" FIXME if '=' is in pkgname/pkgver, it highlights whole string, not just '=' -syn keyword pb_k_pkgname pkgname contained -syn match pbValidPkgname /\([[:alnum:]]\|+\|-\|_\){,32}/ contained contains=pbIllegalPkgname -syn match pbIllegalPkgname /[[:upper:]]\|[^[:alnum:]-+_=]\|=.*=\|=['"]\?.\{33,\}['"]\?/ contained -syn match pbPkgnameGroup /^pkgname=.*/ contains=pbIllegalPkgname,pb_k_pkgname,shDoubleQuote,shSingleQuote - -" pkgbase -" FIXME if '=' is in pkgbase/pkgname/pkgver, it highlights whole string, not just '=' -syn keyword pb_k_pkgbase pkgbase contained -syn match pbValidPkgbase /\([[:alnum:]]\|+\|-\|_\){,32}/ contained contains=pbIllegalPkgbase -syn match pbIllegalPkgbase /[[:upper:]]\|[^[:alnum:]-+_=]\|=.*=\|=['"]\?.\{33,\}['"]\?/ contained -syn match pbPkgbaseGroup /^pkgbase=.*/ contains=pbIllegalPkgbase,pb_k_pkgbase,shDoubleQuote,shSingleQuote - -" pkgver -syn keyword pb_k_pkgver pkgver contained -syn match pbValidPkgver /\([[:alnum:]]\|\.\|+\|_\)/ contained contains=pbIllegalPkgver -syn match pbIllegalPkgver /[^[:alnum:]+=\.\_]\|=.*=/ contained -syn match pbPkgverGroup /^pkgver=.*/ contains=pbIllegalPkgver,pbValidPkgver,pb_k_pkgver,shDoubleQuote,shSingleQuote - -" pkgrel -syn keyword pb_k_pkgrel pkgrel contained -syn match pbValidPkgrel /[[:digit:]]*/ contained contains=pbIllegalPkgrel -syn match pbIllegalPkgrel /[^[:digit:]=]\|=.*=/ contained -syn match pbPkgrelGroup /^pkgrel=.*/ contains=pbIllegalPkgrel,pbValidPkgrel,pb_k_pkgrel,shDoubleQuote,shSingleQuote - -" pkgdesc -syn keyword pb_k_desc pkgdesc contained -" 90 chars: 80 for description, 8 for pkgdesc and 2 for '' -syn match pbIllegalPkgdesc /.\{90,}\|=['"]\?.*['" ]\+[iI][sS] [aA]/ contained contains=pbPkgdescSign -syn match pbValidPkgdesc /[^='"]\.\{,80}/ contained contains=pbIllegalPkgdesc -syn match pbPkgdescGroup /^pkgdesc=.*/ contains=pbIllegalPkgdesc,pb_k_desc,pbValidPkgdesc,shDoubleQuote,shSingleQuote -syn match pbPkgdescSign /[='"]/ contained - -" epoch -syn keyword pb_k_epoch epoch contained -syn match pbValidEpoch /[[:digit:]]*/ contained contains=pbIllegalEpoch -syn match pbIllegalEpoch /[^[:digit:]=]\|=.*=/ contained -syn match pbEpochGroup /^epoch=.*/ contains=pbIllegalEpoch,pbValidEpoch,pb_k_epoch,shDoubleQuote,shSingleQuote - -" url -syn keyword pb_k_url url contained -syn match pbValidUrl /['"]*\(https\|http\|ftp\)\:\/.*\.\+.*/ contained - -syn match pbIllegalUrl /[^=]/ contained contains=pbValidUrl -syn match pbUrlGroup /^url=.*/ contains=pbValidUrl,pb_k_url,pbIllegalUrl,shDoubleQuote,shSingleQuote - -" license -syn keyword pb_k_license license contained -" echo $(pacman -Ql licenses | grep '/usr/share/licenses/common/' | cut -d'/' -f6 | sort -u) -syn keyword pbLicense AGPL AGPL3 Apache APACHE Artistic2.0 CCPL CDDL CPL EPL FDL FDL1.2 FDL1.3 GPL GPL2 GPL3 LGPL LGPL2.1 LGPL3 LPPL MPL PerlArtistic PHP PSF RUBY W3C ZPL contained -" special cases from https://wiki.archlinux.org/index.php/Arch_Packaging_Standards -syn keyword pbLicenseSpecial BSD MIT ZLIB Python contained -syn match pbLicenseCustom /custom\(:[[:alnum:]]*\)*/ contained -syn match pbIllegalLicense /[^='"() ]/ contained contains=pbLicenseCustom,pbLicenseSpecial,pbLicense -syn region pbLicenseGroup start=/^license=(/ end=/)/ contains=pb_k_license,pbLicenseCustom,pbLicenseSpecial,pbLicense,pbIllegalLicense - -" backup -syn keyword pb_k_backup backup contained -syn match pbValidBackup /\.\?[[:alpha:]]*\/[[:alnum:]\{\}+._$-]*]*/ contained -syn region pbBackupGroup start=/^backup=(/ end=/)/ contains=pb_k_backup,pbValidBackup,shDoubleQuote,shSingleQuote - -" arch -syn keyword pb_k_arch arch contained -syn keyword pbArch i686 x86_64 ppc any contained -syn match pbIllegalArch /[^='"() ]/ contained contains=pbArch -syn region pbArchGroup start=/^arch=(/ end=/)/ contains=pb_k_arch,pbArch,pbIllegalArch - -" groups -syn keyword pb_k_groups groups contained -syn match pbValidGroups /\([[:alnum:]]\|+\|-\|_\)*/ contained -syn region pbGroupsGroup start=/^groups=(/ end=/)/ contains=pb_k_groups,pbValidGroups,shDoubleQuote,shSingleQuote - -" depends -syn keyword pb_k_depends depends contained -syn match pbValidDepends /\([[:alnum:]]\|+\|-\|_\)*/ contained -syn region pbDependsGroup start=/^depends=(/ end=/)/ contains=pb_k_depends,pbValidDepends,shDoubleQuote,shSingleQuote - -" makedepends -syn keyword pb_k_makedepends makedepends contained -syn match pbValidMakedepends /\([[:alnum:]]\|+\|-\|_\)*/ contained -syn region pbMakedependsGroup start=/^makedepends=(/ end=/)/ contains=pb_k_makedepends,pbValidMakedepends,shDoubleQuote,shSingleQuote - -" optdepends -syn keyword pb_k_optdepends optdepends contained -syn match pbValidOptdepends /\([[:alnum:]]\|+\|-\|_\)*/ contained -syn region pbOptdependsGroup start=/^optdepends=(/ end=/)/ contains=pb_k_optdepends,pbValidOptdepends,shDoubleQuote,shSingleQuote - -" checkdepends -syn keyword pb_k_ckdepends checkdepends contained -syn match pbValidCkdepends /\([[:alnum:]]\|+\|-\|_\)*/ contained -syn region pbCkdependsGroup start=/^checkdepends=(/ end=/)/ contains=pb_k_ckdepends,pbValidCkdepends,shDoubleQuote,shSingleQuote - -" conflicts -syn keyword pb_k_conflicts conflicts contained -syn match pbValidConflicts /\([[:alnum:]]\|+\|-\|_\)*/ contained -syn region pbConflictsGroup start=/^conflicts=(/ end=/)/ contains=pb_k_conflicts,pbValidConflicts,shDoubleQuote,shSingleQuote - -" provides -syn keyword pb_k_provides provides contained -syn match pbValidProvides /\([[:alnum:]]\|+\|-\|_\)*/ contained -syn region pbProvidesGroup start=/^provides=(/ end=/)/ contains=pb_k_provides,pbValidProvides,shDoubleQuote,shSingleQuote - -" replaces -syn keyword pb_k_replaces replaces contained -syn match pbValidReplaces /\([[:alnum:]]\|+\|-\|_\)*/ contained -syn region pbReplacesGroup start=/^replaces=(/ end=/)/ contains=pb_k_replaces,pbValidReplaces,shDoubleQuote,shSingleQuote - -" install -" XXX remove install from bashStatement, fix strange bug -syn clear bashStatement -syn keyword bashStatement chmod clear complete du egrep expr fgrep find gnufind gnugrep grep less ls mkdir mv rm rmdir rpm sed sleep sort strip tail touch - -syn keyword pb_k_install install contained -syn match pbValidInstall /\([[:alnum:]]\|\$\|+\|-\|_\)*\.install/ contained -syn match pbIllegalInstall /[^=]/ contained contains=pbValidInstall -syn match pbInstallGroup /^install=.*/ contains=pb_k_install,pbValidInstall,pbIllegalInstall,shDeref,shDoubleQuote,shSingleQuote - -" changelog -syn keyword pb_k_changelog changelog contained -syn match pbValidChangelog /\([[:alnum:]]\|\$\|+\|-\|_\)*/ contained -syn match pbIllegalChangelog /[^=]/ contained contains=pbValidChangelog -syn match pbChangelogGroup /^changelog=.*/ contains=pb_k_changelog,pbValidChangelog,pbIllegalChangelog,shDeref,shDoubleQuote,shSingleQuote - -" source: -" XXX remove source from shStatement, fix strange bug -syn clear shStatement -syn keyword shStatement xxx wait getopts return autoload whence printf true popd nohup enable r trap readonly fc fg kill ulimit umask disown stop pushd read history logout times local exit test pwd time eval integer suspend dirs shopt hash false newgrp bg print jobs continue functions exec help cd break unalias chdir type shift builtin let bind - -syn keyword pb_k_source source contained -syn match pbIllegalSource /\(http\|ftp\|https\).*\.\+\(dl\|download.\?\)\.\(sourceforge\|sf\).net/ -syn region pbSourceGroup start=/^source=(/ end=/)/ contains=pb_k_source,pbIllegalSource,shNumber,shDoubleQuote,shSingleQuote,pbDerefEmulation -syn match pbDerefEmulation /\$[{]\?[[:alnum:]_]*[}]\?/ contained -hi def link pbDerefEmulation PreProc - -" md5sums -syn keyword pb_k_md5sums md5sums contained -syn match pbIllegalMd5sums /[^='"()\/ ]/ contained contains=pbValidMd5sums -syn match pbValidMd5sums /\x\{32\}/ contained -syn region pbMd5sumsGroup start=/^md5sums/ end=/)/ contains=pb_k_md5sums,pbMd5Quotes,pbMd5Hash,pbIllegalMd5sums keepend -syn match pbMd5Quotes /'.*'\|".*"/ contained contains=pbMd5Hash,pbIllegalMd5sums -syn match pbMd5Hash /\x\+/ contained contains=pbValidMd5sums -hi def link pbMd5Quotes Keyword -hi def link pbMd5Hash Error -hi def link pbValidMd5sums Number - -" sha1sums -syn keyword pb_k_sha1sums sha1sums contained -syn match pbIllegalSha1sums /[^='"()\/ ]/ contained contains=pbValidSha1sums -syn match pbValidSha1sums /\x\{40\}/ contained -syn region pbSha1sumsGroup start=/^sha1sums/ end=/)/ contains=pb_k_sha1sums,pbSha1Quotes,pbSha1Hash,pbIllegalSha1sums keepend -syn match pbSha1Quotes /'.*'\|".*"/ contained contains=pbSha1Hash,pbIllegalSha1sums -syn match pbSha1Hash /\x\+/ contained contains=pbValidSha1sums -hi def link pbSha1Quotes Keyword -hi def link pbSha1Hash Error -hi def link pbValidSha1sums Number - -" sha256sums -syn keyword pb_k_sha256sums sha256sums contained -syn match pbIllegalSha256sums /[^='"()\/ ]/ contained contains=pbValidSha256sums -syn match pbValidSha256sums /\x\{64\}/ contained -syn region pbSha256sumsGroup start=/^sha256sums/ end=/)/ contains=pb_k_sha256sums,pbSha256Quotes,pbSha256Hash,pbIllegalSha256sums keepend -syn match pbSha256Quotes /'.*'\|".*"/ contained contains=pbSha256Hash,pbIllegalSha256sums -syn match pbSha256Hash /\x\+/ contained contains=pbValidSha256sums -hi def link pbSha256Quotes Keyword -hi def link pbSha256Hash Error -hi def link pbValidSha256sums Number - -" sha384sums -syn keyword pb_k_sha384sums sha384sums contained -syn match pbIllegalSha384sums /[^='"()\/ ]/ contained contains=pbValidSha384sums -syn match pbValidSha384sums /\x\{96\}/ contained -syn region pbSha384sumsGroup start=/^sha384sums/ end=/)/ contains=pb_k_sha384sums,pbSha384Quotes,pbSha384Hash,pbIllegalSha384sums keepend -syn match pbSha384Quotes /'.*'\|".*"/ contained contains=pbSha384Hash,pbIllegalSha384sums -syn match pbSha384Hash /\x\+/ contained contains=pbValidSha384sums -hi def link pbSha384Quotes Keyword -hi def link pbSha384Hash Error -hi def link pbValidSha384sums Number - -" sha512sums -syn keyword pb_k_sha512sums sha512sums contained -syn match pbIllegalSha512sums /[^='"()\/ ]/ contained contains=pbValidSha512sums -syn match pbValidSha512sums /\x\{128\}/ contained -syn region pbSha512sumsGroup start=/^sha512sums/ end=/)/ contains=pb_k_sha512sums,pbSha512Quotes,pbSha512Hash,pbIllegalSha512sums keepend -syn match pbSha512Quotes /'.*'\|".*"/ contained contains=pbSha512Hash,pbIllegalSha512sums -syn match pbSha512Hash /\x\+/ contained contains=pbValidSha512sums -hi def link pbSha512Quotes Keyword -hi def link pbSha512Hash Error -hi def link pbValidSha512sums Number - -" options -syn keyword pb_k_options options contained -syn match pbOptions /\(no\)\?\(strip\|docs\|libtool\|emptydirs\|zipman\|purge\|distcc\|color\|ccache\|check\|sign\|makeflags\|buildflags\)/ contained -syn match pbOptionsNeg /\!/ contained -syn match pbOptionsDeprec /no/ contained -syn region pbOptionsGroup start=/^options=(/ end=/)/ contains=pb_k_options,pbOptions,pbOptionsNeg,pbOptionsDeprec,pbIllegalOption -syn match pbIllegalOption /[^!"'()= ]/ contained contains=pbOptionsDeprec,pbOptions - -" noextract -syn match pbNoextract /[[:alnum:]+._${}-]\+/ contained -syn keyword pb_k_noextract noextract contained -syn region pbNoextractGroup start=/^noextract=(/ end=/)/ contains=pb_k_noextract,pbNoextract,shDoubleQuote,shSingleQuote - -" comments -syn keyword pb_k_maintainer Maintainer Contributor contained -syn match pbMaintainerGroup /Maintainer.*/ contains=pbMaintainer contained - -syn match pbDate /[0-9]\{4}\/[0-9]\{2}\/[0-9]\{2}/ contained - -syn cluster pbCommentGroup contains=pbTodo,pb_k_maintainer,pbMaintainerGroup,pbDate -syn keyword pbTodo contained COMBAK FIXME TODO XXX -syn match pbComment "^#.*$" contains=@pbCommentGroup -syn match pbComment "[^0-9]#.*$" contains=@pbCommentGroup - -" quotes are handled by sh.vim - -hi def link pbComment Comment -hi def link pbTodo Todo - -hi def link pbIllegalPkgname Error -hi def link pb_k_pkgname pbKeywords - -hi def link pbIllegalPkgbase Error -hi def link pb_k_pkgbase pbKeywords - -hi def link pbIllegalPkgver Error -hi def link pb_k_pkgver pbKeywords - -hi def link pbIllegalPkgrel Error -hi def link pb_k_pkgrel pbKeywords - -hi def link pbIllegalPkgdesc Error -hi def link pb_k_desc pbKeywords - -hi def link pbIllegalEpoch Error -hi def link pb_k_epoch pbKeywords - -hi def link pbIllegalUrl Error -hi def link pb_k_url pbKeywords - -hi def link pb_k_license pbKeywords -hi def link pbIllegalLicense Error - -hi def link pb_k_backup pbKeywords - -hi def link pb_k_arch pbKeywords -hi def link pbIllegalArch Error - -hi def link pb_k_groups pbKeywords -hi def link pb_k_makedepends pbKeywords -hi def link pb_k_optdepends pbKeywords -hi def link pb_k_ckdepends pbKeywords -hi def link pb_k_depends pbKeywords -hi def link pb_k_replaces pbKeywords -hi def link pb_k_conflicts pbKeywords -hi def link pb_k_provides pbKeywords - -hi def link pbIllegalInstall Error -hi def link pb_k_install pbKeywords - -hi def link pbIllegalChangelog Error -hi def link pb_k_changelog pbKeywords - -hi def link pb_k_source pbKeywords -hi def link pbIllegalSource Error - -hi def link pb_k_md5sums pbKeywords -hi def link pbIllegalMd5sums Error - -hi def link pb_k_sha1sums pbKeywords -hi def link pbIllegalSha1sums Error - -hi def link pb_k_sha256sums pbKeywords -hi def link pbIllegalSha256sums Error - -hi def link pb_k_sha384sums pbKeywords -hi def link pbIllegalSha384sums Error - -hi def link pb_k_sha512sums pbKeywords -hi def link pbIllegalSha512sums Error - -hi def link pb_k_options pbKeywords -hi def link pbOptionsDeprec Todo -hi def link pbIllegalOption Error - -hi def link pb_k_noextract pbKeywords -hi def link pbNoextract Normal - -hi def link pb_k_maintainer pbKeywords - -hi def link pbKeywords Keyword - -hi def link pbDate Special - -"syntax include @SHELL syntax/sh.vim -"syntax region BUILD start=/^build()/ end=/^}/ contains=@SHELL -"let b:current_syntax = "PKGBUILD" - -" vim: ft=vim diff --git a/contrib/README b/contrib/README deleted file mode 100644 index befd3c1d..00000000 --- a/contrib/README +++ /dev/null @@ -1,41 +0,0 @@ -Here is a brief description of the files included in this directory: - -PKGBUILD.vim - a vim/gvim syntax file for PKGBUILDs. Colors known variable -names, highlights common errors such as invalid characters in pkgname or -pkgver, etc. - -bacman - regenerate a pacman package based on installed files and the pacman -database entries. Useful for reuse, or possible config file extension. - -bash_completion - a bash completion script for pacman, install in -/etc/bash_completion.d/ for use (but rename to something descriptive!). - -checkupdates - print a list of pending updates without touching the system -sync databases (for safety on rolling release distributions). - -paccache - a flexible package cache cleaning utility that allows greater -control over which packages are removed. - -pacdiff - a simple pacnew/pacsave updater for /etc/. - -paclist - list all packages installed from a given repository. Useful for -seeing which packages you may have installed from the testing repository, -for instance. - -paclog-pkglist - lists currently installs packages based pacman's log. - -pacscripts - tries to print out the {pre,post}_{install,remove,upgrade} -scripts of a given package. - -pacsearch - a colorized search combining both -Ss and -Qs output. Installed -packages are easily identified with a *** and local-only packages are also -listed. - -rankmirrors - ranks pacman mirrors by their connection and opening speed. - -updpkgsums - performs an in place update of the checksums in a PKGBUILD. - -vimprojects - a project file for the vim project plugin. - -zsh_completion - a zsh completion script, install (with a rename) to -/usr/share/zsh/site-functions/. diff --git a/contrib/bacman.sh.in b/contrib/bacman.sh.in deleted file mode 100644 index 39fbe99c..00000000 --- a/contrib/bacman.sh.in +++ /dev/null @@ -1,391 +0,0 @@ -#!/bin/bash -# -# bacman: recreate a package from a running system -# This script rebuilds an already installed package using metadata -# stored into the pacman database and system files -# -# Copyright (c) 2008 locci -# Copyright (c) 2008-2016 Pacman Development Team -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# - -shopt -s extglob -shopt -s nullglob - -declare -r myname='bacman' -declare -r myver='@PACKAGE_VERSION@' -USE_COLOR='y' -INCLUDE_PACNEW='n' -QUIET=0 -# Required for fakeroot because options are shifted off the array. -ARGS=("$@") - -m4_include(../scripts/library/output_format.sh) -m4_include(../scripts/library/parseopts.sh) - -# Lazy recursive clean up of temporary dirs -work_dir_root="${TMPDIR:-/tmp}/bacman" -clean_up() { - rm -rf "$work_dir_root".* - echo - exit -} -# Trap termination signals -trap clean_up SIGHUP SIGINT SIGTERM - -# Print usage information -usage() { - printf "%s (pacman) %s\n" "$myname" "$myver" - echo - printf -- "$(gettext "Recreate packages using pacman's database and system files")\n" - echo - printf -- "$(gettext "Usage: %s [options] ")\n" "$0" - echo - printf -- "$(gettext "Options:")\n" - printf -- "$(gettext " -h, --help Show this help message and exit")\n" - printf -- "$(gettext " -q, --quiet Silence most of the status reporting")\n" - printf -- "$(gettext " -m, --nocolor Disable colorized output messages")\n" - printf -- "$(gettext " -o, --out Write output to specified directory (instead of \$PKGDEST)")\n" - printf -- "$(gettext " --pacnew Package .pacnew files")\n" - echo - printf -- "$(gettext "Examples:")" - printf -- " %s linux-headers\n" "$myname" - printf -- " %s -o ~/packages libarchive\n" "$myname" - printf -- " %s --nocolor --pacnew gzip make binutils\n" "$myname" - printf -- " %s \$(pacman -Qq)\n" "$myname" - echo -} - -# Print version information -version() { - printf "%s %s\n" "$myname" "$myver" - echo 'Copyright (C) 2008 locci ' - echo 'Copyright (C) 2008-2016 Pacman Development Team ' -} - - -# Printing the usage information takes precedence over every other parameter -for option in "$@"; do - [[ $option == "-h" || $option == "--help" ]] && usage && exit 0 -done - -# Parse arguments -OPT_SHORT='o:qmv' -OPT_LONG=('out:' 'quiet' 'nocolor' 'pacnew' 'version') -if ! parseopts "$OPT_SHORT" "${OPT_LONG[@]}" -- "$@"; then - usage - exit 1 -fi -set -- "${OPTRET[@]}" -unset OPT_SHORT OPT_LONG OPTRET - -while :; do - case "$1" in - -o|--out) - pkg_dest=$2 - [[ ! -d "$2" ]] && echo -e "The directory \e[39;1m$2\e[0m does not exist!" && exit 3 - shift ;; - -q|--quiet) - QUIET=1 ;; - -m|--nocolor) - USE_COLOR='n' ;; - --pacnew) - INCLUDE_PACNEW='y' ;; - -v|--version) - version - exit 0 ;; - --) - shift - break 2 ;; - esac - shift -done - -# Configure colored output -m4_include(../scripts/library/term_colors.sh) - -# Retrieve the list of packages to be assembled and break if none was specified -pkg_list=($*) -if [[ ${#pkg_list[@]} == 0 ]]; then - usage - exit 1 -fi - -# Run with fake root privileges if EUID is not root -if (( EUID )); then - if [[ -f /usr/bin/fakeroot ]]; then - msg "Entering fakeroot environment" - export INFAKEROOT="1" - /usr/bin/fakeroot -u -- "$0" "${ARGS[@]}" - exit $? - else - warning "installing fakeroot or running $myname as root is required to" - plain " preserve the ownership permissions of files in some packages\n" - fi -fi - -# Source environmental variables and specify fallbacks -if [[ ! -r @sysconfdir@/pacman.conf ]]; then - error "unable to read @sysconfdir@/pacman.conf" - exit 1 -fi -eval $(awk '/DBPath/ {print $1$2$3}' @sysconfdir@/pacman.conf) -pac_db="${DBPath:-@localstatedir@/lib/pacman/}/local" -if [[ ! -r @sysconfdir@/makepkg.conf ]]; then - error "unable to read @sysconfdir@/makepkg.conf" - exit 1 -fi -source "@sysconfdir@/makepkg.conf" -if [[ -r ~/.makepkg.conf ]]; then - source ~/.makepkg.conf -fi -PKGDEST="${PKGDEST:-$PWD}" -pkg_dest="${pkg_dest:-$PKGDEST}" -pkg_pkger="${PACKAGER:-'Unknown Packager'}" - -# Check for an existing database -if [[ ! -d $pac_db ]]; then - error "pacman database directory ${pac_db} not found" - exit 1 -fi - -# Assemble a single package: $1 = pkgname -fakebuild() { - pkg_name="$1" - pkg_dir=("$pac_db/$pkg_name"-+([^-])-+([^-])) - pkg_namver=("${pkg_dir[@]##*/}") - - # Checks database for specified package - if (( ${#pkg_dir[@]} != 1 )); then - error "%d entries for package %s found in pacman database" \ - ${#pkg_dir[@]} "${pkg_name}" - msg2 "%s" "${pkg_dir[@]}" - exit 1 - fi - if [[ ! -d $pkg_dir ]]; then - error "package %s is found in pacman database," "${pkg_name}" - plain " but '%s' is not a directory" "${pkg_dir}" - exit 1 - fi - - # Create working directory - msg "Package: ${pkg_namver}" - work_dir=$(mktemp -d "${work_dir_root}.XXXXXXXXXX") - cd "$work_dir" || exit 1 - - # Assemble list of files which belong to the package and tar them - msg2 "Copying package files..." - - while read i; do - if [[ -z $i ]]; then - continue - fi - - if [[ $i == %+([A-Z])% ]]; then - current=$i - continue - fi - - case "$current" in - %FILES%) - local_file="/$i" - package_file="$work_dir/$i" - - if [[ ! -e $local_file ]]; then - warning "package file $local_file is missing" - continue - fi - ;; - - %BACKUP%) - # Get the MD5 checksum. - original_md5="${i##*$'\t'}" - # Strip the md5sum after the tab. - i="${i%$'\t'*}" - local_file="/$i.pacnew" - package_file="$work_dir/$i" - - # Include unmodified .pacnew files. - local_md5="$(md5sum "$local_file" | cut -d' ' -f1)" - if [[ $INCLUDE_PACNEW == 'n' ]] \ - || [[ ! -e $local_file ]] \ - || [[ $local_md5 != $original_md5 ]]; then - # Warn about modified files. - local_md5="$(md5sum "/$i" | cut -d' ' -f1)" - if [[ $local_md5 != $original_md5 ]]; then - warning "package file /$i has been modified" - fi - # Let the normal file be included in the %FILES% list. - continue - fi - ;; - - *) - continue - ;; - esac - - # Tar files - ret=0 - bsdtar -cnf - -s'/.pacnew$//' "$local_file" 2> /dev/null | bsdtar -xpf - 2> /dev/null - # Workaround to bsdtar not reporting a missing file as an error - if ! [[ -e $package_file || -L $package_file ]]; then - error "unable to add $local_file to the package" - plain " If your user does not have permission to read this file, then" - plain " you will need to run $myname as root." - rm -rf "$work_dir" - exit 1 - fi - done < "$pkg_dir"/files - - ret=$? - if (( ret )); then - rm -rf "$work_dir" - exit 1 - fi - - # Calculate package size - pkg_size=$(du -sk | awk '{print $1 * 1024}') - - # Reconstruct .PKGINFO from database - # TODO adopt makepkg's write_pkginfo() into this or scripts/library - msg2 "Generating .PKGINFO metadata..." - echo "# Generated by $myname $myver" > .PKGINFO - if [[ $INFAKEROOT == "1" ]]; then - echo "# Using $(fakeroot -v)" >> .PKGINFO - fi - echo "# $(LC_ALL=C date)" >> .PKGINFO - echo "#" >> .PKGINFO - while read i; do - if [[ -z $i ]]; then - continue; - fi - if [[ $i == %+([A-Z])% ]]; then - current=$i - continue - fi - - case "$current" in - # desc - %NAME%) - echo "pkgname = $i" >> .PKGINFO - ;; - %VERSION%) - echo "pkgver = $i" >> .PKGINFO - ;; - %DESC%) - echo "pkgdesc = $i" >> .PKGINFO - ;; - %URL%) - echo "url = $i" >> .PKGINFO - ;; - %LICENSE%) - echo "license = $i" >> .PKGINFO - ;; - %ARCH%) - echo "arch = $i" >> .PKGINFO - pkg_arch="$i" - ;; - %BUILDDATE%) - echo "builddate = $(date -u "+%s")" >> .PKGINFO - ;; - %PACKAGER%) - echo "packager = $pkg_pkger" >> .PKGINFO - ;; - %SIZE%) - echo "size = $pkg_size" >> .PKGINFO - ;; - %GROUPS%) - echo "group = $i" >> .PKGINFO - ;; - %REPLACES%) - echo "replaces = $i" >> .PKGINFO - ;; - %DEPENDS%) - echo "depend = $i" >> .PKGINFO - ;; - %OPTDEPENDS%) - echo "optdepend = $i" >> .PKGINFO - ;; - %CONFLICTS%) - echo "conflict = $i" >> .PKGINFO - ;; - %PROVIDES%) - echo "provides = $i" >> .PKGINFO - ;; - %BACKUP%) - # Strip the md5sum after the tab - echo "backup = ${i%%$'\t'*}" >> .PKGINFO - ;; - esac - done < <(cat "$pkg_dir"/{desc,files}) - - comp_files=".PKGINFO" - - # Add instal file if present - if [[ -f $pkg_dir/install ]]; then - cp "$pkg_dir/install" "$work_dir/.INSTALL" - comp_files+=" .INSTALL" - fi - if [[ -f $pkg_dir/changelog ]]; then - cp "$pkg_dir/changelog" "$work_dir/.CHANGELOG" - comp_files+=" .CHANGELOG" - fi - - # Fixes owner:group and permissions for .PKGINFO, .CHANGELOG, .INSTALL - chown root:root "$work_dir"/{.PKGINFO,.CHANGELOG,.INSTALL} 2> /dev/null - chmod 644 "$work_dir"/{.PKGINFO,.CHANGELOG,.INSTALL} 2> /dev/null - - # Generate the package - msg2 "Generating the package..." - - pkg_file="$pkg_dest/$pkg_namver-$pkg_arch${PKGEXT}" - ret=0 - - # Move compressed package to destination - # TODO: Maybe this can be set globally for robustness - shopt -s -o pipefail - bsdtar -cf - $comp_files * | - case "$PKGEXT" in - *tar.gz) gzip -c -f -n ;; - *tar.bz2) bzip2 -c -f ;; - *tar.xz) xz -c -z - ;; - *tar.Z) compress -c -f ;; - *tar) cat ;; - *) warning "'%s' is not a valid archive extension." \ - "$PKGEXT"; cat ;; - esac > "${pkg_file}"; ret=$? - - # Evaluate return code - if (( ret )); then - error "Unable to write package to $pkg_dest" - plain " Maybe the disk is full or you do not have write access" - rm -rf "$work_dir" - exit 1 - fi - - # Clean up working directory - rm -rf "$work_dir" -} - - -for PKG in ${pkg_list[@]}; do - fakebuild $PKG -done -msg "Done." - -exit 0 - -# vim: set noet: diff --git a/contrib/checkupdates.sh.in b/contrib/checkupdates.sh.in deleted file mode 100644 index ff62891b..00000000 --- a/contrib/checkupdates.sh.in +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/bash -# -# checkupdates: Safely print a list of pending updates. -# -# Copyright (c) 2013 Kyle Keen -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# - -declare -r myname='checkupdates' -declare -r myver='@PACKAGE_VERSION@' - -m4_include(../scripts/library/output_format.sh) -m4_include(../scripts/library/term_colors.sh) - -if (( $# > 0 )); then - echo "${myname} (pacman) v${myver}" - echo - echo "Safely print a list of pending updates" - echo - echo "Usage: ${myname}" - echo - echo 'Note: Export the "CHECKUPDATES_DB" variable to change the path of the temporary database.' - exit 0 -fi - -if ! type -P fakeroot >/dev/null; then - error 'Cannot find the fakeroot binary.' - exit 1 -fi - -if [[ -z $CHECKUPDATES_DB ]]; then - CHECKUPDATES_DB="${TMPDIR:-/tmp}/checkup-db-${USER}/" -fi - -trap 'rm -f $CHECKUPDATES_DB/db.lck' INT TERM EXIT - -DBPath="${DBPath:-@localstatedir@/lib/pacman/}" -eval $(awk -F' *= *' '$1 ~ /DBPath/ { print $1 "=" $2 }' @sysconfdir@/pacman.conf) - -mkdir -p "$CHECKUPDATES_DB" -ln -s "${DBPath}/local" "$CHECKUPDATES_DB" &> /dev/null -fakeroot -- pacman -Sy --dbpath "$CHECKUPDATES_DB" --logfile /dev/null &> /dev/null -pacman -Qu --dbpath "$CHECKUPDATES_DB" 2> /dev/null | grep -v '\[.*\]' - -exit 0 - -# vim: set noet: diff --git a/contrib/doc/.gitignore b/contrib/doc/.gitignore deleted file mode 100644 index 3ab20353..00000000 --- a/contrib/doc/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -verify-pacman-repo-db.1 -bacman.8 diff --git a/contrib/doc/Makefile.am b/contrib/doc/Makefile.am deleted file mode 100644 index d5725b1e..00000000 --- a/contrib/doc/Makefile.am +++ /dev/null @@ -1,60 +0,0 @@ -# We have to do some funny stuff here with the manpages. In order to ensure -# a dist tarball doesn't get put out there without manpages, we keep those -# files listed in EXTRA_DIST no matter what. However, we only add them to -# man_MANS if --enable-asciidoc and/or --enable-doxygen are used. - -ASCIIDOC_MANS = \ - verify-pacman-repo-db.1 \ - bacman.8 - -EXTRA_DIST = \ - asciidoc.conf \ - footer.txt \ - verify-pacman-repo-db.1.txt \ - bacman.8.txt \ - $(ASCIIDOC_MANS) - -# Files that should be removed, but which Automake does not know. -MOSTLYCLEANFILES = *.xml $(ASCIIDOC_MANS) - -# Ensure manpages are fresh when building a dist tarball -dist-hook: - $(MAKE) $(AM_MAKEFLAGS) clean - $(MAKE) $(AM_MAKEFLAGS) all - -if USE_GIT_VERSION -GIT_VERSION := $(shell sh -c 'git describe --abbrev=4 --dirty | sed s/^v//') -REAL_PACKAGE_VERSION = $(GIT_VERSION) -else -REAL_PACKAGE_VERSION = $(PACKAGE_VERSION) -endif - -man_MANS = -dist_man_MANS = $(ASCIIDOC_MANS) - -pkgdatadir = ${datadir}/${PACKAGE} - -ASCIIDOC_OPTS = \ - -f $(srcdir)/asciidoc.conf \ - -a pacman_version="$(REAL_PACKAGE_VERSION)" \ - -a pacman_date="`date +%Y-%m-%d`" \ - -a pkgdatadir=$(pkgdatadir) \ - -a localstatedir=$(localstatedir) \ - -a sysconfdir=$(sysconfdir) \ - -a datarootdir=$(datarootdir) - -A2X_OPTS = \ - --no-xmllint \ - -d manpage \ - -f manpage \ - --xsltproc-opts='-param man.endnotes.list.enabled 0 -param man.endnotes.are.numbered 0' - -# These rules are due to the includes and files of the asciidoc text -$(ASCIIDOC_MANS): asciidoc.conf footer.txt Makefile.am - $(AM_V_GEN)a2x $(A2X_OPTS) --asciidoc-opts="$(ASCIIDOC_OPTS) --out-file=./$@" $(srcdir)/$@.txt - -# Dependency rules -verify-pacman-repo-db.1: verify-pacman-repo-db.1.txt -bacman.8: bacman.8.txt - -# vim:set noet: diff --git a/contrib/doc/asciidoc.conf b/contrib/doc/asciidoc.conf deleted file mode 120000 index ff9653d3..00000000 --- a/contrib/doc/asciidoc.conf +++ /dev/null @@ -1 +0,0 @@ -../../doc/asciidoc.conf \ No newline at end of file diff --git a/contrib/doc/bacman.8.txt b/contrib/doc/bacman.8.txt deleted file mode 100644 index dc5af481..00000000 --- a/contrib/doc/bacman.8.txt +++ /dev/null @@ -1,67 +0,0 @@ -///// -vim:set ts=4 sw=4 syntax=asciidoc noet spell spelllang=en_us: -///// -bacman(8) -========== - -Name ----- -bacman - recreate installed packages - - -Synopsis --------- -'bacman' [options] - - -Description ------------ -'bacman' was designed to reassemble installed packages using pacman's database -and system files. -It is useful for regenerating an installed package that you are unable to -download that is also not available in your package cache. - -'bacman' honors packaging settings from linkman:makepkg.conf[8]. - - -Options -------- -*-h, \--help*:: - Display usage information. - -*-q, \--quiet*:: - Silence most of the status reporting. - -*-m, \--nocolor*:: - Disable colored output. - -*-o, \--out *:: - Write the assembled package(s) to the specified directory. - -*\--pacnew*:: - Package `.pacnew` files if available instead of the (possibly modified) - versions in place on the filesystem. - - -Examples --------- - -The following are example usages of the 'bacman' utility: - -$ bacman linux-headers:: - Recreate the package ``linux-headers''. - -$ bacman gzip make binutils -o ~/packages:: - Assemble the packages ``gzip'', ``make'', and ``binutils'' and place - the packages in the ``~/packages'' directory. - -$ bacman --nocolor --pacnew -o ~/backup $(pacman -Qq):: - Assemble all currently installed packages using ``.pacnew'' whenever - available, suppress colored output and place the desired packages in - the ``~/backup''. directory - -See Also --------- -linkman:makepkg[8], linkman:pacman[8] - -include::footer.txt[] diff --git a/contrib/doc/footer.txt b/contrib/doc/footer.txt deleted file mode 120000 index 9dd4bae1..00000000 --- a/contrib/doc/footer.txt +++ /dev/null @@ -1 +0,0 @@ -../../doc/footer.txt \ No newline at end of file diff --git a/contrib/doc/verify-pacman-repo-db.1.txt b/contrib/doc/verify-pacman-repo-db.1.txt deleted file mode 100644 index 62564b8f..00000000 --- a/contrib/doc/verify-pacman-repo-db.1.txt +++ /dev/null @@ -1,60 +0,0 @@ -///// -vim:set ts=4 sw=4 syntax=asciidoc noet spell spelllang=en_us: -///// -verify-pacman-repo-db(1) -======================== - -Name ----- -verify-pacman-repo-db - package repository verification utility - - -Synopsis --------- -'verify-pacman-repo-db' [options] - - -Description ------------ -'verify-pacman-repo-db' looks at a pacman repo database and verifies its -content with the actual package files. The database is expected to be in -the same directory as the packages (or symlinks to the packages). - -The following properties are verified for each package in the database: - - - existence of the package file - - file size - - MD5 and SHA256 checksum (--checksum) - -Options -------- -*-h, \--help*:: - Output a short help message. - -*\--debug*:: - Enable debug output. - -*-c, \--checksum*:: - Verify checksums of packages. Note that this means all packages files will - be read from disk. Otherwise only metadata is compared which does not - require to read package file contents. - -*-t, \--threads* :: - Use 'number' threads to verify packages. Note that each thread may use up - to approximately 128MiB of memory. Default: 1 - -Notes ------ - -This script does intentionally not use any ALPM libraries. The format is simple -enough to be parsed and this way we might just detect more problems because the -libalpm parsing code might also have bugs. We also stay much more portable -which might be good for people that want to check a db, but don't actually have -pacman installed. - - -See Also --------- -linkman:repo-add[8] - -include::footer.txt[] diff --git a/contrib/paccache.sh.in b/contrib/paccache.sh.in deleted file mode 100644 index 02fae527..00000000 --- a/contrib/paccache.sh.in +++ /dev/null @@ -1,366 +0,0 @@ -#!/bin/bash -# -# pacache - flexible pacman cache cleaning -# -# Copyright (C) 2011 Dave Reisner -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - - -shopt -s extglob - -declare -r myname='paccache' -declare -r myver='@PACKAGE_VERSION@' - -declare -a cachedirs=() candidates=() cmdopts=() whitelist=() blacklist=() -declare -i delete=0 dryrun=0 filecount=0 move=0 needsroot=0 totalsaved=0 verbose=0 -declare delim=$'\n' keep=3 movedir= scanarch= - -QUIET=0 -USE_COLOR='y' - -m4_include(../scripts/library/output_format.sh) -m4_include(../scripts/library/parseopts.sh) - -die() { - error "$@" - exit 1 -} - -get_cachedir_from_config() { - local key value - - while IFS=$'= \t' read -r key value _; do - if [[ $key = CacheDir ]]; then - echo "$value" - return 0 - fi - done <"$1" - - return 1 -} - -# reads a list of files on stdin and prints out deletion candidates -pkgfilter() { - # there's whitelist and blacklist parameters passed to this - # script after the block of awk. - - awk -v keep="$1" -v scanarch="$2" ' - function basename(str) { - sub(".*/", "", str); - return str; - } - - function parse_filename(filename, parts, count, i, pkgname, arch) { - - count = split(basename(filename), parts, "-") - - i = 1 - pkgname = parts[i++] - while (i <= count - 3) { - pkgname = pkgname "-" parts[i++] - } - - arch = substr(parts[count], 1, index(parts[count], ".") - 1) - - # filter on whitelist or blacklist - if (wlen && !whitelist[pkgname]) return - if (blen && blacklist[pkgname]) return - - if ("" == packages[pkgname,arch]) { - packages[pkgname,arch] = filename - } else { - packages[pkgname,arch] = packages[pkgname,arch] SUBSEP filename - } - } - - BEGIN { - # create whitelist - wlen = ARGV[1]; delete ARGV[1] - for (i = 2; i < 2 + wlen; i++) { - whitelist[ARGV[i]] = 1 - delete ARGV[i] - } - - # create blacklist - blen = ARGV[i]; delete ARGV[i] - while (i++ < ARGC) { - blacklist[ARGV[i]] = 1 - delete ARGV[i] - } - - # read package filenames - while (getline < "/dev/stdin") { - parse_filename($0) - } - - for (pkglist in packages) { - # idx[1,2] = idx[pkgname,arch] - split(pkglist, idx, SUBSEP) - - # enforce architecture match if specified - if (!scanarch || scanarch == idx[2]) { - count = split(packages[idx[1], idx[2]], pkgs, SUBSEP) - for(i = 1; i <= count - keep; i++) { - print pkgs[i] - } - } - } - }' "${@:3}" -} - -m4_include(../scripts/library/size_to_human.sh) - -runcmd() { - if (( needsroot && EUID != 0 )); then - msg "Privilege escalation required" - if sudo -v &>/dev/null && sudo -l &>/dev/null; then - sudo "$@" - else - die 'Unable to escalate privileges using sudo' - fi - else - "$@" - fi -} - -summarize() { - (( QUIET )) && return - - local -i filecount=$1; shift - local seenarch= seen= arch= name= - local -r pkg_re='(.+)-[^-]+-[0-9]+-([^.]+)\.pkg.*' - - if (( delete )); then - printf -v output 'finished: %d packages removed' "$filecount" - elif (( move )); then - printf -v output "finished: %d packages moved to '%s'" "$filecount" "$movedir" - elif (( dryrun )); then - if (( verbose )); then - msg "Candidate packages:" - while read -r pkg; do - if (( verbose >= 3 )); then - [[ $pkg =~ $pkg_re ]] && name=${BASH_REMATCH[1]} arch=${BASH_REMATCH[2]} - if [[ -z $seen || $seenarch != "$arch" || $seen != "$name" ]]; then - seen=$name seenarch=$arch - printf '%s (%s):\n' "${name##*/}" "$arch" - fi - printf ' %s\n' "${pkg##*/}" - elif (( verbose >= 2 )); then - printf "%s$delim" "$pkg" - else - printf "%s$delim" "${pkg##*/}" - fi - done < <(printf '%s\n' "$@" | pacsort --files) - fi - printf -v output 'finished dry run: %d candidates' "$filecount" - fi - - echo - msg "$output (disk space saved: %s)" "$(size_to_human "$totalsaved")" -} - -usage() { - cat < [options] [targets...] - - Operations: - -d, --dryrun perform a dry run, only finding candidate packages. - -m, --move move candidate packages to "dir". - -r, --remove remove candidate packages. - - Options: - -a, --arch scan for "arch" (default: all architectures). - -c, --cachedir scan "dir" for packages. can be used more than once. - (default: read from @sysconfdir@/pacman.conf). - -f, --force apply force to mv(1) and rm(1) operations. - -h, --help display this help message and exit. - -i, --ignore ignore "pkgs", comma-separated. Alternatively, specify - "-" to read package names from stdin, newline- - delimited. - -k, --keep keep "num" of each package in the cache (default: 3). - --nocolor remove color from output. - -q, --quiet minimize output - -u, --uninstalled target uninstalled packages. - -v, --verbose increase verbosity. specify up to 3 times. - -z, --null use null delimiters for candidate names (only with -v - and -vv). - -EOF -} - -version() { - printf "%s %s\n" "$myname" "$myver" - echo 'Copyright (C) 2011 Dave Reisner ' -} - -OPT_SHORT=':a:c:dfhi:k:m:qrsuVvz' -OPT_LONG=('arch:' 'cachedir:' 'dryrun' 'force' 'help' 'ignore:' 'keep:' 'move' - 'nocolor' 'quiet' 'remove' 'uninstalled' 'version' 'verbose' 'null') - -if ! parseopts "$OPT_SHORT" "${OPT_LONG[@]}" -- "$@"; then - exit 1 -fi -set -- "${OPTRET[@]}" -unset OPT_SHORT OPT_LONG OPTRET - -while :; do - case $1 in - -a|--arch) - scanarch=$2 - shift ;; - -c|--cachedir) - cachedirs+=("$2") - shift ;; - -d|--dryrun) - dryrun=1 ;; - -f|--force) - cmdopts=(-f) ;; - -h|--help) - usage - exit 0 ;; - -i|--ignore) - if [[ $2 = '-' ]]; then - [[ ! -t 0 ]] && IFS=$'\n' read -r -d '' -a ign - else - IFS=',' read -r -a ign <<< "$2" - fi - blacklist+=("${ign[@]}") - unset i ign - shift ;; - -k|--keep) - keep=$2 - if [[ -z $keep || -n ${keep//[0-9]/} ]]; then - die 'argument to option -k must be a non-negative integer' - else - keep=$(( 10#$keep )) - fi - shift ;; - -m|--move) - move=1 movedir=$2 - shift ;; - --nocolor) - USE_COLOR='n' ;; - -q|--quiet) - QUIET=1 ;; - -r|--remove) - delete=1 ;; - -u|--uninstalled) - IFS=$'\n' read -r -d '' -a ign < <(pacman -Qq) - # pacman -Qq may exit with an error, thus making ign an empty array - (( ${#ign[@]} )) || die 'failed to retrieve the list of installed packages' - blacklist+=("${ign[@]}") - unset ign ;; - -V|--version) - version - exit 0 ;; - -v|--verbose) - (( ++verbose )) ;; - -z|--null) - delim='\0' ;; - --) - shift - break 2 ;; - esac - shift -done - -m4_include(../scripts/library/term_colors.sh) - -# setting default cachedir -if [[ -z $cachedirs ]]; then - if cachedir=$(get_cachedir_from_config "@sysconfdir@/pacman.conf"); then - cachedirs=("$cachedir") - else - cachedirs=("${cachedirs[@]:-@localstatedir@/cache/pacman/pkg}") - fi -fi - -# remaining args are a whitelist -whitelist=("$@") - -# sanity checks -case $(( dryrun+delete+move )) in - 0) die "no operation specified (use -h for help)" ;; - [^1]) die "only one operation may be used at a time" ;; -esac - -[[ $movedir && ! -d $movedir ]] && - die "destination directory '%s' does not exist or is not a directory" "$movedir" - -if (( move || delete )); then - # make it an absolute path since we're about to chdir - [[ $movedir && ${movedir:0:1} != '/' ]] && movedir=$PWD/$movedir - [[ $movedir && ! -w $movedir ]] && needsroot=1 -fi - -for cachedir in "${cachedirs[@]}"; do - [[ -d $cachedir ]] || - die "cachedir '%s' does not exist or is not a directory" "$cachedir" - - if (( move || delete )); then - [[ ! -w $cachedir ]] && needsroot=1 - fi - - # unlikely that this will fail, but better make sure - pushd "$cachedir" &>/dev/null || die "failed to chdir to '%s'" "$cachedir" - - # note that these results are returned in an arbitrary order from awk, but - # they'll be resorted (in summarize) iff we have a verbosity level set. - IFS=$'\n' read -r -d '' -a cand < \ - <(printf '%s\n' "$PWD"/*.pkg.tar?(.+([^.])) | pacsort --files | - pkgfilter "$keep" "$scanarch" \ - "${#whitelist[*]}" "${whitelist[@]}" \ - "${#blacklist[*]}" "${blacklist[@]}") - - candidates+=("${cand[@]}") - unset cand - - popd &>/dev/null -done - -if (( ! ${#candidates[*]} )); then - msg 'no candidate packages found for pruning' - exit 0 -fi - -# grab this prior to signature scavenging -pkgcount=${#candidates[*]} - -# copy the list, merging in any found sigs -for cand in "${candidates[@]}"; do - candtemp+=("$cand") - [[ -f $cand.sig ]] && candtemp+=("$cand.sig") -done -candidates=("${candtemp[@]}") -unset candtemp - -# do this before we destroy anything -totalsaved=$(@SIZECMD@ "${candidates[@]}" | awk '{ sum += $1 } END { print sum }') - -# crush. kill. destroy. -(( verbose )) && cmdopts+=(-v) -if (( delete )); then - printf '%s\0' "${candidates[@]}" | runcmd xargs -0 rm "${cmdopts[@]}" -elif (( move )); then - printf '%s\0' "${candidates[@]}" | runcmd xargs -0 mv "${cmdopts[@]}" -t "$movedir" -fi - -summarize "$pkgcount" "${candidates[@]}" - -# vim: set noet: diff --git a/contrib/pacdiff.sh.in b/contrib/pacdiff.sh.in deleted file mode 100644 index dff2115a..00000000 --- a/contrib/pacdiff.sh.in +++ /dev/null @@ -1,194 +0,0 @@ -#!/bin/bash -# pacdiff : a simple pacnew/pacsave updater -# -# Copyright (c) 2007 Aaron Griffin -# Copyright (c) 2013-2016 Pacman Development Team -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# - -shopt -s extglob - -declare -r myname='pacdiff' -declare -r myver='@PACKAGE_VERSION@' - -diffprog=${DIFFPROG:-'vim -d'} -diffsearchpath=${DIFFSEARCHPATH:-/etc} -USE_COLOR='y' -declare -a oldsaves -declare -i USE_FIND=0 USE_LOCATE=0 USE_PACDB=0 OUTPUTONLY=0 - -m4_include(../scripts/library/output_format.sh) - -usage() { - cat <' - echo 'Copyright (C) 2013-2016 Pacman Development Team ' -} - -print_existing() { - [[ -f "$1" ]] && printf '%s\0' "$1" -} - -print_existing_pacsave(){ - for f in "${1}"?(.+([0-9])); do - [[ -f $f ]] && printf '%s\0' "$f" - done -} - -cmd() { - if (( USE_LOCATE )); then - locate -0 -e -b \*.pacnew \*.pacorig \*.pacsave '*.pacsave.[0-9]*' - elif (( USE_FIND )); then - find $diffsearchpath \( -name \*.pacnew -o -name \*.pacorig -o -name \*.pacsave -o -name '*.pacsave.[0-9]*' \) -print0 - elif (( USE_PACDB )); then - awk '/^%BACKUP%$/ { - while (getline) { - if (/^$/) { nextfile } - print $1 - } - }' "${pac_db}"/*/files | while read -r bkup; do - print_existing "/$bkup.pacnew" - print_existing "/$bkup.pacorig" - print_existing_pacsave "/$bkup.pacsave" - done - fi -} - -while [[ -n "$1" ]]; do - case "$1" in - -l|--locate) - USE_LOCATE=1;; - -f|--find) - USE_FIND=1;; - -p|--pacmandb) - USE_PACDB=1;; - -o|--output) - OUTPUTONLY=1;; - --nocolor) - USE_COLOR='n';; - -V|--version) - version; exit 0;; - -h|--help) - usage; exit 0;; - *) - usage; exit 1;; - esac - shift -done - -m4_include(../scripts/library/term_colors.sh) - -if ! type -p ${diffprog%% *} >/dev/null && (( ! OUTPUTONLY )); then - error "Cannot find the $diffprog binary required for viewing differences." - exit 1 -fi - -case $(( USE_FIND + USE_LOCATE + USE_PACDB )) in - 0) USE_PACDB=1;; # set the default search option - [^1]) error "Only one search option may be used at a time" - usage; exit 1;; -esac - -if (( USE_PACDB )); then - if [[ ! -r @sysconfdir@/pacman.conf ]]; then - error "unable to read @sysconfdir@/pacman.conf" - usage; exit 1 - fi - - eval $(awk '/DBPath/ {print $1$2$3}' @sysconfdir@/pacman.conf) - pac_db="${DBPath:-@localstatedir@/lib/pacman/}local" - if [[ ! -d "${pac_db}" ]]; then - error "unable to read pacman database %s". "${pac_db}" - usage; exit 1 - fi -fi - -# see http://mywiki.wooledge.org/BashFAQ/020 -while IFS= read -u 3 -r -d '' pacfile; do - file="${pacfile%.pac*}" - file_type="pac${pacfile##*.pac}" - - if (( OUTPUTONLY )); then - echo "$pacfile" - continue - fi - - # add matches for pacsave.N to oldsaves array, do not prompt - if [[ $file_type = pacsave.+([0-9]) ]]; then - oldsaves+=("$pacfile") - continue - fi - - msg "%s file found for %s" "$file_type" "$file" - if [ ! -f "$file" ]; then - warning "$file does not exist" - rm -iv "$pacfile" - continue - fi - - if cmp -s "$pacfile" "$file"; then - msg2 "Files are identical, removing..." - rm -v "$pacfile" - else - ask "(V)iew, (S)kip, (R)emove %s, (O)verwrite with %s, (Q)uit: [v/s/r/o/q] " "$file_type" "$file_type" - while read c; do - case $c in - q|Q) exit 0;; - r|R) rm -v "$pacfile"; break ;; - o|O) mv -v "$pacfile" "$file"; break ;; - v|V) - $diffprog "$pacfile" "$file" - ask "(V)iew, (S)kip, (R)emove %s, (O)verwrite with %s, (Q)uit: [v/s/r/o/q] " "$file_type" "$file_type"; - continue ;; - s|S) break ;; - *) ask "Invalid answer. Try again: [v/s/r/o/q] "; continue ;; - esac - done - fi -done 3< <(cmd) - -(( ${#oldsaves[@]} )) && warning "Ignoring %s" "${oldsaves[@]}" - -exit 0 - -# vim: set noet: diff --git a/contrib/paclist.sh.in b/contrib/paclist.sh.in deleted file mode 100644 index f4fd540b..00000000 --- a/contrib/paclist.sh.in +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/bash -# paclist - List all packages installed from a given repo -# -# Copyright (C) 2008 Dan McGee -# Copyright (C) 2011 Dave Reisner -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -declare -r myname='paclist' -declare -r myver='@PACKAGE_VERSION@' - -export TEXTDOMAIN='pacman' -export TEXTDOMAINDIR='/usr/share/locale' - -# determine whether we have gettext; make it a no-op if we do not -if ! type gettext &>/dev/null; then - gettext() { - echo "$@" - } -fi - -usage() { - printf "%s (pacman) v%s\n" "${myname}" "${myver}" - echo - printf "List all packages installed from a given repository\n" "${myname}" - echo - printf "Usage: %s \n" "${myname}" - echo - printf "Example: %s testing\n" "${myname}" -} - -version() { - printf "%s %s\n" "$myname" "$myver" - echo 'Copyright (C) 2008 Dan McGee ' - echo 'Copyright (C) 2011 Dave Reisner ' -} - -if [[ -z $1 ]]; then - usage - exit 1 -fi - -if [[ $1 = -@(h|-help) ]]; then - usage - exit 0 -elif [[ $1 = -@(V|-version) ]]; then - version - exit 0 -fi - -printf -v installed '[%s]' "$(gettext installed)" -pacman -Sl $1 | awk -v i="$installed" '$NF == i { print $2,$3 }' - -# exit with pacman's return value, not awk's -exit ${PIPESTATUS[0]} - -# vim: set noet: diff --git a/contrib/paclog-pkglist.sh.in b/contrib/paclog-pkglist.sh.in deleted file mode 100644 index 847b389c..00000000 --- a/contrib/paclog-pkglist.sh.in +++ /dev/null @@ -1,99 +0,0 @@ -#!/bin/bash -# -# paclog-pkglist - Parse a log file into a list of currently installed packages -# -# Copyright (C) 2011 Dave Reisner -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -declare -r myname='paclog-pkglist' -declare -r myver='@PACKAGE_VERSION@' - -export TEXTDOMAIN='pacman' -export TEXTDOMAINDIR='/usr/share/locale' -declare logfile=${1:-@localstatedir@/log/pacman.log} - -usage() { - printf "%s (pacman) v%s\n" "${myname}" "${myver}" - echo - echo "Parse a log file into a list of currently installed packages" - echo - printf "Usage: %s [path to pacman log]\n" "${myname}" - echo - printf "Example: %s @localstatedir@/log/pacman.log\n" "${myname}" - echo - echo 'Defaults to: @localstatedir@/log/pacman.log' -} - -version() { - printf "%s %s\n" "$myname" "$myver" - echo 'Copyright (C) 2011 Dave Reisner ' -} - -if [[ $1 ]]; then - if [[ $1 = -@(h|-help) ]]; then - usage - exit 0 - elif [[ $1 = -@(V|-version) ]]; then - version - exit 0 - elif [[ ! -e $logfile ]]; then - printf $"target not found: %s\n" "$1" - exit 1 - fi -fi - -<"$logfile" awk ' -{ - if ($3 ~ /^\[.*\]$/) { - # new style with caller name - action = $4 - pkgname = $5 - pkgver = $6 - upgver = $8 - nfields = NF - } else { - action = $3 - pkgname = $4 - pkgver = $5 - upgver = $7 - nfields = (NF + 1) # compensate for missing caller field - } -} - -nfields == 6 && action == "installed" { - gsub(/[()]/, "", pkgver) - pkg[pkgname] = pkgver - next -} - -nfields == 8 && (action == "upgraded" || action == "downgraded") { - sub(/\)/, "", upgver) - pkg[pkgname] = upgver - next -} - -nfields == 6 && action == "removed" { - pkg[pkgname] = -1 -} - -END { - for (i in pkg) { - if (pkg[i] != -1) { - printf "%s %s\n",i,pkg[i] - } - } -}' | sort - -# vim: set noet: diff --git a/contrib/pacscripts.sh.in b/contrib/pacscripts.sh.in deleted file mode 100644 index 4a1e0c50..00000000 --- a/contrib/pacscripts.sh.in +++ /dev/null @@ -1,140 +0,0 @@ -#!/bin/bash -# -# pacscripts : tries to print out the {pre,post}_{install,remove,upgrade} -# scripts of a given package -# -# Copyright (c) 2009 Xavier Chantry -# Copyright (c) 2009-2016 Pacman Development Team -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# - -# bash options -set -o nounset -set -o errexit - -declare -r myname='pacscripts' -declare -r myver='@PACKAGE_VERSION@' - -conf="@sysconfdir@/pacman.conf" - -if [ ! -r "$conf" ]; then - echo "ERROR: unable to read $conf" - exit 1 -fi - -eval $(awk '/DBPath/ {print $1$2$3}' "$conf") -eval $(awk '/CacheDir/ {print $1$2$3}' "$conf") -pac_db="${DBPath:-@localstatedir@/lib/pacman}/local" -pac_cache="${CacheDir:-@localstatedir@/cache/pacman/pkg}" - -error() { - local mesg=$1; shift - printf "==> $(gettext "ERROR:") ${mesg}\n" "$@" >&2 -} - -usage() { - echo "${myname} (pacman) v${myver}" - echo - echo "Prints the {pre,post}_{install,remove,upgrade} scripts of a given package." - echo - echo "Usage: ${myname} " - echo - echo " Options:" - echo " -h, --help Print this help message" - echo " -v, --version Print program name and version" - echo - echo "Example: ${myname} gconf-editor" - echo "Example: ${myname} gconf-editor-3.0.1-3-x86_64.pkg.tar.xz" -} - -version() { - printf "%s %s\n" "$myname" "$myver" - echo 'Copyright (c) 2009 Giulio "giulivo" Fidente ' - echo 'Copyright (c) 2009 Xavier Chantry ' -} - -spacman() { - if [ $EUID -eq 0 ]; then - pacman "$@" - else - if ! type -p sudo; then - error "Cannot find the sudo binary!" - error "${myname} requires root privileges. Either install \"sudo\" or run as root." - exit 1 - else - sudo pacman "$@" - fi - fi -} - -print_db() { - pkg=$(pacman -Q "$1") - pkg=${pkg/ /-} - if [ -f $pac_db/$pkg*/install ]; then - cat $pac_db/$pkg*/install - echo - return 0 - else - error "Package $1 does not include any .INSTALL script" - return 1 - fi -} - -print_pkg() { - if ! bsdtar -xqOf "$1" .INSTALL 2>/dev/null; then - error "Package $1 does not include any .INSTALL script" - return 1 - fi - echo -} - -print_scriptlet() { - if [ -f "$1" ]; then - if bsdtar tf "$1" .PKGINFO &>/dev/null; then - print_pkg "$1" - return - fi - fi - if pacman -Q "$1" &>/dev/null; then - print_db "$1" - return - fi - if ! pacman -Si $1 &>/dev/null; then - error "Package $1 not found" - return 1 - fi - url=$(pacman -Sddp $1) - filename=$(basename $url) - if [ ! -f "$pac_cache/$filename" ]; then - if ! spacman -Sddw --noconfirm $1 >&2; then - error "Failed to download $1" - return 1 - fi - echo >&2 - fi - print_pkg "$pac_cache/$filename" - return -} - -if [ $# -ne 1 ] ; then - usage - exit 1 -fi - -case "$1" in - --help|-h) usage; exit 0 ;; - --version|-V) version; exit 0 ;; - *) print_scriptlet $1 ;; -esac diff --git a/contrib/pacsearch.in b/contrib/pacsearch.in deleted file mode 100644 index a89328d0..00000000 --- a/contrib/pacsearch.in +++ /dev/null @@ -1,125 +0,0 @@ -#!/usr/bin/perl -# pacsearch - Perform a pacman search using both the local and the sync databases -# -# Copyright (C) 2008-2014 Dan McGee -# -# Based off original shell script version: -# Copyright (C) 2006-2007 Dan McGee -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -use strict; -use warnings; -use Term::ANSIColor; - -my $myname = 'pacsearch'; -my $myver = '@PACKAGE_VERSION@'; - -sub usage { - print "$myname (pacman) v$myver\n\n"; - print "Perform a pacman search using both the local and the sync databases.\n\n"; - print "Usage: $myname [-n] \n\n"; - print "Options:\n"; - print " -n, --nocolor: turn off coloring\n\n"; - print "Example: $myname ^gnome\n"; -} - -sub version { - printf "%s %s\n", $myname, $myver; - print "Copyright (C) 2008-2014 Dan McGee \n\n"; - print "Based off original shell script version:\n"; - print "Copyright (C) 2006-2007 Dan McGee \n"; -} - -if ($#ARGV lt 0 || $ARGV[0] eq "--help" || $ARGV[0] eq "-h") { - usage; - if ($#ARGV lt 0) { - exit 1; - } - exit 0; -} - -if ($ARGV[0] eq "--version" || $ARGV[0] eq "-V") { - version; - exit 0; -} - -# define formatting variables -my($BLUE, $CYAN, $GREEN, $MAGENTA, $RED, $YELLOW, $BOLD, $RESET); -if ($ARGV[0] eq "--nocolor" || $ARGV[0] eq "-n") { - shift; - $BLUE = ""; - $CYAN = ""; - $GREEN = ""; - $MAGENTA = ""; - $RED = ""; - $YELLOW = ""; - $BOLD = ""; - $RESET = ""; -} else { - $BLUE = color('blue'); - $CYAN = color('cyan'); - $GREEN = color('green'); - $MAGENTA = color('magenta'); - $RED = color('red'); - $YELLOW = color('yellow'); - $BOLD = color('bold'); - $RESET = color('reset'); -} - -# localization -my $LC_INSTALLED = `gettext pacman installed`; - -# Print a "repo/pkgname pkgver (groups) [installed]" line. -# We stick to pacman colors. -sub print_pkg { - my @v = @_; - print "$RESET$BOLD"; - if ( "$v[0]" eq "local" ) { - print "$RED"; - } else { - print "$MAGENTA"; - } - print "$v[0]/$RESET$BOLD$v[1] $GREEN$v[2]$BLUE$v[3]$CYAN$v[4]$RESET\n"; - print "$v[5]"; -} - -sub list_pkg { - my $db = shift; - open (my $out, '-|', 'pacman', $db, '--', @ARGV) or exit 1; - my @pkglist = (); - while ( readline($out) ) { - # We grab the following fields: repo, name, ver, group, installed, and - # desc. We grab leading space for 'group' and 'installed' so that we do - # not need to test if non-empty when printing. - my @pkgfields = /^(.*?)\/(.*?) (.*?)( \(.*?\))?( \[.*\])?$/s; - my $desc = readline($out); - # since 'group' and 'installed' are optional, we should fill it in if - # necessary - $pkgfields[3] = "" if not defined $pkgfields[3]; - $pkgfields[4] = "" if not defined $pkgfields[4]; - $pkgfields[5] = $desc; - push (@pkglist, \@pkgfields); - } - close ($out); - return @pkglist; -} - -my @sync = list_pkg('-Ss', @ARGV); -my %allpkgs = map {$_->[1] . $_->[2] => 1} @sync; -my @query = grep { not $allpkgs{$_->[1] . $_->[2]}} list_pkg('-Qs', @ARGV); -$_->[4] = " [$LC_INSTALLED]" foreach @query; -print_pkg (@{$_}) foreach (@sync, @query); - -#vim: set noet: diff --git a/contrib/rankmirrors.sh.in b/contrib/rankmirrors.sh.in deleted file mode 100644 index 7b50eb29..00000000 --- a/contrib/rankmirrors.sh.in +++ /dev/null @@ -1,234 +0,0 @@ -#!/bin/bash -# -# rankmirrors - read a list of mirrors from a file and rank them by speed -# @configure_input@ -# -# Copyright (c) 2009 Matthew Bruenig -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -# traps interrupt key to spit out pre-interrupt info -trap finaloutput INT - -declare -r myname='rankmirrors' -declare -r myver='@PACKAGE_VERSION@' - -usage() { - echo "${myname} (pacman) v${myver}" - echo - echo "Ranks pacman mirrors by their connection and opening speed. Pacman mirror" - echo "files are located in @sysconfdir@/pacman.d/. It can also rank one mirror if the URL is" - echo "provided." - echo - echo "Usage: ${myname} [options] MIRRORFILE | URL" - echo - echo "Options:" - echo " --version show program's version number and exit" - echo " -h, --help show this help message and exit" - echo " -n NUM number of servers to output, 0 for all" - echo " -t, --times only output mirrors and their response times" - echo " -u, --url test a specific URL" - echo " -v, --verbose be verbose in ouptut" - echo " -r, --repo specify a repository name instead of guessing" - exit 0 -} - -version() { - echo "${myname} (pacman) ${myver}" - echo "Copyright (c) 2009 Matthew Bruenig ." - echo - echo "This is free software; see the source for copying conditions." - echo "There is NO WARRANTY, to the extent permitted by law." - exit 0 -} - -err() { - echo "$1" >&2 - exit 1 -} - -# gettime fetchurl (e.g gettime http://foo.com/core/os/i686/core.db.tar.gz) -# returns the fetching time, or timeout, or unreachable -gettime() { - IFS=' ' output=( $(curl -s -m 10 -w "%{time_total} %{http_code}" "$1" -o/dev/null) ) - (( $? == 28 )) && echo timeout && return - (( ${output[1]} >= 400 || ! ${output[1]} )) && echo unreachable && return - echo "${output[0]}" -} - -# getfetchurl serverurl (e.g. getturl http://foo.com/core/os/i686) -# if $repo is in the line, then assumes core -# if $arch is in the line, then assumes $(uname -m) -# returns a fetchurl (e.g. http://foo.com/core/os/i686/core.db.tar.gz) -ARCH="$(uname -m)" -getfetchurl() { - local strippedurl="${1%/}" - - local replacedurl="${strippedurl//'$arch'/$ARCH}" - if [[ ! $TARGETREPO ]]; then - replacedurl="${replacedurl//'$repo'/core}" - local tmp="${replacedurl%/*}" - tmp="${tmp%/*}" - - local reponame="${tmp##*/}" - else - replacedurl="${replacedurl//'$repo'/$TARGETREPO}" - local reponame="$TARGETREPO" - fi - - if [[ -z $reponame || $reponame = $replacedurl ]]; then - echo "fail" - else - local fetchurl="${replacedurl}/$reponame.db" - echo "$fetchurl" - fi -} - -# This exists to remove the need for a separate interrupt function -finaloutput() { - IFS=$'\n' read -r -d '' -a sortedarray < \ - <(printf '%s\n' "${timesarray[@]}" | LC_COLLATE=C sort) - - # Final output for mirrorfile - numiterator="0" - if [[ $TIMESONLY ]]; then - echo - echo " Servers sorted by time (seconds):" - for line in "${sortedarray[@]}"; do - echo "${line#* } : ${line% *}" - ((numiterator++)) - (( NUM && numiterator >= NUM )) && break - done - else - for line in "${sortedarray[@]}"; do - echo "Server = ${line#* }" - ((numiterator++)) - (( NUM && numiterator >= NUM )) && break - done - fi - exit 0 -} - - -# Argument parsing -[[ $1 ]] || usage -while [[ $1 ]]; do - if [[ ${1:0:2} = -- ]]; then - case "${1:2}" in - help) usage ;; - version) version ;; - times) TIMESONLY=1 ; shift ;; - verbose) VERBOSE=1 ; shift ;; - url) - CHECKURL=1; - [[ $2 ]] || err "Must specify URL."; - URL="$2"; - shift 2;; - repo) - [[ $2 ]] || err "Must specify repository name."; - TARGETREPO="$2"; - shift 2;; - *) err "'$1' is an invalid argument." - esac - elif [[ ${1:0:1} = - ]]; then - - if [[ ! ${1:1:1} ]]; then - [[ -t 0 ]] && err "Stdin is empty." - IFS=$'\n' linearray=( $( -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -shopt -s extglob - -declare -r myname='updpkgsums' -declare -r myver='@PACKAGE_VERSION@' - -usage() { - printf "%s (pacman) v%s\n" "${myname}" "${myver}" - echo - printf "%s will perform an in place update of the checksums in the\n" "${myname}" - echo "path specified by [build file], defaulting to PKGBUILD in the current" - echo "working directory." - echo - printf "Usage: %s [options] [build file]\n" "${myname}" - echo - echo " -h, --help display this help message and exit" - echo " -V, --version display version information and exit" - echo - echo "These options can be passed to makepkg:" - echo " -m, --nocolor disable colorized output messages" -} - -version() { - printf "%s %s\n" "$myname" "$myver" - echo 'Copyright (C) 2012-2013 Dave Reisner ' -} - -die() { - printf "==> ERROR: $1\n" "${@:2}" >&2 - exit 1 -} - -MAKEPKG_OPTS=() -buildfile='PKGBUILD' - -while (( "$#" )); do - case "$1" in - -h|--help) usage; exit ;; - -m|--nocolor) MAKEPKG_OPTS+=("$1"); shift ;; - -V|--version) version; exit ;; - *) buildfile="$1"; break 2 ;; - esac -done - -if [[ ! -f $buildfile ]]; then - die "%s not found or is not a file" "$buildfile" -fi - -# Resolve any symlinks to avoid replacing the symlink with a file. But, we -# have to do this portably -- readlink's flags are inconsistent across OSes. -while [[ -L $buildfile ]]; do - buildfile=$(readlink "$buildfile") - if [[ $buildfile = */* ]]; then - cd "${buildfile%/*}" - buildfile=${buildfile##*/} - fi -done - -# cd into the directory with the build file. This avoids creating random src/ -# directories scattered about the filesystem, and avoids cases where we might -# not be able to write in the $PWD. -if [[ $buildfile = */* ]]; then - cd "${buildfile%/*}" - buildfile=${buildfile##*/} -fi - -# Check $PWD/ for permission to unlink the $buildfile and write a new one -if [[ ! -w . ]]; then - die "No write permission in '%s'" "$PWD" -fi - -# Generate the new sums -export BUILDDIR=$(mktemp -d "${TMPDIR:-/tmp}/updpkgsums.XXXXXX") -newbuildfile=$(mktemp "${TMPDIR:-/tmp}/updpkgsums.XXXXXX") - -trap "rm -rf '$BUILDDIR' '$newbuildfile'" EXIT -newsums=$(makepkg -g -p "$buildfile" "${MAKEPKG_OPTS[@]}") || die 'Failed to generate new checksums' -awk -v newsums="$newsums" ' - /^[[:blank:]]*(md|sha)[[:digit:]]+sums(_[^=]+)?=/,/\)[[:blank:]]*(#.*)?$/ { - if (!w) { - print newsums - w++ - } - next - } - - 1 - END { if (!w) print newsums } -' "$buildfile" > "$newbuildfile" || die 'Failed to write new PKGBUILD' - -# Rewrite the original buildfile. Use cat instead of mv/cp to preserve -# permissions implicitly. -if ! cat -- "$newbuildfile" >"$buildfile"; then - die "Failed to update %s. The file has not been modified." "$buildfile" -fi - -# vim: set noet: diff --git a/contrib/verify-pacman-repo-db.pl b/contrib/verify-pacman-repo-db.pl deleted file mode 100755 index e0a54106..00000000 --- a/contrib/verify-pacman-repo-db.pl +++ /dev/null @@ -1,259 +0,0 @@ -#!/usr/bin/perl -T -use warnings; -use strict; - - -# This is used for the usage output -=pod - -=head1 SYNOPSIS - -verify-pacman-repo-db.pl [options] ... - - Options: - --help, -h Show short help message - --debug Enable debug output - --checksum, -c Verify checksums of packages - --thread, -t Use num threads to verify packages. Default: 1 - NOTE: Each thread uses up to approx. 128MiB of memory - -=cut - -package main; -use Getopt::Long; -use Pod::Usage; - -exit main(); - -sub main { - my %opts = ( - threads => 1, - ); - - Getopt::Long::Configure ("bundling"); - pod2usage(-verbose => 0) if (@ARGV== 0); - GetOptions(\%opts, "help|h", "debug", "threads|t=i", "checksum|c") or pod2usage(2); - pod2usage(0) if $opts{help}; - - my $verifier = Verifier->new(\%opts); - - for my $repodb (@ARGV) { - $verifier->check_repodb($repodb); - } - - $verifier->finalize(); - return $verifier->get_error_status(); -} - -package Verifier; -use Archive::Tar; -use Digest::MD5; -use Digest::SHA; -use File::Basename; -use threads; -use threads::shared; -use Thread::Queue; - -sub new { - my $class = shift; - my $opts = shift; - - my $self :shared = shared_clone({ - opts => \%{$opts}, - package_queue => Thread::Queue->new(), - output_queue => Thread::Queue->new(), - workers => [], - errors => 0, - }); - - bless $self, $class; - $self->start_workers(); - return $self; -} - -sub start_workers { - my $self = shift; - - threads->new(\&_worker_output_queue, $self); - - for (my $i = 0; $i < $self->{opts}->{threads}; $i++) { - my $thr :shared = shared_clone(threads->new(\&_worker_package_queue, $self)); - push @{$self->{workers}}, $thr; - } -} - -sub _worker_package_queue { - my $self = shift; - while (my $workpack = $self->{package_queue}->dequeue()) { - my $dbdata = $self->_parse_db_entry($workpack->{db_desc_content}); - $self->{errors} += $self->_verify_db_entry($workpack->{dirname}, $dbdata); - } -} - -sub _worker_output_queue { - my $self = shift; - while (my $output = $self->{output_queue}->dequeue()) { - print STDERR $output; - } -} - -sub finalize { - my $self = shift; - - $self->{package_queue}->end(); - $self->_join_threads($self->{workers}); - - $self->{output_queue}->end(); - $self->_join_threads([threads->list]); -} - -sub _join_threads { - my $self = shift; - my $threads = shift; - - for my $thr (@{$threads}) { - if ($thr->tid && !threads::equal($thr, threads->self)) { - print "waiting for thread ".$thr->tid()." to finish\n" if $self->{opts}->{debug}; - $thr->join; - } - } -} - -sub get_error_status { - my $self = shift; - - return $self->{errors} > 0; -} - -sub check_repodb { - my $self = shift; - my $repodb = shift; - - my $db = Archive::Tar->new(); - $db->read($repodb); - - my $dirname = dirname($repodb); - my $pkgcount = 0; - - my @files = $db->list_files(); - for my $file_object ($db->get_files()) { - if ($file_object->name =~ m/^([^\/]+)\/desc$/) { - my $package = $1; - $self->{package_queue}->enqueue({ - package => $package, - db_desc_content => $file_object->get_content(), - dirname => $dirname, - }); - $pkgcount++; - } - } - - $self->_debug(sprintf("Queued %d package(s) from database '%s'\n", $pkgcount, $repodb)); -} - -sub _parse_db_entry { - my $self = shift; - my $content = shift; - my %db; - my $key; - - for my $line (split /\n/, $content) { - if ($line eq '') { - $key = undef; - } elsif ($key) { - push @{$db{$key}}, $line; - } elsif ($line =~ m/^%(.+)%$/) { - $key = $1; - } else { - die "\$key not set. Is the db formatted incorrectly?" unless $key; - } - } - return \%db; -} - -sub _output { - my $self = shift; - my $output = shift; - - return if $output eq ""; - - $output = sprintf("Thread %s: %s", threads->self->tid(), $output); - $self->{output_queue}->enqueue($output); -} - -sub _debug { - my $self = shift; - my $output = shift; - $self->_output($output) if $self->{opts}->{debug}; -} - -sub _verify_db_entry { - my $self = shift; - my $basedir = shift; - my $dbdata = shift; - my $ret = 0; - my $output = ""; - - # verify package exists - my $pkgfile = $basedir.'/'.$dbdata->{FILENAME}[0]; - $self->_debug(sprintf("Checking package %s\n", $dbdata->{FILENAME}[0])); - unless (-e $pkgfile) { - $self->_output(sprintf("Package file missing: %s\n", $pkgfile)); - return 1; - } - - $ret += $self->_verify_package_size($dbdata, $pkgfile); - $ret += $self->_verify_package_checksum($dbdata, $pkgfile) if $self->{opts}->{checksum}; - - return $ret; -} - -sub _verify_package_size { - my $self = shift; - my $dbdata = shift; - my $pkgfile = shift; - - my $csize = $dbdata->{CSIZE}[0]; - my $filesize = (stat($pkgfile))[7]; - unless ($csize == $filesize) { - $self->_output(sprintf("Package file has incorrect size: %d vs %d: %s\n", $csize, $filesize, $pkgfile)); - return 1; - } - return 0; -} - -sub _verify_package_checksum { - my $self = shift; - my $dbdata = shift; - my $pkgfile = shift; - - my $md5 = Digest::MD5->new; - my $sha = Digest::SHA->new(256); - - my $content; - # 128MiB to keep random IO low when using multiple threads (only works for large packages though) - my $chunksize = 1024*1024*128; - open my $fh, "<", $pkgfile; - while (read($fh, $content, $chunksize)) { - $md5->add($content); - $sha->add($content); - } - - my $expected_sha = $dbdata->{SHA256SUM}[0]; - my $expected_md5 = $dbdata->{MD5SUM}[0]; - my $got_md5 = $md5->hexdigest; - my $got_sha = $sha->hexdigest; - - unless ($expected_sha eq $got_sha and $expected_md5 eq $got_md5) { - my $output; - $output .= sprintf "Package file has incorrect checksum: %s\n", $pkgfile; - $output .= sprintf "expected: SHA %s\n", $expected_sha; - $output .= sprintf "got: SHA %s\n", $got_sha; - $output .= sprintf "expected: MD5 %s\n", $expected_md5; - $output .= sprintf "got: MD5 %s\n", $got_md5; - $self->_output($output); - return 1; - } - return 0; -} - diff --git a/contrib/vimprojects b/contrib/vimprojects deleted file mode 100644 index e9adfdf1..00000000 --- a/contrib/vimprojects +++ /dev/null @@ -1,25 +0,0 @@ -This is a project file -for the vim-project plugin. -Save it as ~/.vimprojects - -$ pacman -S vim-project -change the pacman path below -$ vim -:Project - -Press \r in the project view -on a project name to generate -the list of files - -pacman=~/devel/pacman/ CD=. filter="*.ac *.am" flags=S { - libalpm=lib/libalpm/ filter="*.c *.h *.am" { - } - pacman=src/pacman/ filter="*.c *.h *.am" { - } - scripts=scripts/ filter="*.sh.in *.py.in *.am" { - } - utils=src/util filter="*.c *.h *.am" { - } - contrib=contrib CD=. { - } -} -- cgit v1.2.3-70-g09d2