From 4ef52f6db4bd8fef7a3d70cbd9e81cb9a55e0729 Mon Sep 17 00:00:00 2001 From: brent s Date: Sun, 13 Nov 2016 17:31:08 -0500 Subject: [PATCH] checkin... --- _bin/new.package.py | 38 ++++++++++++++++--- .../release/02.pkgmeta.j2 | 4 +- _docs/PKGBUILD.templates.d.python/srcinfo.j2 | 22 +++++++++++ .../vcs/02.pkgmeta.j2 | 4 +- 4 files changed, 58 insertions(+), 10 deletions(-) create mode 100644 _docs/PKGBUILD.templates.d.python/srcinfo.j2 diff --git a/_bin/new.package.py b/_bin/new.package.py index a375cc8..fd86bc1 100755 --- a/_bin/new.package.py +++ b/_bin/new.package.py @@ -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()) diff --git a/_docs/PKGBUILD.templates.d.python/release/02.pkgmeta.j2 b/_docs/PKGBUILD.templates.d.python/release/02.pkgmeta.j2 index d5d7b17..18fb24e 100644 --- a/_docs/PKGBUILD.templates.d.python/release/02.pkgmeta.j2 +++ b/_docs/PKGBUILD.templates.d.python/release/02.pkgmeta.j2 @@ -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 %} diff --git a/_docs/PKGBUILD.templates.d.python/srcinfo.j2 b/_docs/PKGBUILD.templates.d.python/srcinfo.j2 new file mode 100644 index 0000000..a0a4ea0 --- /dev/null +++ b/_docs/PKGBUILD.templates.d.python/srcinfo.j2 @@ -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'] }} + + diff --git a/_docs/PKGBUILD.templates.d.python/vcs/02.pkgmeta.j2 b/_docs/PKGBUILD.templates.d.python/vcs/02.pkgmeta.j2 index 28b8209..74034de 100644 --- a/_docs/PKGBUILD.templates.d.python/vcs/02.pkgmeta.j2 +++ b/_docs/PKGBUILD.templates.d.python/vcs/02.pkgmeta.j2 @@ -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 %}