checkin...

This commit is contained in:
brent s 2016-11-13 17:31:08 -05:00
parent abe865d803
commit 4ef52f6db4
4 changed files with 58 additions and 10 deletions

View File

@ -6,6 +6,7 @@ import shutil
import subprocess
import hashlib
import urllib2
import datetime
import git # python-gitpython in AUR
import menu3 # python-menu3 in AUR
import jinja2 # python-jinja in community
@ -84,19 +85,33 @@ def gui_init():
pkg['license'] = list(map(str, license_raw.split()))
pkg['deps'] = []
deps_raw = input("\nWhat does {0} depend on for runtime? if no packages, just hit enter.\nMake sure they correspond to Arch/AUR package names.\nIf you have more than one, separate them by spaces.\n".format(pkg['name']))
pkg['deps'] = list(map(str, deps_raw.split()))
if deps_raw:
pkg['deps'] = list(map(str, deps_raw.split()))
pkg['optdeps'] = []
optdeps_raw = input("\nWhat does {0} optionally depend on (runtime)? if no packages, just hit enter.\nMake sure they correspond to Arch/AUR package names.\nIf you have more than one, separate them by COMMAS.\nThey should follow this format:\npkgname: some reason why it should be installed\n".format(pkg['name']))
pkg['optdeps'] = list(map(str, optdeps_raw.split(',')))
if optdeps_raw:
pkg['optdeps'] = list(map(str, optdeps_raw.split(',')))
pkg['makedeps'] = []
makedeps_raw = input("\nWhat dependencies are required for building/making {0}? If no packages, just hit enter.\nMake sure they correspond to Arch/AUR package names.\nIf you have more than one, separate them by spaces.\n".format(pkg['name']))
pkg['makedeps'] = list(map(str, makedeps_raw.split()))
if makdepds_raw:
pkg['makedeps'] = list(map(str, makedeps_raw.split()))
if pkg['type'] == 'vcs':
pkg['provides'] = [pkg['name'].split('-')[0]]
else:
pkg['provides'] = [pkg['name']]
pkg['provides'] = []
provides_raw = input("\nWhat package names, if any besides itself, does {0} provide?\n(If {0} is a VCS package, do NOT include the non-VCS package name- that's added by default!)\nIf you have more than one, separate them by spaces.\n".format(pkg['name']))
pkg['provides'] = list(map(str, provides_raw.split()))
pkg['conflicts'] = []
if provides_raw:
provides_list = list(map(str, provides_raw.split()))
pkg['provides'] = pkg['provides'] + provides_list
if pkg['type'] == 'vcs':
pkg['conflicts'] = [pkg['name'].split('-')[0]]
else:
pkg['conflicts'] = [pkg['name']]
conflicts_raw = input("\nWhat package names, if any, does {0} conflict with?\n(If {0} is a VCS package, do NOT include the non-VCS package name- that's added by default!)\nIf you have more than one, separate them by spaces.\n".format(pkg['name']))
pkg['conflicts'] = list(map(str, conflicts_raw.split()))
if conflicts_raw:
conflicts_list = list(map(str, conflicts_raw.split()))
pkg['conflicts'] = pkg['conflicts'] + conflicts_list
return(pkg)

## MAKE SURE SOME PREREQS HAPPEN ##
@ -129,17 +144,28 @@ def aur_create(pkg):
# Move the source file
if pkg['srcfile']:
os.rename(pkg['src_dl'], repodir + '/' + pkg['srcfile'])
# And sign with GPG
gpg = gnupg.GPG()
datastream = open(pkg['dl_src'], 'rb')
gpg.sign_file(datastream, keyid = gpgkey[0], detach = True, clearsign = False, output = repodir + '/' + pkg['srcfile'] + '.sig')
datastream.close()
aur.repo.indes.add(pkg['srcfile'] + '.sig')
aur.repo.index.add('PKGBUILD')
# TODO: SRCINFO!
now = datetime.datetime.utcnow().strftime("%a %b %d %H:%M:%S UTC %Y")
srcinfo_out = tpl_env.get_template('srcinfo.j2').render(pkg = pkg, now = now )
with open(repo_dir + "/.SRCINFO", "wb") as srcinfo_file:
srcinfo_file.write(srcinfo_out)
# commit to git
aur_repo.index.commit("initial commit; setting up .gitignores and skeleton PKGBUILD")
# and push...
aur_repo.push()
# and delete the repo
shutil.rmtree(repo_dir)

## ADD THE SUBMODULE TO THE MAIN AUR TREE ##
def aur_submodule(pkg):
print()

pprint.pprint(gui_init())


View File

@ -8,6 +8,6 @@ license=({% for license in pkg['license'] %}'{{ license }}' {% endfor %}){% if p
depends=( {% for dep in pkg['deps'] %}'{{ dep }}' {% endfor %}){% endif %}{% if pkg['optdeps'] is defined and pkg['optdeps']|length > 0 %}
optdepends=( {% for dep in pkg['optdeps'] %}'{{ dep }}' {% endfor %}){% endif %}{% if pkg['makedeps'] is defined and pkg['makedeps']|length > 0 %}
makedepends=( {% for dep in pkg['makedeps'] %}'{{ dep }}' {% endfor %}){% endif %}
_pkgname={{ pkg['name'] }}{% if pkg['provides'] is defined and pkg['provides']|length > 0 %}
provides=( {% for pkg in pkg['provides'] %}'{{ pkg }}' {% endfor %}){% endif %}{% if pkg['conflicts'] is defined and pkg['conflicts']|length > 0 %}
_pkgname={{ pkg['name'] }}{% if pkg['provides'] is defined and pkg['provides']|length > 1 %}
provides=( {% for pkg in pkg['provides'] %}'{{ pkg }}' {% endfor %}){% endif %}{% if pkg['conflicts'] is defined and pkg['conflicts']|length > 1 %}
conflicts=( {% for pkg in pkg['conflicts'] %}'pkg'{% endfor %}){% endif %}

View File

@ -0,0 +1,22 @@
# Generated by aurpkgs
# {{ now }}
pkgbase = {{ pkg['name'] }}
pkgdesc = {{ pkg['desc'] }}
pkgver = {{ pkg['ver'] }}
pkgrel = 1
url = {{ pkg['site'] }}
arch = i686
arch = x86_64
{% for license in pkg['license'] %}
license = {{ license }}
{% endfor %}{% if pkg['deps'] is defined and pkg['deps']|length > 0 %}{% for dep in pkg['deps'] %}
depends = {{ dep }}{% endfor %}{% endif %}{% if pkg['optdeps'] is defined and pkg['optdeps']|length > 0 %}{% for dep in pkg['optdeps'] %}
optdepends = {{ dep }}{% endfor %}{% endif %}
source = {{ pkg['srcurl'] }}{% if pkg['srcfile'] is defined %}
source = {{ pkg['srcfile'] }}{% endif %}
sha512sums = {{ pkg['srchash'] }}{% if pkg['srcfile'] is defined%}
sha512sums = SKIP{% endif %}

pkgname = {{ pkg['name'] }}


View File

@ -8,6 +8,6 @@ license=({% for license in pkg['license'] %}'{{ license }}' {% endfor %}){% if p
depends=( {% for dep in pkg['deps'] %}'{{ dep }}' {% endfor %}){% endif %}{% if pkg['optdeps'] is defined and pkg['optdeps']|length > 0 %}
optdepends=( {% for dep in pkg['optdeps'] %}'{{ dep }}' {% endfor %}){% endif %}{% if pkg['makedeps'] is defined and pkg['makedeps']|length > 0 %}
makedepends=( {% for dep in pkg['makedeps'] %}'{{ dep }}' {% endfor %}){% endif %}
_pkgname={{ pkg['name']|replace("-" + pkg['vcstype'],'') }}{% if pkg['provides'] is defined and pkg['provides']|length > 0 %}
provides=( {% for pkg in pkg['provides'] %}'{{ pkg }}' {% endfor %}){% endif %}{% if pkg['conflicts'] is defined and pkg['conflicts']|length > 0 %}
_pkgname={{ pkg['name']|replace("-" + pkg['vcstype'],'') }}{% if pkg['provides'] is defined and pkg['provides']|length > 1 %}
provides=( {% for pkg in pkg['provides'] %}'{{ pkg }}' {% endfor %}){% endif %}{% if pkg['conflicts'] is defined and pkg['conflicts']|length > 1 %}
conflicts=( {% for pkg in pkg['conflicts'] %}'pkg'{% endfor %}){% endif %}