Create xbps/ and stick package management stuff there.

Also put nomad functions.
This commit is contained in:
Érico Nogueira 2021-03-11 02:33:57 -03:00
parent a2e1002061
commit 51efcfead7
7 changed files with 88 additions and 0 deletions

View File

@ -0,0 +1,14 @@
set -x NOMAD_NAMESPACE '*'
set -x NOMAD_ADDR "https://nomad.s.voidlinux.org"
set -x VAULT_ADDR "https://vault.s.voidlinux.org"
function vault-login
vault login -method=ldap
# can take username=$username parameter
#expires in one day
end
function nomad-token
set -x NOMAD_TOKEN (vault read -field secret_id nomad/creds/apps-admin)
#expires in one hour
end

4
xbps/.local/bin/xclean Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
MASTERDIR=${1:-masterdir}
rm -fr $MASTERDIR/ &&
rm $MASTERDIR

6
xbps/.local/bin/xcreate Executable file
View File

@ -0,0 +1,6 @@
#!/bin/sh
MASTERDIR=masterdir
[ "$1" ] && MASTERDIR=${1:+masterdir-$1}
mktmpdir $MASTERDIR
mkdir $MASTERDIR/tmp
./xbps-src -m $MASTERDIR binary-bootstrap $2

3
xbps/.local/bin/xdirs Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
MASTERDIR=${1:-masterdir}
rm -rf $MASTERDIR/destdir $MASTERDIR/builddir

12
xbps/.local/bin/xfindup Executable file
View File

@ -0,0 +1,12 @@
#!/bin/sh
set +x
PKGLIST="$(xbps-query -l | awk '{print $2}' | xargs -l1 xbps-uhelper getpkgname)"
curl -LO https://a-hel-fi.m.voidlinux.org/void-updates/void-updates.txt
for pkg in $PKGLIST
do
rg "^$pkg " void-updates.txt
done
rg -C 10 ericonr void-updates.txt

49
xbps/.local/bin/xgitsub Executable file
View File

@ -0,0 +1,49 @@
#!/usr/bin/env python3
# by Johnnynator
import git
import argparse
def basename (arg):
pos = arg.rfind("/")
if pos > -1:
arg = arg[pos+1:]
pos = arg.rfind(".")
if pos > -1:
arg = arg[:pos]
return arg
def getUrls (repo):
for submodule in repo.submodules:
if submodule.url.startswith("https://github.com"):
url = submodule.url
if url.endswith(".git"):
url=url[:-4]
print(url + "/archive/${" + basename(submodule.path).replace('-', '_') + "_commit}.tar.gz")
else:
print("Unknown URL, don't know how to rewrite")
exit(1)
def getCommits (repo):
for submodule in repo.submodules:
print(basename(submodule.path).replace('-', '_') + "_commit=" + submodule.hexsha)
def constructPostExtract (repo):
print("post_extract() {")
for sub in repo.submodules:
print("\trmdir -v ${wrksrc}/" + sub.path)
print("\tmv ${wrksrc}/../" + basename(sub.url) + "-${" + basename(sub.path).replace('-', '_') + "_commit} ${wrksrc}/" + sub.path)
print("}")
parser = argparse.ArgumentParser(description='Print some git submodule infos')
parser.add_argument('path', nargs=1, help='path to a git repo')
parser.add_argument('-p', '--print-post-extract', dest='post_extract', action='store_const', const=True, default=False, help='print post_extract function for template')
parser.add_argument('--no-urls', dest='print_urls', action='store_const', const=False, default=True, help='print no distfile urls')
args = parser.parse_args()
repo = git.Repo(args.path[0])
if(args.post_extract):
constructPostExtract(repo)
else:
getCommits(repo)
if(args.print_urls):
getUrls(repo)