Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace bin in medium tests #1264

Merged
merged 6 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions rpmlint/pkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,17 @@ def __enter__(self):
def __exit__(self, exc_type, exc_val, exc_tb):
self.cleanup()

def check_versioned_dep(self, name, version):
# try to match name%_isa as well (e.g. 'foo(x86-64)', 'foo(x86-32)')
name_re = re.compile(r'^%s(\(\w+-\d+\))?$' % re.escape(name))
for d in self.requires + self.prereq:
if name_re.match(d[0]):
if d[1] & rpm.RPMSENSE_EQUAL != rpm.RPMSENSE_EQUAL \
or d[2][1] != version:
return False
return True
return False

def read_with_mmap(self, filename):
"""Mmap a file, return it's content decoded."""
try:
Expand Down Expand Up @@ -715,17 +726,6 @@ def readlink(self, pkgfile):
result = self.files.get(linkpath)
return result

def check_versioned_dep(self, name, version):
# try to match name%_isa as well (e.g. 'foo(x86-64)', 'foo(x86-32)')
name_re = re.compile(r'^%s(\(\w+-\d+\))?$' % re.escape(name))
for d in self.requires + self.prereq:
if name_re.match(d[0]):
if d[1] & rpm.RPMSENSE_EQUAL != rpm.RPMSENSE_EQUAL \
or d[2][1] != version:
return False
return True
return False


def get_installed_pkgs(name):
"""Get list of installed package objects by name."""
Expand Down
Binary file added test/files/README1.gz
Binary file not shown.
Binary file added test/files/README2.bz2
Binary file not shown.
Binary file added test/files/README3.xz
Binary file not shown.
106 changes: 106 additions & 0 deletions test/files/netmask/errors.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
/* errors.c -- error message handlers.
Copyright (C) 1998 Robert Stone <[email protected]>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */

#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include "errors.h"
#include "config.h"


/* compatibility section */
#ifdef HAVE_SYSLOG_H
# include <syslog.h>
#else /* HAVE_SYSLOG_H */
#warning no syslog facility? Errors will go to stderr.
# define syslog(x,y,z)
# define LOG_DEBUG 7
# define LOG_WARNING 4
# define LOG_ERR 3
#endif

#ifndef HAVE_VPRINTF
#error no vprintf? not ANSI C3.159-1989 (``ANSI C'') compliant?
#endif

#ifndef HAVE_STRERROR
#define strerror(x) "system error"
#endif
/* end compatibility section */

static char *progname = NULL;

static int show_status = 0;
static int use_syslog = 0;

static int message(int, const char *);

int initerrors(char *pn, int type, int stat) {
#ifdef HAVE_SYSLOG_H
if(type == 0 || type == 1) use_syslog = type;
#endif /* HAVE_SYSLOG_H */
if(pn != NULL) progname = pn;
if(stat == 0 || stat == 1) show_status = stat;
return(0);
}

int status(const char *fmt, ...) {
static char buf[1024];
va_list args;

if(!show_status) return(0);
va_start(args, fmt);
vsprintf(buf, fmt, args);
va_end(args);
return(message(LOG_DEBUG, buf));
}

int warn(const char *fmt, ...) {
static char buf[1024];
va_list args;

va_start(args, fmt);
vsprintf(buf, fmt, args);
va_end(args);
return(message(LOG_WARNING, buf));
}

int panic(const char *fmt, ...) {
static char buf[1024];
va_list args;

va_start(args, fmt);
vsprintf(buf, fmt, args);
va_end(args);
message(LOG_ERR, buf);
exit(1);
}

int message(int priority, const char *msg) {
char buf[1024];

/* only handle errno if this is not an informational message */
if(errno && priority < 5) {
sprintf(buf, "%s: %s", msg, strerror(errno));
errno = 0;
} else strcpy(buf, msg);
if(use_syslog) syslog(priority, "%s", buf);
else fprintf(stderr, "%s: %s\n", progname, buf);
return(0);
}
45 changes: 45 additions & 0 deletions test/files/netmask/errors.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/* errors.h -- error message handlers.
Copyright (C) 1998 Robert Stone <[email protected]>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */

#ifndef _HAVE_ERRORS_H
#define _HAVE_ERRORS_H

/* call initerrors before using these other functions
*
* these functions seem pretty straightforward to me, the messaging
* functions take sprintf formatted strings and have a limit of
* 1024 byte long error messages.
* progname should be set to argv[0]
* if progname is NULL, it is unchanged
* type == 0 for stderr
* type == 1 for syslog
* otherwise type is unchanged
* stat == 0 to skip status reporting
* stat == 1 to print status messages
* otherwise stat is unchanged
* defaults: progname = NULL, type = 0, stat = 0 */
int initerrors(char *progname, int type, int stat);

int status(const char *fmt, ...);
/* print a status message */

int warn(const char *fmt, ...);
/* print a warning message */

int panic(const char *fmt, ...);
/* print an error and exit */
#endif
Loading
Loading