RPM Community Forums

Mailing List Message of <rpm-cvs>

[CVS] RPM: rpm/tools/ txar.c

From: Jeff Johnson <jbj@rpm5.org>
Date: Thu 30 Aug 2007 - 20:38:44 CEST
Message-Id: <20070830183844.55DB434845B@rpm5.org>
  RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Jeff Johnson
  Root:   /v/rpm/cvs                       Email:  jbj@rpm5.org
  Module: rpm                              Date:   30-Aug-2007 20:38:44
  Branch: HEAD                             Handle: 2007083019384400

  Modified files:
    rpm/tools               txar.c

  Log:
    hackery removal.

  Summary:
    Revision    Changes     Path
    2.3         +0  -146    rpm/tools/txar.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/tools/txar.c
  ============================================================================
  $ cvs diff -u -r2.2 -r2.3 txar.c
  --- rpm/tools/txar.c	29 Aug 2007 20:39:55 -0000	2.2
  +++ rpm/tools/txar.c	30 Aug 2007 18:38:44 -0000	2.3
  @@ -184,151 +184,6 @@
       return map;
   }
   
  -#ifdef	NOTYET
  -static struct {
  -	const char *name;
  -	mode_t type;
  -} filetypes [] = {
  -	{ "file", S_IFREG },
  -	{ "directory", S_IFDIR },
  -	{ "symlink", S_IFLNK },
  -	{ "fifo", S_IFIFO },
  -	{ "character special", S_IFCHR },
  -	{ "block special", S_IFBLK },
  -	{ "socket", S_IFSOCK },
  -#ifdef S_IFWHT
  -	{ "whiteout", S_IFWHT },
  -#endif
  -	{ NULL, 0 }
  -};
  -
  -static const char * filetype_name (mode_t mode) {
  -	unsigned int i;
  -	for (i = 0; filetypes[i].name; i++)
  -		if (mode == filetypes[i].type)
  -			return (filetypes[i].name);
  -	return ("unknown");
  -}
  -
  -static void x_addtime(xar_file_t f, const char * key, const time_t * timep)
  -{
  -    char time[128];
  -    struct tm t;
  -
  -    gmtime_r(timep, &t);
  -    memset(time, 0, sizeof(time));
  -    strftime(time, sizeof(time), "%FT%T", &t);
  -    strcat(time, "Z");
  -    xar_prop_set(f, key, time);
  -}
  -
  -int32_t _xar_stat_archive(xar_t x, xar_file_t f, const char *file, const char *buffer, size_t len, struct stat *st);
  -int32_t _xar_stat_archive(xar_t x, xar_file_t f, const char *file, const char *buffer, size_t len, struct stat *st)
  -{
  -	char *tmpstr;
  -	struct passwd *pw;
  -	struct group *gr;
  -	const char *type;
  -
  -#ifdef	IGNORE
  -	/* no stat attributes for data from a buffer, it is just a file */
  -	if(len){
  -		xar_prop_set(f, "type", "file");
  -		return 0;
  -	}
  -	
  -	if( S_ISREG(st->st_mode) && (st->st_nlink > 1) ) {
  -		xar_file_t tmpf;
  -		const char *id = xar_attr_get(f, NULL, "id");
  -		if( !id ) {
  -			xar_err_new(x);
  -			xar_err_set_file(x, f);
  -			xar_err_set_string(x, "stat: No file id for file");
  -			xar_err_callback(x, XAR_SEVERITY_NONFATAL, XAR_ERR_ARCHIVE_CREATION);
  -			return -1;
  -		}
  -		tmpf = xar_link_lookup(x, st->st_dev, st->st_ino, f);
  -		xar_prop_set(f, "type", "hardlink");
  -		if( tmpf ) {
  -			const char *id;
  -			id = xar_attr_get(tmpf, NULL, "id");
  -			xar_attr_set(f, "type", "link", id);
  -		} else {
  -			xar_attr_set(f, "type", "link", "original");
  -		}
  -	} else
  -#endif
  -	{
  -		type = filetype_name(st->st_mode & S_IFMT);
  -		xar_prop_set(f, "type", type);
  -	}
  -
  -#ifdef	IGNORE
  -	/* Record major/minor device node numbers */
  -	if( S_ISBLK(st->st_mode) || S_ISCHR(st->st_mode)) {
  -		uint32_t major, minor;
  -		char tmpstr[12];
  -		xar_devmake(st->st_rdev, &major, &minor);
  -		memset(tmpstr, 0, sizeof(tmpstr));
  -		snprintf(tmpstr, sizeof(tmpstr)-1, "%u", major);
  -		xar_prop_set(f, "device/major", tmpstr);
  -		memset(tmpstr, 0, sizeof(tmpstr));
  -		snprintf(tmpstr, sizeof(tmpstr)-1, "%u", minor);
  -		xar_prop_set(f, "device/minor", tmpstr);
  -	}
  -
  -	if( S_ISLNK(st->st_mode) ) {
  -		char link[4096];
  -		struct stat lsb;
  -
  -		memset(link, 0, sizeof(link));
  -		readlink(file, link, sizeof(link)-1);
  -		xar_prop_set(f, "link", link);
  -		if( stat(file, &lsb) != 0 ) {
  -			xar_attr_set(f, "link", "type", "broken");
  -		} else {
  -			type = filetype_name(lsb.st_mode & S_IFMT);
  -			xar_attr_set(f, "link", "type", type);
  -		}
  -	}
  -#endif
  -
  -	asprintf(&tmpstr, "%04o", st->st_mode & (~S_IFMT));
  -	xar_prop_set(f, "mode", tmpstr);
  -	free(tmpstr);
  -
  -	asprintf(&tmpstr, "%"PRIu64, (uint64_t)st->st_uid);
  -	xar_prop_set(f, "uid", tmpstr);
  -	free(tmpstr);
  -
  -	pw = getpwuid(st->st_uid);
  -	if( pw )
  -		xar_prop_set(f, "user", pw->pw_name);
  -
  -	asprintf(&tmpstr, "%"PRIu64, (uint64_t)st->st_gid);
  -	xar_prop_set(f, "gid", tmpstr);
  -	free(tmpstr);
  -
  -	gr = getgrgid(st->st_gid);
  -	if( gr )
  -		xar_prop_set(f, "group", gr->gr_name);
  -
  -	x_addtime(f, "atime", &st->st_atime);
  -
  -	x_addtime(f, "mtime", &st->st_mtime);
  -
  -	x_addtime(f, "ctime", &st->st_ctime);
  -
  -#ifdef	IGNORE
  -	flags_archive(f, st);
  -
  -	aacls(f, file);
  -#endif
  -
  -	return 0;
  -}
  -#endif
  -
   static int wrXARbuffer(rpmmap map, const char * fn, char * b, size_t nb)
   {
       if (b && nb > 0) {
  @@ -428,7 +283,6 @@
   
   static int wrRPMbuffer(rpmmap map, const char * fn, char * b, size_t nb)
   {
  -fprintf(stderr, "*** wrRPMbuffer(%p, %s, %p[%lu])\n", map, fn, b, (unsigned long)nb);
       if (b && nb > 0) {
   	if (Fwrite(b, 1, nb, map->fd) != nb)
   	    return 1;
  @@ .
Received on Thu Aug 30 20:38:44 2007
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.