Skip to content
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

Improve cloning bwrap #24

Merged
merged 1 commit into from
Nov 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ and this project tries to adhere to [Semantic Versioning](https://semver.org/spe
- Improved logic for uninstall
- Bugfix: interruptible downloads
- Use native overlayfs instead of fuse implementation. Requires Linux kernel 5.11+
- Improved handling of bwrap as a dependency

### Removed

Expand Down
38 changes: 27 additions & 11 deletions src/maps
Original file line number Diff line number Diff line change
Expand Up @@ -126,22 +126,38 @@ def sanity_checks(parsers):

def program_init(repopath):
"""Init function verifies requirements, sets up the repo. Returns the OSTree Repo."""
opt1 = "-q"
opt2 = "1>/dev/null"
opt3 = ""
if VERBOSE:
opt1 = ""
opt2 = ""
opt3 = "-v"
print("Ensuring bubblewrap exists...")
# step 1 : check bwrap is installed
if (BWRAP == BWRAP_DEFAULT) and not os.path.isfile(BWRAP):
print("Bubblewrap was not found, and is being automatically installed....")
# clone and compile bubblewrap
opt1 = "-q"
opt2 = "1>/dev/null"
if VERBOSE:
print("Cloning bubblewrap...")
opt1 = ""
opt2 = ""
subprocess.run(f"git clone {opt1} https://github.com/aaruni96/bubblewrap.git "
f"{BWRAP[0:-15]}", shell=True, check=False)
subprocess.run(f"cd {BWRAP[0:-15]} && git checkout {opt1} ak/sigint", shell=True,
check=True)
# bubblewrap directory exists
# try cd and get fetch
if os.path.isdir(BWRAP[0:-15]):
if VERBOSE:
print("Bubblewrap directory found. Refreshing...")
subprocess.run(f"cd {BWRAP[0:-15]} && git fetch {opt1} --all --prune && git checkout "
f"{opt1} --force ak/sigint && git reset {opt1} --hard ak/sigint",
shell=True, check=True)
if VERBOSE:
print("Deleting _builddir...")
subprocess.run(f"rm -rf {opt3} {BWRAP[0:-15]}/_builddir".split(), check=True)
# bubblewrap directory does not exist
# clone bubblewrap
else:
if VERBOSE:
print("Cloning bubblewrap...")
subprocess.run(f"git clone {opt1} https://github.com/aaruni96/bubblewrap.git "
f"{BWRAP[0:-15]}", shell=True, check=False)
subprocess.run(f"cd {BWRAP[0:-15]} && git checkout {opt1} ak/sigint", shell=True,
check=True)
# compile bwrap
if VERBOSE:
print("Compiling bubblewrap...")
subprocess.run(f"cd {BWRAP[0:-15]} && meson _builddir {opt2} "
Expand Down
Loading