fix: noconfirm auto-selects first AUR match

This commit is contained in:
2026-05-08 11:01:02 +01:00
parent d39cdc3fd9
commit 153cca6132
8056 changed files with 1983098 additions and 779 deletions
@@ -0,0 +1,7 @@
#include<stdio.h>
#include"version.h"
int main(void) {
printf("Version is %s.\n", version_string);
return 0;
}
@@ -0,0 +1,14 @@
project('run always', 'c')
version = '1.0.0'
vgen = find_program('version_gen.py')
version_src = custom_target('Version string',
input : 'version.c.in',
output : 'version.c',
command : [vgen, '@INPUT@', '@OUTPUT@', version],
build_always : true,
)
executable('versionprinter', 'main.c', version_src)
@@ -0,0 +1,3 @@
#include"version.h"
const char *version_string = "@VERSION@";
@@ -0,0 +1,3 @@
#pragma once
extern const char *version_string;
@@ -0,0 +1,29 @@
#!/usr/bin/env python3
import sys, os, subprocess
def generate(infile, outfile, fallback):
workdir = os.path.split(infile)[0]
if workdir == '':
workdir = '.'
try:
version = subprocess.check_output(['git', 'describe'], cwd=workdir).decode().strip()
except (subprocess.CalledProcessError, OSError, UnicodeDecodeError):
version = fallback
with open(infile) as f:
newdata = f.read().replace('@VERSION@', version)
try:
with open(outfile) as f:
olddata = f.read()
if olddata == newdata:
return
except OSError:
pass
with open(outfile, 'w') as f:
f.write(newdata)
if __name__ == '__main__':
infile = sys.argv[1]
outfile = sys.argv[2]
fallback = sys.argv[3]
generate(infile, outfile, fallback)