chiark / gitweb /
finish
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 4 Nov 2016 13:56:33 +0000 (13:56 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 4 Nov 2016 13:56:33 +0000 (13:56 +0000)
.gitignore
0001-provide-dpkg-filter-valid-versions.patch [new file with mode: 0644]
README [new file with mode: 0644]
check
escape
generate.c

index b25c15b81fae06e1c55946ac6270bfdb293870e8..a3694ea99e8c5af11bd9ea3bfb6aa130a4351ea4 100644 (file)
@@ -1 +1,3 @@
 *~
+generate
+stunt
diff --git a/0001-provide-dpkg-filter-valid-versions.patch b/0001-provide-dpkg-filter-valid-versions.patch
new file mode 100644 (file)
index 0000000..c59a0ed
--- /dev/null
@@ -0,0 +1,75 @@
+From fc2314965332d9f9efb3f79f500f4ddbf76e91f8 Mon Sep 17 00:00:00 2001
+From: Ian Jackson <ijackson@chiark.greenend.org.uk>
+Date: Fri, 4 Nov 2016 13:55:19 +0000
+Subject: [PATCH] provide dpkg --filter-valid-versions
+
+Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
+---
+ src/enquiry.c | 20 ++++++++++++++++++++
+ src/main.c    |  1 +
+ src/main.h    |  2 ++
+ 3 files changed, 23 insertions(+)
+
+diff --git a/src/enquiry.c b/src/enquiry.c
+index 9f71863..b5010ad 100644
+--- a/src/enquiry.c
++++ b/src/enquiry.c
+@@ -694,3 +694,23 @@ cmpversions(const char *const *argv)
+   else
+     return rip->if_equal;
+ }
++
++int
++filterversions(const char *const *argv)
++{
++  char buf[100];
++  char *newline;
++  struct dpkg_error err;
++  struct dpkg_version vp;
++
++  while (fgets(buf,sizeof(buf),stdin)) {
++    newline = strchr(buf,'\n');
++    assert(newline);
++    *newline = 0;
++    if (parseversion(&vp, buf, &err))
++      continue;
++    puts(buf);
++  }
++  assert(feof(stdin));
++  return 0;
++}
+diff --git a/src/main.c b/src/main.c
+index 122a28f..5d03cee 100644
+--- a/src/main.c
++++ b/src/main.c
+@@ -694,6 +694,7 @@ static const struct cmdinfo cmdinfos[]= {
+   ACTION( "print-foreign-architectures",     0,  act_printforeignarches,   print_foreign_arches ),
+   ACTION( "predep-package",                  0,  act_predeppackage,        predeppackage   ),
+   ACTION( "compare-versions",                0,  act_cmpversions,          cmpversions     ),
++  ACTION( "filter-valid-versions",           0,  act_filterversions,       filterversions     ),
+ /*
+   ACTION( "command-fd",                   'c', act_commandfd,   commandfd     ),
+ */
+diff --git a/src/main.h b/src/main.h
+index cddf45e..f4fad13 100644
+--- a/src/main.h
++++ b/src/main.h
+@@ -97,6 +97,7 @@ enum action {
+       act_controlshow,
+       act_cmpversions,
++      act_filterversions,
+       act_arch_add,
+       act_arch_remove,
+@@ -183,6 +184,7 @@ int printarch(const char *const *argv);
+ int printinstarch(const char *const *argv);
+ int print_foreign_arches(const char *const *argv);
+ int cmpversions(const char *const *argv);
++int filterversions(const char *const *argv);
+ /* from verify.c */
+-- 
+2.10.1
+
diff --git a/README b/README
new file mode 100644 (file)
index 0000000..2e5b8f1
--- /dev/null
+++ b/README
@@ -0,0 +1,7 @@
+./generate | ../dpkg/src/dpkg --filter-valid-versions | ./escape | ./check 
+
+
+
+Copyright 2016 Ian Jackson
+Consider all of this GPLv2-or-later
+There is NO WARRANTY
diff --git a/check b/check
index df4b83f411f64bbbfb296834fb86fda1deab805d..a7ae489e6d0f17339317df2232902e04b6fe5c3d 100755 (executable)
--- a/check
+++ b/check
@@ -9,8 +9,8 @@ cd stunt
 #exec 3<&0 </dev/null
 
 git init
-git commit --allow-empty -m 'Test object'
-head=`git rev-parse HEAD`
+#git commit --allow-empty -m 'Test object'
+#head=`git rev-parse HEAD`
 
 #exec <&3 3<&-
 
@@ -22,23 +22,23 @@ perl -we '
 
     sub complete_batch () {
         if ($file) {
-            print STDERR "completing batch ($_)\n";
+            print STDERR "check completing batch\n";
             close $file or die $!;
-            system "git update-ref --stdin <batch"
-                and die "$? $!";
+           system "git update-ref --stdin <batch"
+                and die $? < 0 ? $! : $?;
         }
        $file = undef;
        $count = 0;
     }
 
     while (<>) {
-print STDERR ">$_<\n";
+#print STDERR ">$_<\n";
         $file ||= new IO::File "batch", ">" or die $!;
         chomp;
-       print $file "create refs/tags/$_ '$head'\n" or die $!;
-       $count++ < 1000 or complete_batch;
+       print $file "delete refs/tags/$_\n" or die $!;
+       $count++ < 100000 or complete_batch;
     }
-print STDERR "FOO\n";
+#print STDERR "FOO\n";
     STDIN->error and die $!;
     complete_batch();
 '
diff --git a/escape b/escape
index cd2655fbb2337db277cfa9824bdff35284bb3ba5..3712b1181dae0c212366edf202bc132c621f055c 100755 (executable)
--- a/escape
+++ b/escape
@@ -2,4 +2,4 @@
 use strict;
 
 y/:~/%_/;
-s/\.(?=\.|$|lock$)/.#/;
+s/\.(?=\.|$|lock$)/.#/g;
index f5b79f5587de81e3e2e9cbecfd815cbcdb2f5beb..d12545a2d07f2345bf968d75c82d7f0d8b037389 100644 (file)
@@ -3,7 +3,7 @@
 #include <stdlib.h>
 
 static const char charset[]=
-  "01234567890"
+  "0123456789"
   "abcdefghijklmnopqrstuvwxyz"
   "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
   ".-+:~";