Project import generated by Copybara.
NOKEYCHECK=True
GitOrigin-RevId: 7bc09aa87868701284df56fa5312f5cb372928b3
diff --git a/dpkg.patches/dpkg-01.patch b/dpkg.patches/dpkg-01.patch
new file mode 100644
index 0000000..853d68d
--- /dev/null
+++ b/dpkg.patches/dpkg-01.patch
@@ -0,0 +1,80 @@
+diff -aruN a/utils/start-stop-daemon.c b/utils/start-stop-daemon.c
+--- a/utils/start-stop-daemon.c 2011-10-11 22:56:12.000000000 -0700
++++ b/utils/start-stop-daemon.c 2015-11-24 10:37:17.354279923 -0800
+@@ -79,6 +79,7 @@
+
+ #include <sys/types.h>
+ #include <sys/time.h>
++#include <time.h>
+ #include <sys/stat.h>
+ #include <sys/ioctl.h>
+ #include <sys/termios.h>
+@@ -288,8 +289,16 @@
+ static void
+ xgettimeofday(struct timeval *tv)
+ {
+- if (gettimeofday(tv, NULL) != 0)
++ struct timespec tp;
++ if (clock_gettime(CLOCK_MONOTONIC, &tp))
+ fatal("gettimeofday failed");
++
++ /*
++ * Convert from timespec to timeval
++ * We do not care about microseconds, set to 0
++ */
++ tv->tv_sec = tp.tv_sec;
++ tv->tv_usec = 0;
+ }
+
+ static void
+diff -aruN a/configure b/configure
+--- a/configure 2011-10-13 22:09:45.000000000 -0700
++++ b/configure 2015-11-24 14:33:53.319638762 -0800
+@@ -9350,6 +9350,46 @@
+ SSD_LIBS="${SSD_LIBS:+$SSD_LIBS }-lihash"
+ fi
+
++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in -lrt" >&5
++$as_echo_n "checking for clock_gettime in -lrt... " >&6; }
++if ${ac_cv_lib_rt_clock_gettime+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ ac_check_lib_save_LIBS=$LIBS
++LIBS="-lrt $LIBS"
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h. */
++
++/* Override any GCC internal prototype to avoid an error.
++ Use char because int might match the return type of a GCC
++ builtin and then its argument prototype would still apply. */
++#ifdef __cplusplus
++extern "C"
++#endif
++char clock_gettime ();
++int
++main ()
++{
++return clock_gettime ();
++ ;
++ return 0;
++}
++_ACEOF
++if ac_fn_c_try_link "$LINENO"; then :
++ ac_cv_lib_rt_clock_gettime=yes
++else
++ ac_cv_lib_rt_clock_gettime=no
++fi
++rm -f core conftest.err conftest.$ac_objext \
++ conftest$ac_exeext conftest.$ac_ext
++LIBS=$ac_check_lib_save_LIBS
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_clock_gettime" >&5
++$as_echo "$ac_cv_lib_rt_clock_gettime" >&6; }
++if test "x$ac_cv_lib_rt_clock_gettime" = xyes; then :
++ SSD_LIBS="${SSD_LIBS:+$SSD_LIBS }-lrt"
++fi
++
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for proc_stat_list_create in -lps" >&5
+ $as_echo_n "checking for proc_stat_list_create in -lps... " >&6; }
+ if ${ac_cv_lib_ps_proc_stat_list_create+:} false; then :
+
diff --git a/dpkg.patches/dpkg-02.patch b/dpkg.patches/dpkg-02.patch
new file mode 100644
index 0000000..4276b14
--- /dev/null
+++ b/dpkg.patches/dpkg-02.patch
@@ -0,0 +1,24 @@
+diff -aruN a/scripts/Makefile.am b/scripts/Makefile.am
+--- a/scripts/Makefile.am 2017-11-14 15:56:01.195623027 -0800
++++ b/scripts/Makefile.am 2011-10-13 21:58:09.000000000 -0700
+@@ -109,7 +109,7 @@
+ man3_MANS =
+
+ do_perl_subst = $(AM_V_GEN) \
+- sed -e "s:^\#![:space:]*/usr/bin/perl:\#!$(PERL):" \
++ sed -e "s:^\#![[:space:]]*/usr/bin/perl:\#!$(PERL):" \
+ -e "s:\$$dpkglibdir[[:space:]]*=[[:space:]]*['\"][^'\"]*['\"]:\$$dpkglibdir=\"$(pkglibdir)\":" \
+ -e "s:\$$pkgdatadir[[:space:]]*=[[:space:]]*['\"][^'\"]*['\"]:\$$pkgdatadir=\"$(pkgdatadir)\":" \
+ -e "s:\$$admindir[[:space:]]*=[[:space:]]*['\"][^'\"]*['\"]:\$$admindir=\"$(admindir)\":" \
+diff -aruN a/scripts/Makefile.in b/scripts/Makefile.in
+--- a/scripts/Makefile.in 2017-11-14 15:56:08.451573406 -0800
++++ b/scripts/Makefile.in 2011-10-13 22:09:47.000000000 -0700
+@@ -396,7 +396,7 @@
+ # Keep it even if empty to have man3dir correctly set
+ man3_MANS =
+ do_perl_subst = $(AM_V_GEN) \
+- sed -e "s:^\#![:space:]*/usr/bin/perl:\#!$(PERL):" \
++ sed -e "s:^\#![[:space:]]*/usr/bin/perl:\#!$(PERL):" \
+ -e "s:\$$dpkglibdir[[:space:]]*=[[:space:]]*['\"][^'\"]*['\"]:\$$dpkglibdir=\"$(pkglibdir)\":" \
+ -e "s:\$$pkgdatadir[[:space:]]*=[[:space:]]*['\"][^'\"]*['\"]:\$$pkgdatadir=\"$(pkgdatadir)\":" \
+ -e "s:\$$admindir[[:space:]]*=[[:space:]]*['\"][^'\"]*['\"]:\$$admindir=\"$(admindir)\":" \
diff --git a/dpkg.tar.bz2 b/dpkg.tar.bz2
new file mode 100644
index 0000000..6e1ec0f
--- /dev/null
+++ b/dpkg.tar.bz2
Binary files differ
diff --git a/dpkg.url b/dpkg.url
new file mode 100644
index 0000000..4f74d70
--- /dev/null
+++ b/dpkg.url
@@ -0,0 +1 @@
+http://ftp.debian.org/debian/pool/main/d/dpkg/dpkg_1.16.1.1.tar.bz2
diff --git a/dpkg.version b/dpkg.version
new file mode 100644
index 0000000..3407906
--- /dev/null
+++ b/dpkg.version
@@ -0,0 +1 @@
+1.16.1.1