emacsen-common-2.0.7/0000755000000000000000000000000012265016154011311 5ustar emacsen-common-2.0.7/debian/0000755000000000000000000000000012265017501012530 5ustar emacsen-common-2.0.7/debian/control0000644000000000000000000000057112264557506014153 0ustar Source: emacsen-common Section: editors Priority: optional Build-Depends: debhelper (>= 8) Maintainer: Rob Browning Standards-Version: 3.6.2 Package: emacsen-common Architecture: all Description: Common facilities for all emacsen This package contains code that is needed by all the (x)emacs packages. It will be automatically installed when needed. emacsen-common-2.0.7/debian/emacsen-common.install0000644000000000000000000000055212264557506017040 0ustar compat/emacsen-common /usr/lib/emacsen-common/packages/compat site-start.el etc/emacs 00debian-vars.el etc/emacs/site-start.d debian-startup.el usr/share/emacs/site-lisp emacs-install usr/lib/emacsen-common emacs-remove usr/lib/emacsen-common emacs-package-install usr/lib/emacsen-common emacs-package-remove usr/lib/emacsen-common lib.pl usr/lib/emacsen-common emacsen-common-2.0.7/debian/prerm0000644000000000000000000000025112264557506013613 0ustar #!/bin/sh set -e /usr/lib/emacsen-common/emacs-package-remove --prerm emacsen-common rm -f /var/lib/emacsen-common/state/package/installed/emacsen-common #DEBHELPER# emacsen-common-2.0.7/debian/source/0000755000000000000000000000000012264557506014045 5ustar emacsen-common-2.0.7/debian/source/format0000644000000000000000000000001512264557506015254 0ustar 3.0 (native) emacsen-common-2.0.7/debian/compat0000644000000000000000000000000212264557506013743 0ustar 8 emacsen-common-2.0.7/debian/postrm0000644000000000000000000000013512264557506014013 0ustar #!/bin/sh set -e if [ "$1" = purge ] then rm -rf /var/lib/emacsen-common fi #DEBHELPER# emacsen-common-2.0.7/debian/emacsen-common.docs0000644000000000000000000000011112264557506016311 0ustar debian-emacs-policy sample-package-install-foo sample-package-remove-foo emacsen-common-2.0.7/debian/rules0000755000000000000000000000216312264557506013627 0ustar #!/usr/bin/make -f # Copyright (C) 2012, Rob Browning # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 pkg_dir := debian/emacsen-common pkg_ec_lib := $(pkg_dir)/usr/lib/emacsen-common pkg_ec_var := $(pkg_dir)/var/lib/emacsen-common %: dh $@ override_dh_auto_build: dh_testdir debian-emacs-policy debian/rules chmod u+x emacs-install emacs-remove chmod u+x emacs-package-install emacs-package-remove chmod u+x emacsen-common.install emacsen-common.remove override_dh_auto_install: dh_testdir debian-emacs-policy debian/rules perl -wc emacs-install perl -wc emacs-remove perl -wc emacs-package-install perl -wc emacs-package-remove perl -wc lib.pl rm -rf $(pkg_dir) install -D emacsen-common.install \ $(pkg_ec_lib)/packages/install/emacsen-common install -D emacsen-common.remove \ $(pkg_ec_lib)/packages/remove/emacsen-common install -d $(pkg_ec_lib)/packages/compat install -d $(pkg_ec_var)/state/flavor/installed install -d $(pkg_ec_var)/state/package/installed install -d $(pkg_dir)/usr/local/share/emacs/site-lisp find $(pkg_dir)/usr/local/share/emacs/site-lisp -ls emacsen-common-2.0.7/debian/preinst0000644000000000000000000000060412264557506014154 0ustar #!/bin/sh set -e # The emacsen-common package is a special case; we can't call # emacs-package-install from here since the new version hasn't been # unpacked yet, so just do the important bit that it would have done. installed_state_dir=/var/lib/emacsen-common/state/package/installed if test -d "$installed_state_dir" then rm -f "$installed_state_dir"/emacsen-common fi #DEBHELPER# emacsen-common-2.0.7/debian/changelog0000644000000000000000000004510312265017501014405 0ustar emacsen-common (2.0.7) unstable; urgency=medium * Fix typo; add missing "-m" to mkdir call in postinst and policy. Thanks to Stefan Lippers-Hollmann for the report. (Closes: 735155) -- Rob Browning Mon, 13 Jan 2014 11:00:10 -0600 emacsen-common (2.0.6) unstable; urgency=low * Don't use given/when syntax in emacs-install and emacs-package-install. It's experimental and produces warnings with Perl 5.18. Thanks to Guillem Jover for the report. (Closes: 723157) * sample-package-remove-foo: don't fail if elc_dir is already gone. Thanks to Kevin Ryde for the suggestion. (Closes: 711915) * Complain loudly if an add-on package appears to be broken. Add validate_add_on_pkg() to verify that an add-on package's invocations match its "style", and call it from emacs-package-install and emacs-package-remove. * Ensure there are no duplicates in get_installed_add_on_packages() result. * Check dpkg exit status when reading package status. * emacs-install: mark emacsen flavor available before handling all the add-ons. * Check for unlink errors when handling emacsen flavor installed state file. * emacs-install/emacs-remove: stop messing with package installed state files. That was just wrong -- the installed state file only indicates that a package is ready to go (i.e. it's safe to start calling the install/remove scripts). It has nothing to do with emacsen flavors. * emacs-install/emacs-remove: treat each add-on as old/new case-by-case. Whether or not an add-on package is old or new is a property of the package itself. The old or new status of the emacsen flavor is irrelevant. * Check for unlink errors when handling an add-on's installed state file. * Fix handling of add-on package installed state file. Mark an add-on package as ready (installed) sooner, and wait until after all of the relevant removals before marking an add-on as unavailable. Note that the state file is only intended to indicate that the package is ready for processing by emacsen-common. * debian-emacs-policy: require add-on postinst/prerm to handle state directly. Add-on packages must now maintain their installed/ file directly from their postinst/prerm scripts. This should fix a race whenever emacsen-common and an add-on package are being installed at the same time (i.e. perhaps via "apt-get install add-on emacs24"). If the add-on's postinst goes first, its emacsen install script won't be run. * debian-emacs-policy: change conflicts requirement from "<" to "<<". -- Rob Browning Sat, 11 Jan 2014 20:22:23 -0600 emacsen-common (2.0.5) unstable; urgency=low * Don't ignore dependency install scripts in emacs-package-install. The previous code didn't actually update the script name properly in the loop where it was trying to install all of an add-on package's dependencies. As a result, none of the dependencies' install scripts were actually invoked. Thanks to Sébastien Villemot for tracking down the problem, and providing the patch. (closes: #693472) * Invoke each add-on install script correctly as new-style or old-style. Previously, emacs-package-install would invoke all of the add-on install scripts in a dependency chain as either old-style or new-style, based solely on whether or not the package that triggered the install was old-style or new-style. Now it should invoke each package's install script based on whether the package itself is new-style or old-style, as determined by the presence or absence of the policy-required /usr/lib/emacsen-common/packages/compat/PACKAGE file. Thanks to Sébastien Villemot for the report. (closes: #693472) -- Rob Browning Wed, 12 Dec 2012 20:15:05 -0600 emacsen-common (2.0.4) unstable; urgency=low * Don't use the obsolete calc package as a policy example. Thanks to "A. N. Other" for the report. (closes: #674181) * Don't override /usr/local/* load-path entries in debian-run-directories. Previously, debian-run-directories would prepend all of the add-on package paths to load-path, which meant that (in violation of Debian policy) /usr/local wouldn't preceed the other entries. Thanks to Hendrik Tews for the report and Kevin Ryde for an initial suggested patch -- posted to #454778. (closes: #676424) -- Rob Browning Sun, 02 Dec 2012 16:03:18 -0600 emacsen-common (2.0.3) unstable; urgency=low * Move #DEBHEPLER# up in the postinst to avoid an emacs complaint about a missing /usr/local/emacs/site-lisp during the emacsen-common package install script. * Report something like "ERROR: install script from foo package failed" to more clearly indicate the cause of an install/remove failure. -- Rob Browning Tue, 22 May 2012 22:53:55 -0500 emacsen-common (2.0.2) unstable; urgency=low * Install usr/local/emacs/site-lisp in the right place so debhelper will handle it. Thanks to Vincent Lefevre for the report. (Closes: #672878) -- Rob Browning Mon, 14 May 2012 19:40:05 -0500 emacsen-common (2.0.1) unstable; urgency=low * Add debian-emacs-policy requirement that add-on packages conflict with emacsen-common < 2.0.0. * Put emacsen-commmon install/remove scripts in the correct location. Thanks to Adam Borowski and Ondřej Surý for the report. (Closes: #672874) -- Rob Browning Mon, 14 May 2012 19:15:57 -0500 emacsen-common (2.0.0) unstable; urgency=low * Remove the requirement that add-on packages depend on emacsen or emacsen-common. This should eliminate the need for many of the trivial Debian foo-el packages, but before the dependencies can be removed, an add-on package must be changed to follow the updated debian-emacs-policy. * Treat the failure of any add-on package install or remove script as a fatal error. Otherwise inter-add-on package dependencies won't be respected. * Migrate to debhelper. -- Rob Browning Sun, 13 May 2012 16:38:30 -0500 emacsen-common (1.4.23) unstable; urgency=low * Remove vestigal dependency on bsdmainutils. Thanks to Sven Joachim for the report. (Closes: #480894) * Require add-on packages to create .el symlinks alongside .elc files. Update debian-emacs-policy to require add-on packages to install a .el symlink alongside each compiled .elc file. Thanks to "Karl M. Hegbloom" for the original report. (Closes: #122444) -- Rob Browning Sat, 11 Feb 2012 15:55:07 -0600 emacsen-common (1.4.22) unstable; urgency=medium * Call mapc instead of mapcar in debian-startup.el since mapcar was only being called for side-effects. Thanks to "Trent W. Buck" for the report. (closes: 530961) -- Rob Browning Wed, 01 Dec 2010 21:46:10 -0600 emacsen-common (1.4.21) unstable; urgency=medium * Don't print a message if /etc/mailname doesn't exist. Thanks to Josh Triplett for the report. (closes: 427757) -- Rob Browning Tue, 30 Nov 2010 17:57:47 -0600 emacsen-common (1.4.20) unstable; urgency=medium * Update debian-emacs-policy to correctly reflect current usage. * Don't call install-info to remove old emacs entry in the postinst. It's been many years since the last package created that entry. Thanks to Marco Nenciarini for the report. (closes: 604164) -- Rob Browning Mon, 29 Nov 2010 21:26:02 -0600 emacsen-common (1.4.19) unstable; urgency=low * Move the sample package install/remove scripts from debian-emacs-policy to the files sample-package-install-foo and sample-package-remove-foo in /usr/share/doc/emacsen-common. * Fix some suspicious code in the sample package install/remove scripts. Thanks to Kevin Ryde . (closes: 424940) * Update debian-file->string to use insert-file-contents-literally. Change gnus-nntpserver-file defvar to setq. Thanks to Jari Aalto . (closes: 269155) * Always call debian-run-directories. Previously a bug would prevent it from running if debian-emacs-flavor wasn't set. Thanks to Francesco Potorti` and Andrew Kemp . (closes: 222518, 136779) * Thanks to Agustin Martin Domingo for collecting and incorporating many of the fixes in the previous release, this release, and probably the next several releases into his git repository. That work is being used heavily as a reference during these updates. -- Rob Browning Sun, 17 May 2009 15:42:24 -0700 emacsen-common (1.4.18) unstable; urgency=low * Add --no-site-file and --no-init-file for the compilation of emacsen-common's .elc files. Those options should be fine for emacsen-common itself right now. Thanks to Peter S Galbraith . (closes: 132355) * Fix minor documentation bug. Thanks to Roland Stigge . (closes: 208414) * Print the error message when debian-run-directories encounters an error while loading a file. Thanks to Kevin Ryde . (closes: 329030) -- Rob Browning Sun, 10 May 2009 20:52:52 -0700 emacsen-common (1.4.17) unstable; urgency=low * Remove "Conflicts: emacs". If I recall correctly, this dates back to a time when the Emacs binary package was just named "emacs" (i.e. unversioned), and before the creation of emacsen-common and the Debian Emacs Policy. The Conflicts should be safe to remove now, and the removal will allow us to create a new emacs-defaults source package (a la gcc-defaults) that will produce an emacs package that always depends on the current "standard" version of Emacs (i.e. emacs21, emacs22, etc.). * Update to Standards-Version to 3.6.2. -- Rob Browning Thu, 5 Jan 2006 18:10:56 -0800 emacsen-common (1.4.16) unstable; urgency=high * Fix sarge RC bug. Alter debian-pkg-add-load-path-item to handle nil in load-path. Thanks to Manoj Srivastava. (closes: 270388) * Include section and priorty in dpkg-gencontrol generated control file. (closes: 288752) * Don't create /usr/doc/ symlinks anymore. * Remove pause in 00debian-vars.el when there is no /etc/mailname. The message will always be available in *Messages*. The real fix for this may involve bug 149924. (closes: 115116) * Ignore *~ when generating package list. Eventually we may do something more like run-parts, but this is at least an improvement. (ref: #29494) * Make the package description a bit more elaborate. (closes: 209469) * Fix debian-emacs-policy typo. (closes: 175779) -- Rob Browning Thu, 27 Jan 2005 12:27:09 -0600 emacsen-common (1.4.15) unstable; urgency=low * make /etc/emacs/site-start.d/00debian-vars.el a conffile as per Debian policy. (closes: Bug#132842) * don't use dolist (not defined everywhere by default). (closes: Bug#132352) * document debian-pkg-add-load-path-item better and fix to actually modify load-path. (closes: Bug#134464) * make debian-unique-strings iterative since elisp isn't as recursion friendly as we might like. (closes: Bug#131803) * for now, issue a descriptive error message if emacsen-common is used before it's configured. -- Rob Browning Mon, 18 Feb 2002 11:42:31 -0600 emacsen-common (1.4.14) unstable; urgency=low * policy(9): /usr/local/share/emacs//site-lisp should not exist. * policy(9): /usr/share/emacs//site-lisp should not exist. * policy(9): all emacsen must have /usr/share/emacsen-common/mark-end-local in their load-path in the right place. * policy(9): add-on packages must use debian-pkg-add-load-path-item to augment the load-path now. (closes: #122877) * fix non-idempotentency in prerm. (closes: #96702) * remove bogus directories from package. (closes: #121393) * fix generate-install-list dependency list generation bug. (closes: #46948) * patch example in debian-emacs-policy. (closes: #23424) * debian-startup.el: don't call load-file. (closes: #116126) -- Rob Browning Tue, 29 Jan 2002 14:52:51 -0600 emacsen-common (1.4.13) unstable; urgency=low * Update my email address. * Fix tmpfile usage. (closes: #26601, #45140) * Move doc files to /usr/share/doc (closes: #91457, #72493) * Remove execute permission from conffiles file. (closes: #61303) * Updated policy concerning the long-standing problem with version specific site-lisp dirs. New policy, once adopted should eliminate the cruft problem. -- Rob Browning Tue, 17 Jul 2001 11:07:08 -0500 emacsen-common (1.4.12) unstable frozen; urgency=low * Emergency changes to startup policy. We're reverting for now to the old behavior because the new way breaks too many things, and we need to release. Please see debian-emacs-policy's bits about debian-emacs-flavor for details, and sorry for the short notice. -- Rob Browning Tue, 20 Jun 2000 11:17:52 -0500 emacsen-common (1.4.11) unstable frozen; urgency=low * Upload to frozen to match emacs20 bugfix upload for frozen. Without this the frozen emacs20 is uninstallable. (Closes: Bug#64648) * Hopefully accomodate bug in xemacs packages with strange hack. This will work around the current problem, but xemacs still needs some fixing. (Closes: Bug#61161 Bug#61080 Bug#61110 Bug#61133 Bug#61157) * Update debian-emacs-policy to be stricter about startup behaviors and to more clearly indicate what I really meant. Since no one's responded to my proposal on debian-emacsen, I guess there are no objections :> Feel free to bring this up later if you have a problem... -- Rob Browning Thu, 25 May 2000 09:54:12 -0500 emacsen-common (1.4.10) unstable; urgency=low * Moved debian-emacs-flavor here from emacs20. Other emacsen maintainers note, you should not declare this in your packages anymore. It is now set by debian-startup automatically from its argument. See debian-emacs-policy for details. * Fix problem in args to install-info in postinst. (Closes: Bug#25196) * Get /usr/local/... permissions right. (Closes: Bug#25913) * Fix bashism in postrm. (Closes: Bug#41967 Bug#50674) * Remove symlinks from package so I can put it under CVS. -- Rob Browning Tue, 22 Feb 2000 16:11:33 -0600 emacsen-common (1.4.9) frozen unstable; urgency=low * silenced mkdir warnings in postinst. * fixed important bug in dependency sorting (Closes: Bug#34095) -- Rob Browning Mon, 8 Mar 1999 19:00:32 -0600 emacsen-common (1.4.8) unstable; urgency=low * Clean up old "emacs" info entry in postinst. -- Rob Browning Sun, 26 Jul 1998 17:03:05 -0500 emacsen-common (1.4.7) unstable; urgency=low * First implementation of dependency sorting mechanism Sorting mechanism is dirt slow since I have to use N "dpkg --status calls" * Added bsdmainutils dependency (tsort used by dependency mechanism) * Minor edits to debian-emacs-policy. Bigger changes brewing... -- Rob Browning Sat, 25 Jul 1998 13:26:55 -0500 emacsen-common (1.4.6) frozen unstable; urgency=low * debian-emacs-policy: add-on packages may not depend on emacsen-common. * debian-emacs-policy: add-on packages must declare install/remove script dependencies (i.e. make, etc.) * fixed postinst to be cleaner about /usr/local/* (Closes: Bug#21524, Bug#22737, Bug#22959) * Made /etc/emacs/site-start.el a conffile (Closes: Bug#21934) -- Rob Browning Mon, 29 Jun 1998 18:53:51 -0500 emacsen-common (1.4.5) frozen unstable; urgency=low * Fixed upload problem. This should still go in frozen as it still closes Bug#21089. -- Rob Browning Sat, 16 May 1998 21:18:10 -0500 emacsen-common (1.4.4) frozen unstable; urgency=low * Fix things so failure in add-on package install/remove script won't kill an emacs flavor install, but will kill an independent add-on package install. (Closes: Bug#21089) -- Rob Browning Fri, 15 May 1998 13:06:04 -0500 emacsen-common (1.4.3) frozen unstable; urgency=low * Fix problem in postinst /usr/local... creation (Closes: Bug#19935) -- Rob Browning Thu, 19 Mar 1998 08:15:55 -0600 emacsen-common (1.4.2) frozen unstable; urgency=low * Upload to frozen and unstable (oops.) -- Rob Browning Tue, 17 Mar 1998 13:10:20 -0600 emacsen-common (1.4.1) unstable; urgency=low * Fixed typos in debian-emacs-policy. * Fixed handling of /usr/local dir. (Closes: Bug#19301) * Fixed load-path clobbering in debian-startup.el (Closes: Bug#19597) * Switched to more reasonable version numbering (debian-only package). Using Linux kernel scheme. -- Rob Browning Fri, 13 Mar 1998 12:21:29 -0600 emacsen-common (1.3-1) unstable; urgency=low * Fixed debian-vars (Closes: Bug#17235) - renamed functions to debian-* - eliminated spurious message about mark. - don't set user-mail-address (it's done for you by emacs later) - clean up load messages -- Rob Browning Sat, 14 Feb 1998 15:20:00 -0600 emacsen-common (1.2-1) unstable; urgency=low * Fixed disabled load line in debian-startup.el (Closes: Bug#18189) -- Rob Browning Sat, 14 Feb 1998 13:03:20 -0600 emacsen-common (1.1-2) unstable; urgency=low * Updated postrm to remove /var/lib/emacsen-common on purge if it's actually empty. -- Rob Browning Mon, 9 Feb 1998 01:34:32 -0600 emacsen-common (1.1-1) unstable; urgency=low * Added debian-emacs-policy to /usr/doc/emacsen-common * Updated debian-emacs-policy to reflect this. * Changed to call add-on install/remove scripts for the common "emacs" flavor only on package install. -- Rob Browning Fri, 23 Jan 1998 20:49:35 -0600 emacsen-common (1.0-1) unstable; urgency=low * Initial creation. -- Rob Browning Sun, 18 Jan 1998 13:35:05 -0600 emacsen-common-2.0.7/debian/postinst0000644000000000000000000000124312265016154014341 0ustar #!/bin/sh set -e # Convert installed-flavors to flavor/installed/*. if test -e /var/lib/emacsen-common/installed-flavors then for flavor in $(cat /var/lib/emacsen-common/installed-flavors) do touch "/var/lib/emacsen-common/state/flavor/installed/$flavor" done rm -f /var/lib/emacsen-common/installed-flavors fi # Put debhelper section before emacs-package-install to avoid emacs # complaints about missing /usr/local/share/emacs/site-lisp. #DEBHELPER# mkdir -p -m 0755 /var/lib/emacsen-common/state/package/installed touch /var/lib/emacsen-common/state/package/installed/emacsen-common /usr/lib/emacsen-common/emacs-package-install --postinst emacsen-common emacsen-common-2.0.7/debian/copyright0000644000000000000000000000065712264557506014510 0ustar This package was created by Rob Browning on Sun, 18 Jan 1998 13:36:35 -0600 The source for this package was created by Robert Browning with some code borrowed from the previous Debian emacs 19 package. Unless otherwise noted, the contents are Copyright Robert Browning, 1998-2012 and all of the code is covered under the terms of the GPL. See the file /usr/share/common-licenses/GPL for more information. emacsen-common-2.0.7/lib.pl0000755000000000000000000001154012264557506012432 0ustar #!/usr/bin/perl -w use strict; use Cwd; # depends on: dpkg, tsort, perl my $lib_dir = "/usr/lib/emacsen-common"; my $var_dir = "/var/lib/emacsen-common"; $::installed_package_state_dir = "${var_dir}/state/package/installed"; $::installed_flavor_state_dir = "${var_dir}/state/flavor/installed"; sub ex { my(@cmd) = @_; if(system(@cmd) != 0) { die join(" ", @cmd) . " failed"; } } sub glob_in_dir { my ($dir, $pattern) = @_; my $oldir = getcwd; chdir($dir) or die "chdir $dir: $!"; my @files = glob("*[!~]"); chdir($oldir); return \@files; } sub validate_add_on_pkg { my ($pkg, $script, $old_invocation_style) = @_; if($old_invocation_style) { if(-e "$lib_dir/packages/compat/$pkg") { print STDERR "ERROR: $pkg is broken - called $script as an old-style add-on, but has compat file.\n"; #exit(1); } } else # New invocation style. { unless(-e "$lib_dir/packages/compat/$pkg") { print STDERR "ERROR: $pkg is broken - called $script as a new-style add-on, but has no compat file.\n"; #exit(1); } } } sub get_installed_add_on_packages { # Return all of the old format packages, plus all of the new-format # packages that are ready (i.e. have a state/installed file). In # this case ready means ready for compilation. my $all_pkgs = glob_in_dir("$lib_dir/packages/install", '*[!~]'); my $new_format_pkgs = glob_in_dir("$lib_dir/packages/compat", '*[!~]'); my %ready_pkgs = map { $_ => 1 } @$all_pkgs; for my $p (@$new_format_pkgs) { delete $ready_pkgs{$p} unless (-e "$::installed_package_state_dir/$p"); } my @result = keys %ready_pkgs; return \@result; } sub get_installed_flavors { my $flavors = glob_in_dir($::installed_flavor_state_dir, '*[!~]'); return @$flavors; } sub get_package_status { my($pkg) = @_; my $status = `dpkg --status $pkg`; die 'emacsen-common: dpkg invocation failed' if($? != 0); $status =~ s/\n\s+//gmo; # handle any continuation lines... return $status; } sub filter_depends { my($depends_string, $installed_add_ons) = @_; # Filter out all the "noise" (version number dependencies, etc) # and handle or deps too, i.e. "Depends: foo, bar | baz" my @relevant_depends = split(/[,|]/, $depends_string); @relevant_depends = map { /\s*(\S+)/o; $1; } @relevant_depends; # Filter out all non-add-on packages. @relevant_depends = grep { my $candidate = $_; grep { $_ eq $candidate } @$installed_add_ons; } @relevant_depends; return @relevant_depends; } sub generate_relevant_tsort_dependencies_internals { my($pkglist, $installed_add_ons, $progress_hash) = @_; # print "GRD: " . join(" ", @$pkglist) . "\n"; my $pkg = shift @$pkglist; if(!$pkg || $$progress_hash{$pkg}) { return (); } else { my $status = get_package_status($pkg); $status =~ /^Depends:\s+(.*)/mo; my $depends = $1; $depends = "" if ! $depends; my @relevant_depends = filter_depends($depends, $installed_add_ons); my $newpkglist = [@$pkglist, @relevant_depends]; $$progress_hash{$pkg} = 1; # pkg is in twice so we don't have to worry about package with no # relevant dependencies. tsort can't handle that. my @tsort_strings = "$pkg $pkg\n"; map { push @tsort_strings, "$_ $pkg\n"; } @relevant_depends; return (@tsort_strings, generate_relevant_tsort_dependencies_internals($newpkglist, $installed_add_ons, $progress_hash)); } } sub generate_relevant_tsort_dependencies { my($pkglist, $installed_add_ons, $progress_hash) = @_; # Make a copy because we're going to mangle it. my @listcopy = @$pkglist; shift @_; return(generate_relevant_tsort_dependencies_internals(\@listcopy, @_)); } sub reorder_add_on_packages { my($pkglist, $installed_add_ons) = @_; my @depends = generate_relevant_tsort_dependencies($pkglist, $installed_add_ons, {}); my $pid = open(TSORT, "-|"); die "Couldn't fork for tsort: $!" unless defined($pid); # What a strange idiom... if($pid == 0) { my $sub_pid = open(IN, "|-"); die "Couldn't sub-fork for tsort: $!" unless defined($sub_pid); if($sub_pid == 0) { exec 'tsort' or die "Couldn't run tsort: $!"; } print IN @depends; exit 0; } my @ordered_pkgs = ; chomp @ordered_pkgs; return @ordered_pkgs } sub generate_add_on_install_list { my($packages_to_sort) = @_; my @sorted_pkgs = reorder_add_on_packages($packages_to_sort, get_installed_add_on_packages()); return(@sorted_pkgs); } # Test code # my @input_packages = ; # my @result = generate_add_on_install_list(@input_packages); # print " " . join("\n ", @result); # To make require happy... 1; emacsen-common-2.0.7/emacs-install0000755000000000000000000000336512264557506014014 0ustar #!/usr/bin/perl -w use Errno; use strict; my $lib_dir = "/usr/lib/emacsen-common"; my $invoked_by_old_pkg; my $context; my $flavor; require $lib_dir . "/lib.pl"; umask 0022 or die "emacs-install: can't set umask, aborting."; sub usage { my($file_handle) = @_; if($invoked_by_old_pkg) { print $file_handle "Usage: emacs-install FLAVOR\n"; } else { print $file_handle "Usage: emacs-install (--preinst|--postinst) FLAVOR\n"; } } if(scalar(@ARGV) == 1) { $invoked_by_old_pkg = 1; $flavor = $ARGV[0]; $context = 'postinst;' } elsif (scalar(@ARGV) == 2) { if($ARGV[0] eq '--preinst') { $context = 'preinst'; } elsif($ARGV[0] eq '--postinst') { $context = 'postinst'; } else { usage(*STDERR{IO}); exit(1); } $flavor = $ARGV[1]; } else { usage(*STDERR{IO}); exit(1); } if($context eq 'preinst') { my $f = "$::installed_flavor_state_dir/$flavor"; unlink("$f"); die "ERROR: cannot unlink $f: $!, " unless (unlink($f) or $!{ENOENT}); exit(0); } # Must be --postinst. my @installed_flavors = get_installed_flavors(); # Mark as safe to include in list of flavors for package setup. ex('touch', "$::installed_flavor_state_dir/$flavor"); my @ordered_pkg_list = generate_add_on_install_list(get_installed_add_on_packages()); foreach my $pkg (@ordered_pkg_list) { print "Install $pkg for $flavor\n"; my $script = $lib_dir . "/packages/install/$pkg"; my $failed; if(-e "$lib_dir/packages/compat/$pkg") # New-style package. { $failed = -e $script && (system($script, $flavor) != 0); } else # Old-style package. { $failed = -e $script && (system($script, $flavor, @installed_flavors) != 0); } if($failed) { print STDERR "ERROR: install script from $pkg package failed\n"; exit(1); } } emacsen-common-2.0.7/debian-startup.el0000644000000000000000000001277112264557506014577 0ustar ;;; debian-startup.el --- Debian specific emacsen startup code. ;; Copyright (C) 1998-2012 Rob Browning ;; Maintainer: Rob Browning ;; Keywords: debian ;; This file is part of the debian release of GNU Emacs, and will ;; be contributed to the FSF after testing. It is released under the same ;; terms, namely the GPL v2 or later. ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. ;;; Commentary: ;; This file contains startup code needed by all the various flavors ;; of Emacs for a Debian system. (defun debian-pkg-add-load-path-item (item) "Takes a path item (a string) and adds it to load path in the correct position for an add-on package, before the emacs system directories, but after the /usr/local/ directories. After modifying load-path, returns the new load-path." (let ((pos 0) (last-local-pos nil) (lp-rest load-path)) ;; Find the last /usr/local/ element. (while (not (null lp-rest)) (if (and (not (null (car lp-rest))) (string-match "^/usr/local" (car lp-rest))) (setq last-local-pos pos)) (setq pos (+ pos 1)) (setq lp-rest (cdr lp-rest))) (if (not last-local-pos) (error "No /usr/local/ prefixed paths in load-path")) (let ((result '()) (pos 0) (remainder load-path)) (while (consp remainder) (setq result (cons (car remainder) result)) (setq remainder (cdr remainder)) (if (= pos last-local-pos) (setq result (cons item result))) (setq pos (+ pos 1))) (setq load-path (nreverse result)) load-path))) (defun debian-unique-strings (strings) "Takes a list of strings and returns the list with *adjacent* duplicates removed." (let ((result '())) (while (consp strings) (if (not (string= (car strings) (car (cdr strings)))) (setq result (cons (car strings) result))) (setq strings (cdr strings))) (nreverse result))) (defun debian-run-directories (&rest dirs) "Load each file of the form XXfilename.el or XXfilename.elc in any of the dirs, where XX must be a number. The files will be run in alphabetical order. If a file appears in more than one of the dirs, then the earlier dir takes precedence, and a .elc file always supercedes a .el file of the same name." (let* ((paths (mapcar 'copy-sequence dirs)) ; Ensure we have unique objects. ;; Get a list of all the files in all the specified ;; directories that match the pattern. (files (apply 'append (mapcar (lambda (dir) (directory-files dir nil "^[0-9][0-9].*\\.elc?$" t)) paths))) ;; Now strip the directory portion, remove any .el or .elc ;; extension. (stripped-names (mapcar (lambda (file) (if (string-match "\\.el$" file) (substring file 0 -3) (if (string-match "\\.elc$" file) (substring file 0 -4) file))) (mapcar (lambda (file) (file-name-nondirectory file)) files))) ;; Finally sort them, and delete duplicates (base-names (debian-unique-strings (sort stripped-names 'string<)))) (setq load-path (append paths load-path)) ; Prefix paths temporarily. ;; Now load the files. "load" will make sure we get the byte ;; compiled one first, if any, and will respect load-path's ;; ordering. (mapc (lambda (file) (condition-case err (load file nil) (error (message "Error while loading %s: %s" file (error-message-string err))))) base-names) ;; Remove the paths we inserted, and only those paths. (dolist (item paths) (setq load-path (remq item load-path))))) (defun debian-startup (flavor) ;; Our handling of debian-emacs-flavor here is truly weird, but we ;; have to do it like this because some of the emacsen flavors ;; didn't DWIM in their startup sequence. I wasn't as clear as I ;; should have been in debian-policy, but they were also ;; technically violating policy. ;; It's even weirder now. I've changed policy back to the old way, ;; but I'm also doing some sanity checking here and making sure that ;; even debian-emacs-flavor gets set no matter what. I'm in a rush ;; right now, but I'll come back later and make all this cleaner and ;; better documented. Sorry. (unless (boundp 'debian-emacs-flavor) (defconst debian-emacs-flavor flavor "A symbol representing the particular debian flavor of emacs that's running. Something like 'emacs20, 'xemacs20, etc.")) (let ((common-dir "/etc/emacs/site-start.d") (flavor-dir (concat "/etc/" (symbol-name flavor) "/site-start.d"))) (debian-run-directories flavor-dir common-dir))) emacsen-common-2.0.7/emacs-package-install0000755000000000000000000000433112264557506015377 0ustar #!/usr/bin/perl -w use Errno; use strict; my $lib_dir = "/usr/lib/emacsen-common"; my $invoked_by_old_pkg; my $context; my $pkg; require $lib_dir . "/lib.pl"; umask 0022 or die "emacs-package-install: can't set umask, aborting."; sub usage { my($file_handle) = @_; if($invoked_by_old_pkg) { print $file_handle "Usage: emacs-package-install FLAVOR\n"; } else { print $file_handle "Usage: emacs-package-install (--preinst|--postinst) FLAVOR\n"; } } sub is_new_pkg { my($pkg) = @_; return (-e "$lib_dir/packages/compat/$pkg"); } if(scalar(@ARGV) == 1) { $invoked_by_old_pkg = 1; $pkg = $ARGV[0]; $context = 'postinst'; } elsif (scalar(@ARGV) == 2) { if($ARGV[0] eq '--preinst') { $context = 'preinst'; } elsif($ARGV[0] eq '--postinst') { $context = 'postinst'; } else { usage(*STDERR{IO}); exit(1); } $pkg = $ARGV[1]; } else { usage(*STDERR{IO}); exit(1); } validate_add_on_pkg($pkg, 'emacs-package-install', $invoked_by_old_pkg); if($context eq 'preinst') { die "ERROR: cannot unlink $::installed_package_state_dir/$pkg: $!, " unless (unlink("$::installed_package_state_dir/$pkg") or $!{ENOENT}); exit(0); } # Must be --postinst. # Mark package as safe to attempt to setup. ex('touch', "$::installed_package_state_dir/$pkg"); # Get all the packages $pkg depends on, dependency sorted. my @pkgs_to_handle = generate_add_on_install_list([$pkg]); my @installed_flavors = get_installed_flavors(); foreach my $pkg (@pkgs_to_handle) { my $script = $lib_dir . "/packages/install/$pkg"; if(is_new_pkg($pkg)) { foreach my $flavor (@installed_flavors) { print "Install $pkg for $flavor\n"; if(-e $script && (system($script, $flavor) != 0)) { print STDERR "ERROR: install script from $pkg package failed\n"; exit(1); } } } else # old pkg { print "Install $pkg for emacs\n"; ex($script, 'emacs', @installed_flavors) if -e $script; foreach my $flavor (@installed_flavors) { print "Install $pkg for $flavor\n"; if(-e $script && (system($script, $flavor, @installed_flavors) != 0)) { print STDERR "ERROR: install script from $pkg package failed\n"; exit(1); } } } } emacsen-common-2.0.7/debian-emacs-policy0000644000000000000000000003572112265016154015051 0ustar -*-indented-text-*- First, for the purposes of this policy, some terminology: - a particular flavor of Emacs, for example: xemacs20 xemacs21 emacs22 emacs23 - either a or the generic value "emacs", i.e.: emacs xemacs20 xemacs21 emacs22 emacs23 add-on package - any package which wishes to use the emacsen-common infrastructure, usually in order to byte-compile itself for some subset of the currently installed emacs flavors. - the name of an add-on package, for example: auctex bbdb gnus 1) Guarding use of emacsen-common infrastructure Any use of the emacsen-common infrastructure must be guarded by a test for the existence of the emacsen-common installed state file. i.e.: if test -e /var/lib/emacsen-common/state/package/installed/emacsen-common then emacs-package-install ... fi Of course this requirement does not apply for the maintainer scripts of any package that depends on emacsen-common (i.e. for each emacsen main package: emacs23, etc.). 2) Flavor indication Each emacs binary must set the variable debian-emacs-flavor to be the same as the name of the debian-package. For example, the emacs23 package does this in startup.el: (defconst debian-emacs-flavor 'emacs23 "A symbol representing the particular debian flavor of emacs running. Something like 'emacs20, 'xemacs20, etc.") For now, debian-emacs-flavor should be defined regardless of the use of -q or --no-site-file. [ NOTE: We may eventually consider moving debian-emacs-flavor to emacsen-common and have emacsen-common set it based on the argument to debian-startup. That would minimize changes to startup.el, but it was attempted briefly in the past, too close to a freeze, and caused enough trouble that we backed off.] 3) Emacs startup strategy We have the following startup files/directories: emacsen-common: /etc/emacs/site-start.{el,d} xemacs20: /etc/xemacs20/site-start.d xemacs21: /etc/xemacs21/site-start.d emacs22: /etc/emacs22/site-start.d emacs23: /etc/emacs23/site-start.d /etc/emacs/site-start.el is a conffile, and is owned by emacsen-common. This file should not be modified by *any* add-on packages, or by any emacsen package maintainer. It is solely for the use of the local admin. It should be empty unless the local admin modifies it. The load-path for a given emacs flavor must include /etc/ and /etc/emacs in that order (see section 8 below), and on startup each emacsen must call (debian-startup ) and then load "site-start". This means that /etc/emacs/site-start.el will be loaded if it exists, unless there's an /etc//site-start.el{,c} or /etc/emacs/site-start.elc which will take precedence. These site-start.el files are also the sole domain of the local system admin, and should be empty unless modified by the local admin. Given that the site-startup.el files are "off-limits" to the emacsen maintainers, the next question is, "Where should we run debian-startup?" The safest possibility, and the one I had originally intended was to modify lisp/startup.el to do the right thing, and I had also intended that --no-site-file would disable all of the Debian startup bits, including calling Debian startup. So here's what emacs23 has in startup.el: ;; Debian startup (if site-run-file (progn ;; Load all the Debian package snippets. ;; It's in here because we want -q to kill it too. (if (load "debian-startup" t t nil) (debian-startup debian-emacs-flavor)) ;; Now the normal site file... (load site-run-file t t nil))) This makes sure that Debian's bits are setup as early as possible, and requires only minor modifications to the emacs source. An alternate possibility might be to use lisp/site-init.el, but I'm not sure that would work right. Feel free to contact me if you know better. debian-startup, among other things, calls debian-run-directories. debian-run-directories collects the union of all the file base names (i.e. without any .el or .elc extension, and without the directory component: i.e. /etc/xemacs/site-start.d/50foo.elc => 50foo), then temporarily augments the emacs load path to include /etc//site-start.d and /etc/emacs/site-start.d in that order, and then calls (load base-name) in alphabetical order. This result is that .elc files will take precedence over .el files in a given directory, and files in the site-start.d directory will take precedence over those in the emacs common directory. 4) Code locations In addition to the /etc//site-start* directories, we have the following directories (their use will be described shortly): emacsen-common: /usr/share/emacs/site-lisp/ xemacs20: /usr/share/xemacs20/site-lisp/ xemacs21: /usr/share/xemacs21/site-lisp/ emacs22: /usr/share/emacs22/site-lisp/ emacs23: /usr/share/emacs23/site-lisp/ These are treated as part of the normal emacsen load path with the dir taking precedence over the emacs (common) dir. /usr/share//site-lisp should be used instead of the normal site-lisp directory for that flavor of emacs, and the package for a given flavor of emacs should not have the normal site-lisp directory. For example, instead of the emacs23 package having /usr/share/emacs/23.2/site-lisp, it should only have /usr/share/emacs23/site-lisp. This is important because it allows us to avoid having dangling directories for old versions across upgrades. We could have chosen to keep a compatibility symlink, but that seemed likely to mask bugs in the debianized packages. 5) Emacs add-on package support (examples below should make this much clearer) A) Each add-on package must add a "Conflicts: emacsen-common (<< 2.0.0)" and include a file like this that indicates its emacsen-common compatibility level: /usr/lib/emacsen-common/packages/compat/ This file should contain a single integer, which at the moment should be 0. (Currently, the file is just used to distinguish between old-style packages and new-style packages.) B) Each add-on package may place a file named the same as the package in /usr/lib/emacsen-common/packages/install/ /usr/lib/emacsen-common/packages/remove/ and the package must make these calls from the given maintainer scripts: preinst: if test -e /var/lib/emacsen-common/state/package/installed/emacsen-common then /usr/lib/emacsen-common/emacs-package-install --preinst fi postinst: mkdir -p -m 0755 /var/lib/emacsen-common/state/package/installed touch /var/lib/emacsen-common/state/package/installed/ if test -e /var/lib/emacsen-common/state/package/installed/emacsen-common then /usr/lib/emacsen-common/emacs-package-install --postinst fi prerm: if test -e /var/lib/emacsen-common/state/package/installed/emacsen-common then /usr/lib/emacsen-common/emacs-package-remove --prerm fi rm -f /var/lib/emacsen-common/state/package/installed/ The postinst call must not be made until the package is completely configured and otherwise ready for use, and the prerm call must be made before any changes that would make the package not completely configured and ready for use. These calls will ensure that the add-on package's emacsen-common install and remove scripts are called at the appropriate times. In particular the postinst call will trigger the install script for every flavor of emacs that's already completely installed. If flavors are being installed simultaneously, the install script may be delayed until that flavor's postinst runs. When the install or remove script is called, the add-on package can assume that the flavor for which it is being invoked is completely installed (i.e. past the significant parts of its postinst). The install and remove scripts will be invoked with a single argument, the being installed or removed. So if emacs23 and xemacs21 are fully installed, installing add-on foo will result in calls to: /usr/lib/emacsen-common/packages/install/foo emacs23 /usr/lib/emacsen-common/packages/install/foo xemacs21 emacs-package remove does the symmetric thing. C) Add-on packages need not declare a dependency on emacsen-common, nor on any emacs flavors, but they must (of course) declare dependencies on any other relevant packages, including relevant add-on packages, or tools needed by the install/remove scripts. The emacsen-common infrastructure will ensure that the install/remove script invocations are ordered to respect inter-add-on package dependencies. D) Each add-on package has the right to place files into the following directories: /etc//site-start.d /usr/share//site-lisp/ E) If an add-on package compiles any of its Emacs Lisp sources (which must be compiled to a subdirectory of /usr/share//site-lisp/ -- see section 4 above) it must also create a symlink in the same directory as the compiled output that points to the corresponding source file. For example, if add-on package foo produces /usr/share/emacs23/site-lisp/foo/bar.elc, then it must also create a symlink /usr/share/emacs23/site-lisp/foo/bar.el pointing to the corresponding source file. This ensures that Emacs will be able to locate the source code for the add-on package when using M-x find-function, etc. F) Each emacsen main package (i.e. emacs23, emacs23-nox, etc.) must depend on emacsen-common (>= 2.0.0). G) Each emacsen main package (i.e. emacs23, emacs23-nox, etc.) must make these calls from the given maintainer scripts: preinst: /usr/lib/emacsen-common/emacs-install --preinst postinst: /usr/lib/emacsen-common/emacs-install --postinst prerm: /usr/lib/emacsen-common/emacs-remove --prerm The postinst call must not be made until the package is completely configured and ready for use, and the prerm call must be made before any changes that would make the package not completely configured and ready for use. These calls will ensure that all of the relevant add-on packages' emacsen-common install and remove scripts are called at the appropriate times. In particular the postinst call may trigger the install scripts and the prerm script may trigger the remove scripts for any package that is ready. If add-on packages are being installed simultaneously, the add-on install scripts may be delayed until their postinst scripts are run. 6) Mandatory binary symlink Each emacsen main package must have a symlink /usr/bin/ to /usr/bin/ so that when add-on package install/remove scripts are called, they can just use /usr/bin/$ARGV[0] to get the right binary for byte-compilation. 7) Virtual package Each emacsen main package must "Provides: emacsen", and packages that just need to make sure some flavor of emacs is installed should "Depends: emacsen". If they depend on specific flavors of emacs, then they should list those dependencies explicitly instead. 8) Emacs lisp load path. At a minimum, each emacs must have the following directories in the given order in their load path: /etc/ /etc/emacs /usr/local/share/emacs//site-lisp /usr/local/share/emacs/site-lisp /usr/share/emacs//site-lisp /usr/share/emacs/site-lisp where is the normal emacs upstream version number for the relevant flavor like 20.2 or 23.2. Emacs add-on packages may not modify load-path directly. They must use (debian-pkg-add-load-path-item ). This function will make sure that their additions end up in the right place -- before the emacs system directories, but after the /usr/local/ directories. Also, add-on packages will need to either check (fboundp 'debian-pkg-add-load-path-item) before calling this function, or add a dependency on emacsen-common (>= 1.4.14). 9) Usage of autoload instead of load in the site-start.d files. It's been suggested, and is probably a good idea that maintainers switch to using autoload rather than load when possible in their site-start.d files. For example, instead of (load "some-package"), you should use autoloads for all the top level, user visible functions. That's it. Hopefully this gives the add-on package maintainers the flexibility they need to be able to DTRT, and the common case won't be all that difficult. Examples: 1) xemacs21 and the add-on packages tm and auctex are already installed, and now someone installs emacs23. In its prerm, emacs23 would make this call: /usr/lib/emacsen-common/emacs-install --postinst emacs23 which would result in calls to /usr/lib/emacsen-common/packages/install/auctex emacs23 /usr/lib/emacsen-common/packages/emacs/install/tm emacs23 2) Now, given (1), assume that someone removes xemacs21. In its prerm, xemacs21 would make this call: /usr/lib/emacsen-common/emacs-remove --prerm xemacs21 which would result in calls to /usr/lib/emacsen-common/packages/remove/auctex xemacs21 /usr/lib/emacsen-common/packages/remove/tm xemacs21 3) Now assume emacs23 and xemacs21 are installed, and that someone removes tm. The call to emacsen-package-remove in tm's prerm will result in the following calls: /usr/lib/emacsen-common/packages/remove/tm emacs23 /usr/lib/emacsen-common/packages/remove/tm xemacs21 In the remove/tm file, tm is responsible for cleaning up any files it put into its allowed locations: /etc//site-start.d/ /usr/share//site-lisp/tm 4) Now assume that emacs23 and auctex are not installed, and that someone installs both at the same time. At some point during the installation, after emacs23 and auctex are fully configured, this command will be invoked: /usr/lib/emacsen-common/packages/remove/auctex emacs23 This call may happen from either emacs23 or auctex's postinst as a result of their respective calls to emacs-install and emacs-package-install. Which package causes the invocation will depend on the order in which dpkg decides to invoke their postint scripts. The emacsen-common infrastructure makes sure that the last one wins. 5) Finally, please see sample-package-install-foo and sample-package-remove-foo in /usr/share/doc/emacsen-common/. These are sample install and remove scripts for a hypothetical package "foo" that only needs to byte compile a list of files for each flavor. emacsen-common-2.0.7/emacsen-common.install0000755000000000000000000000205212264557506015616 0ustar #!/bin/sh set -e FLAVOR=$1 # Make sure these options are appropriate for the given package. compile_options="--no-init-file --no-site-file -batch -f batch-byte-compile" echo emacsen-common: Handling install of emacsen flavor ${FLAVOR} # Normal add-on packages should usually *not* scatter their files # directly in site-lisp, but should use a package subdir. This # package/file is an exception. # Remove potentially stale versions. rm -f \ /etc/${FLAVOR}/site-start.d/00debian-vars.el \ /etc/${FLAVOR}/site-start.d/00debian-vars.elc \ /usr/share/${FLAVOR}/site-lisp/debian-startup.el \ /usr/share/${FLAVOR}/site-lisp/debian-startup.elc # Create symlinks to the .el files (see section 5E in debian-emacs polcy). (cd /etc/${FLAVOR}/site-start.d ln -s ../../emacs/site-start.d/00debian-vars.el .) (cd /usr/share/${FLAVOR}/site-lisp ln -s ../../emacs/site-lisp/debian-startup.el .) # byte compile everything. ${FLAVOR} ${compile_options} \ /etc/${FLAVOR}/site-start.d/00debian-vars.el \ /usr/share/${FLAVOR}/site-lisp/debian-startup.el exit 0; emacsen-common-2.0.7/00debian-vars.el0000644000000000000000000000344012264557506014201 0ustar ;; 00debian-vars.el ;; ;; Initialize some emacs variables from debian policy files. ;; ;; Copyright (C) 1997, Frederic Lepied ;; ;; original Author: Frederic Lepied ;; enhanced and documented by: Mark Eichin ;;============================================================================= ;; Autoloaded section. ;;============================================================================= ;;;### (eval-when-compile ;; Quiet byte compiler (defvar gnus-nntpserver-file)) ;;;*** ;;============================================================================= ;; Configuration section. ;;============================================================================= (defun debian-file->string (name &optional func) "Convert a file into a string" (interactive "fFile name : ") (let ((filename (expand-file-name name))) (if (not (file-readable-p filename)) nil (with-temp-buffer ;; Do not run any user `find-file-hooks' (insert-file-contents-literally filename) (if func (funcall func)) (buffer-string))))) (defun debian-clean-mailname () (while (search-forward "\n" nil t) (replace-match "" nil t))) ;; Particular variables, and their justification: ;; policy/ch4.html, 4.3 Mail processing on Debian systems, /etc/mailname ;; policy/ch-binarypkg.html, 3.5 Maintainer scripts, /etc/news/server (let ((mailname (debian-file->string "/etc/mailname" (function debian-clean-mailname)))) (if mailname (setq mail-host-address mailname))) ;; Don't need to check NNTPSERVER for override, gnus does that for us. (if (file-readable-p "/etc/news/server") (setq gnus-nntpserver-file "/etc/news/server")) ;;; 00debian-vars.el ends here emacsen-common-2.0.7/compat/0000755000000000000000000000000012264557506012606 5ustar emacsen-common-2.0.7/compat/emacsen-common0000644000000000000000000000000212264557506015422 0ustar 0 emacsen-common-2.0.7/site-start.el0000644000000000000000000000063412264557506013747 0ustar ;; Emacsen independent startup file. All of the various installed ;; flavors of emacs (emacs22, emacs23, xemacs21) will load this file ;; at startup. Make sure any code you put here is emacs flavor ;; independent. ;; Package maintainers: do not have Debian packages edit this file. ;; See /usr/share/doc/emacsen-common/debian-emacs-policy.gz for the ;; proper way to handle Emacs package initialization code. emacsen-common-2.0.7/emacsen-common.remove0000755000000000000000000000047612264557506015455 0ustar #!/bin/sh set -e FLAVOR=$1 echo emacsen-common: Handling removal of emacsen flavor ${FLAVOR} rm -f \ /etc/${FLAVOR}/site-start.d/00debian-vars.el \ /etc/${FLAVOR}/site-start.d/00debian-vars.elc \ /usr/share/${FLAVOR}/site-lisp/debian-startup.el \ /usr/share/${FLAVOR}/site-lisp/debian-startup.elc exit 0; emacsen-common-2.0.7/emacs-remove0000755000000000000000000000274512264557506013644 0ustar #!/usr/bin/perl -w use Errno; use strict; my $lib_dir = "/usr/lib/emacsen-common"; my $invoked_by_old_pkg; my $flavor; require $lib_dir . "/lib.pl"; umask 0022 or die "emacs-remove: can't set umask, aborting."; sub usage { my($file_handle) = @_; if($invoked_by_old_pkg) { print $file_handle "Usage: emacs-remove FLAVOR\n"; } else { print $file_handle "Usage: emacs-remove --prerm FLAVOR\n"; } } if(scalar(@ARGV) == 1) { $invoked_by_old_pkg = 1; $flavor = $ARGV[0]; } elsif(scalar(@ARGV) == 2 && $ARGV[0] eq '--prerm') { $flavor = $ARGV[1]; } else { usage(*STDERR{IO}); exit(1); } my @ordered_pkg_list = reverse generate_add_on_install_list(get_installed_add_on_packages()); my @installed_flavors = get_installed_flavors(); foreach my $pkg (@ordered_pkg_list) { print "Remove $pkg for $flavor\n"; my $script = $lib_dir . "/packages/remove/$pkg"; my $failed; if(-e "$lib_dir/packages/compat/$pkg") # New-style package. { $failed = -e $script && (system($script, $flavor) != 0); } else # Old-style package. { $failed = -e $script && (system($script, $flavor, @installed_flavors) != 0); } if($failed) { print STDERR "ERROR: remove script from $pkg package failed\n"; exit(1); } } # Silence "single use" warning. $::installed_flavor_state_dir = $::installed_flavor_state_dir; die "ERROR: cannot unlink $::installed_flavor_state_dir/$flavor: $!, " unless (unlink("$::installed_flavor_state_dir/$flavor") or $!{ENOENT}); emacsen-common-2.0.7/sample-package-remove-foo0000644000000000000000000000073412264557506016200 0ustar #!/bin/sh # /usr/lib/emacsen-common/packages/remove/foo # [ Sample only -- this script hasn't been tested, so be careful. ] set -e FLAVOR=$1 elc_dir=/usr/share/${FLAVOR}/site-lisp/foo echo remove/foo: Handling removal of emacsen flavor ${FLAVOR} echo emacsen-common: purging byte-compiled files for ${FLAVOR} rm -f ${elc_dir}/*.elc rm -f ${elc_dir}/*.el rm -f ${elc_dir}/Install.log* if test -e "${elc_dir}" then rmdir --ignore-fail-on-non-empty "${elc_dir}" fi exit 0; emacsen-common-2.0.7/sample-package-install-foo0000644000000000000000000000147112264557506016350 0ustar #!/bin/sh # /usr/lib/emacsen-common/packages/install/foo # [ Sample only -- this script hasn't been tested, so be careful. ] set -e FLAVOR=$1 echo install/foo: Handling install of emacsen flavor ${FLAVOR} byte_compile_options="-batch -f batch-byte-compile" elc_dir=/usr/share/${FLAVOR}/site-lisp/foo/ echo install/foo: byte-compiling for ${FLAVOR} [ -d ${elc_dir} ] || mkdir ${elc_dir} # Create symlinks to the .el files (see section 6E in debian-emacs # polcy). This makes complation easy, and also allows find-function # and find-library to work properly. (cd ${elc_dir} && cp -s ../../../emacs/site-lisp/foo/*.el .) # Byte compile them (cd ${elc_dir} set +e ${FLAVOR} ${byte_compile_options} *.el > Install.log 2>&1 if test $? -ne 0 then cat Install.log exit 1 fi set -e gzip -9v Install.log) exit 0; emacsen-common-2.0.7/emacs-package-remove0000755000000000000000000000325512264557506015232 0ustar #!/usr/bin/perl -w use Errno; use strict; my $lib_dir = "/usr/lib/emacsen-common"; my $invoked_by_old_pkg; my $context; my $pkg; require $lib_dir . "/lib.pl"; umask 0022 or die "emacs-remove: can't set umask, aborting."; sub usage { my($file_handle) = @_; if($invoked_by_old_pkg) { print $file_handle "Usage: emacs-package-remove FLAVOR\n"; } else { print $file_handle "Usage: emacs-package-remove --prerm FLAVOR\n"; } } if(scalar(@ARGV) == 1) { $invoked_by_old_pkg = 1; $pkg = $ARGV[0]; } elsif (scalar(@ARGV) == 2 && $ARGV[0] eq '--prerm') { $pkg = $ARGV[1]; } else { usage(*STDERR{IO}); exit(1); } validate_add_on_pkg($pkg, 'emacs-package-remove', $invoked_by_old_pkg); # Silence "single use" warning. $::installed_package_state_dir = $::installed_package_state_dir; my @installed_flavors = get_installed_flavors(); my $script = $lib_dir . "/packages/remove/$pkg"; if(!$invoked_by_old_pkg) { foreach my $flavor (@installed_flavors) { print "Remove $pkg for $flavor\n"; if(-e $script && (system($script, $flavor) != 0)) { print STDERR "ERROR: remove script from $pkg package failed\n"; exit(1); } } } else # $invoked_by_old_pkg { print "Remove $pkg for emacs\n"; ex($script, 'emacs', @installed_flavors) if -e $script; foreach my $flavor (@installed_flavors) { print "Remove $pkg for $flavor\n"; if(-e $script && (system($script, $flavor, @installed_flavors) != 0)) { print STDERR "ERROR: remove script from $pkg package failed\n"; exit(1); } } } die "ERROR: cannot unlink $::installed_package_state_dir/$pkg: $!, " unless (unlink("$::installed_package_state_dir/$pkg") or $!{ENOENT});