Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
pmaports
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
187
Issues
187
List
Boards
Labels
Service Desk
Milestones
Merge Requests
31
Merge Requests
31
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Security & Compliance
Security & Compliance
Dependency List
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
postmarketOS
pmaports
Commits
adaf4f3c
Verified
Commit
adaf4f3c
authored
Nov 06, 2018
by
Martijn Braam
Committed by
Oliver Smith
Nov 27, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added build helper for sr.ht
parent
0188930f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
94 additions
and
0 deletions
+94
-0
.sr.ht/install_pmbootstrap.sh
.sr.ht/install_pmbootstrap.sh
+26
-0
.sr.ht/submit.py
.sr.ht/submit.py
+68
-0
No files found.
.sr.ht/install_pmbootstrap.sh
0 → 100755
View file @
adaf4f3c
#!/bin/sh -e
# Copyright 2018 Oliver Smith
# SPDX-License-Identifier: GPL-3.0-or-later
# Config: pmbootstrap tag (or branch)
tag
=
"master"
# Get download URL and pmaports path
url
=
"https://gitlab.com/postmarketOS/pmbootstrap/-/archive/
$tag
/pmbootstrap-
$tag
.tar.bz2"
pmaports
=
"
$(
cd
$(
dirname
$0
)
/..
;
pwd
-P
)
"
# Set up binfmt_misc
echo
"Setting-up binfmt_misc"
sudo
mount
-t
binfmt_misc none /proc/sys/fs/binfmt_misc
# Download pmbootstrap (to /tmp/pmbootstrap)
echo
"Downloading pmbootstrap (
$tag
):
$url
"
cd
/tmp
wget
-q
-O
"pmb.tar.bz2"
"
$url
"
tar
-xf
"pmb.tar.bz2"
mv
pmbootstrap-
*
pmbootstrap
# Install to $PATH and init
sudo ln
-s
/tmp/pmbootstrap/pmbootstrap.py /usr/bin/pmbootstrap
echo
"Initializing pmbootstrap with aports at '
$pmaports
'"
yes
''
| pmbootstrap
-q
--aports
"
$pmaports
"
init
.sr.ht/submit.py
0 → 100755
View file @
adaf4f3c
#!/usr/bin/env python3
import
os
import
argparse
import
json
import
requests
commit_default
=
os
.
environ
[
'COMMIT'
]
if
'COMMIT'
in
os
.
environ
else
None
parser
=
argparse
.
ArgumentParser
(
description
=
'tool to send data to build.postmarketos.org'
)
parser
.
add_argument
(
'--token'
,
default
=
'~/.pmos_token'
,
help
=
'secret token to authenticate to build.postmarketos.org'
)
parser
.
add_argument
(
'--host'
,
default
=
'https://build.postmarketos.org'
,
help
=
'base url for the submit request'
)
parser
.
add_argument
(
'--commit'
,
default
=
commit_default
,
help
=
'value for the X-Commit header'
)
parser
.
add_argument
(
'--arch'
,
default
=
'x86_64'
,
help
=
'value for the X-Arch header'
)
parser
.
add_argument
(
'--id'
,
help
=
'id of the job in the queue, value for the X-Id header'
)
parser
.
add_argument
(
'--json'
,
action
=
'store_true'
,
help
=
'datafile is a json file, do extra sanity checks'
)
parser
.
add_argument
(
'--verbose'
,
'-v'
,
action
=
'store_true'
,
help
=
'show more debug info'
)
parser
.
add_argument
(
'endpoint'
,
help
=
'endpoint name on the API'
)
parser
.
add_argument
(
'datafile'
,
help
=
'file containing the data to be submitted'
)
args
=
parser
.
parse_args
()
if
args
.
commit
is
None
:
print
(
'You need to either add COMMIT to the environment or specify --commit'
)
exit
(
1
)
if
args
.
verbose
:
print
(
'Environment:'
)
print
(
os
.
environ
)
with
open
(
os
.
path
.
expanduser
(
args
.
token
),
encoding
=
"utf-8"
)
as
handle
:
secret
=
handle
.
read
()
.
strip
()
url
=
'{}/api/{}'
.
format
(
args
.
host
,
args
.
endpoint
)
if
args
.
json
:
# Send contents of file as HTTP POST with json payload
with
open
(
args
.
datafile
,
encoding
=
"utf-8"
)
as
handle
:
data
=
handle
.
read
()
data
=
json
.
loads
(
data
)
print
(
'Sending json data to {}'
.
format
(
url
))
response
=
requests
.
post
(
url
,
json
=
data
,
headers
=
{
'X-Secret'
:
secret
,
'X-Commit'
:
args
.
commit
,
'X-Arch'
:
args
.
arch
})
else
:
filename
=
os
.
path
.
basename
(
args
.
datafile
)
# Send contents of file as HTTP POST with multipart/formdata payload
files
=
{
'file'
:
(
filename
,
open
(
args
.
datafile
,
'rb'
),
'application/octet-stream'
)
}
print
(
'Uploading {} to {}'
.
format
(
filename
,
url
))
response
=
requests
.
post
(
url
,
files
=
files
,
headers
=
{
'X-Secret'
:
secret
,
'X-Commit'
:
args
.
commit
,
'X-Arch'
:
args
.
arch
,
'X-Id'
:
args
.
id
})
if
response
.
status_code
>
399
:
print
(
'Error occured:'
)
print
(
response
.
content
.
decode
())
exit
(
1
)
else
:
print
(
response
.
content
.
decode
())
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment