Standardizing for PKGBUILD

This commit is contained in:
DarkFeather 2019-04-30 15:53:55 -05:00
parent e7c96f98bb
commit 4b383874b6
8 changed files with 291 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
pkg/
src/

View File

@ -249,3 +249,18 @@ function getmagnetlink {
echo '<'$magnetlink'>'
fi
}
### AniNIX Foundation help ###
function findaninixcheckouts {
find /usr/local/src/ -type f -name config -exec egrep -l 'url[[:space:]]=[[:space:]]/srv/foundation|url[[:space:]]=[[:space:]]https://aninix.net|url[[:space:]]=[[:space:]]([a-zA-Z0-9])+@aninix.net' {} \; 2>/dev/null | sed 's#.git/config$##'
}
function aninixgitstatus {
for i in `findaninixcheckouts`; do
infoheader BEGIN REPORT for "$i"
git -C "$i" status
infoheader END REPORT
echo
done
}

135
C/ll.h Normal file
View File

@ -0,0 +1,135 @@
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#define DEBUG 0
/* This is a library for a singly-linked list with O(n) searchtime.
It is intended to be used for small, changing datasets in the bot
*/
//The struct specification
typedef struct {
char * data;
void * next;
} LLElem;
/* Print the list */
void ll_printall(LLElem * root) {
if (DEBUG) printf("printing\n");
while (root != NULL) {
printf("%s\n",root->data);
root = root->next;
}
putchar('\n');
}
/* Returns 1 on true, 0 on false */
int ll_contains(char * data, LLElem * root) {
if (data == NULL) return 0;
while (root != NULL) {
if (!strcmp(root->data,data)) {
return 1;
}
root = root->next;
}
return 0;
}
/* Add an element and return the new tree */
LLElem * ll_add(char * new_data, LLElem * root) {
char * newString = calloc(strlen(new_data),1);
strncpy(newString,new_data,strlen(new_data));
if (root == NULL) {
root = calloc(sizeof(LLElem),1);
root->data = newString;
root->next = NULL;
if (DEBUG) printf("Creating root %d with:\n%s\n:done\n\n",root,newString);
if (DEBUG) ll_printall(root);
return root;
} else {
if (!ll_contains(new_data,root)) {
LLElem * curr = root;
while (curr->next != NULL) {
curr = (LLElem *) curr->next;
}
curr->next = calloc(sizeof(LLElem),1);
curr = (LLElem *) curr->next;
curr->data = newString;
curr->next = NULL;
if (DEBUG) printf("Appending to %d:\n%s\n:done\n\n",root,newString);
if (DEBUG) ll_printall(root);
return root;
}
}
return NULL;
}
/* Remove an element */
LLElem * ll_remove(char * old_data, LLElem * root) {
LLElem * tmp;
//TODO paused here -- need to rewrite.
return NULL;
}
/* Delete and free the contents of a list */
void ll_removeall(LLElem * root) {
while (root != NULL) {
root = ll_remove(root->data,root);
}
}
/* read the contents of a file, comma-delimited, into a file */
LLElem * ll_read(char * filename, int * count) {
FILE * fd = fopen(filename,"r");
if (fd == NULL) {
if (DEBUG) printf("No file found.\n");
return NULL;
} else {
if (DEBUG) printf("File opened.\n");
}
char * buffer, * tmp;
int fcount = 0;
fseek(fd,0,SEEK_END);
size_t size = ftell(fd);
fseek(fd,0,SEEK_SET);
buffer=calloc(size,1);
fread(buffer,size,1,fd);
char entry[size]; //create a buffer with the maximum size
bzero(entry,size);//zero the buffer
int ccount=0; //ccount is the current character location.
int tmpsize=0; //tmpsize will be the size of the buffer
LLElem * root = NULL;
while (ccount < size) {
if (buffer[ccount]==10) {
entry[tmpsize]=0;
//if (DEBUG) printf("%s -> --%s--\n",entry,buffer);
if (entry != NULL && strlen(entry)) {
fcount++;
root = ll_add(entry,root);
//if (DEBUG) printf("Added --%s--\n\n",entry);
tmpsize=0;
}
} else {
entry[tmpsize] = buffer[ccount];
tmpsize++;
}
ccount++;
}
if (count != NULL) *count=fcount;
return root;
}
/* Print the list */
char * ll_get(int num,LLElem * root) {
if (DEBUG) printf("printing\n");
while (num-- && root != NULL) {
if (DEBUG) printf("%s,",root->data);
root = root->next;
}
if (num && root != NULL) return root->data;
return NULL;
}

View File

@ -20,6 +20,7 @@ namespace AniNIX.Shared {
String line;
while (true) {
line = fileReader.ReadLine();
ReportMessage.Log(Verbosity.Verbose,String.Format("Read line: {0}",line));
if (line == null) break;
//Ignore comments prefixed with '#'
if (line.StartsWith("#")) continue;
@ -57,6 +58,7 @@ namespace AniNIX.Shared {
}
return foundEntries;
}
/// <summary>
/// If a conf section doesn't use key=value syntax, use this to grab the lines instead.
/// </summary>

35
Java/PortTest.java Normal file
View File

@ -0,0 +1,35 @@
import java.io.ObjectOutputStream;
import java.net.Socket;
import java.io.PrintWriter;
import java.io.IOException;
public class PortTest {
private String host;
private int port;
public PortTest(String host, int port) {
this.host=host;
this.port=port;
}
public void Test() {
try {
Socket socket = new Socket(this.host,this.port);
PrintWriter out = new PrintWriter(socket.getOutputStream(),true);
out.println("");
System.out.println("OK");
} catch (Exception e) { System.out.println(e.getMessage()); }
}
public static void main(String[] args) {
try {
PortTest t = new PortTest(args[0],Integer.parseInt(args[1]));
t.Test();
}
catch (Exception e) {
System.out.println(e.getMessage());
}
}
}

27
LICENSE Normal file
View File

@ -0,0 +1,27 @@
# http://www.wtfpl.net/about/
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.
ANINIX ADDENDUM
Trademark Pending 2017 (https://aninix.net/irc/)
The "AniNIX" name and |> logo is trademark-pending as of 2017. All
AniNIX materials can be reproduced and re-used, though you must
contact the admins of the network to get written permission to use
the AniNIX name.
Attribution is appreciated for other materials but not legally
required or necessary.

29
Makefile Normal file
View File

@ -0,0 +1,29 @@
installdir = ${pkgdir}/opt/aninix/SharedLibraries/
targets = Bash C CSharp
compile:
@echo Nothing to compile.
install: compile
mkdir -p ${installdir}
for target in ${targets}; do rsync -avzl "$$target" ${installdir}; done
make checkperm
clean:
for i in `cat .gitignore`; do rm -Rf $$i; done
uninstall:
rm -Rf ${installdir}
test:
@echo Nothing to do.
checkperm:
chmod -R 0755 ${installdir}
chown root:root ${installdir}
diff: ${INSTALLFIR}
diff -rc . ${installdir}
reverse:
rsync -avzlp ${installdir} .

46
PKGBUILD Normal file
View File

@ -0,0 +1,46 @@
# Maintainer: Shikoba Kage <darkfeather@aninix.net>
pkgname=aninix-shared-libraries
pkgver=0.1.e7c96f9
pkgver() {
printf "0.1.""$(git rev-parse --short HEAD)"
}
pkgrel=1
epoch=
pkgdesc="AniNIX::Foundation/SharedLibraries \\\\ Shared code libraries that all the AniNIX projects should use -- this should reduce error and code duplication"
arch=("x86_64")
url="https://aninix.net/foundation/SharedLibraries"
license=('custom')
groups=()
depends=('mono>=5.0.0' 'curl' 'grep' 'bash>=4.4' 'git>=2.13')
makedepends=('make>=4.2')
checkdepends=()
optdepends=()
provides=('aninix-shared-libraries')
conflicts=()
replaces=()
backup=()
options=()
install=
changelog=
source=()
noextract=()
md5sums=()
validpgpkeys=()
prepare() {
git pull
}
build() {
make -C ..
}
check() {
printf 'quit\n\n' | make -C "${srcdir}/.." test
}
package() {
export pkgdir="${pkgdir}"
make -C .. install
install -D -m644 ../LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}