remove extra files from 'tracked files'
This commit is contained in:
parent
a7089d248f
commit
10c1866b33
16
conf.json
16
conf.json
|
@ -1,16 +0,0 @@
|
|||
{
|
||||
"user": "borysr",
|
||||
"email": "borysr@gmail.com",
|
||||
"remotes": [
|
||||
{
|
||||
"name": "r",
|
||||
"protocol": "http",
|
||||
"domain": "qstack.pl",
|
||||
"port": "3000",
|
||||
"token_name": "t",
|
||||
"token": "8ee3f1b7980197aeceadee3cf4d980f817d44f06",
|
||||
"group": "1i-2023",
|
||||
"project": "homework"
|
||||
}
|
||||
]
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,81 +0,0 @@
|
|||
|
||||
ARCH=riscv64-unknown-elf
|
||||
GNU_DIR=$(HOME)/riscv/riscv/
|
||||
GNU_BIN=$(GNU_DIR)/bin
|
||||
|
||||
|
||||
CC=$(GNU_BIN)/$(ARCH)-gcc
|
||||
CXX=$(GNU_BIN)/$(ARCH)-g++
|
||||
AS=$(GNU_BIN)/$(ARCH)-as
|
||||
LD=$(GNU_BIN)/$(ARCH)-ld
|
||||
OBJCOPY=$(GNU_BIN)/$(ARCH)-objcopy
|
||||
OBJDUMP=$(GNU_BIN)/$(ARCH)-objdump
|
||||
SIZE=$(GNU_BIN)/$(ARCH)-size
|
||||
AR=$(GNU_BIN)/$(ARCH)-ar
|
||||
RANLIB=$(GNU_BIN)/$(ARCH)-ranlib
|
||||
|
||||
|
||||
CFLAGS+=-ffreestanding
|
||||
CFLAGS+=-fno-pic
|
||||
CFLAGS+=-march=rv32i -mabi=ilp32
|
||||
CFLAGS+= -g
|
||||
|
||||
|
||||
LDFLAGS+=-nostdlib
|
||||
LDFLAGS+=-Wl,-Ttext=0x00000000
|
||||
|
||||
# see: https://github.com/riscv/riscv-gcc/issues/120
|
||||
#LDFLAGS+=-Wl,--no-relax
|
||||
|
||||
|
||||
|
||||
ASFLAGS+=$(CFLAGS)
|
||||
CXXFLAGS+=$(CFLAGS)
|
||||
|
||||
CLEAN_DIRS=$(SUBDIRS:%=clean-%)
|
||||
ALL_DIRS=$(SUBDIRS:%=all-%)
|
||||
|
||||
OBJDUMPFLAGS+=-Mnumeric,no-aliases
|
||||
|
||||
.PHONY: all clean world $(CLEAN_DIRS) $(ALL_DIRS)
|
||||
|
||||
|
||||
%.bin : %
|
||||
$(OBJCOPY) $< -O binary $@
|
||||
|
||||
%.lst : %
|
||||
$(OBJDUMP) $(OBJDUMPFLAGS) -dr --disassemble-all $< > $<.lst
|
||||
|
||||
% : %.o
|
||||
$(LINK.cc) $(LDFLAGS) -o $@ $^ $(LDLIBS)
|
||||
$(SIZE) -x -A $@
|
||||
|
||||
%.s: %.c
|
||||
$(COMPILE.c) -S -o $@ $<
|
||||
|
||||
%.s: %.cc
|
||||
$(COMPILE.cc) -S -o $@ $<
|
||||
|
||||
%.o: %.c
|
||||
$(COMPILE.c) -o $@ $<
|
||||
|
||||
%.o: %.cc
|
||||
$(COMPILE.cc) -o $@ $<
|
||||
|
||||
%.srec: %
|
||||
$(OBJCOPY) $< -O srec $@
|
||||
|
||||
|
||||
|
||||
|
||||
all:: $(ALL_DIRS)
|
||||
|
||||
clean:: $(CLEAN_DIRS)
|
||||
|
||||
$(ALL_DIRS)::
|
||||
$(MAKE) -C $(@:all-%=%) all
|
||||
|
||||
$(CLEAN_DIRS)::
|
||||
$(MAKE) -C $(@:clean-%=%) clean
|
||||
|
||||
world:: clean all
|
|
@ -1,42 +0,0 @@
|
|||
.text
|
||||
.global _start
|
||||
.type _start, @function
|
||||
|
||||
_start:
|
||||
# Initialize global pointer
|
||||
.option push
|
||||
.option norelax
|
||||
la gp, __global_pointer$
|
||||
.option pop
|
||||
|
||||
li sp, 0x1fff0
|
||||
|
||||
# Clear the bss segment
|
||||
la a0, __bss_start
|
||||
la a1, __BSS_END__
|
||||
|
||||
clear_bss:
|
||||
bgeu a0, a1, finish_bss
|
||||
sb x0, 0(a0)
|
||||
addi a0, a0, 1
|
||||
beq x0, x0, clear_bss
|
||||
finish_bss:
|
||||
|
||||
nop //!
|
||||
|
||||
call main
|
||||
|
||||
nop //!
|
||||
|
||||
# abort execution here
|
||||
ebreak
|
||||
|
||||
.section .rodata
|
||||
alfabet:
|
||||
.string "abcdefghijklmnopqrstuwxyz"
|
||||
slowo:
|
||||
|
||||
.section .data
|
||||
wynik:
|
||||
.string "mpabi"
|
||||
.space 26 # rezerwuje 26 bajtów dla wyniku, zainicjowane na 0
|
|
@ -1,39 +0,0 @@
|
|||
.text
|
||||
.global _start
|
||||
.type _start, @function
|
||||
|
||||
_start:
|
||||
# Initialize global pointer
|
||||
.option push
|
||||
.option norelax
|
||||
la gp, __global_pointer$
|
||||
.option pop
|
||||
|
||||
# Initialize stack pointer from linker script symbol
|
||||
la sp, __stack_top
|
||||
|
||||
# Clear the BSS segment
|
||||
la a0, __bss_start
|
||||
la a1, __bss_end
|
||||
|
||||
clear_bss:
|
||||
bgeu a0, a1, finish_bss
|
||||
sb x0, 0(a0)
|
||||
addi a0, a0, 1
|
||||
j clear_bss
|
||||
finish_bss:
|
||||
|
||||
call main
|
||||
|
||||
ebreak
|
||||
|
||||
.section .rodata
|
||||
|
||||
alfabet:
|
||||
.string "abcdefghijklmnopqrstuwxyz"
|
||||
slowo:
|
||||
|
||||
.section .data
|
||||
wynik:
|
||||
.string "mpabi"
|
||||
.space 26 # rezerwuje 26 bajtów dla wyniku, zainicjowane na 0
|
|
@ -1,43 +0,0 @@
|
|||
MEMORY
|
||||
{
|
||||
RAM (wx) : ORIGIN = 0x0, LENGTH = 128K
|
||||
}
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.text :
|
||||
{
|
||||
*(.text*)
|
||||
*(.rodata*)
|
||||
} > RAM
|
||||
|
||||
.data :
|
||||
{
|
||||
*(.data*)
|
||||
} > RAM
|
||||
|
||||
.bss :
|
||||
{
|
||||
*(.bss*)
|
||||
*(COMMON)
|
||||
} > RAM
|
||||
|
||||
/* Add stack at the end of RAM */
|
||||
. = ALIGN(4);
|
||||
_end = .;
|
||||
PROVIDE(end = .);
|
||||
|
||||
/* Define stack size and location */
|
||||
_stack_size = 0x4000; /* Example stack size: 16KB */
|
||||
_stack_end = ORIGIN(RAM) + LENGTH(RAM); /* End of RAM */
|
||||
_stack_start = _stack_end - _stack_size; /* Calculate start of the stack */
|
||||
.stack (NOLOAD) :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
. = . + _stack_size;
|
||||
. = ALIGN(4);
|
||||
_sp = .;
|
||||
} > RAM
|
||||
|
||||
PROVIDE(__stack = _sp);
|
||||
}
|
|
@ -1,67 +0,0 @@
|
|||
/* Linker script for a system with 128KB RAM starting at 0x10000 */
|
||||
MEMORY
|
||||
{
|
||||
RAM (wx) : ORIGIN = 0x0000, LENGTH = 128K
|
||||
}
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
/* Place code and readonly data at the beginning of RAM */
|
||||
.text :
|
||||
{
|
||||
*(.text*)
|
||||
*(.rodata*)
|
||||
} > RAM
|
||||
|
||||
/* Place initialized data right after the .text section */
|
||||
.data :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
*(.data*)
|
||||
} > RAM
|
||||
|
||||
/* Uninitialized data (BSS) follows initialized data */
|
||||
.bss :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
__bss_start = .;
|
||||
*(.bss*)
|
||||
*(COMMON)
|
||||
. = ALIGN(4);
|
||||
__bss_end = .;
|
||||
} > RAM
|
||||
|
||||
/* Define heap start right after bss */
|
||||
. = ALIGN(4);
|
||||
__heap_start = .;
|
||||
PROVIDE(heap_start = __heap_start);
|
||||
|
||||
/* Leave space for the heap by not explicitly defining its end */
|
||||
/* The heap grows towards the stack */
|
||||
|
||||
/* Reserve space for the stack at the end of RAM */
|
||||
/* Let's say we want a 16KB stack */
|
||||
. = ALIGN(4);
|
||||
__stack_size = 16K; /* Size of the stack */
|
||||
__stack_top = ORIGIN(RAM) + LENGTH(RAM); /* Top of the stack */
|
||||
__stack_start = __stack_top - __stack_size; /* Start of the stack */
|
||||
.stack (NOLOAD) :
|
||||
{
|
||||
. = __stack_start;
|
||||
. += __stack_size; /* Allocate space for the stack */
|
||||
. = ALIGN(4);
|
||||
} > RAM
|
||||
|
||||
PROVIDE(__stack = __stack_top);
|
||||
PROVIDE(stack_top = __stack_top);
|
||||
PROVIDE(stack_start = __stack_start);
|
||||
|
||||
/* Heap end is dynamically located at the start of the stack */
|
||||
__heap_end = __stack_start;
|
||||
PROVIDE(heap_end = __heap_end);
|
||||
|
||||
/* End of RAM usage */
|
||||
. = ALIGN(4);
|
||||
_end = .;
|
||||
PROVIDE(end = _end);
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
MEMORY
|
||||
{
|
||||
RAM (wx) : ORIGIN = 0x10000, LENGTH = 128K
|
||||
}
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.text : { *(.text*) } > RAM
|
||||
.rodata : { *(.rodata*) } > RAM
|
||||
.data : { *(.data*) } > RAM
|
||||
.bss : { *(.bss*) } > RAM
|
||||
_end = .; /* Definiuje koniec sekcji danych, może być używane do określenia rozmiaru sterty */
|
||||
}
|
111
igit-borys.py
111
igit-borys.py
|
@ -1,111 +0,0 @@
|
|||
import argparse
|
||||
import json
|
||||
import sys
|
||||
import subprocess
|
||||
import os
|
||||
from datetime import datetime
|
||||
|
||||
DEFAULT_CONFIG = {
|
||||
"user": "borysr",
|
||||
"email": "borysr@gmail.com",
|
||||
"remotes": [{
|
||||
"name": "r", # Zaktualizowano z "default" na "mpabi"
|
||||
"protocol": "http",
|
||||
"domain": "qstack.pl",
|
||||
"port": "3000",
|
||||
"token_name": "t",
|
||||
"token": "8ee3f1b7980197aeceadee3cf4d980f817d44f06",
|
||||
"group": "1i-2023",
|
||||
"project": "homework"
|
||||
}]
|
||||
}
|
||||
|
||||
def load_or_create_config(config_file, args):
|
||||
config_exists = os.path.exists(config_file) and os.stat(config_file).st_size != 0
|
||||
if config_exists:
|
||||
with open(config_file, 'r') as file:
|
||||
config = json.load(file)
|
||||
else:
|
||||
config = DEFAULT_CONFIG.copy()
|
||||
|
||||
# Znajdź istniejące zdalne repozytorium o podanej nazwie
|
||||
remote = next((remote for remote in config['remotes'] if remote['name'] == args.remote), None)
|
||||
|
||||
# Jeśli istnieje zdalne repozytorium i podano argumenty związane z konfiguracją zdalnego repozytorium
|
||||
if remote:
|
||||
for field in ['protocol', 'domain', 'port', 'token_name', 'token', 'group', 'project']:
|
||||
# Aktualizuj tylko, jeśli argument został jawnie podany
|
||||
if getattr(args, field, None) is not None:
|
||||
remote[field] = getattr(args, field)
|
||||
|
||||
# Jeśli zdalne repozytorium nie istnieje, ale podano nazwę, tworzymy nowe zdalne repozytorium
|
||||
elif args.remote:
|
||||
new_remote = {'name': args.remote}
|
||||
for field in ['protocol', 'domain', 'port', 'token_name', 'token', 'group', 'project']:
|
||||
new_remote[field] = getattr(args, field, DEFAULT_CONFIG['remotes'][0].get(field, ''))
|
||||
if new_remote[field] == None:
|
||||
new_remote[field] = DEFAULT_CONFIG['remotes'][0].get(field, '')
|
||||
config['remotes'].append(new_remote)
|
||||
|
||||
# Aktualizuj informacje o użytkowniku i email, tylko jeśli zostały podane
|
||||
if getattr(args, 'user', None):
|
||||
config['user'] = args.user
|
||||
if getattr(args, 'email_domain', None):
|
||||
config['email'] = f"{args.user}@{args.email_domain}"
|
||||
|
||||
# Zapisz zmodyfikowaną konfigurację
|
||||
with open(config_file, 'w') as file:
|
||||
json.dump(config, file, indent=4)
|
||||
|
||||
return config
|
||||
|
||||
|
||||
def init_git_repo(config):
|
||||
user_name = config['user']
|
||||
user_email = config['email']
|
||||
branch_name = f"{user_name}-{datetime.now().strftime('%Y-%m-%d')}"
|
||||
|
||||
if subprocess.run(["git", "rev-parse", "--git-dir"], stderr=subprocess.DEVNULL).returncode != 0:
|
||||
subprocess.run(["git", "init"])
|
||||
subprocess.run(["git", "config", "user.name", user_name])
|
||||
subprocess.run(["git", "config", "user.email", user_email])
|
||||
subprocess.run(["git", "checkout", "-b", branch_name])
|
||||
print("Git repository initialized.")
|
||||
else:
|
||||
print("Already inside a Git repository. Skipping initialization.")
|
||||
|
||||
remotesFromList = str(subprocess.run(["git", "remote", "-v"], capture_output=True).stdout)
|
||||
remotesFromList = remotesFromList.replace('b\'', "").replace('\'', "").split('\\n')
|
||||
for rm in remotesFromList:
|
||||
name = rm.split("\\t")[0]
|
||||
subprocess.run(["git", "remote", "remove", name], stderr=subprocess.DEVNULL)
|
||||
|
||||
for remote in config['remotes']:
|
||||
remote_url = f"{remote['protocol']}://{remote['token_name']}:{remote['token']}@{remote['domain']}:{remote['port']}/{remote['group']}/{remote['project']}"
|
||||
# Usunięcie i ponowne dodanie zdalnego repozytorium, jeśli jest zaktualizowane
|
||||
#subprocess.run(["git", "remote", "remove", remote['name']], stderr=subprocess.DEVNULL)
|
||||
subprocess.run(["git", "remote", "add", remote['name'], remote_url])
|
||||
print(f"Remote '{remote['name']}' added or updated.")
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="Git repository initializer with custom configuration.")
|
||||
parser.add_argument("--user", help="User name")
|
||||
parser.add_argument("--email_domain", help="Email domain")
|
||||
parser.add_argument("--config", help="Path to the JSON config file", default="conf.json")
|
||||
parser.add_argument("--remote", help="Name of the remote to add or update")
|
||||
parser.add_argument("--protocol", help="Remote protocol")
|
||||
parser.add_argument("--domain", help="Remote domain")
|
||||
parser.add_argument("--port", help="Remote port")
|
||||
parser.add_argument("--token_name", help="Remote token name")
|
||||
parser.add_argument("--token", help="Remote token")
|
||||
parser.add_argument("--group", help="Group name")
|
||||
parser.add_argument("--project", help="Project name")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
config = load_or_create_config(args.config, args)
|
||||
init_git_repo(config)
|
||||
print("Git repository initialized and configured based on the provided configuration.")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
Loading…
Reference in New Issue