Commit Graph

150 Commits

Author SHA1 Message Date
Daniel P. Berrange
72de0d2819 Pass graphics setup from dst back to src via migration cookies
Extend the QEMU migration cookie structure to allow information
about the destination host graphics setup to be passed by to
the source host. This will enable seamless migration of any
connected graphics clients

* src/qemu/qemu_migration.c: Add graphics info to migration
  cookies
* daemon/libvirtd.c: Always initialize gnutls to enable
  x509 cert parsing in QEMU
2011-05-16 15:18:21 +01:00
Daniel P. Berrange
8654175c5b Introduce migration cookies to QEMU driver
The migration protocol has support for a 'cookie' parameter which
is an opaque array of bytes as far as libvirt is concerned. Drivers
may use this for passing around arbitrary extra data they might
need during migration. The QEMU driver needs to do a few things:

 - Pass hostname/uuid to allow strict protection against localhost
   migration attempts
 - Pass SPICE/VNC server port from the target back to the source to
   allow seamless relocation of client sessions
 - Pass lock driver state from source to destination

This patch introduces the basic glue for handling cookies
but only includes the host/guest UUID & name.

* src/libvirt_private.syms: Export virXMLParseStrHelper
* src/qemu/qemu_migration.c, src/qemu/qemu_migration.h: Parsing
  and formatting of migration cookies
* src/qemu/qemu_driver.c: Pass in cookie parameters where possible
* src/remote/remote_protocol.h, src/remote/remote_protocol.x: Change
  cookie max length to 16384 bytes
2011-05-16 15:18:20 +01:00
Cole Robinson
aaf2b70bae domain_event: Add virDomainEventState structure
This structure will be used to unify lots of duplicated event handling code
across the state drivers.

v2:
    Check for state == NULL in StateFree
    Add NONNULL tagging
    Use bool for isDispatching

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2011-05-13 10:48:32 -04:00
Matthias Bolte
2a5251e2c4 remote generator: Add skipgen/autogen flags to .x files
Make procedure parsing more robust, by allowing arbitrary
amounts of whitespaces.

Also make some error messages more verbose.
2011-05-12 08:44:07 +02:00
Eric Blake
cb84580a25 maint: omit translation for all VIR_INFO
We were 31/73 on whether to translate; since less than 50% translated
and since VIR_INFO is less than VIR_WARN which also doesn't translate,
this makes sense.

* cfg.mk (sc_prohibit_gettext_markup): Add VIR_INFO, since it
falls between WARN and DEBUG.
* daemon/libvirtd.c (qemudDispatchSignalEvent, remoteCheckAccess)
(qemudDispatchServer): Adjust offenders.
* daemon/remote.c (remoteDispatchAuthPolkit): Likewise.
* src/network/bridge_driver.c (networkReloadIptablesRules)
(networkStartNetworkDaemon, networkShutdownNetworkDaemon)
(networkCreate, networkDefine, networkUndefine): Likewise.
* src/qemu/qemu_driver.c (qemudDomainDefine)
(qemudDomainUndefine): Likewise.
* src/storage/storage_driver.c (storagePoolCreate)
(storagePoolDefine, storagePoolUndefine, storagePoolStart)
(storagePoolDestroy, storagePoolDelete, storageVolumeCreateXML)
(storageVolumeCreateXMLFrom, storageVolumeDelete): Likewise.
* src/util/bridge.c (brProbeVnetHdr): Likewise.
* po/POTFILES.in: Drop src/util/bridge.c.
2011-05-11 15:20:33 -06:00
Lai Jiangshan
b65f37a4a1 libvirt,logging: cleanup VIR_XXX0()
These VIR_XXXX0 APIs make us confused, use the non-0-suffix APIs instead.

How do these coversions works? The magic is using the gcc extension of ##.
When __VA_ARGS__ is empty, "##" will swallow the "," in "fmt," to
avoid compile error.

example: origin				after CPP
	high_level_api("%d", a_int)	low_level_api("%d", a_int)
	high_level_api("a  string")	low_level_api("a  string")

About 400 conversions.

8 special conversions:
VIR_XXXX0("") -> VIR_XXXX("msg") (avoid empty format) 2 conversions
VIR_XXXX0(string_literal_with_%) -> VIR_XXXX(%->%%) 0 conversions
VIR_XXXX0(non_string_literal) -> VIR_XXXX("%s", non_string_literal)
  (for security) 6 conversions

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
2011-05-11 12:41:14 -06:00
Eric Blake
9d8e01a1db build: translate generated strings
Make sure that xgettext scans generated files for translatable
strings, rather than just files stored in libvirt.git.

* .gnulib: Update, for bootstrap and syntax-check fixes.
* bootstrap: Resynchronize with gnulib.
* cfg.mk (generated_files): Define.
* po/POTFILES.in: Add more files with _().
2011-05-09 11:51:05 -06:00
Daniel P. Berrange
3496b7f500 build: Remove all generated RPC files from GIT
Stop storing the generated files for the remote protocol client
and server in source control. The generated files will still be
included in the result of 'make dist' to avoid end-users needing
to generate the files

Signed-off-by: Eric Blake <eblake@redhat.com>

Unfortunately, this means that the strings marked for translation
in generated files are not picked up by gnulib's syntax-check,
I'm working on fixing that in gnulib.

* .gitignore, cfg.mk, po/POTFILES.in: Reflect deletion.
2011-05-06 16:22:33 -06:00
Eric Blake
d3c5104dda build: rename generated files to .h, for automake's sake
In preparation for removing generated files, it is necessary
to tell automake that the generated files must be distributed
but not directly compiled (since they are included into the
body of a larger .c file that is compiled).  Hence, even though
these files are code and not headers in the strict sense of
the word, it is easier to rename them to .h for automake's sake.

* daemon/remote_client_bodies.c: Rename to .h.
* daemon/qemu_client_bodies.c: Likewise.
* src/remote/remote_client_bodies.c: Likewise.
* src/remote/qemu_client_bodies.c: Likewise.
* daemon/Makefile.am (remote_dispatch_bodies.c)
(qemu_dispatch_bodies.c): Rename to .h.
(remote.c, EXTRA_DIST): Reflect rename.
* daemon/remote.c: Likewise.
* daemon/remote_generator.pl: Likewise.
* src/Makefile.am (remote/remote_driver.c): Likewise.
* src/remote/remote_driver.c: Likewise.
* po/POTFILES.in: Likewise.
* cfg.mk (exclude_file_name_regexp--sc_require_config_h)
(exclude_file_name_regexp--sc_require_config_h_first)
(exclude_file_name_regexp--sc_prohibit_empty_lines_at_EOF):
Likewise.
2011-05-06 15:11:36 -06:00
Matthias Bolte
b5041a49ec remote generator, client: Handle functions that return lists 2011-05-06 20:27:27 +02:00
Matthias Bolte
f68bb4edb3 remote generator, client: Handle simple remote driver functions
Rename remoteSecretListSecrets to remoteListSecrets to match the normal
naming pattern.
2011-05-06 20:26:21 +02:00
Matthias Bolte
aff1db9fab remote generator, daemon: Output function bodies too
This patch just covers the simple functions without explicit return
values. There is more to be handled.

The generator collects the members of the XDR argument structs and uses
this information to generate the function bodies.

Exclude the generated files from offending syntax-checks.

Suggested by Richard W.M. Jones
2011-05-06 20:04:56 +02:00
Matthias Bolte
78ef49eae3 Update and sort msg_gen_function list and mark unmarked messages
Inspired by Eric Blake
2011-04-18 19:05:15 +02:00
Matthias Bolte
12459d1ea7 xen: Replace statsErrorFunc with a macro
Also mark error messages in block_stats.c for translation, add the
new macro to the msg_gen functions in cfg.mk and add block_stats.c
to po/POTFILES.in
2011-04-17 07:53:26 +02:00
Eric Blake
99fa30804b maint: fix grammar errors
Jim Meyering recently improved gnulib to catch various grammar
errors during 'make syntax-check'.

* .gnulib: Update to latest, for syntax-check improvements.
* include/libvirt/libvirt.h.in (virConnectAuthCallbackPtr): Use
cannot rather than two words.
* src/driver.c: Likewise.
* src/driver.h (VIR_SECRET_GET_VALUE_INTERNAL_CALL): Likewise.
* src/remote/remote_driver.c (initialize_gnutls): Likewise.
* src/util/pci.c (pciBindDeviceToStub): Likewise.
* src/storage/storage_backend.c (virStorageBackendCreateQemuImg):
Likewise.
(virStorageBackendUpdateVolTargetInfoFD): Avoid doubled word.
* docs/formatdomain.html.in: Likewise.
* src/qemu/qemu_process.c (qemuProcessStart): Likewise.
* cfg.mk (exclude_file_name_regexp--sc_prohibit_can_not)
(exclude_file_name_regexp--sc_prohibit_doubled_word): Exclude
existing translation problems.
2011-04-12 09:06:14 -06:00
Daniel P. Berrange
242195425c Fix domain events C example on Win32
printf on Win32 does not necessarily support %lld and we don't
have GNULIBs wrapper for printf(). Switch to use asprintf() for
which we do have a gnulib wrapper with %lld support

* examples/domain-events/events-c/event-test.c: Fix formatting
  of %lld on Win32
* cfg.mk: Don't require use of virAsprintf since this is an
  example app for out of tree users to follow
2011-03-31 16:01:49 +01:00
Eric Blake
6c9e89bbd2 maint: avoid locale-sensitivity in string case comparisons
strcase{cmp/str} have the drawback of being sensitive to the global
locale; this is unacceptable in a library setting.  Prefer a
hard-coded C locale alternative for all but virsh, which is user
facing and where the global locale isn't changing externally.

* .gnulib: Update to latest, for c-strcasestr change.
* bootstrap.conf (gnulib_modules): Drop strcasestr, add c-strcase
and c-strcasestr.
* cfg.mk (sc_avoid_strcase): New rule.
(exclude_file_name_regexp--sc_avoid_strcase): New exception.
* src/internal.h (STRCASEEQ, STRCASENEQ, STRCASEEQLEN)
(STRCASENEQLEN): Adjust offenders.
* src/qemu/qemu_monitor_text.c (qemuMonitorTextEjectMedia):
Likewise.
* tools/virsh.c (namesorter): Document exception.
2011-03-30 20:26:27 -06:00
Eric Blake
391c397e48 maint: prohibit access(,X_OK)
This simplifies several callers that were repeating checks already
guaranteed by util.c, and makes other callers more robust to now
reject directories.  remote_driver.c was over-strict - access(,R_OK)
is only needed to execute a script file; a binary only needs
access(,X_OK) (besides, it's unusual to see a file with x but not
r permissions, whether script or binary).

* cfg.mk (sc_prohibit_access_xok): New syntax-check rule.
(exclude_file_name_regexp--sc_prohibit_access_xok): Exempt one use.
* src/network/bridge_driver.c (networkStartRadvd): Fix offenders.
* src/qemu/qemu_capabilities.c (qemuCapsProbeMachineTypes)
(qemuCapsInitGuest, qemuCapsInit, qemuCapsExtractVersionInfo):
Likewise.
* src/remote/remote_driver.c (remoteFindDaemonPath): Likewise.
* src/uml/uml_driver.c (umlStartVMDaemon): Likewise.
* src/util/hooks.c (virHookCheck): Likewise.
2011-03-24 15:18:44 -06:00
Eric Blake
2d24037db0 build: nuke all .x-sc* files, and fix VPATH syntax-check
Not every day you see a patch that nukes 27 files!

* .gnulib: Update to latest, for maint.mk improvements
* bootstrap: Resync to gnulib.
* bootstrap.conf (ACLOCAL): Swap the secondary aclocal include
directory, now that bootstrap picks up gnulib/m4 instead of m4.
* Makefile.am (syntax_check_exceptions, EXTRA_DIST): No longer
worry about nuked files.
* cfg.mk (sc_x_sc_dist_check): Delete dead rule.
(VC_LIST_ALWAYS_EXCLUDE_REGEX): Add HACKING.
(exclude_file_name_regexp--sc_*): Inline and simplify contents...
* .x-sc_*: ...from here, then delete the files.
2011-03-23 15:51:32 -06:00
Jim Fehlig
2b84e445d5 Add libxenlight driver
Add a new xen driver based on libxenlight [1], which is the primary
toolstack starting with Xen 4.1.0.  The driver is stateful and runs
privileged only.

Like the existing xen-unified driver, the libxenlight driver is
accessed with xen:// URI.  Driver selection is based on the status
of xend.  If xend is running, the libxenlight driver will not load
and xen:// connections are handled by xen-unified.  If xend is not
running *and* the libxenlight driver is available, xen://
connections are deferred to the libxenlight driver.

V6:
 - Address several code style issues noted by Daniel Veillard
 - Make drive work with xen:/// URI
 - Hold domain object reference while domain is injected in
   libvirt event loop.  Race found and fixed by Markus Groß.

V5:
 - Ensure events are unregistered when domain private data
   is destroyed.  Discovered and fixed by Markus Groß.

V4:
 - Handle restart of libvirtd, reconnecting to previously
   started domains
 - Rebased to current master
 - Tested against Xen 4.1 RC7-pre (c/s 22961:c5d121fd35c0)

V3:
  - Reserve vnc port within driver when autoport=yes

V2:
  - Update to Xen 4.1 RC6-pre (c/s 22940:5a4710640f81)
  - Rebased to current master
  - Plug memory leaks found by Stefano Stabellini and valgrind
  - Handle SHUTDOWN_crash domain death event

[1] http://lists.xensource.com/archives/html/xen-devel/2009-11/msg00436.html
2011-03-18 08:57:48 -06:00
Eric Blake
e004a8d98e maint: make spacing in .sh files easier
Commit 7f193757 renamed libvirt-guests.init from .in to .sh, which
made it slip past sc_TAB_in_indentation.  I nearly reintroduced a
tab, so I'm pushing this to prevent that from happening.

* cfg.mk (sc_TAB_in_indentation): Update rule to include .sh files.
* .dir-locals.el: List spacing preference for .sh files.
2011-03-14 21:57:42 -06:00
Jiri Denemark
9fc4b6a606 qemu: Switch over command line capabilities to virBitmap
This is done for two reasons:
- we are getting very close to 64 flags which is the maximum we can use
  with unsigned long long
- by using LL constants in enum we already violates C99 constraint that
  enum values have to fit into int
2011-02-24 12:10:00 +01:00
Eric Blake
03ba07cb73 hash: make virHashFree more free-like
Two-argument free functions are uncommon; match the style elsewhere
by caching the callback at creation.

* src/util/hash.h (virHashCreate, virHashFree): Move deallocator
argument to creation.
* cfg.mk (useless_free_options): Add virHashFree.
* src/util/hash.c (_virHashTable): Track deallocator.
(virHashCreate, virHashFree): Update to new signature.
* src/conf/domain_conf.c (virDomainObjListDeinit)
(virDomainObjListInit, virDomainDiskDefForeachPath)
(virDomainSnapshotObjListDeinit, virDomainSnapshotObjListInit):
Update callers.
* src/conf/nwfilter_params.c (virNWFilterHashTableFree)
(virNWFilterHashTableCreate): Likewise.
* src/conf/nwfilter_conf.c (virNWFilterTriggerVMFilterRebuild):
Likewise.
* src/cpu/cpu_generic.c (genericHashFeatures, genericBaseline):
Likewise.
* src/xen/xm_internal.c (xenXMOpen, xenXMClose): Likewise.
* src/nwfilter/nwfilter_learnipaddr.c (virNWFilterLearnInit)
(virNWFilterLearnShutdown): Likewise.
* src/qemu/qemu_command.c (qemuDomainPCIAddressSetCreate)
(qemuDomainPCIAddressSetFree): Likewise.
* src/qemu/qemu_process.c (qemuProcessWaitForMonitor): Likewise.
2011-02-21 08:27:02 -07:00
Jiri Denemark
15285754dd maint: Expand tabs in python code
Also cfg.mk is tweaked to force this for all future changes to *.py
files.
2011-02-18 08:59:51 +01:00
Eric Blake
3a97fa28e4 build: avoid problems with autogen.sh runs from tarball
Introduced by commit fac97c65c distributing cfg.mk, which
previously could blindly assume it was in a git checkout.

* cfg.mk (_update_required): Also check for .git.
* autogen.sh: Don't run bootstrap from a tarball.
Reported by Daniel Veillard.
2011-02-12 06:28:28 -07:00
Eric Blake
1652fa2fd2 maint: whitespace cleanup
* .dir-locals.el (html-mode): Let emacs help out.
* cfg.mk (sc_TAB_in_indentation): Check more files.
* docs/internals/command.html.in: Fix offenders.
* docs/formatdomain.html.in: Likewise.
* docs/internals.html.in: Likewise.
Reported by Jiri Denemark.
2011-02-09 11:18:06 -07:00
Eric Blake
c1be1a2e0e smartcard: add domain conf support
* src/conf/domain_conf.h (virDomainSmartcardType): New enum.
(virDomainSmartcardDef, virDomainDeviceCcidAddress): New structs.
(virDomainDef): Include smartcards.
(virDomainSmartcardDefIterator): New typedef.
(virDomainSmartcardDefFree, virDomainSmartcardDefForeach): New
prototypes.
(virDomainControllerType, virDomainDeviceAddressType): Add ccid
enum values.
(virDomainDeviceInfo): Add ccid address type.
* src/conf/domain_conf.c (virDomainSmartcard): Convert between
enum and string.
(virDomainSmartcardDefParseXML, virDomainSmartcardDefFormat)
(virDomainSmartcardDefFree, virDomainDeviceCcidAddressParseXML)
(virDomainDefMaybeAddSmartcardController): New functions.
(virDomainDefParseXML): Parse the new XML.
(virDomainDefFormat): Convert back to XML.
(virDomainDefFree): Clean up.
(virDomainDeviceInfoIterate): Iterate over passthrough aliases.
(virDomainController, virDomainDeviceAddress)
(virDomainDeviceInfoParseXML, virDomainDeviceInfoFormat)
(virDomainDefAddImplicitControllers): Support new values.
* src/libvirt_private.syms (domain_conf.h): New exports.
* cfg.mk (useless_free_options): List new function.
2011-02-03 19:28:53 -07:00
Eric Blake
030ce43b49 maint: reject raw close, popen in 'make syntax-check'
commit f1fe9671e was supposed to make sure we use files.h
macros to avoid double close, but it didn't work.

Meanwhile, virCommand is vastly superior to system(), fork(),
and popen() (also to virExec, but we haven't completed that
conversion), so enforce that, too.

* cfg.mk (sc_prohibit_close): Fix typo that excluded close, and
add pclose.
(sc_prohibit_fork_wrappers): New rule, for fork, system, and popen.
* .x-sc_prohibit_close: More exemptions.
* .x-sc_prohibit_fork_wrappers: New file.
* Makefile.am (syntax_check_exceptions): Ship new file.
* src/datatypes.c (virReleaseConnect): Tweak comment to avoid
false positive.
* src/util/files.h (VIR_CLOSE): Likewise.
2011-01-29 10:36:47 -07:00
Eric Blake
b96b6f4723 qemu: fix error messages
Regression in commit caa805ea let a lot of bad messages slip in.

* cfg.mk (msg_gen_function): Fix function name.
* src/qemu/qemu_cgroup.c (qemuRemoveCgroup): Fix fallout from
'make syntax-check'.
* src/qemu/qemu_driver.c (qemudDomainGetInfo)
(qemuDomainWaitForMigrationComplete, qemudStartVMDaemon)
(qemudDomainSaveFlag, qemudDomainAttachDevice)
(qemuDomainUpdateDeviceFlags): Likewise.
* src/qemu/qemu_hotplug.c (qemuDomainAttachHostUsbDevice)
(qemuDomainDetachPciDiskDevice, qemuDomainDetachSCSIDiskDevice):
Likewise.
2011-01-27 20:41:26 -07:00
Matthias Bolte
2c0db5b5dc Simplify "NWFilterPool" to "NWFilter"
The public object is called NWFilter but the corresponding private
object is called NWFilterPool. I don't see compelling reasons for this
Pool suffix. One might argue that an NWFilter is a "pool" of rules, etc.

Remove the Pool suffix from NWFilterPool. No functional change included.
2011-01-18 23:14:37 +01:00
Eric Blake
63dbc84a88 maint: improve sc_prohibit_strncmp syntax check
* .gnulib: Update, for sc_prohibit_strcmp fix.
* cfg.mk: Adjust copyright; the only FSF portions come from when
this file was copied from coreutils.
(sc_prohibit_strncmp): Copy bug-fixes from sc_prohibit_strcmp.
* .x-sc_prohibit_strcmp: Delete, now that rule is smarter.
* .x-sc_prohibit_strncmp: Likewise.
* Makefile.am (syntax_check_exceptions): Track deletion.
2011-01-14 15:39:05 -07:00
Eric Blake
98334e7c3a domain_conf: split source data out from ChrDef
This opens up the possibility of reusing the smaller ChrSourceDef
for both qemu monitor and a passthrough smartcard device.

* src/conf/domain_conf.h (_virDomainChrDef): Factor host
details...
(_virDomainChrSourceDef): ...into new struct.
(virDomainChrSourceDefFree): New prototype.
* src/conf/domain_conf.c (virDomainChrDefFree)
(virDomainChrDefParseXML, virDomainChrDefFormat): Split...
(virDomainChrSourceDefClear, virDomainChrSourceDefFree)
(virDomainChrSourceDefParseXML, virDomainChrSourceDefFormat):
...into new functions.
(virDomainChrDefParseTargetXML): Update clients to reflect type
split.
* src/vmx/vmx.c (virVMXParseSerial, virVMXParseParallel)
(virVMXFormatSerial, virVMXFormatParallel): Likewise.
* src/xen/xen_driver.c (xenUnifiedDomainOpenConsole): Likewise.
* src/xen/xend_internal.c (xenDaemonParseSxprChar)
(xenDaemonFormatSxprChr): Likewise.
* src/vbox/vbox_tmpl.c (vboxDomainDumpXML, vboxAttachSerial)
(vboxAttachParallel): Likewise.
* src/security/security_dac.c (virSecurityDACSetChardevLabel)
(virSecurityDACSetChardevCallback)
(virSecurityDACRestoreChardevLabel)
(virSecurityDACRestoreChardevCallback): Likewise.
* src/security/security_selinux.c (SELinuxSetSecurityChardevLabel)
(SELinuxSetSecurityChardevCallback)
(SELinuxRestoreSecurityChardevLabel)
(SELinuxSetSecurityChardevCallback): Likewise.
* src/security/virt-aa-helper.c (get_files): Likewise.
* src/lxc/lxc_driver.c (lxcVmStart, lxcDomainOpenConsole):
Likewise.
* src/uml/uml_conf.c (umlBuildCommandLineChr): Likewise.
* src/uml/uml_driver.c (umlIdentifyOneChrPTY, umlIdentifyChrPTY)
(umlDomainOpenConsole): Likewise.
* src/qemu/qemu_command.c (qemuBuildChrChardevStr)
(qemuBuildChrArgStr, qemuBuildCommandLine)
(qemuParseCommandLineChr): Likewise.
* src/qemu/qemu_domain.c (qemuDomainObjPrivateXMLFormat)
(qemuDomainObjPrivateXMLParse): Likewise.
* src/qemu/qemu_cgroup.c (qemuSetupChardevCgroup): Likewise.
* src/qemu/qemu_hotplug.c (qemuDomainAttachNetDevice): Likewise.
* src/qemu/qemu_driver.c (qemudFindCharDevicePTYsMonitor)
(qemudFindCharDevicePTYs, qemuPrepareChardevDevice)
(qemuPrepareMonitorChr, qemudShutdownVMDaemon)
(qemuDomainOpenConsole): Likewise.
* src/qemu/qemu_command.h (qemuBuildChrChardevStr)
(qemuBuildChrArgStr): Delete, now that they are static.
* src/libvirt_private.syms (domain_conf.h): New exports.
* cfg.mk (useless_free_options): Update list.
* tests/qemuxml2argvtest.c (testCompareXMLToArgvFiles): Update
tests.
2011-01-14 09:54:26 -07:00
Jean-Baptiste Rouault
cddd2a0628 Add VMware Workstation and Player driver 2010-12-17 21:19:39 +01:00
Hu Tao
482380b587 threadpool impl
* src/util/threadpool.c, src/util/threadpool.h: Thread pool
  implementation
* src/Makefile.am: Build thread pool
* src/libvirt_private.syms: Export public functions
2010-12-09 11:39:17 -07:00
Daniel P. Berrange
f16ad06fb2 Introduce new APIs for spawning processes
This introduces a new set of APIs in src/util/command.h
to use for invoking commands. This is intended to replace
all current usage of virRun and virExec variants, with a
more flexible and less error prone API.

* src/util/command.c: New file.
* src/util/command.h: New header.
* src/Makefile.am (UTIL_SOURCES): Build it.
* src/libvirt_private.syms: Export symbols internally.
* tests/commandtest.c: New test.
* tests/Makefile.am (check_PROGRAMS): Run it.
* tests/commandhelper.c: Auxiliary program.
* tests/commanddata/test2.log - test15.log: New expected outputs.
* cfg.mk (useless_free_options): Add virCommandFree.
(msg_gen_function): Add virCommandError.
* po/POTFILES.in: New translation.
* .x-sc_avoid_write: Add exemption.
* tests/.gitignore: Ignore new built file.
2010-12-02 16:00:44 -07:00
Eric Blake
fce3baee26 util: add virVasprintf
* src/util/util.h (virVasprintf): New declaration.
* src/util/util.c (virVasprintf): New function.
(virAsprintf): Use it.
* src/util/virtaudit.c (virAuditSend): Likewise.
* src/libvirt_private.syms: Export it.
* cfg.mk (sc_prohibit_asprintf): Also prohibit vasprintf.
* .x-sc_prohibit_asprintf: Add exemption.
2010-12-02 11:23:15 -07:00
Eric Blake
dd70168a5b maint: allow 'make syntax-check' to run again
* cfg.mk (VC_LIST_ALWAYS_EXCLUDE_REGEX): Permanently exempt
docs/news.html.in from all future syntax checks.
2010-11-30 13:33:52 -07:00
Eric Blake
416c09bcc0 maint: prohibit most uses of xmlGetProp
Making this change makes it easier to spot the memory leaks
that will be fixed in the next patch.

* cfg.mk (sc_prohibit_xmlGetProp): New rule.
* .x-sc_prohibit_xmlGetProp: New exception.
* Makefile.am (EXTRA_DIST): Ship exception file.
* tools/virsh.c (cmdDetachInterface, cmdDetachDisk): Adjust
offenders.
* src/conf/storage_conf.c (virStoragePoolDefParseSource):
Likewise.
* src/conf/network_conf.c (virNetworkDHCPRangeDefParseXML)
(virNetworkIPParseXML): Likewise.
2010-11-24 15:23:43 -07:00
Eric Blake
97cde147b5 maint: ensure syntax check exceptions are distributed
* Makefile.am (EXTRA_DIST): Factor exceptions files...
(syntax_check_excpetions): into new list.  Include recently added
exceptions.
* cfg.mk (sc_x_sc_dist_check): New check, copied from coreutils.
2010-11-24 15:23:43 -07:00
Eric Blake
f1fe9671e3 build: enforce files.h usage
* cfg.mk (sc_prohibit_close): New syntax-check rule.
* src/util/pci.c (pciWaitForDeviceCleanup): Fix violation.
* .x-sc_prohibit_close: New exceptions.
* Makefile.am (EXTRA_DIST): Distribute new file.
2010-11-24 15:23:43 -07:00
Eric Blake
d2af8ffcd8 maint: tighten strncmp syntax check
Using 'int ret = strcmp(a, b)' in a qsort function is a valid use of
str[n]cmp that should _not_ be turned to STREQ, but it was falling
foul of our specific syntax-check.  Meanwhile, gnulib's maint.mk
already has a tighter bound for strcmp, so we can copy that regex and
just check for strncmp, which results in fewer false positives that
require exceptions.

* cfg.mk (sc_prohibit_strcmp_and_strncmp): Rename...
(sc_prohibit_strncmp): ...to this, and tighten, to mirror
maint.mk's sc_prohibit_strcmp's better regex.
* Makefile.am (syntax_check_exceptions): Update exception rule.
* .x-sc_prohibit_strcmp_and_strncmp: Rename...
* .x-sc_prohibit_strncmp: ...and trim.
2010-11-18 12:21:58 -07:00
Eric Blake
e8aba782e7 maint: avoid remaining sprintf uses
* cfg.mk (sc_prohibit_sprintf): New rule.
(sc_prohibit_asprintf): Avoid false positives.
* docs/hacking.html.in (Printf-style functions): Document the
policy.
* HACKING: Regenerate.
* .x-sc_prohibit_sprintf: New exemptions.
* Makefile.am (syntax_check_exceptions): Ship new file.
* src/vbox/vbox_tmpl.c (vboxStartMachine, vboxAttachUSB): Use
virAsprintf instead.
* src/uml/uml_driver.c (umlOpenMonitor): Use snprintf instead.
* tools/virsh.c (cmdDetachInterface): Likewise.
* src/security/security_selinux.c (SELinuxGenSecurityLabel):
Likewise.
* src/openvz/openvz_driver.c (openvzDomainDefineCmd): Likewise,
and ensure large enough buffer.
2010-11-17 10:13:12 -07:00
Eric Blake
c811d46fab virt-aa-helper: translate error messages
These messages are visible to the user, so they should be
consistently translated.

* cfg.mk (msg_gen_function): Add vah_error, vah_warning.
* src/security/virt-aa-helper.c: Translate messages.
(catchXMLError): Fix capitalization.
2010-11-17 10:13:12 -07:00
Matthias Bolte
34ed4e9809 Generate HACKING from docs/hacking.html.in 2010-11-12 19:47:20 +01:00
Matthias Bolte
e65812d479 xen-proxy: Remove it entirely and use libvirtd instead
Suggested by danpb, as it's not up-to-date anymore and
lacks many functions that were added to libvirtd.
2010-11-08 22:00:35 +01:00
Eric Blake
1987b09093 maint: fix syntax-check failure of previous patch
* cfg.mk (sc_prohibit_trailing_blank_lines): Delete; this is
adequately covered by maint.mk's sc_prohibit_empty_lines_at_EOF.
* .x-sc_prohibit_empty_lines_at_EOF: New file, to exempt raw
patches.
* Makefile.am (EXTRA_DIST): Include new exemption.
2010-10-26 15:50:19 -06:00
Jiri Denemark
0495fe59ad Avoid unnecessary bootstrap runs in VPATH builds 2010-08-11 09:20:26 +02:00
Eric Blake
5f211d4bc5 build: rerun bootstrap if po/Makevars got nuked
There has been a frequent complaint of:

make[2]: Entering directory `/home/remote/eblake/libvirt/po'
make[2]: *** No rule to make target `/config.status', needed by `Makefile'.  Stop.

It happens after nuking and regenerating the po directory,
which is a common action after running anything like
'make dist' or 'make rpm' that dirties all the .po files.

Teach autogen.sh that it must regenerate po/Makevars to avoid
the missing variable declaration, and teach cfg.mk to recognize
that a nuked po directory is cause to rerun autogen.sh.

* cfg.mk (_update_required): Check for po/Makevars.
* autogen.sh (bootstrap): Run bootstrap if it got lost.
Diagnosed by Justin Clift.
2010-08-04 14:36:14 -06:00
Chris Lalancette
337d201ef2 Qemu remote protocol.
Since we are adding a new "per-hypervisor" protocol, we
make it so that the qemu remote protocol uses a new
PROTOCOL and PROGRAM number.  This allows us to easily
distinguish it from the normal REMOTE protocol.

This necessitates changing the proc in remote_message_header
from a "remote_procedure" to an "unsigned", which should
be the same size (and thus preserve the on-wire protocol).

Changes since v1:
 - Fixed up a couple of script problems in remote_generate_stubs.pl
 - Switch an int flag to a bool in dispatch.c

Changes since v2:
 - None

Changes since v3:
 - Change unsigned proc to signed proc, to conform to spec

Signed-off-by: Chris Lalancette <clalance@redhat.com>
2010-07-23 17:30:33 -04:00
Eric Blake
e82f917015 build: fix VPATH 'make syntax-check'
* cfg.mk (sc_check_author_list): Look in correct location.
2010-06-01 16:34:25 -06:00
Jim Meyering
208b2ad879 maint: new syntax-check rule to ensure that AUTHORS stays in sync
* cfg.mk (sc_check_AUTHOR_list): New rule.
* .mailmap: New file, to tell git log how to map email addresses.
2010-05-28 15:02:04 +02:00
Jim Fehlig
2f32d7afd5 Add simple bitmap operations to utils
V2:
  - Move bitmap impl to src/util/bitmap.[ch]
  - Use CHAR_BIT instead of explicit '8'
  - Use size_t instead of unsigned int
  - Fix calculation of bitmap size in virBitmapAlloc
  - Ensure bit is within range of map in the set, clear, and get
    operations
  - Use bool in virBitmapGetBit
  - Add virBitmapFree to free-like funcs in cfg.mk

V3:
  - Check for overflow in virBitmapAlloc
  - Fix copy and paste bug in virBitmapAlloc
  - Use size_t in prototypes
  - Add ATTRIBUTE_NONNULL in prototypes where appropriate
    and remove NULL check from impl

V4:
  - Add ATTRIBUTE_RETURN_CHECK in prototypes where appropriate.
2010-05-21 11:29:03 -06:00
Jim Meyering
7a3267cfcf maint: enforce policy wrt VIR_DEBUG and VIR_DEBUG0
* cfg.mk (sc_prohibit_gettext_markup): Just like VIR_WARN*.
2010-05-20 21:36:26 +02:00
Jim Meyering
2f26addb25 maint: enforce policy wrt VIR_ERROR and VIR_ERROR0
* cfg.mk (msg_gen_function): Add VIR_ERROR and VIR_ERROR0,
so that sc_libvirt_unmarked_diagnostics will check them, too.
2010-05-20 21:36:26 +02:00
Jim Meyering
97d5c95d8e maint: prohibit newline at end of diagnostic
* cfg.mk (sc_prohibit_newline_at_end_of_diagnostic): New rule.
Idea proposed by Jiri Denemark.
2010-05-20 15:44:44 +02:00
Jim Meyering
052893cf66 maint: enforce no-markup policy wrt VIR_WARN-like macros
* cfg.mk (sc_prohibit_gettext_markup): New rule, to enforce
this policy.  Contrary to most diagnostic-emitting functions,
where we require _(...) markup, here, we require that _() *not*
be used for certain functions (or function-like macros).
2010-05-19 12:52:47 +02:00
Jim Meyering
a986892e61 maint: add more free-like functions to the list and deal with fallout
* cfg.mk (useless_free_options): Add many vir*Free* function names,
and then remove the useless if-before-free tests exposed by running
make syntax-check.
* src/conf/interface_conf.c (virInterfaceDefFree): Remove useless "if".
(virInterfaceAssignDef): Likewise.
* src/conf/network_conf.c (virNetworkAssignDef): Likewise.
* src/conf/storage_conf.c (virStoragePoolObjAssignDef): Likewise.
* src/node_device/node_device_hal.c (dev_create): Likewise.
* src/security/virt-aa-helper.c (vahDeinit): Likewise.
* src/test/test_driver.c (testNodeDeviceCreateXML): Likewise.
* src/util/conf.c (virConfSetValue): Likewise.
2010-05-18 07:53:42 +02:00
Jim Meyering
933522a341 maint: add virCgroupFree to the list of free-like functions
This makes the useless-if-before-free test in maint.mk spot
uses of virCgroupFree just like it does for free and the other
listed functions.
* cfg.mk (useless_free_options): Add virCgroupFree.
Prompted by suggestion from Eric Blake.
2010-05-18 07:53:42 +02:00
Eric Blake
7cdf26637e maint: avoid spurious output if program not present
Some shells warn about missing programs before redirection;
the idiomatic way to silence them is to run the program check
inside a subshell, with the redirections outside the subshell.
But a subshell is only needed in places where it is reasonable
to expect the use of such a noisy shell in the first place.

* src/Makefile.am (remote_protocol-structs): Use subshell, for
FreeBSD 8.0 /bin/sh.
* cfg.mk (sc_preprocessor_indentation): Avoid subshell, since the
only users running cfg.mk can be assumed to have decent tools.
2010-05-10 14:56:37 -06:00
Eric Blake
5fe816eccd build: fix autogen rule for VPATH build
* cfg.mk (gnulib_srcdir): Override maint.mk default.
(_update_required): Run in correct directory.
2010-04-28 08:15:12 -06:00
Eric Blake
1f7560e25d maint: enforce whitespace on shell scripts
Noticed because virt-pki-validate was very inconsistent on
using tabs vs. 8 spaces, sometimes mixing both paradigms on
a single line.

'git diff -b' shows significant changes only in cfg.mk.

* cfg.mk (sc_TAB_in_indentation): Add a few files.
* daemon/libvirtd.init.in: Avoid tabs.
* tools/virt-pki-validate.in: Likewise.
2010-04-22 09:06:30 -06:00
Eric Blake
871aa6e3c1 maint: ignore 'make syntax-check' failure files
* .gitignore: Add exemption.
* cfg.mk (local-checks-to-skip): Ignore a test to silence a skip
warning.
2010-04-21 14:32:08 -06:00
Matthias Bolte
98caf6db76 Cleanup the msg_gen_function list in cfg.mk
Remove symbols that don't exist anymore (e.g. ERROR0) or aren't
message generating functions (e.g. VIR_FREE) or are now reported
as unmarked because the grep command is different, but that should
not be marked at all (e.g. DEBUG0).

Also don't restrict one of the grep lines in the
libvirt_unmarked_diagnostics rule to match exactly one space
between function name and opening parenthesis.
2010-04-09 02:34:25 +02:00
Matthias Bolte
9455323530 remote: Remove virConnectPtr from error/errorf
Also unify error/errorf to remoteError and update cfg.mk accordingly.
2010-04-09 01:56:27 +02:00
Eric Blake
36bcd7026b build: avoid autogen on 'make clean'
Tested by running 'git submodule foreach git pull origin master' and
'git add .gnulib', then seeing that 'make clean' skips autogen
although 'make' properly runs it.

* cfg.mk (_clean_requested): New check, to speed up 'make clean'
even if gnulib submodule is outdated.
Suggested by Daniel P. Berrange.
2010-04-06 14:43:47 -06:00
Matthias Bolte
0d7d699795 macvtap: Remove virConnectPtr from ReportError
Also rename ReportError to macvtapError.
2010-04-06 20:00:30 +02:00
Matthias Bolte
028db0bf5d esx: Mark error messages for translation
Also define ESX_ERROR and ESX_VI_ERROR in a central place, instead of
defining them in each source file.

Add ESX_ERROR and ESX_VI_ERROR to the msg_gen_function list in cfg.mk.

Update po/POTFILES.in accordingly.
2010-04-06 19:24:24 +02:00
Matthias Bolte
dbfa2ff572 vbox: Mark all error messages for translation
Add vboxError to the msg_gen_function list in cfg.mk.
2010-04-06 19:02:58 +02:00
David Allan
1bbe12de44 Clarified error message
* Since the file pattern matches RNG schemas as well as C sources, the error message should mention both.
2010-04-05 10:24:13 -04:00
Eric Blake
d002c250cd build: improve check for out-of-date .gnulib submodule
git reset --hard 96e5a2d4d5
./autogen.sh
make -s
git pull
make -s    <-- expecting auto-bootstrap here, doesn't happen

Use git diff to expose whether the submodule has untracked changes,
which are typical on an incremental pull if .gnulib was updated but
the user did not manually run 'git submodule update'.

After this patch is applied, I encountered a new problem when
following the reproducing pattern.  Basically, the change to .gnulib
between libvirt's commit 96e5a2d4 and this patch introduced a change
to sys_ioctl.in.h, but gnulib (intentionally) does not make the
replacement headers depend on Makefile changes.  Therefore, I ended up
with the generated replacement header being broken:
gnulib/lib/sys/ioctl.h complained about a use of @.  But that seems
like something that should be fixed upstream in gnulib's bootstrap
script (that is, when doing a gnulib update, all files created from
.in.h file should probably be deleted).  Without the benefit of that
proposed gnulib fix, I worked around the problem by manually removing
the stale gnulib/lib/sys/ioctl.h.

* autogen.sh (t): Also run bootstrap if the gnulib submodule needs
to be updated.
* cfg.mk (_autogen): Likewise.
Reported by Matthias Bolte.
2010-04-02 15:49:32 -06:00
Eric Blake
e7168f7965 build: import latest gnulib
A lot of syntax check rules have to be rewritten, but the
result is easier to maintain.  I tested each syntax rule
by intentionally introducing a temporary violation of the rule.
Additionally, some false positives for unmarked_diagnostics
crept in, and an improved copyright_format test caught some bugs.

* .gnulib: Update to latest.
* cfg.mk (sc_prohibit_test_minus_ao): Delete, it was moved into
gnulib's maint.mk.
(sc_avoid_write, sc_prohibit_strcmp_and_strncmp)
(sc_prohibit_asprintf, sc_prohibit_strncpy, sc_prohibit_readlink)
(sc_prohibit_gethostname, sc_prohibit_gettext_noop)
(sc_prohibit_VIR_ERR_NO_MEMORY, sc_prohibit_nonreentrant)
(sc_prohibit_ctype_h, sc_TAB_in_indentation)
(sc_avoid_ctype_macros)
(sc_prohibit_virBufferAdd_with_string_literal)
(sc_prohibit_gethostby, sc_copyright_format): Rewrite in terms of
new maint.mk macros.
(sc_libvirt_unmarked_diagnostics): Fix whitespace.
* .x-sc_unmarked_diagnostics: New file.
* tests/object-locking.ml: Fix copyright.
* tools/virt-pki-validate.in: Likewise.
* tools/virt-xml-validate.in: Likewise.
2010-04-02 10:18:55 -06:00
Eric Blake
a792bf240f build: more fallout from test -a
* cfg.mk (sc_prohibit_test_minus_ao): Also check for [.
* docs/Makefile.am (%.html, html/index.html): Avoid non-portable
test usage.
* libvirt.spec.in (%post): Likewise.
* tools/virt-pki-validate.in (servercert.pem): Likewise.
* configure.ac (LOGNAME): Use test, not [, in files processed by
autoconf.
Detected by Matthias Bolte.
2010-03-31 15:18:13 -06:00
Jim Meyering
00195f9f8d maint: mark xenapiSessionErrorHandler messages for translation
* cfg.mk (msg_gen_function): Add xenapiSessionErrorHandler.
* po/POTFILES.in: Add src/xenapi/xenapi_driver.c
* src/xenapi/xenapi_driver.c: Mark strings for translation.
* src/xenapi/xenapi_utils.c (xenapiUtil_ParseQuery):
2010-03-31 16:30:41 +02:00
Eric Blake
4eb8022260 build: automate the rerun of autogen.sh
Automate the reuse of autogen.sh, rather than just erroring out.

* cfg.mk (_update_required): Run autogen.sh, rather than just
warning about it.
(_autogen): New target.
2010-03-30 11:29:09 -06:00
Eric Blake
f0dc84d83f build: update gnulib
Picks up fixes for gethostname compilation problems on mingw.

* .gnulib: Update to latest.
* build-aux/.gitignore: Regenerate.
* cfg.mk (local-checks-to-skip): Avoid new test not relevent to
libvirt.
2010-03-26 19:16:37 +01:00
Eric Blake
271945a148 maint: update syntax-check rule to also catch test's -o operator
* cfg.mk (sc_prohibit_test_minus_a): Rename...
(sc_prohibit_test_minus_ao): ...and flag '-o', too.
2010-03-26 08:50:14 +01:00
Jim Meyering
156133597d tests: teach syntax-check that virDomainDefFree has free-like semantics
* cfg.mk (useless_free_options): Add virDomainDefFree to the list
of free-like functions.
* src/test/test_driver.c (testDomainCreateXML): Remove useless-if-
before-virDomainDefFree.
* src/conf/domain_conf.c (virDomainAssignDef): Likewise
2010-03-26 08:16:54 +01:00
Jim Meyering
95c8ddd2ec maint: add syntax-check rule to prohibit use of test's -a operator
* cfg.mk (sc_prohibit_test_minus_a): New rule.
2010-03-24 09:32:43 +01:00
Eric Blake
fc148ca133 maint: enforce recent copyright style
* cfg.mk (sc_copyright_format): New rule.
2010-03-18 21:20:32 +01:00
Eric Blake
257d90f3fb maint: fix typo
* cfg.mk (sc_prohibit_gettext_noop): Fix typo
2010-03-18 16:26:06 +01:00
Eric Blake
bc3f582bb0 maint: enforce recent N_ usage
* cfg.mk (sc_prohibit_gettext_noop): New rule applied in "make syntax-check"
2010-03-18 14:05:44 +01:00
Eric Blake
3b04f3bb0f build: change to gnulib module list should rerun bootstrap
* autogen.sh (curr_status): Also include hash of bootstrap.conf
when checking for changes that require bootstrap rerun.
* cfg.mk (_update_required): Likewise.
2010-03-10 18:14:15 +01:00
Eric Blake
89a08ba63a build: enforce preprocessor indentation
Since cppi is not part of Fedora Core 12, the check is conditional:
without cppi, running 'make syntax-check' merely warns:

$ make sc_preprocessor_indentation
preprocessor_indentation
maint.mk: skipping test sc_preprocessor_indentation: cppi not installed

* cfg.mk (sc_preprocessor_indentation): New syntax-check rule.
(preprocessor_exempt): New macro, with first exemption.
2010-03-10 18:00:26 +01:00
Jim Meyering
27efcfb7eb maint: disallow TAB-in-indentation also in *.rng files
* cfg.mk (sc_TAB_in_indentation): Also check .rng files.
2010-03-01 20:19:20 +01:00
Jim Meyering
0f88dade23 build: make git submodule checking more reliable
* cfg.mk (_curr_status): Accommodate leading "+" or "-" in the output
of git submodule status.
* autogen.sh: Likewise.
2010-02-25 13:35:03 +01:00
Jim Meyering
d2a9773457 build: update gnulib submodule to latest
* cfg.mk (local-checks-to-skip): Disable sc_prohibit_hash_without_use
for now, since it fails with a false-positive match.
2010-02-23 21:31:17 +01:00
Chris Lalancette
54c973d52b Add a rule to check for uses of readlink.
Signed-off-by: Chris Lalancette <clalance@redhat.com>
2010-01-22 09:42:35 -05:00
Jim Meyering
eabb98b0a8 gnulib added a new syntax-check test: use $(VAR), not @VAR@
The latter is not officially "wrong", but *is* terribly anachronistic.
I think automake documentation or comments call that syntax obsolescent.
* cfg.mk (_makefile_at_at_check_exceptions): Exempt @SCHEMADIR@
and @SYSCONFDIR@ uses -- there are no Makefile variables for those.
* docs/Makefile.am: Use $(INSTALL), not @INSTALL@.
* examples/dominfo/Makefile.am: Similar.
* examples/domsuspend/Makefile.am: Similar.
* proxy/Makefile.am: Similar.
* python/Makefile.am: Similar.
* python/tests/Makefile.am: Similar.
* src/Makefile.am: Similar.
* tests/Makefile.am: Similar.
2010-01-18 09:50:08 +01:00
Chris Lalancette
d27098c054 Add a new syntax-check rule for gethostname.
We should always be using virGetHostname in place of
gethostname; thus add in a new syntax-check rule to make
sure no new uses creep in.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
2009-10-26 10:34:27 +01:00
Chris Lalancette
4c893ef9be Various syntax-check fixes.
Make a pass over the syntax-check files, tightening up regex's,
un-ignoring certain files, and cleaning things up.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
2009-10-26 10:34:05 +01:00
Jiri Denemark
3bd4c7ba16 Fix build in separate build directory
* cfg.mk: use $(srcdir)/ prefix for Makefile.nonreentrant include
* examples/domain-events/events-c/Makefile.am tools/Makefile.am
  examples/hellolibvirt/Makefile.am: extend the include paths to
  use $(top_srcdir)/include too.
2009-10-01 16:55:09 +02:00
Chris Lalancette
b92587bc56 Fix up "make syntax-check" after the tree restructuring.
Signed-off-by: Chris Lalancette <clalance@redhat.com>
2009-09-23 14:58:13 +02:00
Chris Lalancette
03d777f345 Introduce virStrncpy.
Add the virStrncpy function, which takes a dst string, source string,
the number of bytes to copy and the number of bytes available in the
dest string.  If the source string is too large to fit into the
destination string, including the \0 byte, then no data is copied and
the function returns NULL.  Otherwise, this function copies n bytes
from source into dst, including the \0, and returns a pointer to the
dst string.  This function is intended to replace all unsafe uses
of strncpy in the code base, since strncpy does *not* guarantee that
the buffer terminates with a \0.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
2009-09-22 20:10:00 +02:00
Jim Meyering
8f84fef2eb build: submodule machinery now works also when no tag is reachable
The code in cfg.mk to detect when the git submodule was out of date
worked most of the time, but not when checked out in a certain way.
* cfg.mk: Extract submodule hash from command output and file,
and compare only that, since the format of the full line may vary.
Reported by Mike Burns, with some diagnosis by Daniel P Berrange.
2009-07-16 18:42:47 +02:00
Jim Meyering
08a2e796e8 make "make syntax-check" consistent with "git diff --check"
This makes "make syntax-check" fail when a version-controlled
file contains a trailing blank line.
* cfg.mk (sc_prohibit_trailing_blank_lines): New rule.
2009-07-16 15:06:42 +02:00
Jim Meyering
f272378d52 build: automatically rerun ./bootstrap when needed
When "git pull" (or any other operation) brings in a new version of the
gnulib git submodule, you must rerun the autogen.sh script.  With this
change, "make" now fails and tells you to run ./autogen.sh, when needed.
* autogen.sh: Maintain a new file, .git-module-status, containing
the current submodule status.  If it doesn't exist or its content
is different from what "git submodule status" prints, then run
./bootstrap
* .gitignore: Add .git-module-status
* cfg.mk: Diagnose out of date submodule and fail.
* README-hacking: Update not to mention bootstrap.
* Makefile.am (MAINTAINERCLEANFILES): Add .git-module-status,
so that "make maintainerclean" will remove it.
2009-07-10 13:39:28 +02:00
Jim Meyering
bf773e0467 use gnumakefile and maintainer-makefile modules from gnulib
* bootstrap (modules): Add gnumakefile and maintainer-makefile.
* GNUmakefile: Remove file, now provided by gnulib.
* Makefile.maint: Remove.  Replaced by maint.mk from gnulib.
.gitignore: Add GNUmakefile and maint.mk.
* cfg.mk (prev_version_file): Disable this feature.
Setting this to /dev/null avoids an otherwise harmless diagnostic.
2009-07-08 16:17:51 +02:00
Jim Meyering
360194bfb5 skip some of gnulib's new rules
* cfg.mk (local-checks-to-skip): Add these: sc_error_message_uppercase,
sc_program_name, sc_require_test_exit_idiom, sc_makefile_check.
2009-07-08 16:17:51 +02:00
Jim Meyering
c120fcc06a Prepare to use maint.mk from gnulib
Since Makefile.maint will soon come from gnulib's maint.mk,
sync Makefile.maint to have the same contents (modulo minor
things).  In syncing it, we have to remove some libvirt-specific
rules.  Since we want to keep them (of course), put those in cfg.mk.
* Makefile.maint: Merge from gnulib's maint.mk.
* cfg.mk (sc_avoid_write): New rule.  From Makefile.cfg.
(sc_prohibit_strcmp_and_strncmp): Likewise, and rename.
(sc_prohibit_asprintf, sc_prohibit_VIR_ERR_NO_MEMORY): Likewise.
(sc_prohibit_nonreentrant): Likewise.
(sc_prohibit_ctype_h): Likewise.
(sc_TAB_in_indentation, sc_avoid_ctype_macros): Likewise.
(sc_prohibit_virBufferAdd_with_string_literal): Likewise.
(sc_prohibit_gethostby): Likewise.
(sc_libvirt_unmarked_diagnostics): Likewise.  Also, rename the
rule, inserting "_libvirt", since this rule is a specialization of
the one in gnulib.
* GNUmakefile: Include cfg.mk, not Makefile.cfg
* .x-sc_prohibit_strcmp_and_strncmp: New file.
* Makefile.am (EXTRA_DIST): Add .x-sc_prohibit_strcmp_and_strncmp
2009-07-08 16:17:51 +02:00
Jim Meyering
96c807feb8 * Makefile.cfg: Rename to...
* cfg.mk: ...this.  New file.
2009-07-08 16:17:51 +02:00