clean repo...

This commit is contained in:
brent s 2016-06-24 18:47:32 -04:00
commit b225b1a609
5 changed files with 283 additions and 0 deletions

18
.gitignore vendored Normal file
View File

@ -0,0 +1,18 @@
.*.swp
*.pkg.tar.xz
src/
pkg/
*.tar
*.tar.bz2
*.tar.xz
*.tar.gz
*.tgz
*.txz
*.tbz
*.tbz2
*.zip
*.run
*.7z
*.rar
*.deb
*.pkg.tar.xz.sig

1
TODO Normal file
View File

@ -0,0 +1 @@
acpidump burp cjdcmd-git clamav-milter cryptcat gummiboot irssi-script-sasl irssi-script-spellcheck irssi-script-trackbar rpm socat2 vim-netrw

167
_bin/new.package.sh Executable file
View File

@ -0,0 +1,167 @@
#!/bin/bash
set -e


## SETTINGS ##

GPGKEY='748231EBCBD808A14F5E85D28C004C2F93481F6B' # https://wiki.archlinux.org/index.php/PKGBUILD#validpgpkeys
MAINTNAME='brent s. <bts[at]square-r00t[dot]net>'
PKGBUILD_DIR='/opt/dev/arch'

# These shouldn't be touched.
PKGNAME=${1}
PKGVER="${2}"


## SANITY ##
set +e # disable bail-on-error because we want a non-zero if a package name is not right, etc.
mkdir -p ${PKGBUILD_DIR}
cd ${PKGBUILD_DIR}
echo "${PKGNAME}" | egrep -Eq '^([a-z0-9\_]|-)+$'
if [[ "${?}" -ne '0' ]];
then
echo "ERROR: That does not seem to be a valid package name!"
exit
fi
echo "${PKGVER}" | egrep -Eq '^([0-9\.]|git|svn)+$'
if [[ "${?}" -ne '0' ]];
then
echo "ERROR: That does not seem to be a valid package version!"
echo "Acceptable values are numbers, .'s, or simply 'git'."
exit
elif [[ "${PKGVER}" == 'git' || "${PKGVER}" == 'svn' ]];
then
PKGVER='0.0.00001'
GITPKG='y'
fi

if [[ -z "${2}" ]];
then
echo "USAGE: ${0} <package name> <package version>"
exit
fi
set -e

echo "Will create a package named ${PKGNAME} with initial version of ${PKGVER}. Press enter to continue, or ctrl-C to quit."
read PKGCHK


## CREATE THE REPO/PACKAGE IN AUR ##
git clone aur@aur.archlinux.org:${PKGNAME}
#mkdir -p ${PKGNAME}

## DROP IN A VANILLA PKGBUILD ##
cat > ${PKGNAME}/PKGBUILD << EOF
# Maintainer: ${MAINTNAME}
validpgpkeys=('${GPGKEY}')
pkgname=${PKGNAME}
pkgver=${PKGVER}
pkgrel=1
pkgdesc="%%SOME DESCRIPTION HERE%%"
arch=('i686' 'x86_64')
url="%%SOME URL HERE%%"
license=('%%SOME LICENSE(S) HERE%%')
install=
changelog=
noextract=()
#depends=('%%RUNTIME DEPENDENCIES HERE%%')
#optdepends=('%%OPTIONAL DEPENDENCIES HERE (pkg: why needed)%%')
#makedepends=('%%BUILDTIME DEPENDENCIES HERE%%')
EOF

if [[ -n "${GITPKG}" ]];
then
STRIPPKG=$(echo "${PKGNAME}" | sed -re 's/-(git|svn)//g')
else
STRIPPKG="${PKGNAME}"
fi

cat >> ${PKGNAME}/PKGBUILD << EOF
_pkgname=${STRIPPKG}
#_pkgname2='%%OPTIONAL SHORTHAND PACKAGE NAME%%'
EOF


if [[ -n "${GITPKG}" ]];
then
cat >> ${PKGNAME}/PKGBUILD << EOF
source=("\${_pkgname}::git+https://github.com/\${_pkgname}/\${_pkgname}.git")
sha512sums=('SKIP')
EOF
else
cat >> ${PKGNAME}/PKGBUILD << EOF
source=("https://\${pkgname}.com/\${_pkgname}/\${_pkgname}-\${pkgver}.tar.gz"
"\${_pkgname}-\${pkgver}.tar.gz.sig")
sha512sums=('cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e'
'SKIP')
EOF
fi

cat >> ${PKGNAME}/PKGBUILD << EOF
provides=("\${_pkgname}")
#conflicts=("\${_pkgname}")
EOF

if [[ -n "${GITPKG}" ]];
then
cat >> ${PKGNAME}/PKGBUILD << EOF
pkgver() {
cd "\${srcdir}/\${_pkgname}"
(
printf "r%s.%s" "\$(git rev-list --count HEAD)" "\$(git rev-parse --short HEAD)"
#( set -o pipefail
# git describe --long --tags 2>/dev/null | sed 's/\\([^-]*-g\\)/r\\1/;s/-/./g' ||
# printf "r%s.%s" "\$(git rev-list --count HEAD)" "\$(git rev-parse --short HEAD)"
#)
)
}
EOF
fi

cat >> ${PKGNAME}/PKGBUILD << EOF

build() {
cd "\${srcdir}/\${_pkgname}/src"
make prefix=\${pkgdir}/usr
}

package() {
install -D -m755 \${srcdir}/\${_pkgname}/src/\${_pkgname2} \${pkgdir}/usr/bin/\${_pkgname2}
install -D -m644 \${srcdir}/\${_pkgname}/docs/README.html.en \${pkgdir}/usr/share/doc/\${_pkgname}/README.html
}
EOF

cd ${PKGNAME}
cat >> $(git rev-parse --git-dir)/hooks/pre-commit << EOF
#!/bin/bash

/usr/bin/mksrcinfo

git add .SRCINFO
EOF

chmod 700 $(git rev-parse --git-dir)/hooks/pre-commit

cat >> ${PKGNAME}/.gitignore << EOF
*/
.*.swp
*.pkg.tar.xz
src/
pkg/
*.tar
*.tar.bz2
*.tar.xz
*.tar.gz
*.tgz
*.txz
*.tbz
*.tbz2
*.zip
*.run
*.7z
*.rar
*.deb
EOF


cd ${PKGNAME}

45
_bin/sign.pkg.sh Normal file
View File

@ -0,0 +1,45 @@
#!/bin/bash



GPGKEY='748231EBCBD808A14F5E85D28C004C2F93481F6B'
PKGBUILD_DIR='/opt/dev/arch'


if [[ -n "${1}" ]];
then
PKGNAME="${1}"
else
PKGNAME="$(pwd | sed -e 's@^.*/@@g')"
fi

if [ ! -d "${PKGBUILD_DIR}/${PKGNAME}" ];
then
echo "ERROR: ${PKGNAME} is not a package directory in ${PKGBUILD_DIR}!"
exit
fi

if [ ! -f "${PKGBUILD_DIR}/${PKGNAME}/PKGBUILD" ];
then
echo "ERROR: ${PKGNAME} is a package directory in ${PKGBUILD_DIR}, but it is missing a PKGBUILD file!"
fi

cd "${PKGBUILD_DIR}/${PKGNAME}"

rm *.sig # don't delete sigs, we want to keep them in case they exist for co-maintainers...? see line 34
updpkgsums

for i in $(find ./ -maxdepth 1 -type f | egrep -Ev '(*\.install|PKGBUILD|Changelog|\.gitignore)');
do
# i need a better way of dealing with sigs from co-maintainers.
# when i think of something, comment out line 29 and uncomment the commented lines below to add sigs
#cp ${i}.sig ${i}.sig.old
gpg -u 0x${GPGKEY} --detach-sign ${i}
#cat ${i}.sig.old >> ${i}.sig
#rm ${i}.sig.old
done

updpkgsums

git add --all .
git commit -m "version bump, etc."

52
_bin/submodule.update.sh Normal file
View File

@ -0,0 +1,52 @@
#!/bin/bash

PKGBUILD_DIR='/opt/dev/arch'


cd "${PKGBUILD_DIR}"
if [ ! -d "${PKGBUILD_DIR}" ];
then
mkdir -p $(dirname "${PKGBUILD_DIR}")
git init "${PKGBUILD_DIR}"
elif [ ! -d "${PKGBUILD_DIR}/.git" ];
then
echo "ERROR: ${PKGBUILD_DIR} does not seem to be a git directory."
exit
fi

if [ -n "${1}" ];
then
PKGNAME="${1}"
echo "This script will delete ${PKGNAME} and pull a fresh copy of it from the AUR, adding it as a submodule to this directory."
echo "Hit enter to continue, or ctrl-c to exit."
read DELCHK
else
PKGNAME='ALL'
echo "This script will delete ANY/ALL existing working tree directories that match the name of an existing repository you have access to in the AUR!"
echo "Hit enter to continue, or ctrl-c to exit."
read DELCHK
fi

URI='aur@aur.archlinux.org'

function freshenrepo () {

REPO="${1}"

# Check to see if it exists. https://stackoverflow.com/questions/12641469/list-submodules-in-a-git-repository
git config --file .gitmodules --get-regexp path | awk '{ print $2 }' | egrep -Eq "^${REPO}"
if [[ "${?}" -eq '0' ]];
then
# We remove it so we can grab a fresh copy directly from the AUR.
#https://stackoverflow.com/questions/1260748/how-do-i-remove-a-submodule
git rm --cached ${REPO}
git submodule deinit ${REPO}
}

if
for i in $(ssh aur@aur.archlinux.org list-repos | sed -e 's/[[:space:]]*//g' | sort);
do
freshenrepo ${i}
done