Преглед на файлове

* Ok, TMPDIR usage is back in dpkg-deb and working
* {include,scripts}/Makefile.am: Fix for using DESTDIR
* debian/rules: really convert to DESTDIR on install target this
time. chmod -x everything in /usr/lib to make lintian happy.
in the clean phase just rm -rf $(BUILD), we don't need to run
distclean and all that other stuff. Don't run "make dist", we
simply copy the .tar.gz that dpkg-source creates for the byhand
source.

Ben Collins преди 27 години
родител
ревизия
60e79bfff7
променени са 7 файла, в които са добавени 91 реда и са изтрити 52 реда
  1. 11 0
      ChangeLog
  2. 5 0
      debian/changelog
  3. 5 16
      debian/rules
  4. 34 12
      dpkg-deb/build.c
  5. 3 2
      dpkg-deb/info.c
  6. 2 2
      include/Makefile.am
  7. 31 20
      methods/Makefile.am

+ 11 - 0
ChangeLog

@@ -1,3 +1,14 @@
+Tue Oct 19 18:07:28 EDT 1999 Ben Collins <bcollins.debian.org>
+
+  * Ok, TMPDIR usage is back in dpkg-deb and working
+  * {include,scripts}/Makefile.am: Fix for using DESTDIR
+  * debian/rules: really convert to DESTDIR on install target this
+    time. chmod -x everything in /usr/lib to make lintian happy.
+    in the clean phase just rm -rf $(BUILD), we don't need to run
+    distclean and all that other stuff. Don't run "make dist", we
+    simply copy the .tar.gz that dpkg-source creates for the byhand
+    source.
+
 Tue Oct 19 09:59:22 EDT 1999 Ben Collins <bcollins.debian.org>
 
   * Reverted the new tmpfile stuff in dpkg-deb. For some reason it's

+ 5 - 0
debian/changelog

@@ -43,6 +43,11 @@ dpkg (1.4.1.17) unstable; urgency=low
   * Increased largemem auto detection to >= 24megs, since it's not uncommon
     for dpkg to actually use 16megs of ram all on its own when using the
     largemem setting (old minimum was 16megs)
+  * debian/rules: chmod -x everything in /usr/lib to make lintian happy.
+    in the clean phase just rm -rf $(BUILD), we don't need to run
+    distclean and all that other stuff. Don't run "make dist", we
+    simply copy the .tar.gz that dpkg-source creates for the byhand
+    source.
 
  -- Wichert Akkerman <wakkerma@debian.org>  UNRELEASED
 

+ 5 - 16
debian/rules

@@ -32,11 +32,8 @@ $(BUILD)/config.status:
 
 clean:
 	$(checkdir)
-	-$(MAKE) -C $(BUILD) -i distclean
-	$(RM) -r debian/{build,files,substvars,tmp*}
-	$(RM) $(BUILD)/dpkg-*.tar.gz
-	$(RM) po/*.gmo
-	$(RM) config.log
+	$(RM) -r debian/{files,substvars,tmp*}
+	$(RM) -r $(BUILD)
 	find . \( -name '*~' -o -name '#*#' \) -print0 | xargs -r0 $(RM) --
 
 build: $(BUILD)/config.status
@@ -65,16 +62,7 @@ binary-trees: build
 		debian/tmp-dev/etc/dpkg/shlibs.default ; \
 	fi
 	cp debian/{prerm,postinst} $(mcidir)/.
-	$(MAKE) -C $(BUILD) top_distdir=. dist 
-	$(MAKE) -C $(BUILD) \
-		prefix=$(DIR)/debian/tmp-main/usr \
-		sysconfdir=$(DIR)/debian/tmp-main/etc \
-		datadir=$(DIR)/debian/tmp-main/usr/share \
-		mandir=$(DIR)/debian/tmp-main/usr/share/man \
-		infodir=$(DIR)/debian/tmp-main/usr/share/info \
-		sharedstatedir=$(DIR)/debian/tmp-main/var/lib \
-		localstatedir=$(DIR)/debian/tmp-main/var/lib \
-		install
+	$(MAKE) -C $(BUILD) DESTDIR=$(DIR)/debian/tmp-main install
 	install -m 755 debian/dev-postinst debian/tmp-dev/DEBIAN/postinst
 	install -m 755 debian/dev-prerm debian/tmp-dev/DEBIAN/prerm
 	install -d debian/tmp-dev/etc/emacs/site-start.d
@@ -97,6 +85,7 @@ binary-trees: build
 	ln -s ../man7/undocumented.7.gz debian/tmp-main/usr/share/man/man1/dpkg-divert.1.gz
 	gzip -9vf debian/tmp-main/usr/share/doc/dpkg/changelog*
 	cp debian/copyright debian/tmp-main/usr/share/doc/dpkg/copyright
+	chmod -x `find debian/tmp-{main,dev}/usr/lib -type f`
 	ln -s dpkg debian/tmp-dev/usr/share/doc/dpkg-dev
 	set -e; for f in \
  usr/share/doc/dpkg/{internals.html,changelog.manuals.gz} \
@@ -138,7 +127,7 @@ binary-indep: binary-trees
 	set -e; \
 		version=`sed -n 's/^Version: //p' $(DIR)/debian/tmp-dev/DEBIAN/control`; \
 		file=dpkg-$${version}.tar.gz; \
-		cp $(BUILD)/$${file} $(DIR)/..; \
+		cp $(DIR)/../dpkg_$${version}.tar.gz $(DIR)/../$${file}; \
 		dpkg-distaddfile -f$(DIR)/debian/files $${file} byhand -;
 
 binary-arch: binary-trees

+ 34 - 12
dpkg-deb/build.c

@@ -59,17 +59,23 @@ void do_build(const char *const *argv) {
   
   char *m;
   const char *debar, *directory, *const *mscriptp, *versionstring, *arch;
-  char *controlfile;
+  char *controlfile, *tfbuf, *envbuf;
   struct pkginfo *checkedinfo;
   struct arbitraryfield *field;
   FILE *ar, *gz, *cf;
-  int p1[2],p2[2], warns, errs, n, c, subdir;
+  int p1[2],p2[2], warns, errs, n, c, subdir, gzfd;
   pid_t c1,c2,c3,c4,c5;
   struct stat controlstab, datastab, mscriptstab, debarstab;
   char conffilename[MAXCONFFILENAME+1];
   time_t thetime= 0;
   
   directory= *argv++; if (!directory) badusage(_("--build needs a directory argument"));
+  /* template for our tempfiles */
+  if ((envbuf= getenv("TMPDIR")) == NULL)
+    envbuf= P_tmpdir;
+  tfbuf = (char *)malloc(strlen(envbuf)+13);
+  strcpy(tfbuf,envbuf);
+  strcat(tfbuf,"/dpkg.XXXXXX");
   subdir= 0;
   if ((debar= *argv++) !=0) {
     if (*argv) badusage(_("--build takes at most two arguments"));
@@ -209,15 +215,23 @@ void do_build(const char *const *argv) {
     execlp(TAR,"tar","-cf","-",".",(char*)0); ohshite(_("failed to exec tar -cf"));
   }
   close(p1[1]);
-  if (!(gz= tmpfile())) ohshite(_("failed to make tmpfile (control)"));
+  if ((gzfd= mkstemp(tfbuf)) == -1) ohshite(_("failed to make tmpfile (control)"));
+  if ((gz= fdopen(gzfd,"a")) == NULL) ohshite(_("failed to open tmpfile "
+      "(control), %s"), tfbuf);
+  /* make sure it's gone, the fd will remain until we close it */
+  if (unlink(tfbuf)) ohshit(_("failed to unlink tmpfile (control), %s"),
+      tfbuf);
+  /* reset this, so we can use it elsewhere */
+  strcpy(tfbuf,envbuf);
+  strcat(tfbuf,"/dpkg.XXXXXX");
   if (!(c2= m_fork())) {
-    m_dup2(p1[0],0); m_dup2(fileno(gz),1); close(p1[0]);
+    m_dup2(p1[0],0); m_dup2(gzfd,1); close(p1[0]);
     execlp(GZIP,"gzip","-9c",(char*)0); ohshite(_("failed to exec gzip -9c"));
   }
   close(p1[0]);
   waitsubproc(c2,"gzip -9c",0);
   waitsubproc(c1,"tar -cf",0);
-  if (fstat(fileno(gz),&controlstab)) ohshite(_("failed to fstat tmpfile (control)"));
+  if (fstat(gzfd,&controlstab)) ohshite(_("failed to fstat tmpfile (control)"));
   if (oldformatflag) {
     if (fprintf(ar, "%-8s\n%ld\n", OLDARCHIVEVERSION, (long)controlstab.st_size) == EOF)
       werr(debar);
@@ -237,16 +251,24 @@ void do_build(const char *const *argv) {
       werr(debar);
   }                
                 
-  if (lseek(fileno(gz),0,SEEK_SET)) ohshite(_("failed to rewind tmpfile (control)"));
+  if (lseek(gzfd,0,SEEK_SET)) ohshite(_("failed to rewind tmpfile (control)"));
   if (!(c3= m_fork())) {
-    m_dup2(fileno(gz),0); m_dup2(fileno(ar),1);
+    m_dup2(gzfd,0); m_dup2(fileno(ar),1);
     execlp(CAT,"cat",(char*)0); ohshite(_("failed to exec cat (control)"));
   }
   waitsubproc(c3,"cat (control)",0);
   
   if (!oldformatflag) {
     fclose(gz);
-    if (!(gz= tmpfile())) ohshite(_("failed to make tmpfile (data)"));
+    if ((gzfd= mkstemp(tfbuf)) == -1) ohshite(_("failed to make tmpfile (data)"));
+    if ((gz= fdopen(gzfd,"a")) == NULL) ohshite(_("failed to open tmpfile "
+        "(data), %s"), tfbuf);
+    /* make sure it's gone, the fd will remain until we close it */
+    if (unlink(tfbuf)) ohshit(_("failed to unlink tmpfile (data), %s"),
+        tfbuf);
+    /* reset these, in case we want to use the later */
+    strcpy(tfbuf,envbuf);
+    strcat(tfbuf,"/dpkg.XXXXXX");
   }
   m_pipe(p2);
   if (!(c4= m_fork())) {
@@ -258,7 +280,7 @@ void do_build(const char *const *argv) {
   close(p2[1]);
   if (!(c5= m_fork())) {
     m_dup2(p2[0],0); close(p2[0]);
-    m_dup2(oldformatflag ? fileno(ar) : fileno(gz),1);
+    m_dup2(oldformatflag ? fileno(ar) : gzfd,1);
     execlp(GZIP,"gzip","-9c",(char*)0);
     ohshite(_("failed to exec gzip -9c from tar --exclude"));
   }
@@ -266,7 +288,7 @@ void do_build(const char *const *argv) {
   waitsubproc(c5,"gzip -9c from tar --exclude",0);
   waitsubproc(c4,"tar --exclude",0);
   if (!oldformatflag) {
-    if (fstat(fileno(gz),&datastab)) ohshite("_(failed to fstat tmpfile (data))");
+    if (fstat(gzfd,&datastab)) ohshite("_(failed to fstat tmpfile (data))");
     if (fprintf(ar,
                 "%s"
                 DATAMEMBER "%-12lu0     0     100644  %-10ld`\n",
@@ -275,9 +297,9 @@ void do_build(const char *const *argv) {
                 (long)datastab.st_size) == EOF)
       werr(debar);
 
-    if (lseek(fileno(gz),0,SEEK_SET)) ohshite(_("failed to rewind tmpfile (data)"));
+    if (lseek(gzfd,0,SEEK_SET)) ohshite(_("failed to rewind tmpfile (data)"));
     if (!(c3= m_fork())) {
-      m_dup2(fileno(gz),0); m_dup2(fileno(ar),1);
+      m_dup2(gzfd,0); m_dup2(fileno(ar),1);
       execlp(CAT,"cat",(char*)0); ohshite(_("failed to exec cat (data)"));
     }
     waitsubproc(c3,"cat (data)",0);

+ 3 - 2
dpkg-deb/info.c

@@ -59,12 +59,13 @@ static void info_prepare(const char *const **argvp,
                          const char **debarp,
                          const char **directoryp,
                          int admininfo) {
-  static char dbuf[L_tmpnam];
+  static char *dbuf;
   pid_t c1;
   
   *debarp= *(*argvp)++;
   if (!*debarp) badusage(_("--%s needs a .deb filename argument"),cipaction->olong);
-  if (!tmpnam(dbuf)) ohshite(_("failed to make temporary filename"));
+  if ((dbuf= tempnam(NULL,"dpkg")) == NULL)
+    ohshite(_("failed to make temporary filename"));
   *directoryp= dbuf;
 
   if (!(c1= m_fork())) {

+ 2 - 2
include/Makefile.am

@@ -29,12 +29,12 @@ MAINTAINERCLEANFILES	= $(srcdir)/Makefile.in
 .PHONY: install-data-local uninstall-local
 
 install-data-local:
-	$(mkinstalldirs) $(pkglocalstatedir)/{$(pinfo_suffix),$(pupdates_suffix)}
+	$(mkinstalldirs) $(DESTDIR)$(pkglocalstatedir)/{$(pinfo_suffix),$(pupdates_suffix)}
 
 uninstall-local:
 	-for d in $(pkglocalstatedir)/{$(pinfo_suffix),$(pupdates_suffix)} \
 		$(pkgincludedir) $(pkglocalstatedir) $(pkglocalstatedir); do \
-		[ -e $$d ] && rmdir $$d; \
+		[ -e $$d ] && rmdir $(DESTDIR)$$d; \
 	done
 
 dpkg.h: stamp-dpkg.h

+ 31 - 20
methods/Makefile.am

@@ -26,62 +26,73 @@ MAINTAINERCLEANFILES	= $(srcdir)/Makefile.in
 	install-exec-local dist-hook uninstall-local
 
 install-data-local: install-methods-data install-descs-data
-	$(mkinstalldirs) $(methodsmnt)
+	$(mkinstalldirs) $(DESTDIR)$(methodsmnt)
 
 install-methods-data:
 	set -e; for m in $(METHODS); do \
-		$(mkinstalldirs) $(methodsdir)/$$m $(methodsdatadir)/$$m; \
-		$(INSTALL_DATA) $(srcdir)/$$m.names $(methodsdir)/$$m/names; \
+		$(mkinstalldirs) $(DESTDIR)$(methodsdir)/$$m \
+			$(DESTDIR)$(methodsdatadir)/$$m; \
+		$(INSTALL_DATA) $(srcdir)/$$m.names \
+			$(DESTDIR)$(methodsdir)/$$m/names; \
 	done
 
 install-descs-data:
 	set -e; for x in $(DESCS); do \
 		d=`echo $$x | sed 's:.*/\([^/]*\)$$:\1:; s:\.:/:'`; \
-		$(INSTALL_DATA) $(srcdir)/$$x $(methodsdir)/$$d; \
+		$(INSTALL_DATA) $(srcdir)/$$x $(DESTDIR)$(methodsdir)/$$d; \
 	done
 
 install-exec-local:
 	set -e; for m in $(METHODS); do \
-		$(mkinstalldirs) $(methodsdir)/$$m $(methodsdatadir)/$$m; \
+		$(mkinstalldirs) $(DESTDIR)$(methodsdir)/$$m \
+			$(DESTDIR)$(methodsdatadir)/$$m; \
 	done
 	set -e; for m in $(METHODS); do \
 		for s in $(MSCRIPTS); do \
-			$(INSTALL_PROGRAM) $(srcdir)/$$m.$$s $(methodsdir)/$$m/$$s; \
+			$(INSTALL_PROGRAM) $(srcdir)/$$m.$$s \
+				$(DESTDIR)$(methodsdir)/$$m/$$s; \
 		done; \
 	done
 
 uninstall-local:
 	-for m in $(METHODS); do \
-		rm -f $(methodsdir)/$$m/names; \
-		[ -e $(methodsdir)/$$m ] && rmdir $(methodsdir)/$$m; \
+		rm -f $(DESTDIR)$(methodsdir)/$$m/names; \
+		[ -e $(DESTDIR)$(methodsdir)/$$m ] && rmdir \
+			$(DESTDIR)$(methodsdir)/$$m; \
 	done
 	-for x in $(DESCS); do \
 		d=`echo $$x | sed 's:\.:/:'`; \
 		dir=`echo $$d | sed 's:\(.*\)/[^/]*$$:\1:'`; \
-		rm -f $(methodsdir)/$$d; \
-		[ -e $$dir ] && rmdir $$dir; \
+		rm -f $(DESTDIR)$(methodsdir)/$$d; \
+		[ -e $(DESTDIR)$$dir ] && rmdir $(DESTDIR)$$dir; \
 	done
 	-for m in $(METHODS); do \
 		for s in $(MSCRIPTS); do \
-			rm -f $(methodsdir)/$$m/$$s; \
+			rm -f $(DESTDIR)$(methodsdir)/$$m/$$s; \
 		done; \
-		[ -e $(methodsdir)/$$m ] && rmdir $(methodsdir)/$$m; \
-		[ -e $(methodsdatadir)/$$m ] && rmdir $(methodsdatadir)/$$m; \
-		[ -e $(methodsmnt)/$$m ] && rmdir $(methodsmnt)/$$m; \
+		[ -e $(DESTDIR)$(methodsdir)/$$m ] && rmdir \
+			$(DESTDIR)$(methodsdir)/$$m; \
+		[ -e $(DESTDIR)$(methodsdatadir)/$$m ] && rmdir \
+			$(DESTDIR)$(methodsdatadir)/$$m; \
+		[ -e $(DESTDIR)$(methodsmnt)/$$m ] && rmdir \
+			$(DESTDIR)$(methodsmnt)/$$m; \
 	done
-	-[ -e $(methodsmnt) ] && rmdir $(methodsmnt)
-	-[ -e $(methodsdir) ] && rmdir $(methodsdir)
-	-[ -e $(methodsdatadir) ] && rmdir $(methodsdatadir)
+	-[ -e $(DESTDIR)$(methodsmnt) ] && rmdir \
+		$(DESTDIR)$(methodsmnt)
+	-[ -e $(DESTDIR)$(methodsdir) ] && rmdir \
+		$(DESTDIR)$(methodsdir)
+	-[ -e $(DESTDIR)$(methodsdatadir) ] && rmdir \
+		$(DESTDIR)$(methodsdatadir)
 
 dist-hook:
 	set -e; for m in $(METHODS); do \
-		cp -p $(srcdir)/$$m.names $(distdir)/; \
+		cp -p $(srcdir)/$$m.names $(DESTDIR)$(distdir)/; \
 		for s in $(MSCRIPTS); do \
-			cp -p $(srcdir)/$$m.$$s $(distdir)/; \
+			cp -p $(srcdir)/$$m.$$s $(DESTDIR)$(distdir)/; \
 		done; \
 	done
 	for d in $(DESCS); do \
-		cp -p $(srcdir)/$$d $(distdir)/; \
+		cp -p $(srcdir)/$$d $(DESTDIR)$(distdir)/; \
 	done
 
 ## End of file.