Merge pull request #111 from Gottox/no-build-date

xbps-create: do not add a build-date property to packages.
This commit is contained in:
Enno Boland
2015-09-03 09:26:53 +02:00
6 changed files with 29 additions and 25 deletions

View File

@@ -585,24 +585,6 @@ process_archive(struct archive *ar,
}
}
static void
set_build_date(void)
{
char outstr[64];
time_t t;
struct tm *tmp;
t = time(NULL);
tmp = localtime(&t);
assert(tmp);
if (strftime(outstr, sizeof(outstr)-1, "%F %R %Z", tmp) == 0)
die("failed to set build-date object (strftime):");
if (!xbps_dictionary_set_cstring(pkg_propsd, "build-date", outstr))
die("failed to add build-date object:");
}
int
main(int argc, char **argv)
{
@@ -778,7 +760,6 @@ main(int argc, char **argv)
xbps_dictionary_set_cstring_nocopy(pkg_propsd, "version", version);
xbps_dictionary_set_cstring_nocopy(pkg_propsd, "pkgver", pkgver);
xbps_dictionary_set_cstring_nocopy(pkg_propsd, "short_desc", desc);
set_build_date();
/* Optional properties */
if (homepage)

View File

@@ -37,6 +37,24 @@
#include <xbps.h>
#include "defs.h"
static int
set_build_date(const xbps_dictionary_t pkgd, time_t timestamp)
{
char outstr[64];
struct tm tmp;
if (!localtime_r(&timestamp, &tmp))
return -1;
if (strftime(outstr, sizeof(outstr)-1, "%F %R %Z", &tmp) == 0)
return -1;
if (!xbps_dictionary_set_cstring(pkgd, "build-date", outstr))
return -1;
return 0;
}
int
index_add(struct xbps_handle *xhp, int args, int argmax, char **argv, bool force)
{
@@ -188,6 +206,12 @@ index_add(struct xbps_handle *xhp, int args, int argmax, char **argv, bool force
rv = EINVAL;
goto out;
}
if (set_build_date(binpkgd, st.st_mtime) < 0) {
free(pkgver);
free(pkgname);
rv = EINVAL;
goto out;
}
/* Remove unneeded objects */
xbps_dictionary_remove(binpkgd, "pkgname");
xbps_dictionary_remove(binpkgd, "version");