-
Notifications
You must be signed in to change notification settings - Fork 185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor attempt while providing upstream downstream #262
base: master
Are you sure you want to change the base?
Conversation
@FeralInteractive Please provide upstream-way of building (ideally with explanation) for this binary so that i can make a proper logic, thank you ^-^ EDIT: I know how to build it, but having more informations for in-code docs and logic for known issues would be appreciated |
I'm not sure I understand the goals here or what's missing in the current repo - could you explain a little more? |
@mdiluz I want to change following
I would also like to add exherbo and devuan downstream to upstream if you want it otherwise i will keep it in my fork, because keeping this on upstream repos seems to make it easier to work with. ^-^ Assuming it being welcomed? |
@@ -0,0 +1,3 @@ | |||
# Downstream management | |||
|
|||
Directory dedicated for various package managers to recognize this repository into a package |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WTF no please don't do something like this upstream. Packaging files should be downstream, always. It only bloats the repo and you can't even directly change something in there since you don't have write rights.
all: | ||
# FIXME: Add nice message | ||
@ exit 2 | ||
|
||
build: | ||
@ bootstrap.sh build | ||
|
||
exherbo-docker-test: | ||
@ sudo docker run \ | ||
--interactive \ | ||
--tty \ | ||
--volume "$$(pwd)/dist/paludis/exherbo:/var/repositories/gamemode" \ | ||
exherbo/exherbo-x86_64-pc-linux-gnu-base \ | ||
bash -c "true \ | ||
&& chown root:tty /dev/tty \ | ||
&& usermod -a -G tty paludisbuild \ | ||
&& printf '%s\n' \ | ||
\"format = e\" \ | ||
\"location = \"\$$\{root\}/var/db/paludis/repositories/gamemode\"\" \ | ||
\"sync = file:///var/repositories/gamemode\" \ | ||
> /etc/paludis/repositories/gamemode.conf \ | ||
&& cat /etc/paludis/repositories/gamemode.conf \ | ||
&& cave sync \ | ||
&& cave resolve games-utils/gamemode \ | ||
" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding a second build system (Make) just for a test that could be run in a script is a bad idea, it ruins automatic build systems like debhelper on Debian.
# Simple bootstrap script to build and run the daemon | ||
#!/bin/sh | ||
# Originally created by FeralInteractive <https://www.feralinteractive.com/en/> under BSD 3-Clause License <https://github.com/FeralInteractive/gamemode/blob/master/LICENSE.txt> in 2017 bootstrap.sh | ||
# Performed full refact by Jacob Hrbek <[email protected]> under GPLv3 license <https://www.gnu.org/licenses/gpl-3.0.en.html> in 05.07.2020 04:28:55 CET |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ignoring the need for this, please don't put license clutter in here. The file was already licensed under a BSD license, so no need to change that to a GPL license.
|
||
# Maintainer info | ||
UPSTREAM="https://github.com/FeralInteractive" | ||
MAINTAINER="https://github.com/Kreyren" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's nice that you want to maintain this file, but I think that's something you should ask beforehand since you don't have write access to this repo.
if command -v "$UNAME" 1>/dev/null; then | ||
unameKernel="$("$UNAME" -s)" | ||
edebug "Identified the kernel as '$unameKernel" | ||
case "$unameKernel" in | ||
Linux) | ||
KERNEL="$unameKernel" | ||
|
||
# Restart polkit so we don't get pop-ups whenever we pkexec | ||
if systemctl list-unit-files |grep -q polkit.service; then | ||
sudo systemctl try-restart polkit | ||
# Assume Linux Distro and release | ||
# NOTICE(Krey): We are expecting this to return a lowercase value | ||
if command -v "$LSB_RELEASE" 1>/dev/null; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it is necessary to identify either the kernel or the distro
# Used to prefix logs with timestemps, uses ISO 8601 by default | ||
logPrefix="[ $(date -u +"%Y-%m-%dT%H:%M:%SZ") ] " | ||
# Path to which we will save logs | ||
# NOTICE(Krey): To avoid storing file '$HOME/.some-name.sh.log' we are stripping the '.sh' here | ||
logPath="${XDG_DATA_HOME:-$HOME/.local/share}/${myName%%.sh}.log" | ||
|
||
# inicialize the script in logs | ||
"$PRINTF" '%s\n' "Started $myName on $("$UNAME" -s) at $(date -u +"%Y-%m-%dT%H:%M:%SZ")" >> "$logPath" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly this is so small there is no need to log this. Users can simply copy the output (this script isn't intended for packaging).
name: Shell | ||
|
||
# Relevant to events - https://help.github.com/en/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows | ||
on: | ||
pull_request: | ||
types: [synchronize, opened, reopened, ready_for_review] | ||
paths: | ||
- '**.sh' | ||
|
||
jobs: | ||
# Linting | ||
lint: | ||
runs-on: ubuntu-latest | ||
container: debian:stable | ||
steps: | ||
- name: Installing dependencies.. | ||
run: | | ||
# Sync repos | ||
# Check for git | ||
if ! apt list --installed 2>/dev/null | grep -qP "^git\/stable.*"; then | ||
# Check if we can install git | ||
if ! apt list | grep -qP "^git\/stable.*"; then | ||
apt update | ||
elif apt list | grep -qP "^git\/stable.*"; then | ||
true | ||
else | ||
exit 255 | ||
fi | ||
# Install git | ||
apt install -y git | ||
elif apt list --installed 2>/dev/null | grep -qP "^git\/stable.*"; then | ||
true | ||
else | ||
exit 255 | ||
fi | ||
# Check for shellcheck | ||
if ! apt list --installed 2>/dev/null | grep -qP "^shellcheck\s{1}-.*"; then | ||
# Check if we can install shellcheck | ||
if ! apt list | grep -qP "^shellcheck\s{1}-.*"; then | ||
apt update | ||
elif apt list | grep -qP "^shellcheck\s{1}-.*"; then | ||
true | ||
else | ||
exit 255 | ||
fi | ||
# Install shellcheck | ||
apt install -y shellcheck | ||
elif apt list --installed 2>/dev/null | grep -qP "^shellcheck\s{1}-.*"; then | ||
true | ||
else | ||
exit 255 | ||
fi | ||
- name: Pulling git dir.. | ||
uses: actions/checkout@v2 | ||
- name: Processing files.. | ||
# Make sure that bash is used | ||
shell: bash | ||
run: | | ||
cd "$GITHUB_WORKSPACE" | ||
|
||
# Process files | ||
## NOTICE: Do not use for loop to avoid pitfall https://mywiki.wooledge.org/BashPitfalls#pf1 | ||
git --git-dir="$GITHUB_WORKSPACE/.git" ls-files -z -- '*.sh' | while IFS= read -rd '' file; do | ||
printf 'linting shell file %s\n' "$file" | ||
shellcheck --external-sources --shell=sh "$file" | ||
done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides a spellcheck being pretty much useless wasted computation time, this can be easily integrated into travis in like two lines.
name: Exherbo | ||
|
||
# Relevant to events - https://help.github.com/en/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows | ||
on: | ||
pull_request: | ||
types: [synchronize, opened, reopened, ready_for_review] | ||
paths: | ||
- 'dist/paludis/exherbo' | ||
|
||
jobs: | ||
# Linting | ||
lint: | ||
runs-on: ubuntu-latest | ||
container: exherbo:exherbo-x86_64-pc-linux-gnu-base | ||
steps: | ||
- name: FIXME | ||
# Make sure that bash is used | ||
shell: bash | ||
run: | | ||
printf '%s\n' "FIXME" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't want to downplay Exherbo - but before a CI for Exherbo is added, one might add Fedora or Arch first since they have a much bigger user and developer base, and thus are more representative if the CI would actually fail.
name: bootstrap-test | ||
|
||
# Relevant to events - https://help.github.com/en/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows | ||
on: | ||
pull_request: | ||
types: [synchronize, opened, reopened, ready_for_review] | ||
paths: | ||
- 'bootstrap.sh' | ||
|
||
jobs: | ||
# Linting | ||
lint: | ||
runs-on: ubuntu-latest | ||
container: debian:stable | ||
steps: | ||
- name: FIXME | ||
# Make sure that bash is used | ||
shell: bash | ||
run: | | ||
printf '%s\n' "FIXME" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Already included into travis, no need for this.
else | ||
exit 255 | ||
fi | ||
# Check for shellcheck |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to run the spellcheck twice.
First of all, I don't think that there is a lack of "QA" for this tiny bootstrap script. And gamemode it doesn't have a hard dependency on systemd either. It does require
So in this case, you might not want to run meson builddir -Dwith-sd-bus-provider=elogind --prefix=/usr
meson compile -C builddir
sudo meson install -C builddir And restart |
I largely agree with @stephanlachnit here, there's no reason to put downstream stuff into the upstream repo. I also want to comment a little:
This is a reason to delete it, not add 500 lines of code. And maybe this is simply a reminder to move the travis stuff over to github actions now that those are allowed for free. |
I guess it should simply be pointed out that In this instance, it will install into As such, the script should probably be removed, or the defaults should change. In short term, the install instruction should put a clear message that |
Yeah I guess it's a good idea to make it more clear that the scripts is only intended if you install from source. Switching to |
DO_NOT_MERGE: Work in progress
Currently it is painful to build this project due to the lack of code quality assurance in bootstrap.sh and seemingly hard dependency on systemd, this is an attempt to resolve it while providing upstream downstream for paludis made for Exherbo Linux and Exheredrey.