Skip to content

Commit

Permalink
py3: fixup file mode
Browse files Browse the repository at this point in the history
py3 uses 0o644 instead of 0644, py2 supports both, so use first one.

Signed-off-by: Manuel Traut <[email protected]>
Reviewed-by: Torben Hohn <[email protected]>
  • Loading branch information
Manuel Traut committed Dec 18, 2017
1 parent 562c3c2 commit 892f872
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 21 deletions.
12 changes: 6 additions & 6 deletions elbepack/cdroms.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,17 +178,17 @@ def mk_binary_cdrom(rfs, arch, codename, init_codename, xml, target, log, cdrom_
# to make the installer accept this as a CDRom
repo_fs = Filesystem( repo_path )
repo_fs.mkdir_p (".disk")
repo_fs.write_file (".disk/base_installable", 0644, "main\n")
repo_fs.write_file (".disk/base_components", 0644, "main\n")
repo_fs.write_file (".disk/cd_type", 0644, "not_complete\n")
repo_fs.write_file (".disk/info", 0644, "elbe inst cdrom - full cd\n")
repo_fs.write_file (".disk/base_installable", 0o644, "main\n")
repo_fs.write_file (".disk/base_components", 0o644, "main\n")
repo_fs.write_file (".disk/cd_type", 0o644, "not_complete\n")
repo_fs.write_file (".disk/info", 0o644, "elbe inst cdrom - full cd\n")
repo_fs.symlink (".", "debian", allow_exists=True)
repo_fs.write_file ("md5sum.txt", 0644, "")
repo_fs.write_file ("md5sum.txt", 0o644, "")

# write source xml onto cdrom
xml.xml.write (repo_fs.fname ('source.xml'))

target_repo_fs = Filesystem( target_repo_path )
target_repo_fs.write_file (".aptignr", 0644, "")
target_repo_fs.write_file (".aptignr", 0o644, "")

return repo.buildiso( os.path.join( target, "bin-cdrom.iso" ) )
2 changes: 1 addition & 1 deletion elbepack/commands/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def run_command( argv ):
write_template(os.path.join(out_path,o), os.path.join(init_template_dir, t), d, linebreak=False )

if t in make_executable:
os.chmod( os.path.join(out_path,o), 0755 )
os.chmod( os.path.join(out_path,o), 0o755 )

shutil.copyfile( args[0],
os.path.join(out_path, "source.xml" ) )
Expand Down
4 changes: 2 additions & 2 deletions elbepack/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def set_postbuild (self, builddir, postbuild_file):
with open (builddir+"/postbuild.sh", 'w') as dst:
copyfileobj (postbuild_file, dst)

os.chmod (builddir+"/postbuild.sh", 0755)
os.chmod (builddir+"/postbuild.sh", 0o755)
dos2unix (builddir+"/postbuild.sh")

return self._update_project_file( s, builddir, "postbuild.sh",
Expand Down Expand Up @@ -179,7 +179,7 @@ def set_savesh (self, builddir, savesh_file):
with open (builddir+"/save.sh", 'w') as dst:
copyfileobj (savesh_file, dst)

os.chmod (builddir+"/save.sh", 0755)
os.chmod (builddir+"/save.sh", 0o755)
dos2unix (builddir+"/save.sh")

return self._update_project_file( s, builddir, "save.sh",
Expand Down
2 changes: 1 addition & 1 deletion elbepack/debpkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def build_binary_deb( name, arch, version, description, files, deps, target_dir
pkgdir = os.path.join( tmpdir, pkgfname )

os.system( 'mkdir -p "%s"' % os.path.join( pkgdir, "DEBIAN" ) )
write_file( os.path.join( pkgdir, "DEBIAN" , "control" ), 0644, gen_controlfile(name, version, arch, description, deps) )
write_file( os.path.join( pkgdir, "DEBIAN" , "control" ), 0o644, gen_controlfile(name, version, arch, description, deps) )

for (fname, instpath) in files:
full_instpath = os.path.join( pkgdir, instpath )
Expand Down
2 changes: 1 addition & 1 deletion elbepack/efilesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def __enter__(self):

self.mkdir_p ("usr/sbin")
self.write_file ("usr/sbin/policy-rc.d",
0755, "#!/bin/sh\nexit 101\n")
0o755, "#!/bin/sh\nexit 101\n")

self.mount()
return self
Expand Down
2 changes: 1 addition & 1 deletion elbepack/filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def read_file( self, path ):
fp.close()
return retval

def mkdir_p (self, newdir, mode=0755):
def mkdir_p (self, newdir, mode=0o755):
"""works the way a good mkdir -p would...
- already exists, silently complete
- regular file in the way, raise an exception
Expand Down
2 changes: 1 addition & 1 deletion elbepack/finetuning.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ def execute(self, log, buildenv, target):
with open ((target.path + '/pub.key'), 'wb') as tkey:
tkey.write (key.getvalue ())

target.mkdir_p ("/var/cache/elbe/gnupg", mode=0700)
target.mkdir_p ("/var/cache/elbe/gnupg", mode=0o700)
with target:
os.environ ['GNUPGHOME'] = target.path + "/var/cache/elbe/gnupg"
log.do ("gpg --import " + target.path + "/pub.key")
Expand Down
7 changes: 3 additions & 4 deletions elbepack/rfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ def __init__ (self, xml, log, path, build_sources=False, clean=False ):
if not self.rfs.isfile( "etc/elbe_version" ):
# avoid starting daemons inside the buildenv
self.rfs.mkdir_p ("usr/sbin")
self.rfs.write_file ("usr/sbin/policy-rc.d",
0755, "#!/bin/sh\nexit 101\n")
self.rfs.write_file ("usr/sbin/policy-rc.d", 0o755, "#!/bin/sh\nexit 101\n")
self.debootstrap ()
self.fresh_debootstrap = True
self.need_dumpdebootstrap = True
Expand Down Expand Up @@ -210,13 +209,13 @@ def initialize_dirs (self, build_sources=False):
if self.rfs.exists("etc/apt/sources.list"):
self.rfs.remove("etc/apt/sources.list")

self.rfs.write_file ("etc/apt/sources.list", 0644, mirror)
self.rfs.write_file ("etc/apt/sources.list", 0o644, mirror)

self.rfs.mkdir_p( "var/cache/elbe" )

preseed = get_preseed( self.xml )
preseed_txt = preseed_to_text( preseed )
self.rfs.write_file( "var/cache/elbe/preseed.txt", 0644, preseed_txt )
self.rfs.write_file( "var/cache/elbe/preseed.txt", 0o644, preseed_txt )
with self.rfs:
self.log.chroot( self.rfs.path, 'debconf-set-selections < %s' % self.rfs.fname("var/cache/elbe/preseed.txt") )

Expand Down
6 changes: 3 additions & 3 deletions elbepack/updatepkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,14 @@ def gen_update_pkg (project, xml_filename, upd_filename,

if project.presh_file:
copyfile (project.presh_file, update + '/pre.sh')
os.chmod (update + '/pre.sh', 0755)
os.chmod (update + '/pre.sh', 0o755)

if project.postsh_file:
copyfile (project.postsh_file, update + '/post.sh')
os.chmod (update + '/post.sh', 0755)
os.chmod (update + '/post.sh', 0o755)

if cmd_dir:
inlucdedir (update, 'cmd', cmd_dir, mode=0755)
inlucdedir (update, 'cmd', cmd_dir, mode=0o755)

if cfg_dir:
inlucdedir (update, 'conf', cfg_dir)
Expand Down
2 changes: 1 addition & 1 deletion elbepack/virtapt.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def pulse (self, obj):
#print "updating in progress", obj
return True

def mkdir_p (self, newdir, mode=0755):
def mkdir_p (self, newdir, mode=0o755):
"""works the way a good mkdir -p would...
- already exists, silently complete
- regular file in the way, raise an exception
Expand Down

0 comments on commit 892f872

Please sign in to comment.