1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-08-13 17:03:46 -04:00

Fail sanely on OUTPUT rules when --nolog is passed

Check for existence of the logfile first, and output an error if not found

Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Aaron Griffin 2007-11-29 22:33:45 -06:00 committed by Dan McGee
parent 565d2eeed5
commit f8b113ed97

View File

@ -15,7 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
from util import *
from stat import *
@ -52,7 +52,11 @@ class pmrule:
if retcode != int(key):
success = 0
elif case == "OUTPUT":
if not grep(os.path.join(root, LOGFILE), key):
logfile = os.path.join(root, LOGFILE)
if not os.access(logfile, os.F_OK):
print "LOGFILE not found, cannot validate 'OUTPUT' rule"
success = 0
elif not grep(os.path.join(root, LOGFILE), key):
success = 0
else:
print "PACMAN rule '%s' not found" % case