Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3661932
roles/freebsd-repo/ports/files/parse-portshaker-merged-ports.py
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
dereckson
Oct 16 2024, 18:58
2024-10-16 18:58:42 (UTC+0)
Size
1 KB
Referenced Files
None
Subscribers
None
roles/freebsd-repo/ports/files/parse-portshaker-merged-ports.py
View Options
#!/usr/bin/env python3
# -------------------------------------------------------------
# portshaker merged ports -> pkglist
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# Description: Read portshaker merged ports file
# Output a pkglist for Poudriere
# License: BSD-2-Clause
# -------------------------------------------------------------
import
os
import
sys
# -------------------------------------------------------------
# Poudriere helper methods
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
POUDRIERE_CONFIG_ROOT
=
"/usr/local/etc/poudriere.d"
def
get_ports_tree_config_dir
(
name
):
return
POUDRIERE_CONFIG_ROOT
+
"/ports/"
+
name
def
is_ports_tree_exists
(
name
):
return
os
.
path
.
exists
(
get_ports_tree_config_dir
(
name
))
def
get_ports_tree_path
(
name
):
mnt_path
=
get_ports_tree_config_dir
(
name
)
+
"/mnt"
with
open
(
mnt_path
)
as
fd
:
return
fd
.
readline
()
.
strip
()
# -------------------------------------------------------------
# Portshaker helper methods
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
def
parse_port
(
line
):
return
line
.
strip
()
.
split
(
":"
)[
1
]
def
get_portshaker_merged_ports
(
name
):
try
:
ports_path
=
get_ports_tree_path
(
name
)
+
"/.portshaker-merged-ports"
except
FileNotFoundError
:
return
[]
return
[
parse_port
(
line
)
for
line
in
open
(
ports_path
)]
# -------------------------------------------------------------
# Application entry point
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
def
run
(
tree_name
):
ports
=
get_portshaker_merged_ports
(
tree_name
)
for
port
in
ports
:
print
(
port
)
if
__name__
==
"__main__"
:
argc
=
len
(
sys
.
argv
)
if
argc
<
2
:
print
(
f
"Usage: {sys.argv[0]} <ports tree name>"
,
file
=
sys
.
stderr
)
sys
.
exit
(
1
)
run
(
sys
.
argv
[
1
])
File Metadata
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2199386
Default Alt Text
roles/freebsd-repo/ports/files/parse-portshaker-merged-ports.py (1 KB)
Attached To
Mode
P364 roles/freebsd-repo/ports/files/parse-portshaker-merged-ports.py
Attached
Detach File
Event Timeline
Log In to Comment