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

Release 0.1 #9

Merged
merged 18 commits into from
Feb 12, 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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ all:
echo "Python package doesn't need compiling!"

install:
install src/maps.py $(DESTDIR)$(prefix)/bin/maps
install src/maps $(DESTDIR)$(prefix)/bin/maps
install --mode 644 src/completion.bash $(DESTDIR)$(prefix)/share/bash-completion/completions/maps

clean:
Expand Down
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# MaPS - MaRDI Packaging System

![](https://img.shields.io/badge/version-0.1--beta-blue)
![](https://img.shields.io/badge/version-0.1-blue)

## Introduction

Expand Down
34 changes: 34 additions & 0 deletions pkg/arch/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Maintainer: Aaruni Kaushik <[email protected]>
pkgname=maps-git
pkgver=v0.1.alpha.33.g175bddb
pkgrel=1
pkgdesc="Sandboxing tool for Mathematical Research Software"
arch=('x86_64')
url='https://github.com/aaruni96/maps'
license=('GPL3')
depends=('base-devel'
'cairo'
'git'
'gobject-introspection-runtime'
'python3'
'ostree'
'fuse-overlayfs'
'python-tomli'
)
conflicts=('maps')
provides=('maps')
optdepends=()
makedepends=('git')
source=("git+https://github.com/aaruni96/maps.git")
md5sums=('SKIP')
BUILDENV+=('!check')

pkgver() {
cd "$srcdir/maps"
git describe --tags | sed 's/-/./g'
}

package(){
install -Dm 755 "$srcdir/maps/src/maps" "$pkgdir/usr/bin/maps"
install -Dm 644 "$srcdir/maps/src/completion.bash" "$pkgdir/usr/share/bash-completion/completions/maps"
}
94 changes: 94 additions & 0 deletions pkg/debian/build-debian.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
#!/bin/bash
# step 1: grab the thingy

wget 'http://github.com/aaruni96/maps/archive/refs/heads/devel.tar.gz' -O maps.tar.gz

# unpack

tar -xf maps.tar.gz

# grab version

VERSION=$(cat maps-devel/Readme.md | grep -i 'version' | head -n 1 | sed 's/^.*version-//' | sed 's/-.*//')

#rename

mv -v maps.tar.gz "maps_${VERSION}.orig.tar.gz"
mv -v maps-devel "maps_${VERSION}"

# setup the debian specific dirs

cd "maps_${VERSION}" && mkdir -pv "debian/source"

# add the format version

echo "3.0 (quilt)" > "debian/source/format"

echo "maps (0.1-1) UNRELEASED; urgency=medium

* Initial release.

-- Aaruni Kaushik <[email protected]> Thu, 16 Nov 2023 15:00:38 +0100" > "debian/changelog"

# add control

echo 'Source: maps
Maintainer: Aaruni Kaushik <[email protected]>
Section: misc
Priority: optional
Standards-Version: 4.6.0.1
Build-Depends: debhelper-compat (= 13)

Package: maps
Architecture: amd64
Depends: ${shlibs:Depends}, ${misc:Depends}, libcairo2-dev, git, gcc (>= 11), python3, python3-dev, libgirepository1.0-dev, libostree-dev, fuse-overlayfs, python3-venv, libcap-dev, autoconf, python3-gi, python3-tomli
Description: Mathematical Packaging System
MaPS helps mathematicians create and publish software runtimes,
as well as deploy and run software inside published runtimes.' > "debian/control"

# add copyright

echo 'Format: http://dep.debian.net/deps/dep5
Upstream-Name: MaPS
Source: https://github.com/aaruni96/maps

Files: *
Copyright: 2023 Aaruni Kaushi
License: GPL-3.0

License: GPL-3.0
This package is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this package; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
.
On Debian systems, the complete text of the GNU General
Public License can be found in `/usr/share/common-licenses/GPL-3.`' > "debian/copyright"

# debian.dirs

echo "usr/bin
usr/share/bash-completion/completions" > "debian/maps.dirs"

# debian rules

echo '#!/usr/bin/make -f
%:
dh $@

override_dh_auto_install:
$(MAKE) DESTDIR=$$(pwd)/debian/maps prefix=/usr install' > "debian/rules"

# try building, see what happens

debuild -us -uc

33 changes: 33 additions & 0 deletions pkg/debian/make-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/sh
set -e

do_hash() {
HASH_NAME=$1
HASH_CMD=$2
echo "${HASH_NAME}:"
for f in $(find -type f); do
f=$(echo $f | cut -c3-) # remove ./ prefix
if [ "$f" = "Release" ]; then
continue
fi
echo " $(${HASH_CMD} ${f} | cut -d" " -f1) $(wc -c $f)"
done
}

cat << EOF
Origin: RPTU Testing Repository
Label: RPTU
Suite: stable
Codename: stable
Version: 1.0
Architectures: amd64 arm64 arm7 i386
Components: main
Description: Repo for experimental software made in RPTU Kaiserslauatern
Date: $(date -Ru)
EOF
do_hash "MD5Sum" "md5sum"
do_hash "SHA1" "sha1sum"
do_hash "SHA256" "sha256sum"

# Remember to also run
# dpkg-scanpackages --arch amd64 pool
8 changes: 4 additions & 4 deletions src/completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ _maps_completions()

# if completing the first word
if [ $cword -eq 1 ]; then
COMPREPLY=($(compgen -W "runtime remote package --help -h --command -d --deploy -l --list --repo --reset -r --run -u --uninstall --verbose" -- $cur))
COMPREPLY=($(compgen -W "runtime remote package --help -h --command -d --deploy -l --list --list-local --repo --reset -r --run -u --uninstall --verbose" -- $cur))
return
fi

Expand Down Expand Up @@ -45,15 +45,15 @@ _maps_completions()
fi
# for "package" specified case
if [ "${COMP_WORDS[1]}" == "package" ]; then
if [ $prev == "-c" -o $prev == "--commit" -o $prev == "-i" -o $prev == "--initialize" -o $prev == "-s" -o $prev == "-sandbox" ]; then
if [ $prev == "-c" -o $prev == "--commit" -o $prev == "-i" -o $prev == "--initialize" -o $prev == "-s" -o $prev == "--sandbox" ]; then
COMPREPLY=($(compgen -o dirnames -- "$cur"))
return
fi
fi
fi

if [ $prev == "runtime" ]; then
COMPREPLY=($(compgen -W "-h --help --command -d --deploy -l --list --repo --reset -r --run -u --uninstall --verbose" -- $cur))
COMPREPLY=($(compgen -W "-h --help --command -d --deploy -l --list --list-local --repo --reset -r --run -u --uninstall --verbose" -- $cur))
return
fi

Expand All @@ -65,7 +65,7 @@ _maps_completions()
fi

if [ $prev == "package" ]; then
if [ $cword -eq 3 ]; then
if [ $cword -eq 2 ]; then
COMPREPLY=($(compgen -W "-h --help -c --commit -i --initialize -s --sandbox -v --verbose" -- $cur))
return
fi
Expand Down
18 changes: 10 additions & 8 deletions src/maps
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import gi
gi.require_version("OSTree", "1.0")
from gi.repository import OSTree, GLib

VERSION = '0.1-beta'
VERSION = '0.1'
BWRAP_DEFAULT = f"{os.getenv('HOME')}/.var/org.mardi.maps/deps/bubblewrap/bwrap"
if os.getenv('BWRAP_CMD') is not None:
BWRAP = str(os.getenv('BWRAP_CMD'))
Expand Down Expand Up @@ -89,6 +89,7 @@ def addCLI():
help="Start a sandbox at LOCATION")
parser_pack.add_argument('-v', '--verbose', dest='VERBOSE', action='store_true',
help="enable verbose output")
parser_pack.add_argument('--repo', dest='REPO', help="Repository to use")

return parser, parser_runtime, parser_remote, parser_pack

Expand Down Expand Up @@ -253,7 +254,7 @@ def mode_run(args):
senv["LC_ALL"] = "C"
# ignore SIGINT
signal.signal(signal.SIGINT, signal.SIG_IGN)
rstatus = subprocess.run((f"{BWRAP} --no-int-term --unshare-user --unshare-pid "
rstatus = subprocess.run((f"{BWRAP} --forward-signals --unshare-user --unshare-pid "
f"--bind {DATADIR}/live / --bind {HOME}/Public {senv['HOME']}/Public"
" --die-with-parent --proc /proc --dev /dev --uid 0 --gid 0 "
f"{command}").split(),
Expand Down Expand Up @@ -286,7 +287,7 @@ def download(args, repo, remote, refname, cerror=0):
with concurrent.futures.ThreadPoolExecutor() as executor:
progress = OSTree.AsyncProgress.new()
future = executor.submit(zipped_pull, [repo, remote, refname, progress])
print(f"Downloading {refname} from {remote}")
print(f"Downloading {refname} from {remote}. This may take some time.\nPlease wait...")
while True:
sys.stdout.write(next(SPINNER))
sys.stdout.flush()
Expand Down Expand Up @@ -335,7 +336,7 @@ def uninstall_runtime(repo, args):
if VERBOSE:
print("Marking branch for deletion from repo...")
repo.set_ref_immediate(remote, runtime, None, None)
repo.prune(OSTree.RepoPruneFlags(0), -1, None)
repo.prune(OSTree.RepoPruneFlags(2), -1, None)
break

if not (FLAG1 and FLAG2):
Expand Down Expand Up @@ -454,9 +455,9 @@ def mode_package(repo, args):
senv["LC_ALL"] = "C"
# ignore SIGINT
signal.signal(signal.SIGINT, signal.SIG_IGN)
rstatus = subprocess.run([BWRAP, "--no-int-term", "--unshare-user", "--unshare-pid",
rstatus = subprocess.run([BWRAP, "--forward-signals", "--unshare-user", "--unshare-pid",
"--bind", args.LOCATION, "/", "--proc", "/proc", "--dev", "/dev",
"----die-with-parent", "--uid", "0", "--gid", "0", "bash",
"--die-with-parent", "--uid", "0", "--gid", "0", "bash",
"--norc"],
env=senv, check=False)
if VERBOSE:
Expand All @@ -469,7 +470,7 @@ def mode_package(repo, args):
# we are given TREE and BRANCH. All we have to do is commit TREE to BRANCH
with concurrent.futures.ThreadPoolExecutor() as executor:
future = executor.submit(commit, [repo, args.COMMIT[0], args.COMMIT[1]])
print(f"Committing {args.COMMIT[0]} as {args.COMMIT[1]}")
print(f"Committing {args.COMMIT[0]} as {args.COMMIT[1]}. Please wait...")
while True:
sys.stdout.write(next(SPINNER))
sys.stdout.flush()
Expand Down Expand Up @@ -525,6 +526,7 @@ def reset(runtime):
else:
opts = '-rf'
subprocess.run(f"rm {opts} {DATADIR}/live/*".split(), check=True)
print(f"{runtime} reset successfully!")


# runtime mode: the default path for execution
Expand All @@ -539,7 +541,7 @@ def mode_runtime(repo, args):
refs = list(repo.list_refs()[1].keys())
if refs:
for ref in sorted(refs):
print(f"{ref.split(':')[1]}")
print(f"{ref.split(':')[-1]}")
elif args.RESET:
reset(args.RESET)
elif args.UNINSTALL:
Expand Down
Loading