update to 0.68, make it compile again with rpm 4.0
authorcturner <devnull@localhost>
Wed, 20 Oct 2004 04:15:15 +0000 (04:15 +0000)
committercturner <devnull@localhost>
Wed, 20 Oct 2004 04:15:15 +0000 (04:15 +0000)
CVS patchset: 7493
CVS date: 2004/10/20 04:15:15

perl-RPM2/Changes
perl-RPM2/MANIFEST
perl-RPM2/RPM2.pm
perl-RPM2/RPM2.xs
perl-RPM2/test.pl

index 39333b3..1549eeb 100644 (file)
@@ -1,3 +1,9 @@
+0.68 2004-10-20 cturner
+       * make it compile again with rpm 4.0
+
+0.67 2004-09-15 cturner
+       * add support for manipulating headers and header lists
+
 0.66  2004-04-14 cturner
        * add changelog support and doc updates from Ville Skytta <ville.skytta@iki.fi>
 
index e596278..865aed0 100644 (file)
@@ -9,3 +9,4 @@ test-rpm-1.0-1.noarch.rpm
 test-rpm-1.0-1.src.rpm
 hdlist-test.hdr
 typemap
+META.yml                                 Module meta-data (added by MakeMaker)
index 419cea3..df37e1b 100644 (file)
@@ -8,7 +8,7 @@ use File::Basename qw/basename dirname/;
 use File::Spec ();
 
 use vars qw/$VERSION/;
-$VERSION = '0.67';
+$VERSION = '0.68';
 use vars qw/@ISA/;
 @ISA = qw/DynaLoader/;
 
index 3b90739..5cefe7d 100644 (file)
@@ -70,12 +70,12 @@ void * _null_callback(
                }
                break;
 
+#ifdef RPM2_RPM41
        case RPMCALLBACK_INST_START:
                rpmcliHashesCurrent = 0;
                if (h == NULL || !(flags & INSTALL_LABEL))
                        break;
                break;
-
        case RPMCALLBACK_TRANS_PROGRESS:
        case RPMCALLBACK_INST_PROGRESS:
                break;
@@ -119,6 +119,7 @@ void * _null_callback(
                break;
        case RPMCALLBACK_UNKNOWN:
                break;
+#endif
        default:
                break;
        }
@@ -176,6 +177,8 @@ BOOT:
        REGISTER_CONSTANT(_RPMVSF_NOPAYLOAD);
        REGISTER_CONSTANT(TR_ADDED);
        REGISTER_CONSTANT(TR_REMOVED);
+        REGISTER_CONSTANT(RPMSENSE_PATCHES);
+        REGISTER_CONSTANT(RPMSENSE_CONFIG);
 #endif
 
        REGISTER_CONSTANT(RPMSENSE_ANY);
@@ -205,8 +208,6 @@ BOOT:
         REGISTER_CONSTANT(RPMSENSE_RPMLIB);
         REGISTER_CONSTANT(RPMSENSE_TRIGGERPREIN);
         REGISTER_CONSTANT(RPMSENSE_KEYRING);
-        REGISTER_CONSTANT(RPMSENSE_PATCHES);
-        REGISTER_CONSTANT(RPMSENSE_CONFIG);
 
     }
 
@@ -306,6 +307,8 @@ _read_package_info(fp, vsflags)
        ts = rpmtsFree(ts);
 #endif
 
+#ifdef RPM2_RPM41
+
 void
 _create_transaction(vsflags)
        int vsflags
@@ -329,6 +332,8 @@ _create_transaction(vsflags)
 
        PUSHs(h_sv);
 
+#endif
+
 void
 _read_from_file(fp)
        FILE *fp
@@ -525,6 +530,7 @@ _unload(h)
 
 MODULE = RPM2          PACKAGE = RPM2::C::Transaction
 
+#ifdef RPM2_RPM41
 void
 DESTROY(t)
        rpmts t
@@ -656,4 +662,6 @@ _run(t, ok_probs, prob_filter)
     OUTPUT:
        RETVAL
 
+#endif
+
 
index b7620fe..8f9e8ec 100644 (file)
@@ -133,62 +133,68 @@ ok(RPM2->rpm_api_version == 4.0 or RPM2->vsf_nosha1 == 65536);
 $db  = undef;
 $i   = undef;
 
-#
-# Transaction tests.
-my $t = RPM2->create_transaction();
-ok(ref($t) eq 'RPM2::Transaction');
-ok(ref($t) eq 'RPM2::Transaction');
-$pkg = RPM2->open_package("test-rpm-1.0-1.noarch.rpm");
-# Make sure we still can open packages.
-ok($pkg);
-# Add package to transaction
-ok($t->add_install($pkg));
-# Check element count
-ok($t->element_count() == 1);
-# Test depedency checks
-ok($t->check());
-# Order the transaction...see if we get our one transaction.
-ok($t->order());
-my @rpms = $t->elements();
-ok($rpms[0] eq  $pkg->as_nvre());
-ok(scalar(@rpms) == 1);
-# Install package
-ok($t->run());
-$t = undef;
-
-#
-# See if we can find the rpm in the database now...
-$db = RPM2->open_rpm_db();
-ok(defined $db);
-@pkg = ();
-$i = $db->find_by_name_iter("test-rpm");
-ok($i);
-while (my $pkg = $i->next) {
-  push @pkg, $pkg;
+if (RPM2->rpm_api_version > 4.0) {
+  #
+  # Transaction tests.
+  my $t = RPM2->create_transaction();
+  ok(ref($t) eq 'RPM2::Transaction');
+  ok(ref($t) eq 'RPM2::Transaction');
+  $pkg = RPM2->open_package("test-rpm-1.0-1.noarch.rpm");
+  # Make sure we still can open packages.
+  ok($pkg);
+  # Add package to transaction
+  ok($t->add_install($pkg));
+  # Check element count
+  ok($t->element_count() == 1);
+  # Test depedency checks
+  ok($t->check());
+  # Order the transaction...see if we get our one transaction.
+  ok($t->order());
+  my @rpms = $t->elements();
+  ok($rpms[0] eq  $pkg->as_nvre());
+  ok(scalar(@rpms) == 1);
+  # Install package
+  ok($t->run());
+  $t = undef;
+
+  #
+  # See if we can find the rpm in the database now...
+  $db = RPM2->open_rpm_db();
+  ok(defined $db);
+  @pkg = ();
+  $i = $db->find_by_name_iter("test-rpm");
+  ok($i);
+  while (my $pkg = $i->next) {
+    push @pkg, $pkg;
+  }
+  ok(scalar(@pkg) == 1);
+  $i  = undef;
+  $db = undef;
+
+  #
+  # OK, lets remove that rpm with a new transaction
+  $t = RPM2->create_transaction();
+  ok(ref($t) eq 'RPM2::Transaction');
+  # We need to find the package we installed, and try to erase it
+  ok($t->add_erase($pkg[0]));
+  # Check element count
+  ok($t->element_count() == 1);
+  # Test depedency checks
+  ok($t->check());
+  # Order the transaction...see if we get our one transaction.
+  ok($t->order());
+  #my @rpms = $t->elements();
+  ok($rpms[0] eq  $pkg->as_nvre());
+  ok(scalar(@rpms) == 1);
+  # Install package
+  ok($t->run());
+  # Test closing the database
+  ok($t->close_db());
+}
+else {
+  # transactions are rpm 4.1 and newer, so we skip them here.
+  ok(1) for 1 .. 22;
 }
-ok(scalar(@pkg) == 1);
-$i  = undef;
-$db = undef;
-
-#
-# OK, lets remove that rpm with a new transaction
-$t = RPM2->create_transaction();
-ok(ref($t) eq 'RPM2::Transaction');
-# We need to find the package we installed, and try to erase it
-ok($t->add_erase($pkg[0]));
-# Check element count
-ok($t->element_count() == 1);
-# Test depedency checks
-ok($t->check());
-# Order the transaction...see if we get our one transaction.
-ok($t->order());
-#my @rpms = $t->elements();
-ok($rpms[0] eq  $pkg->as_nvre());
-ok(scalar(@rpms) == 1);
-# Install package
-ok($t->run());
-# Test closing the database
-ok($t->close_db());
 
 my @headers = RPM2->open_hdlist("hdlist-test.hdr");
 ok(scalar @headers, 3, 'found three headers in hdlist-test.hdr');