mirror of
https://github.com/release-engineering/dist-git.git
synced 2025-02-23 23:12:55 +00:00
config: setup_git_package
This commit is contained in:
parent
a58d00d2aa
commit
f229591d4e
2 changed files with 40 additions and 20 deletions
|
@ -50,6 +50,10 @@ def _get_conf(cp, section, option, default):
|
||||||
config = ConfigParser()
|
config = ConfigParser()
|
||||||
config.read("/etc/dist-git/dist-git.conf")
|
config.read("/etc/dist-git/dist-git.conf")
|
||||||
PKGDB_URL = _get_conf(config, "acls", "pkgdb_acls_url", "")
|
PKGDB_URL = _get_conf(config, "acls", "pkgdb_acls_url", "")
|
||||||
|
EMAIL_DOMAIN = _get_conf(config, "notifications", "email_domain", "fedoraproject.org")
|
||||||
|
PKG_OWNER_EMAILS = _get_conf(config, "notifications", "pkg_owner_emails",
|
||||||
|
"$PACKAGE-owner@fedoraproject.org,scm-commits@lists.fedoraproject.org")
|
||||||
|
|
||||||
|
|
||||||
GIT_FOLDER = '/srv/git/rpms/'
|
GIT_FOLDER = '/srv/git/rpms/'
|
||||||
MKBRANCH = '/usr/local/bin/mkbranch'
|
MKBRANCH = '/usr/local/bin/mkbranch'
|
||||||
|
@ -179,7 +183,8 @@ def branch_package(pkgname, requested_branches, existing_branches):
|
||||||
# Create the devel branch if necessary
|
# Create the devel branch if necessary
|
||||||
exists = os.path.exists(os.path.join(GIT_FOLDER, '%s.git' % pkgname))
|
exists = os.path.exists(os.path.join(GIT_FOLDER, '%s.git' % pkgname))
|
||||||
if not exists or 'master' not in existing_branches:
|
if not exists or 'master' not in existing_branches:
|
||||||
_invoke(SETUP_PACKAGE, [pkgname])
|
emails = PKG_OWNER_EMAILS.replace("$PACKAGE", pkgname)
|
||||||
|
_invoke(SETUP_PACKAGE, ["--pkg-owner-emails", emails, "--email-domain", EMAIL_DOMAIN, pkgname])
|
||||||
if 'master' in requested_branches:
|
if 'master' in requested_branches:
|
||||||
requested_branches.remove('master') # SETUP_PACKAGE creates master
|
requested_branches.remove('master') # SETUP_PACKAGE creates master
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
# All local changes will be lost.
|
# All local changes will be lost.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Figure out the environment we're running in
|
# Figure out the environment we're running in
|
||||||
GITROOT=/srv/git/rpms
|
GITROOT=/srv/git/rpms
|
||||||
|
|
||||||
|
@ -29,43 +30,57 @@ GIT_SSH_URL="ssh://localhost"
|
||||||
Usage() {
|
Usage() {
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
Usage:
|
Usage:
|
||||||
$0 <package_name>
|
$0 [OPTIONS] <package_name>
|
||||||
|
|
||||||
Creates a new repo for <package_name>
|
Creates a new repo for <package_name>
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
-h,--help This help message
|
-h,--help This help message
|
||||||
|
--email-domain DOMAIN Email domain for git hooks.maildomain
|
||||||
|
--pkg-owner-emails EMAILS Comma separated list of emails for
|
||||||
|
git hooks.mailinglist
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ $# -gt 2 ]; then
|
# fail with no arguments
|
||||||
|
if [ $# -eq 0 ]; then
|
||||||
Usage
|
Usage
|
||||||
exit -1
|
exit -1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# parse the arguments
|
OPTS=$(getopt -o h -l help -l email-domain: -l pkg-owner-emails: -- "$@")
|
||||||
while [ -n "$1" ] ; do
|
if [ $? != 0 ]
|
||||||
case "$1" in
|
then
|
||||||
-h | --help )
|
exit 1
|
||||||
Usage
|
fi
|
||||||
exit 0
|
|
||||||
;;
|
|
||||||
|
|
||||||
* )
|
eval set -- "$OPTS"
|
||||||
PACKAGE="$1"
|
|
||||||
;;
|
while true ; do
|
||||||
|
case "$1" in
|
||||||
|
-h | --help) Usage; exit 0;;
|
||||||
|
--email-domain) EMAIL_DOMAIN=$2; shift 2;;
|
||||||
|
--pkg-owner-emails) PKG_OWNER_EMAILS=$2; shift 2;;
|
||||||
|
--) shift; break;;
|
||||||
esac
|
esac
|
||||||
shift
|
|
||||||
done
|
done
|
||||||
|
|
||||||
# I hate shell scripting. I'm sure the above is totally wrong
|
# fail when more or none packages are specified
|
||||||
|
if ! [ $# -eq 1 ]; then
|
||||||
# check the arguments
|
|
||||||
if [ -z "$PACKAGE" ] ; then
|
|
||||||
Usage
|
Usage
|
||||||
exit -1
|
exit -1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
PACKAGE=$1
|
||||||
|
|
||||||
|
if [ -z $EMAIL_DOMAIN ]; then
|
||||||
|
EMAIL_DOMAIN=fedoraproject.org
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z $PKG_OWNER_EMAILS ]; then
|
||||||
|
PKG_OWNER_EMAILS=$PACKAGE-owner@fedoraproject.org,scm-commits@lists.fedoraproject.org
|
||||||
|
fi
|
||||||
|
|
||||||
# Sanity checks before we start doing damage
|
# Sanity checks before we start doing damage
|
||||||
[ $VERBOSE -gt 1 ] && echo "Checking package $PACKAGE..."
|
[ $VERBOSE -gt 1 ] && echo "Checking package $PACKAGE..."
|
||||||
if [ -f $GITROOT/$PACKAGE.git/refs/heads/master ] ; then
|
if [ -f $GITROOT/$PACKAGE.git/refs/heads/master ] ; then
|
||||||
|
@ -95,8 +110,8 @@ mkdir -p $GITROOT/$PACKAGE.git
|
||||||
pushd $GITROOT/$PACKAGE.git >/dev/null
|
pushd $GITROOT/$PACKAGE.git >/dev/null
|
||||||
git init -q --shared --bare
|
git init -q --shared --bare
|
||||||
echo "$PACKAGE" > description # This is used to figure out who to send mail to.
|
echo "$PACKAGE" > description # This is used to figure out who to send mail to.
|
||||||
git config --add hooks.mailinglist "$PACKAGE-owner@fedoraproject.org,scm-commits@lists.fedoraproject.org"
|
git config --add hooks.mailinglist $PKG_OWNER_EMAILS
|
||||||
git config --add hooks.maildomain fedoraproject.org
|
git config --add hooks.maildomain $EMAIL_DOMAIN
|
||||||
popd >/dev/null
|
popd >/dev/null
|
||||||
|
|
||||||
# Now clone that repo and create the .gitignore and sources file
|
# Now clone that repo and create the .gitignore and sources file
|
||||||
|
|
Loading…
Add table
Reference in a new issue