summaryrefslogtreecommitdiff
path: root/emulators/suse_base
diff options
context:
space:
mode:
authortron <tron@pkgsrc.org>1999-09-26 11:28:11 +0000
committertron <tron@pkgsrc.org>1999-09-26 11:28:11 +0000
commit38c732d8bbcbb1aa453b09d74f9d876c1be81dbe (patch)
tree51422981b0941b389eb725dfd3dcbd2c21a191ec /emulators/suse_base
parent79632eee5f1a0c6a614958620dc0fc7c4fa5dd50 (diff)
downloadpkgsrc-38c732d8bbcbb1aa453b09d74f9d876c1be81dbe.tar.gz
Check all symbolic links after the complete RPM file has been written to
disk. If they point to a file store them like files in the package list instead of using an "@exec" "@unexec" pair.
Diffstat (limited to 'emulators/suse_base')
-rw-r--r--emulators/suse_base/files/rpm2pkg.c56
1 files changed, 49 insertions, 7 deletions
diff --git a/emulators/suse_base/files/rpm2pkg.c b/emulators/suse_base/files/rpm2pkg.c
index 699d571030d..26fdc7ad4de 100644
--- a/emulators/suse_base/files/rpm2pkg.c
+++ b/emulators/suse_base/files/rpm2pkg.c
@@ -1,6 +1,6 @@
/*
- $NetBSD: rpm2pkg.c,v 1.1 1999/09/19 23:58:37 tron Exp $
+ $NetBSD: rpm2pkg.c,v 1.2 1999/09/26 11:28:11 tron Exp $
*/
@@ -382,6 +382,53 @@ int WriteFile(gzFile In,char *Name,mode_t Mode,long Length)
return FALSE;
}
+void CheckSymLinks(PListEntry **Links,PListEntry **Files,PListEntry **Dirs)
+
+{
+ PListEntry *Link;
+ struct stat Stat;
+
+ while ((Link=*Links)!=NULL)
+ {
+ PListEntry *Ptr;
+ char *Basename;
+
+ if (Link->pe_Left!=NULL)
+ CheckSymLinks(&Link->pe_Left,Files,Dirs);
+
+ if ((stat(Link->pe_Name,&Stat)<0)||!S_ISREG(Stat.st_mode))
+ {
+ Links=&Link->pe_Right;
+ continue;
+ }
+
+ (void)InsertPListEntry(Files,Link->pe_Name);
+ if ((Basename=strrchr(Link->pe_Name,'/'))!=NULL)
+ {
+ *Basename='\0';
+ if ((Ptr=FindPListEntry(*Dirs,Link->pe_Name))!=NULL)
+ Ptr->pe_DirEmpty=FALSE;
+ }
+
+ if (Link->pe_Right==NULL)
+ {
+ *Links=Link->pe_Left;
+ free(Link);
+ break;
+ }
+
+ *Links=Link->pe_Right;
+ Ptr=Link->pe_Left;
+ free(Link);
+
+ if (Ptr==NULL) continue;
+
+ Link=*Links;
+ while (Link->pe_Left!=NULL) Link=Link->pe_Left;
+ Link->pe_Left=Ptr;
+ }
+}
+
int main(int argc,char **argv)
{
@@ -614,12 +661,7 @@ int main(int argc,char **argv)
return EXIT_FAILURE;
}
- if ((stat(Name,&Stat)==0)&&S_ISREG(Stat.st_mode))
- {
- (void)InsertPListEntry(&Files,Name);
- (void)MakeTargetDir(Name,&Dirs,TRUE);
- }
- else InsertPListEntry(&Links,Name)->pe_Link=Link;
+ InsertPListEntry(&Links,Name)->pe_Link=Link;
break;
}
case C_ISREG: