Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
flatdeb-steam
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
steamrt
flatdeb-steam
Commits
1543f378
Commit
1543f378
authored
6 years ago
by
Simon McVittie
Browse files
Options
Downloads
Patches
Plain Diff
run: Allow apt sources to be manipulated from the command-line
Signed-off-by:
Simon McVittie
<
smcv@collabora.com
>
parent
1ff1ee96
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
run.py
+76
-0
76 additions, 0 deletions
run.py
suites/stretch.yaml
+6
-3
6 additions, 3 deletions
suites/stretch.yaml
with
82 additions
and
3 deletions
run.py
+
76
−
0
View file @
1543f378
...
...
@@ -100,6 +100,38 @@ class AptSource:
self
.
components
=
components
self
.
trusted
=
trusted
@classmethod
def
from_string
(
cls
,
line
,
):
tokens
=
line
.
split
()
trusted
=
False
if
len
(
tokens
)
<
4
:
raise
ValueError
(
'
apt sources must be specified in the form
'
'"
deb http://URL SUITE COMPONENT [COMPONENT...]
"'
)
if
tokens
[
0
]
not
in
(
'
deb
'
,
'
deb-src
'
):
raise
ValueError
(
'
apt sources must start with
"
deb
"
or
"
deb-src
"'
)
if
tokens
[
1
]
==
'
[trusted=yes]
'
:
trusted
=
True
tokens
=
[
tokens
[
0
]]
+
tokens
[
2
:]
elif
tokens
[
1
].
startswith
(
'
[
'
):
raise
ValueError
(
'
The only apt source option supported is [trusted=yes]
'
)
return
cls
(
kind
=
tokens
[
0
],
uri
=
tokens
[
1
],
suite
=
tokens
[
2
],
components
=
tokens
[
3
:],
trusted
=
trusted
,
)
def
__str__
(
self
):
if
self
.
trusted
:
maybe_options
=
'
[trusted=yes]
'
...
...
@@ -301,6 +333,14 @@ class Builder:
parser
.
add_argument
(
'
--architecture
'
,
'
--arch
'
,
'
-a
'
)
parser
.
add_argument
(
'
--runtime-branch
'
,
default
=
self
.
runtime_branch
)
parser
.
add_argument
(
'
--version
'
,
action
=
'
store_true
'
)
parser
.
add_argument
(
'
--replace-apt-source
'
,
action
=
'
append
'
,
default
=
[])
parser
.
add_argument
(
'
--remove-apt-source
'
,
action
=
'
append
'
,
default
=
[])
parser
.
add_argument
(
'
--add-apt-source
'
,
action
=
'
append
'
,
default
=
[])
parser
.
add_argument
(
'
--add-apt-keyring
'
,
action
=
'
append
'
,
default
=
[])
subparsers
=
parser
.
add_subparsers
(
dest
=
'
command
'
,
metavar
=
'
command
'
)
subparser
=
subparsers
.
add_parser
(
...
...
@@ -328,6 +368,12 @@ class Builder:
args
=
parser
.
parse_args
()
for
replacement
in
args
.
replace_apt_source
:
if
'
=
'
not
in
replacement
:
parser
.
error
(
'
--replace-apt-source argument must be in the form
'
'"
LABEL=deb http://ARCHIVE SUITE COMPONENT[...]
"'
)
if
args
.
version
:
print
(
'
flatdeb {}
'
.
format
(
VERSION
))
return
...
...
@@ -382,6 +428,30 @@ class Builder:
)
trusted
=
source
.
get
(
'
apt_trusted
'
,
False
)
if
'
label
'
in
source
:
replaced
=
False
for
replacement
in
reversed
(
args
.
replace_apt_source
):
key
,
value
=
replacement
.
split
(
'
=
'
,
1
)
if
key
==
source
[
'
label
'
]:
tokens
=
value
.
split
()
if
tokens
[
0
]
==
'
both
'
:
self
.
apt_sources
.
append
(
AptSource
.
from_string
(
'
deb
'
+
value
[
4
:]))
self
.
apt_sources
.
append
(
AptSource
.
from_string
(
'
deb-src
'
+
value
[
4
:]))
else
:
self
.
apt_sources
.
append
(
AptSource
.
from_string
(
value
))
replaced
=
True
break
if
replaced
or
source
[
'
label
'
]
in
args
.
remove_apt_source
:
continue
if
source
.
get
(
'
deb
'
,
True
):
self
.
apt_sources
.
append
(
AptSource
(
'
deb
'
,
uri
,
suite
,
...
...
@@ -396,6 +466,12 @@ class Builder:
trusted
=
trusted
,
))
for
addition
in
args
.
add_apt_source
:
self
.
apt_sources
.
append
(
AptSource
.
from_string
(
addition
))
for
addition
in
args
.
add_apt_keyring
:
self
.
apt_keyrings
.
append
(
addition
)
if
self
.
apt_sources
[
0
].
kind
!=
'
deb
'
:
parser
.
error
(
'
First apt source must provide .deb packages
'
)
...
...
This diff is collapsed.
Click to expand it.
suites/stretch.yaml
+
6
−
3
View file @
1543f378
...
...
@@ -5,9 +5,12 @@ apt_components:
debootstrap_script
:
'
stretch'
can_merge_usr
:
true
sources
:
-
apt_uri
:
'
http://deb.debian.org/debian'
-
apt_uri
:
'
http://deb.debian.org/debian-debug'
-
label
:
debian
apt_uri
:
'
http://deb.debian.org/debian'
-
label
:
debug
apt_uri
:
'
http://deb.debian.org/debian-debug'
apt_suite
:
'
*-debug'
-
apt_uri
:
'
http://security.debian.org'
-
label
:
security
apt_uri
:
'
http://security.debian.org'
apt_suite
:
'
*/updates'
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment