[pacman-dev] CVS update of pacman-lib (7 files)
Dan McGee
dan at archlinux.org
Wed Feb 28 11:37:24 EST 2007
Date: Wednesday, February 28, 2007 @ 11:37:24
Author: dan
Path: /home/cvs-pacman/pacman-lib
Modified: lib/libalpm/be_files.c (1.31 -> 1.32)
lib/libalpm/package.c (1.78 -> 1.79) pactest/pmdb.py (1.4 -> 1.5)
pactest/pmenv.py (1.7 -> 1.8) pactest/pmfile.py (1.3 -> 1.4)
pactest/pmrule.py (1.4 -> 1.5) pactest/util.py (1.3 -> 1.4)
* Unifying placement of REPLACES in desc file, as pacman2 does. We'll worry
about bigger DB changes later, but lets not screw anything up for release.
* Removed some weird uses of "not ... ==" usage in pactest- correct me if I'm
wrong, but isn't "!=" a lot more clean and concise?
* Print description of failed tests in the pactest summary. This could get
dirty with a lot of failed tests though, so watch out.
------------------------+
lib/libalpm/be_files.c | 21 ++++++++++-----------
lib/libalpm/package.c | 3 ++-
pactest/pmdb.py | 25 ++++++++++++++-----------
pactest/pmenv.py | 11 ++++++++---
pactest/pmfile.py | 4 ++--
pactest/pmrule.py | 2 +-
pactest/util.py | 9 +++++----
7 files changed, 42 insertions(+), 33 deletions(-)
Index: pacman-lib/lib/libalpm/be_files.c
diff -u pacman-lib/lib/libalpm/be_files.c:1.31 pacman-lib/lib/libalpm/be_files.c:1.32
--- pacman-lib/lib/libalpm/be_files.c:1.31 Mon Feb 26 03:38:48 2007
+++ pacman-lib/lib/libalpm/be_files.c Wed Feb 28 11:37:24 2007
@@ -365,10 +365,6 @@
if(fgets(info->md5sum, sizeof(info->md5sum), fp) == NULL) {
goto error;
}
- /* XXX: these are only here as backwards-compatibility for pacman 2.x
- * sync repos.... in pacman3, they have been moved to DEPENDS.
- * Remove this when we move to pacman3 repos.
- */
} else if(!strcmp(line, "%REPLACES%")) {
/* the REPLACES tag is special -- it only appears in sync repositories,
* not the local one. */
@@ -434,17 +430,20 @@
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
info->provides = alpm_list_add(info->provides, strdup(line));
}
- } else if(!strcmp(line, "%REPLACES%")) {
- /* the REPLACES tag is special -- it only appears in sync repositories,
- * not the local one. */
+ }
+ /* TODO: we were going to move these things here, but it should wait.
+ * A better change would be to figure out how to restructure the DB. */
+ /* else if(!strcmp(line, "%REPLACES%")) {
+ * the REPLACES tag is special -- it only appears in sync repositories,
+ * not the local one. *
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
info->replaces = alpm_list_add(info->replaces, strdup(line));
- }
+ }
} else if(!strcmp(line, "%FORCE%")) {
- /* FORCE tag only appears in sync repositories,
- * not the local one. */
+ * FORCE tag only appears in sync repositories,
+ * not the local one. *
info->force = 1;
- }
+ } */
}
fclose(fp);
fp = NULL;
Index: pacman-lib/lib/libalpm/package.c
diff -u pacman-lib/lib/libalpm/package.c:1.78 pacman-lib/lib/libalpm/package.c:1.79
--- pacman-lib/lib/libalpm/package.c:1.78 Mon Feb 26 03:38:48 2007
+++ pacman-lib/lib/libalpm/package.c Wed Feb 28 11:37:24 2007
@@ -178,7 +178,8 @@
}
/* Parses the package description file for the current package
- *
+ * TODO: this should ALL be in a backend interface (be_files), we should
+ * be dealing with the abstracted concepts only in this file
* Returns: 0 on success, 1 on error
*
*/
Index: pacman-lib/pactest/pmdb.py
diff -u pacman-lib/pactest/pmdb.py:1.4 pacman-lib/pactest/pmdb.py:1.5
--- pacman-lib/pactest/pmdb.py:1.4 Mon Feb 26 03:33:48 2007
+++ pacman-lib/pactest/pmdb.py Wed Feb 28 11:37:24 2007
@@ -193,11 +193,12 @@
pkg.conflicts = _getsection(fd)
elif line == "%PROVIDES%":
pkg.provides = _getsection(fd)
- elif line == "%REPLACES%":
- pkg.replaces = _getsection(fd)
- elif line == "%FORCE%":
- fd.readline()
- pkg.force = 1
+ # TODO this was going to be changed, but isn't anymore
+ #elif line == "%REPLACES%":
+ # pkg.replaces = _getsection(fd)
+ #elif line == "%FORCE%":
+ # fd.readline()
+ # pkg.force = 1
fd.close()
pkg.checksum["depends"] = getmd5sum(filename)
pkg.mtime["depends"] = getmtime(filename)
@@ -253,6 +254,8 @@
else:
if pkg.replaces:
data.append(_mksection("REPLACES", pkg.replaces))
+ if pkg.force:
+ data.append(_mksection("FORCE", ""))
if pkg.csize:
data.append(_mksection("CSIZE", pkg.csize))
if pkg.md5sum:
@@ -293,11 +296,11 @@
data.append(_mksection("CONFLICTS", pkg.conflicts))
if pkg.provides:
data.append(_mksection("PROVIDES", pkg.provides))
- if not self.treename == "local":
- if pkg.replaces:
- data.append(_mksection("REPLACES", pkg.replaces))
- if pkg.force:
- data.append(_mksection("FORCE", ""))
+ #if self.treename != "local":
+ # if pkg.replaces:
+ # data.append(_mksection("REPLACES", pkg.replaces))
+ # if pkg.force:
+ # data.append(_mksection("FORCE", ""))
if data:
data.append("")
filename = os.path.join(path, "depends")
@@ -354,7 +357,7 @@
and oldpkg.mtime[key] == (0, 0, 0) \
and pkg.mtime[key] == (0, 0, 0):
continue
- if not oldpkg.mtime[key][1:3] == pkg.mtime[key][1:3]:
+ if oldpkg.mtime[key][1:3] != pkg.mtime[key][1:3]:
modified += 1
return modified
Index: pacman-lib/pactest/pmenv.py
diff -u pacman-lib/pactest/pmenv.py:1.7 pacman-lib/pactest/pmenv.py:1.8
--- pacman-lib/pactest/pmenv.py:1.7 Tue Feb 27 14:44:45 2007
+++ pacman-lib/pactest/pmenv.py Wed Feb 28 11:37:24 2007
@@ -104,11 +104,16 @@
fail = test.result["fail"]
rules = len(test.rules)
if fail == 0:
- print "[PASSED]",
+ result = "[PASSED]"
else:
- print "[FAILED]",
+ result = "[FAILED]"
+ print result,
print "%s Rules: OK = %2u FAIL = %2u SKIP = %2u" \
- % (test.testname.ljust(32), success, fail, rules - (success + fail))
+ % (test.testname.ljust(32), success, fail, \
+ rules - (success + fail))
+ if fail != 0:
+ # print test description if test failed
+ print " ", test.description
print "=========="*8
print "Results"
Index: pacman-lib/pactest/pmfile.py
diff -u pacman-lib/pactest/pmfile.py:1.3 pacman-lib/pactest/pmfile.py:1.4
--- pacman-lib/pactest/pmfile.py:1.3 Mon Feb 26 03:19:02 2007
+++ pacman-lib/pactest/pmfile.py Wed Feb 28 11:37:24 2007
@@ -52,8 +52,8 @@
vprint("\t\told: %s / %s" % (self.checksum, self.mtime))
vprint("\t\tnew: %s / %s" % (checksum, mtime))
- if not self.checksum == checksum \
- or not (self.mtime[1], self.mtime[2]) == (mtime[1], mtime[2]):
+ if self.checksum != checksum \
+ or (self.mtime[1], self.mtime[2]) != (mtime[1], mtime[2]):
retval = 1
return retval
Index: pacman-lib/pactest/pmrule.py
diff -u pacman-lib/pactest/pmrule.py:1.4 pacman-lib/pactest/pmrule.py:1.5
--- pacman-lib/pactest/pmrule.py:1.4 Tue Feb 27 23:00:21 2007
+++ pacman-lib/pactest/pmrule.py Wed Feb 28 11:37:24 2007
@@ -86,7 +86,7 @@
if not value in newpkg.requiredby:
success = 0
elif case == "REASON":
- if not newpkg.reason == int(value):
+ if newpkg.reason != int(value):
success = 0
elif case == "FILES":
if not value in newpkg.files:
Index: pacman-lib/pactest/util.py
diff -u pacman-lib/pactest/util.py:1.3 pacman-lib/pactest/util.py:1.4
--- pacman-lib/pactest/util.py:1.3 Mon Feb 26 03:19:03 2007
+++ pacman-lib/pactest/util.py Wed Feb 28 11:37:24 2007
@@ -62,7 +62,7 @@
"""
filename = ""
link = ""
- if not name.find(" -> ") == -1:
+ if name.find(" -> ") != -1:
filename, link = name.split(" -> ")
elif name[-1] == "*":
filename = name.rstrip("*")
@@ -80,7 +80,7 @@
link = ""
filename = ""
- if not name.find(" -> ") == -1:
+ if name.find(" -> ") != -1:
islink = 1
filename, link = name.split(" -> ")
elif name[-1] == "*":
@@ -181,8 +181,9 @@
# Repositories
data.extend(["[%s]\n" \
"server = file://%s\n" \
- % (value.treename, os.path.join(root, SYNCREPO, value.treename)) \
- for key, value in db.iteritems() if not key == "local"])
+ % (value.treename, \
+ os.path.join(root, SYNCREPO, value.treename)) \
+ for key, value in db.iteritems() if key != "local"])
mkfile(os.path.join(root, filename), "\n".join(data))
More information about the pacman-dev
mailing list