diff options
author | pjmattal <pjmattal> | 2005-04-10 17:32:45 +0200 |
---|---|---|
committer | pjmattal <pjmattal> | 2005-04-10 17:32:45 +0200 |
commit | 6157aea84343f86f2a80010557ec583f964c7d2e (patch) | |
tree | 8371ae49694b76016c8b2413192c37421a3c8d22 /tupkg | |
parent | b78a20c3359fab4cf042e6e5e56bb9d5d3c0449a (diff) | |
download | aur-6157aea84343f86f2a80010557ec583f964c7d2e.tar.gz aur-6157aea84343f86f2a80010557ec583f964c7d2e.tar.xz |
added more safe checks on result codes from file deletes in tupkgupdate
Diffstat (limited to 'tupkg')
-rwxr-xr-x | tupkg/update/tupkgupdate | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/tupkg/update/tupkgupdate b/tupkg/update/tupkgupdate index 9b85c9f8..514a6970 100755 --- a/tupkg/update/tupkgupdate +++ b/tupkg/update/tupkgupdate @@ -257,22 +257,23 @@ def execute(command): global switches print(command) if not (switches.get("-n") == True): - os.system(command) + return os.system(command) + return 0 def copyFileToRepo(filename, repodir): destfile = os.path.join(repodir, os.path.basename(filename)) - command = "cp -p '" + filename + "' '" + destfile + "'" - execute(command) + command = "cp --preserve=timestamps '" + filename + "' '" + destfile + "'" + return execute(command) def deleteFile(filename): command = "rm '" + filename + "'" - execute(command) + return execute(command) def runGensync(repo, pkgbuild): #target = os.path.join(repo, os.path.basename(repo) + ".db.tar.gz") target = os.path.join(repo, "community.db.tar.gz") command = "gensync '" + pkgbuild_dir + "' '" + target + "'" - execute(command) + return execute(command) ############################################################ # Functions for error handling @@ -492,7 +493,10 @@ for package in dbmodify: # Copy for file in copy: - copyFileToRepo(file, repo_dir) + retval = copyFileToRepo(file, repo_dir) + if (retval != 0): + error("Could not copy file to repo: '" + file + "'") + sys.exit(-1) # Delete (second, for safety's sake) for file in delete: deleteFile(file) @@ -503,4 +507,7 @@ if (switches.get("--delete") == True): deleteFile(file) # Run gensync to build the repo index if (len(copy) + len(delete) > 0): - runGensync(repo_dir, pkgbuild_dir) + retval = runGensync(repo_dir, pkgbuild_dir) + if (retval != 0): + error("Gensync returned an error!") + sys.exit(-1) |