# Ensure a directory exists to remove files to
if not Options["No-Action"]:
if not os.path.exists(del_dir):
- os.makedirs(del_dir, 02775)
+ os.makedirs(del_dir, 0o2775)
if not os.path.isdir(del_dir):
utils.fubar("%s must be a directory." % (del_dir))
if os.path.exists(dest_filename):
dest_filename = utils.find_next_free(dest_filename, 10)
Logger.log(["change destination file name", os.path.basename(dest_filename)])
- utils.move(f, dest_filename, 0660)
+ utils.move(f, dest_filename, 0o660)
else:
Logger.log(["skipping file because of permission problem", fname])
utils.warn("skipping '%s', permission denied." % fname)
def main():
global Cnf, Options, Logger
- os.umask(0002)
+ os.umask(0o002)
Cnf = utils.get_conf()
Arguments = [ ('h', "help", "Generate-Index-Diffs::Options::Help"),
os.makedirs(keydir)
if secret:
# Make sure secret keyring directories are 0700
- os.chmod(keydir, 0700)
+ os.chmod(keydir, 0o700)
# Touch the file
print "Creating %s ..." % (fullpath)
file(fullpath, 'w')
if secret:
- os.chmod(fullpath, 0600)
+ os.chmod(fullpath, 0o600)
else:
- os.chmod(fullpath, 0644)
+ os.chmod(fullpath, 0o644)
######################################################################
os.unlink(lfn)
if os.path.exists(qfn):
os.symlink(qfn,lfn)
- os.chmod(qfn, 0644)
+ os.chmod(qfn, 0o644)
return (max(delaydays-1,0)*24*60*60+remainingtime, changesname, delay, uploader, achanges.get('closes','').split(),achanges, delaydays)
def list_uploads(filelist, rrd_dir):
"""
(fd, path) = tempfile.mkstemp("", "transitions", Cnf["Dir::TempPath"])
- os.chmod(path, 0644)
+ os.chmod(path, 0o644)
f = open(path, "w")
yaml.dump(transitions, f, default_flow_style=False)
return path
logdir = Config()["Dir::Log"]
if not os.path.exists(logdir):
umask = os.umask(00000)
- os.makedirs(logdir, 02775)
+ os.makedirs(logdir, 0o2775)
os.umask(umask)
# Open the logfile
if debug:
logfile = sys.stderr
else:
- umask = os.umask(00002)
+ umask = os.umask(0o0002)
logfile = utils.open_file(logfilename, 'a')
os.umask(umask)
# internal helper function
def rename(self, filename):
tempfilename = filename + '.new'
- os.chmod(tempfilename, 0664)
+ os.chmod(tempfilename, 0o664)
os.rename(tempfilename, filename)
def close(self):
dest = os.path.join(self.holding_dir, base_filename)
try:
- fd = os.open(dest, os.O_RDWR | os.O_CREAT | os.O_EXCL, 0640)
+ fd = os.open(dest, os.O_RDWR | os.O_CREAT | os.O_EXCL, 0o640)
os.close(fd)
except OSError as e:
# Shouldn't happen, but will if, for example, someone lists a
filename = "%s/%s" % (cnf["Dir::BTSVersionTrack"],
self.pkg.changes_file[:-8]+".versions")
os.rename(temp_filename, filename)
- os.chmod(filename, 0644)
+ os.chmod(filename, 0o644)
# Write out the binary -> source mapping.
(fd, temp_filename) = utils.temp_filename(cnf["Dir::BTSVersionTrack"], prefix=".")
filename = "%s/%s" % (cnf["Dir::BTSVersionTrack"],
self.pkg.changes_file[:-8]+".debinfo")
os.rename(temp_filename, filename)
- os.chmod(filename, 0644)
+ os.chmod(filename, 0o644)
session.commit()
dest_file = os.path.join(cnf["Dir::Reject"], file_entry)
try:
- dest_fd = os.open(dest_file, os.O_RDWR | os.O_CREAT | os.O_EXCL, 0644)
+ dest_fd = os.open(dest_file, os.O_RDWR | os.O_CREAT | os.O_EXCL, 0o644)
except OSError as e:
# File exists? Let's find a new name by adding a number
if e.errno == errno.EEXIST:
# Make sure we really got it
try:
- dest_fd = os.open(dest_file, os.O_RDWR|os.O_CREAT|os.O_EXCL, 0644)
+ dest_fd = os.open(dest_file, os.O_RDWR|os.O_CREAT|os.O_EXCL, 0o644)
except OSError as e:
# Likewise
utils.warn("**WARNING** failed to claim %s in the reject directory." % (file_entry))
raise
# If we got here, we own the destination file, so we can
# safely overwrite it.
- utils.move(file_entry, dest_file, 1, perms=0660)
+ utils.move(file_entry, dest_file, 1, perms=0o660)
os.close(dest_fd)
###########################################################################
# so let's just raise an exception ...
if os.path.exists(reason_filename):
os.unlink(reason_filename)
- reason_fd = os.open(reason_filename, os.O_RDWR|os.O_CREAT|os.O_EXCL, 0644)
+ reason_fd = os.open(reason_filename, os.O_RDWR|os.O_CREAT|os.O_EXCL, 0o644)
rej_template = os.path.join(cnf["Dir::Templates"], "queue.rejected")
os.unlink (filename);
return;
- fd = os.open(filename, os.O_RDWR|os.O_EXCL, 0700);
+ fd = os.open(filename, os.O_RDWR|os.O_EXCL, 0o700);
os.write (fd, message_raw.as_string(True));
os.close (fd);
################################################################################
-def move (src, dest, overwrite = 0, perms = 0664):
+def move (src, dest, overwrite = 0, perms = 0o664):
if os.path.exists(dest) and os.path.isdir(dest):
dest_dir = dest
else:
dest_dir = os.path.dirname(dest)
if not os.path.exists(dest_dir):
umask = os.umask(00000)
- os.makedirs(dest_dir, 02775)
+ os.makedirs(dest_dir, 0o2775)
os.umask(umask)
#print "Moving %s to %s..." % (src, dest)
if os.path.exists(dest) and os.path.isdir(dest):
os.chmod(dest, perms)
os.unlink(src)
-def copy (src, dest, overwrite = 0, perms = 0664):
+def copy (src, dest, overwrite = 0, perms = 0o664):
if os.path.exists(dest) and os.path.isdir(dest):
dest_dir = dest
else:
dest_dir = os.path.dirname(dest)
if not os.path.exists(dest_dir):
umask = os.umask(00000)
- os.makedirs(dest_dir, 02775)
+ os.makedirs(dest_dir, 0o2775)
os.umask(umask)
#print "Copying %s to %s..." % (src, dest)
if os.path.exists(dest) and os.path.isdir(dest):