xbps: merge patch from master to store pkg files mtime in the binpkg metadata.

This commit is contained in:
Juan RP 2015-02-22 18:23:46 +01:00
parent 612097f6dc
commit 51f23fd9e1
3 changed files with 66 additions and 2 deletions

View file

@ -3,7 +3,7 @@
# NOTE: keep this package synchronized with "srcpkgs/xbps".
pkgname=xbps-static
version=0.43.1
revision=9
revision=10
build_style=configure
short_desc="The XBPS package system utilities - static binaries"
maintainer="Juan RP <xtraeme@gmail.com>"

View file

@ -0,0 +1,64 @@
From 2cae0cba01fc4baab98073006187d6edb94eedf0 Mon Sep 17 00:00:00 2001
From: Juan RP <xtraeme@gmail.com>
Date: Sun, 22 Feb 2015 18:20:32 +0100
Subject: [PATCH] xbps-create(8): store file mtime in metadata for upcoming
changes.
---
NEWS | 3 +++
bin/xbps-create/main.c | 12 ++++++++++--
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/bin/xbps-create/main.c b/bin/xbps-create/main.c
index e089700..5f2e101 100644
--- bin/xbps-create/main.c
+++ bin/xbps-create/main.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2012-2014 Juan Romero Pardines.
+ * Copyright (c) 2012-2015 Juan Romero Pardines.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -57,6 +57,7 @@
struct xentry {
TAILQ_ENTRY(xentry) entries;
+ uint64_t mtime;
char *file, *type, *target, *hash;
ino_t inode;
};
@@ -272,6 +273,8 @@ ftw_cb(const char *fpath, const struct stat *sb, int type, struct FTW *ftwbuf _u
*/
xe->type = strdup("links");
assert(xe->type);
+ /* store modification time for regular files and links */
+ xe->mtime = (uint64_t)sb->st_mtime;
buf = malloc(sb->st_size+1);
assert(buf);
r = readlink(fpath, buf, sb->st_size+1);
@@ -348,6 +351,8 @@ ftw_cb(const char *fpath, const struct stat *sb, int type, struct FTW *ftwbuf _u
die("failed to process hash for %s:", fpath);
xe->inode = sb->st_ino;
+ /* store modification time for regular files and links */
+ xe->mtime = (uint64_t)sb->st_mtime;
} else if (type == FTW_D || type == FTW_DP) {
/* directory */
@@ -409,8 +414,11 @@ process_xentry(const char *key, const char *mutable_files)
xbps_dictionary_set_cstring(d, "file", p);
if (xe->target)
xbps_dictionary_set_cstring(d, "target", xe->target);
- else if (xe->hash)
+ if (xe->hash)
xbps_dictionary_set_cstring(d, "sha256", xe->hash);
+ if (xe->mtime)
+ xbps_dictionary_set_uint64(d, "mtime", xe->mtime);
+
xbps_array_add(a, d);
xbps_object_release(d);
}
--
2.3.0

View file

@ -1,7 +1,7 @@
# Template file for 'xbps'
pkgname=xbps
version=0.43.1
revision=9
revision=10
bootstrap=yes
build_style=configure
short_desc="The XBPS package system utilities"