FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
ununpack_globals.h
Go to the documentation of this file.
1 /*******************************************************************
2  Copyright (C) 2011-2014 Hewlett-Packard Development Company, L.P.
3 
4  This program is free software; you can redistribute it and/or
5  modify it under the terms of the GNU General Public License
6  version 2 as published by the Free Software Foundation.
7 
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License along
14  with this program; if not, write to the Free Software Foundation, Inc.,
15  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16  *******************************************************************/
21 #ifndef UNUNPACK_GLOBALS_H
22 #define UNUNPACK_GLOBALS_H
23 
24 #ifdef COMMIT_HASH
25 char BuildVersion[]="Build version: " COMMIT_HASH ".\n";
26 char Version[]=COMMIT_HASH;
27 #else
28 char Version[]="0.9.9";
29 #endif
30 
31 int Verbose=0;
32 int Quiet=0;
34 int UnlinkAll=0;
36 int ForceDuplicate=0; /* when using db, should it process duplicates? */
37 int PruneFiles=0;
38 int SetContainerArtifact=1; /* should initial container be an artifact? */
39 FILE *ListOutFile=NULL;
42 
43 /* for the repository */
45 char REP_GOLD[16]="gold";
46 char REP_FILES[16]="files";
47 
48 char UploadFileName[FILENAME_MAX]; /* upload file name */
49 
50 /*** For DB queries ***/
51 char *Pfile = NULL;
52 char *Pfile_Pk = NULL; /* PK for *Pfile */
53 char *Upload_Pk = NULL; /* PK for upload table */
54 PGconn *pgConn = NULL; /* PGconn from DB */
55 int agent_pk=-1; /* agent ID */
56 char SQL[MAXSQL];
57 char uploadtree_tablename[19]; /* upload.uploadtree_tablename */
58 magic_t MagicCookie = 0;
59 
60 unpackqueue Queue[MAXCHILD+1]; /* manage children */
61 int MaxThread=1; /* value between 1 and MAXCHILD */
62 int Thread=0;
63 
64 /*** Global Stats (for summaries) ***/
65 long TotalItems=0; /* number of records inserted */
66 int TotalFiles=0;
71 
72 /*** Command table ***/
74 {
75 /* 0 */ { "","","","","",CMD_NULL,0,0177000,0177000, },
76 /* 1 */ { "application/gzip","zcat","","> '%s' 2>/dev/null","",CMD_PACK,1,0177000,0177000, },
77 /* 2 */ { "application/x-gzip","zcat","","> '%s' 2>/dev/null","",CMD_PACK,1,0177000,0177000, },
78 /* 3 */ { "application/x-compress","zcat","","> '%s' 2>/dev/null","",CMD_PACK,1,0177000,0177000, },
79 /* 4 */ { "application/x-bzip","bzcat","","> '%s' 2>/dev/null","",CMD_PACK,1,0177000,0177000, },
80 /* 5 */ { "application/x-bzip2","bzcat","","> '%s' 2>/dev/null","",CMD_PACK,1,0177000,0177000, },
81 /* 6 */ { "application/x-upx","upx","-d -o'%s'",">/dev/null 2>&1","",CMD_PACK,1,0177000,0177000, },
82 /* 7 */ { "application/pdf","pdftotext","-htmlmeta","'%s' >/dev/null 2>&1","",CMD_PACK,1,0100000,0100000, },
83 /* 8 */ { "application/x-pdf","pdftotext","-htmlmeta","'%s' >/dev/null 2>&1","",CMD_PACK,1,0100000,0100000, },
84 /* 9 */ { "application/x-zip","unzip","-q -P none -o","-x / >/dev/null 2>&1","unzip -Zhzv '%s' > '%s'",CMD_ARC,1,0177000,0177000, },
85 /* 10 */{ "application/zip","unzip","-q -P none -o","-x / >/dev/null 2>&1","unzip -Zhzv '%s' > '%s'",CMD_ARC,1,0177000,0177000, },
86 /* 11 */{ "application/x-tar","tar","-xSf","2>&1 ; echo ''","",CMD_ARC,1,0177000,0177777, },
87 /* 12 */{ "application/x-gtar","tar","-xSf","2>&1 ; echo ''","",CMD_ARC,1,0177000,0177777, },
88 /* 13 */{ "application/x-cpio","cpio","--no-absolute-filenames -i -d <",">/dev/null 2>&1","",CMD_ARC,1,0177777,0177777, },
89 /* 14 */{ "application/x-rar","unrar","x -o+ -p-",">/dev/null 2>&1","",CMD_ARC,1,0177000,0177000, },
90 /* 15 */{ "application/x-cab","cabextract","",">/dev/null 2>&1","",CMD_ARC,1,0177000,0177000, },
91 /* 16 */{ "application/x-7z-compressed","7z","x -y -pjunk",">/dev/null 2>&1","",CMD_ARC,1,0177000,0177000, },
92 /* 17 */{ "application/x-7z-w-compressed","7z","x -y -pjunk",">/dev/null 2>&1","",CMD_ARC,1,0177000,0177000, },
93 /* 18 */{ "application/x-rpm","rpm2cpio","","> '%s' 2> /dev/null","rpm -qip '%s' > '%s' 2>&1",CMD_RPM,1,0177000,0177000, },
94 /* 19 */{ "application/x-archive","ar","x",">/dev/null 2>&1","",CMD_AR,1,0177000,0177777, },
95 /* 20 */{ "application/x-debian-package","ar","x",">/dev/null 2>&1","dpkg -I '%s' > '%s'",CMD_AR,1,0177000,0177777, },
96 /* 21 */{ "application/x-iso","","","","isoinfo -d -i '%s' > '%s'",CMD_ISO,1,0177777,0177777, },
97 /* 22 */{ "application/x-iso9660-image","","","","isoinfo -d -i '%s' > '%s'",CMD_ISO,1,0177777,0177777, },
98 /* 23 */{ "application/x-fat","fat","","","",CMD_DISK,1,0177700,0177777, },
99 /* 24 */{ "application/x-ntfs","ntfs","","","",CMD_DISK,1,0177700,0177777, },
100 /* 25 */{ "application/x-ext2","linux-ext","","","",CMD_DISK,1,0177777,0177777, },
101 /* 26 */{ "application/x-ext3","linux-ext","","","",CMD_DISK,1,0177777,0177777, },
102 /* 27 */{ "application/x-x86_boot","departition","","> /dev/null 2>&1","",CMD_PARTITION,1,0177000,0177000, },
103 /* 28 */{ "application/x-debian-source","dpkg-source","-x","'%s' >/dev/null 2>&1","",CMD_DEB,1,0177000,0177000, },
104 /* 29 */{ "application/x-xz","tar","-JxSf",">/dev/null 2>&1","",CMD_ARC,1,0177000,0177777, },
105 /* 30 */{ "application/jar","unzip","-q -P none -o","-x / >/dev/null 2>&1","unzip -Zhzv '%s' > '%s'",CMD_ARC,1,0177000,0177000, },
106 /* 31 */{ "application/java-archive","unzip","-q -P none -o","-x / >/dev/null 2>&1","unzip -Zhzv '%s' > '%s'",CMD_ARC,1,0177000,0177000, },
107 /* 32 */{ "application/x-dosexec","7z","x -y -pjunk",">/dev/null 2>&1","",CMD_ARC,1,0177000,0177000, },
108 /* 33 */{ "","","",">/dev/null 2>&1","",CMD_DEFAULT,1,0177000,0177000, },
109  { NULL,NULL,NULL,NULL,NULL,-1,-1,0177000,0177000, },
110 };
111 #endif
char BuildVersion[]
Definition: buckets.c:79
char * Pfile
Pfile name (SHA1.MD5.Size)
char * Upload_Pk
Upload pk in DB.
int UnlinkSource
Remove recursive sources after unpacking?
long TotalItems
Number of records inserted.
char SQL[MAXSQL]
For DB.
magic_t MagicCookie
for Magic
cmdlist CMD[]
Global command table.
Queue for files to be unpacked.
Definition: ununpack.h:93
int Verbose
Verbose level for log.
int UseRepository
Using files from the repository?
int SetContainerArtifact
Should initial container be an artifact?
int TotalCompressedFiles
Number of compressed files.
char REP_GOLD[16]
Gold repository name.
int UnlinkAll
Remove ALL unpacked files when done (clean up)?
PGconn * pgConn
Database connection.
int TotalFiles
Number of regular files.
int TotalContainers
Number of containers.
int TotalDirectories
Number of directories.
FILE * ListOutFile
File to store unpack list.
char UploadFileName[FILENAME_MAX]
Upload file name.
int MaxThread
Value between 1 and MAXCHILD.
Command table&#39;s single row.
Definition: ununpack.h:147
int PruneFiles
Remove links? >1 hard links, zero files, etc.
char uploadtree_tablename[19]
upload.uploadtree_tablename
unpackqueue Queue[MAXCHILD+1]
Manage children.
int IgnoreSCMData
1: Ignore SCM data, 0: dont ignore it.
int ForceContinue
Force continue when unpack tool fails?
int agent_pk
Definition: agent.h:85
int Quiet
Run in quiet mode?
int ForceDuplicate
When using db, should it process duplicates?
int TotalArtifacts
Number of artifacts.
int ReunpackSwitch
Set if the uploadtree records are missing from db.
char REP_FILES[16]
Files repository name.
char * Pfile_Pk
Pfile pk in DB.
int Thread
Number of threads in execution.