summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2014-01-14rpm: support conditionals in patch-exportMarkus Lehtonen6-19/+46
One can now define conditional patches that are enclosed in '%if' or '%ifarch' when the spec file is updated. One can do this by defining 'Gbp-Rpm-If: <conditional>' and 'Gbp-Rpm-IfArch: <conditional>' in the commit message. Only one conditional per patch is supported, i.e. you cannot define 'IfArch' and 'If' for the same patch. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-01-14import-srpm: import all packaging files from src.rpmMarkus Lehtonen1-6/+15
Don't try to be too clever when importing an (true) src.rpm - just import all files from there without trying to guess file list from spec. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-01-14import-srpm: skip pristine-tar for non-tar sources archivesMarkus Lehtonen2-3/+19
Don't even try to import non-tar archives to pristine-tar because that fails. Instead, print a warning and continue without using pristine-tar. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-01-14Import RpmGitRepository if DebianGitRepository is not availableZhang Qiang2-6/+12
This is just a workaround, this should be fixed in nicer way by refactoring the code. Signed-off-by: Zhang Qiang <qiang.z.zhang@intel.com>
2014-01-14test_import_srpm: add checks for files in repoMarkus Lehtonen1-7/+25
Enhance some tests by checking that the correct files are present in the working directory of the repo. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-01-14rpm.SpecFile: drop the internal sources structureMarkus Lehtonen3-87/+85
Get rid of duplicate data tracking. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Yigang Wen <yigangx.wen@intel.com>
2014-01-14rpm.SpecFile: drop the internal 'patches' structureMarkus Lehtonen5-54/+74
To get rid of duplicate data tracking. Also, add test for testing the macro expansion of patch and source names. Also add tests for SpecFile.patchseries. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-01-14rpm.SpecFile: change specfile attribute to represent filenameMarkus Lehtonen5-15/+14
There is specdir to get the (absolute) directory path. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-01-14rpm: make SpecFile.update_patches() use new tag/macro methodsMarkus Lehtonen1-59/+43
Use new set/delete methods for updating the patches in the spec file. The internal patches structure is not updated and now only used when importing patches. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-01-14rpm helpers: yet another fix to patch numberingMarkus Lehtonen8-23/+25
'Patch:' does not indicate "patch number 0". Patch: and 'Patch0:' can both be present in the same spec file. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-01-14rpm helpers: support all tagsMarkus Lehtonen4-4/+104
Support all 'non-list' tags that we know of. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-01-14rpm helpers: parse 'nosource' and 'nopatch' sources correctlyMarkus Lehtonen3-2/+6
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-01-14rpm helpers: implement _set/delete_special_macro() methodsMarkus Lehtonen4-2/+63
Currently intended for updating '%patch' macros. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-01-14rpm refactor: rewrite set_tag functionalityMarkus Lehtonen6-19/+197
In addition to refactoring, make sure that we keep the internal _tags structure in sync. Changes the default place for new tags: add new tags after the 'Name:' tag instead of 'Release:'. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-01-14rpm/LinkedList.delete: return the previous nodeMarkus Lehtonen1-4/+7
The preceding node of the deleted node. However, return the next (i.e. the new first node) of the list if deleting the first node, and, return None if the list is empty after deletion. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-01-14rpm refactor: split spec parsing into multiple methodsMarkus Lehtonen2-198/+238
Also, record all tags and macros from the spec in separate internal structures. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-01-14rpm refactor: move spec file filtering into a separate functionMarkus Lehtonen1-31/+36
Also, remove the skip_tags option from the init as it's currently not used anywhere and it'd be better parse the spec file similarly in every place. The option can be re-added in the future if really needed. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-01-14import-srpm: enhance spec guessingMarkus Lehtonen2-3/+19
Use package name (in case of src.rpm) or directory name (in case of dir) as the preferred name of the spec file. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-01-14rpm.SpecFile: return correct patch file path in patchseries()Markus Lehtonen1-1/+3
Fixes importing patches when the 'Patch:' tag contains an URI. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-01-14buildpackage-rpm: support setting/updating the 'VCS:' tagMarkus Lehtonen3-0/+23
Git-buildpackage-rpm now always updates the 'VCS:' tag in the exported spec file. A new config option 'spec-vcs-tag' controls the format: - if empty, no 'VCS' tag is inserted and possible old 'VCS' tag is removed - otherwise, a 'VCS' tag is inserted or the old 'VCS' tag is updated - '%(tag)s' expands to the long tag name (from git-describe) Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-01-14rpm helpers: support updating tags in the spec fileMarkus Lehtonen6-3/+182
Currently only the 'VCS' tag is supported. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-01-14tests: add more comprehensive tests for import-srpmMarkus Lehtonen4-0/+338
Basic tests for virtually all features of import-srpm. Adds a new python module to include all (upcoming) git-buildpackage rpm commandline tool tests. Also, adds a separate git submodule for the rpm test data. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-01-14rpm: simplify the SrcRpmFile class a bitMarkus Lehtonen1-20/+12
Get rid of the unnecessary private methods. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-01-14rpm: introduce new 'Gbp-Patch-Macros' special key in spec parsingMarkus Lehtonen4-1/+63
This can be used to mark location where to add new patch macros when updating the spec. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-01-14rpm: rename the 'GbpIgnorePatch' special key in spec parsingMarkus Lehtonen4-5/+5
to 'Gbp-Ignore-Patches' for better readability. All the special keys (or "gbp-tags") now have to start with the "Gbp-" prefix. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-01-14rpm: use linked list to store spec contentMarkus Lehtonen1-209/+187
Tries to make spec parsing and updating more robust by using a linked list to represent spec content, instead of using normal list and trying to track line numbers. Deleting and adding lines should be safer, now. Also, consolidates the regexp usage of spec parsing a bit. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-01-14rpm: implement a simple doubly linked listMarkus Lehtonen1-0/+211
This class is intended to store the spec file content, needed for modifying the spec file. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-01-14rpm: circumvent an rpm-python macro expansion problemMarkus Lehtonen1-0/+4
Parse the spec file two times to circumvent a rpm-python problem which causes macros not to be correctly expanded if used before their definition. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-01-14rpm: configuration option for setting the output color schemeMarkus Lehtonen4-4/+12
Adds the new 'color-scheme' option to the rpm tools. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-01-14packaging: Add new file packaging/.test-requiresOlev Kartau1-0/+9
This new file contains distro-specific list of packages that are needed for testing. These are written in separate file to avoid polluting specfiles, and are used by automatic testing script. Signed-off-by: Olev Kartau <olev.kartau@intel.com> Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-01-14debian packaging: HACK: disable test in Debian buildsMarkus Lehtonen2-9/+3
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-01-14TODO: add rpm todoMarkus Lehtonen1-0/+17
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-01-14buildpackage-rpm: fail patch-export if local patches foundMarkus Lehtonen1-0/+9
Make patch export fail if local patch files (not marked for manual maintenance) exist. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-01-14import-srpm: return 2 if patch import failsMarkus Lehtonen1-4/+11
A new return value for failed patch import. If the patch import fails the repo is left in clean and buildable state so one might want to distinguish that from other failures. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-01-14docs: update rpm documentationMarkus Lehtonen6-152/+347
Sync with the latest version of the git-buildpackage RPM tools. Also add more content to the "building" and "development" sections. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-01-14tests: add unittests for gbp.rpmMarkus Lehtonen23-0/+445
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-01-14rpm: circumvent a bug in python-rpmMarkus Lehtonen1-3/+16
Which caused the packager tag to be incorrect in some cases. Rpm-python doesn't seem to reset spec.sourceHeader[rpm.RPMTAG_PACKAGER] if no packager tag is defined in the spec file. Thus, if we (in the same context) first parse spec A (which has a packager tag) and then spec B (which doesn't have a packager tag) python-rpm will give the packager of A for B as well. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-01-14import-srpm: suppress some pylint warningsMarkus Lehtonen1-63/+89
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-01-14buildpackage-rpm: return 2 for patch-export or tarball generation errorsMarkus Lehtonen1-14/+29
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-01-14rpm: implement file path filters in patch exportMarkus Lehtonen3-3/+13
Implements a filter option allows one to filter out changes to certain files/paths in the patch-generation. A commit is totally ignored if all files would be filtered out. The path filter is given as a Python regexp. This option is useful for example in filtering out the changes to packaging files when maintaining packaging and sources in the same branch. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-01-14buildpackage-rpm: support special tree-ish names in --git-upstream-treeMarkus Lehtonen1-13/+23
Support special 'WC*' and 'INDEX' values for the --git-upstream-tree option. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-01-14Universal configurable base tmpdir for all gbp rpm toolsMarkus Lehtonen4-46/+61
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-01-14import-srpm: support for patch importMarkus Lehtonen3-9/+81
Adds a new commandline option '--patch-import' for importing patches into the source tree in packaging branch. When enabled, gbp applies and commits all patches (not marked for manual maintenance) into the packaging branch. If this succeeds, it also removes all imported patch files from the packaging directory and the spec file. Currently only supported for non-orphan-packaging. This setting is true by default which should make more sense as the developer wants to do code development in the packaging branch (if he/she selects to use non-orphan packaging). However, patch-import is force-disabled if in bare git repository. We cannot support this, currently. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-01-14rpm: bigger refactor of import-srpmMarkus Lehtonen2-243/+190
Import source rpms in the same way as unpacked sources: that is, first unpack the srpm and then use the same code for importing. Also, tries to make tmpdir handling a bit better: all temporary directories are created under one "base tmpdir". Also, get rid of the orig tarball guessing and unpackging in SrcRpmFile class in gbp.rpm. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-01-14rpm: support squashing commits in patch generationMarkus Lehtonen4-4/+41
Implements an option for git-buildpackage-rpm and gbp-pq to squash commits (from upstream) up to certain tree-ish into one monolithic diff. Useful e.g. if you wan't to auto-generate a stable update patch. The new format of the cmdline option filename is commit-ish followed by (optionally) a colon and the desired diff filename base. Suffix '.diff' is added by GBP. Magic word 'HEAD' translates to the end-commit when given as the squash-point. This allows one to configure gbp to always squash all commits into one monolithic diff. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-01-14rpm: add --orig-prefix optionMarkus Lehtonen3-4/+20
Adds a new option --orig-prefix that affects the prefix of the generated/imported orig tarballs. For git-buildpackage-rpm, it defines the prefix of tarballs generated by the tool, 'auto' (default) makes gbp to guess the prefix, as before. NOTE: this doesn't affect the tarballs checked out from pristine-tar (i.e. if --pristine-tar is defined) or tarballs that are already present (see --git-tarball-dir option). For git-import-orig, this new option affects the prefix of tarballs imported into pristine-tar branch. If set to 'auto' (default) gbp doesn't mangle the prefix. Other tools (e.g. git-import-srpm) are not affected. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-01-14rpm: enhance logic in guessing the prefix of source archivesMarkus Lehtonen3-37/+138
Now a prefix is guessed for all source archives (not for the one and only "orig archive"). By default it is '<archive_name>-<archive_version>/' if name and version can be determined from the filename. If not, the archive basename (i.e. filename less archive and compression extensions) is used. In addition, more logic is applied to the "orig archive": gbp examines the setup macro (if found) for the source and takes the prefix from there. If some macros (in the '-n' option of the setup macro) cannot be expanded archive basename us used as the prefix. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-01-14rpm: support generating compressed patchesMarkus Lehtonen5-1/+63
This patch adds the support to generate compressed patches. User can define the patch file size limit after which patches gzipped. Re-writes the write_patch() function(s) and now uses the same-and-only write_patch() for buildpackage-rpm and pq-rpm. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-01-14pq-rpm: support importing compressed patchesMarkus Lehtonen1-4/+20
Adds support for importing compressed patches. NOTE: Only gzip is supported, for the time being, other compression methods shouldn't be to hard to add, if needed. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-01-14rpm helpers: add support for gbp-specific rpmlibMarkus Lehtonen2-1/+10
Adds support to use a special rpmlib, defined by rpm packaging policy. This makes it possible to use the target distro's rpmlib. That is, parse spec files for target distros (and architectures) incompatible with your host system. With the default RpmPkgPolicy, GBP tries to import "rpmlibgbp". Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>