mirror of
https://github.com/ostreedev/ostree.git
synced 2024-12-22 17:35:55 +03:00
parse-datetime: use the module from gnulib
Use the parse-datetime module from gnulib, and adapt it to not require other modules as portability is not really an issue for us. DATE can be specified in different formats, such as: "-1 week", "last monday", "1 week ago". Include the generated .c file in the repository so to not add another dependency to Bison. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
parent
6335dadb49
commit
335ea3f339
@ -85,6 +85,10 @@ ostree_SOURCES += \
|
|||||||
src/ostree/ot-remote-builtin-refs.c \
|
src/ostree/ot-remote-builtin-refs.c \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
|
src/ostree/parse-datetime.c: src/ostree/parse-datetime.y
|
||||||
|
$(YACC) $< -o $@
|
||||||
|
|
||||||
|
|
||||||
ostree_bin_shared_cflags = $(AM_CFLAGS) -I$(srcdir)/src/libotutil -I$(srcdir)/src/libostree -I$(srcdir)/src/ostree \
|
ostree_bin_shared_cflags = $(AM_CFLAGS) -I$(srcdir)/src/libotutil -I$(srcdir)/src/libostree -I$(srcdir)/src/ostree \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
ostree_bin_shared_ldadd = libglnx.la libbsdiff.la libotutil.la libostree-kernel-args.la libostree-1.la
|
ostree_bin_shared_ldadd = libglnx.la libbsdiff.la libotutil.la libostree-kernel-args.la libostree-1.la
|
||||||
|
@ -13,6 +13,7 @@ AC_SYS_LARGEFILE
|
|||||||
|
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
AM_PROG_CC_C_O
|
AM_PROG_CC_C_O
|
||||||
|
AC_PROG_YACC
|
||||||
|
|
||||||
changequote(,)dnl
|
changequote(,)dnl
|
||||||
if test "x$GCC" = "xyes"; then
|
if test "x$GCC" = "xyes"; then
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,31 +1,22 @@
|
|||||||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
|
/* Parse a string into an internal time stamp.
|
||||||
*
|
|
||||||
* Copyright (C) 2015 Red Hat, Inc.
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library 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
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the
|
|
||||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
||||||
* Boston, MA 02111-1307, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
Copyright (C) 1995, 1997-1998, 2003-2004, 2007, 2009-2015 Free Software
|
||||||
|
Foundation, Inc.
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU Lesser General Public License as published
|
||||||
|
by the Free Software Foundation; either version 2 of the License, 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, see <http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
#include <gio/gio.h>
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <stdbool.h>
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
bool parse_datetime (struct timespec *, char const *, struct timespec const *);
|
bool parse_datetime (struct timespec *, char const *, struct timespec const *);
|
||||||
G_END_DECLS
|
|
||||||
|
1649
src/ostree/parse-datetime.y
Normal file
1649
src/ostree/parse-datetime.y
Normal file
File diff suppressed because it is too large
Load Diff
@ -93,4 +93,16 @@ ${CMD_PREFIX} ostree --repo=repo prune --keep-younger-than="2015-10-29 12:43:29
|
|||||||
find repo/objects -name '*.commit' | wc -l > commitcount
|
find repo/objects -name '*.commit' | wc -l > commitcount
|
||||||
assert_file_has_content commitcount "^1$"
|
assert_file_has_content commitcount "^1$"
|
||||||
|
|
||||||
|
|
||||||
|
${CMD_PREFIX} ostree prune --repo=repo --refs-only --depth=0 -v
|
||||||
|
find repo/objects -name '*.commit' | wc -l > commitcount
|
||||||
|
assert_file_has_content commitcount "^1$"
|
||||||
|
${CMD_PREFIX} ostree --repo=repo commit --branch=test -m test -s test tree --timestamp="October 25 1985"
|
||||||
|
${CMD_PREFIX} ostree --repo=repo commit --branch=test -m test -s test tree --timestamp="October 21 2015"
|
||||||
|
find repo/objects -name '*.commit' | wc -l > commitcount
|
||||||
|
assert_file_has_content commitcount "^3$"
|
||||||
|
${CMD_PREFIX} ostree --repo=repo prune --keep-younger-than="1 week ago"
|
||||||
|
find repo/objects -name '*.commit' | wc -l > commitcount
|
||||||
|
assert_file_has_content commitcount "^1$"
|
||||||
|
|
||||||
echo "ok prune"
|
echo "ok prune"
|
||||||
|
Loading…
Reference in New Issue
Block a user