Store dose3 Packages and Sources in a secure way using tempfile
This commit is contained in:
parent
e68e7e31e8
commit
d6cd69e9d2
1 changed files with 12 additions and 4 deletions
16
run.py
16
run.py
|
@ -16,6 +16,8 @@ import subprocess
|
||||||
import yaml
|
import yaml
|
||||||
import daklib_arch
|
import daklib_arch
|
||||||
import debarch
|
import debarch
|
||||||
|
import tempfile
|
||||||
|
import os
|
||||||
|
|
||||||
abi_from_abitable = [row[0] for row in debarch._load_table('/usr/share/dpkg/abitable')]
|
abi_from_abitable = [row[0] for row in debarch._load_table('/usr/share/dpkg/abitable')]
|
||||||
abi_from_ostable = [row[0].split('-')[0] for row in debarch._load_table('/usr/share/dpkg/ostable')]
|
abi_from_ostable = [row[0].split('-')[0] for row in debarch._load_table('/usr/share/dpkg/ostable')]
|
||||||
|
@ -55,20 +57,26 @@ def dpkg_arch_matches(arch, wildcard):
|
||||||
env={}) == 0
|
env={}) == 0
|
||||||
|
|
||||||
def dose_arch_matches(arch, wildcard):
|
def dose_arch_matches(arch, wildcard):
|
||||||
with open("/tmp/sources", "w") as f:
|
f1 = tempfile.NamedTemporaryFile(mode='w', delete=False)
|
||||||
f.write("""
|
n1 = f1.name
|
||||||
|
f1.write("""
|
||||||
Package: foo
|
Package: foo
|
||||||
Architecture: %s
|
Architecture: %s
|
||||||
Version: 0.invalid.0
|
Version: 0.invalid.0
|
||||||
"""%(wildcard))
|
"""%(wildcard))
|
||||||
with open("/tmp/packages", "w") as f:
|
f1.close()
|
||||||
f.write("""
|
f2 = tempfile.NamedTemporaryFile(mode='w', delete=False)
|
||||||
|
n2 = f2.name
|
||||||
|
f2.write("""
|
||||||
Package: build-essential
|
Package: build-essential
|
||||||
Architecture: %s
|
Architecture: %s
|
||||||
Version: 0.invalid.0
|
Version: 0.invalid.0
|
||||||
"""%(arch))
|
"""%(arch))
|
||||||
|
f2.close()
|
||||||
data = subprocess.check_output(['dose-builddebcheck', '--deb-native-arch=%s'%arch,
|
data = subprocess.check_output(['dose-builddebcheck', '--deb-native-arch=%s'%arch,
|
||||||
'--successes', '/tmp/packages', '/tmp/sources'])
|
'--successes', '/tmp/packages', '/tmp/sources'])
|
||||||
|
os.unlink(n1)
|
||||||
|
os.unlink(n2)
|
||||||
data = yaml.load(data, Loader=yaml.CBaseLoader)
|
data = yaml.load(data, Loader=yaml.CBaseLoader)
|
||||||
return len(data['report']) == 1
|
return len(data['report']) == 1
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue