qrpm 0.5.3 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5f18febdc69d52be520720e7279961f03469e6011ae6a149a2aeee6151dd5dda
4
- data.tar.gz: 7ac4f4b7ec4cbfd1633378ad6794a26761af9eb13e6e64643384738297d24c41
3
+ metadata.gz: 8e586c518e0a92575d817d0bc83c3a3d5de1355249952535ad0ab9cb3e0c980c
4
+ data.tar.gz: 7216415b387f365a3b8979904a8302de92d0b5d18ef5d2c05e1813ce4dbacba2
5
5
  SHA512:
6
- metadata.gz: 69504c36e66243663c420b1728643733ad06f781e01d6365b6e56b91bd3e6f6f0c5587c68a89c96a656ebf0596a65d9cd023873ce3e10b92c3a98716f1905adf
7
- data.tar.gz: 93a16bf658e128f970f94cb78ce5ae61fecd87c8504cb9beab14c4d50b9d515bcf1bb0c195decd365d1b11b3f27cdc2b5e5eb78e2a7c3d63585f2a3ee281778e
6
+ metadata.gz: cffc3d4360cabdc426ee1fc2a0e74c75faf58f04f2f9eb888738d7505550c87d7ccc37832b1e8b312b13b5fa3c8e14c65253434b7a65468335646e6c3546d3db
7
+ data.tar.gz: 111553786fc1513e752816314745bac348d7d2a0c638d71facc00c5edf39ee2ca5db36951730b7998f1afdbf001a76bdfbfd86fd33fdf3b44955b612d65191fd
data/example/qrpm.yml CHANGED
@@ -10,8 +10,8 @@ require:
10
10
  - httpd
11
11
  - postgresql13
12
12
 
13
- make: # List of commands to build project
14
- - echo "Hej du" > bin/another_file
13
+ make: |
14
+ echo "Hej du" > bin/another_file
15
15
 
16
16
  $bindir:
17
17
  - bin/a_file
data/example.yml CHANGED
@@ -1,84 +1,180 @@
1
- # QRPM configuration file. See https://github.com/clrgit/qrpm
1
+ # Example QRPM configuration file that shows all possibilities. See
2
+ # 'qrpm --help' for the full documentation
3
+ #
4
+ # A qrpm file is a YAML file with three kinds of top-level entries: RPM
5
+ # fields, variables, and directories. A line with '__END__' terminates the
6
+ # file, everything after it is ignored
2
7
 
3
- # program ::= directory...
4
- # directory ::= field... directory...
5
- # field ::= key '*' value
6
- # directory ::= array(string)
8
+ # RPM FIELDS
7
9
  #
8
- # TODO
9
- # o Use '@' instead of '$'. Yields @name and @{name} that doesn't interfere
10
- # with bash expansion
11
- #
10
+ # All fields have defaults so the shortest possible qrpm file is a single
11
+ # directory entry
12
+
13
+ name: example # Default is the name of the current directory
14
+ summary: An example package # Default 'The $name RPM package'
15
+ description: | # Default is the summary
16
+ A longer description of the package. It can span
17
+ several lines
18
+ # version: 1.2.3 # Default is extracted from the newest
19
+ # tag/branch in the git history, see
20
+ # 'qrpm --help' for the details
21
+ # version_file: lib/version.rb # Scan a file for the version instead. Can't
22
+ # be used together with version
23
+ release: 1 # Default 1
24
+ packager: Some Body <somebody@example.com> # Default is the name of the current user
25
+ license: MIT # Default GPL
26
+ require: # Required packages. A single name or a list
27
+ - bash
28
+ - ruby >= 3.0
29
+
30
+ # INCLUDE FILES
12
31
  #
13
- # ${{name}} in $(...)
14
- # QRPM dependency check variable definitions and needs to be able to detect
15
- # variable usages in $(...) constructs
16
-
17
- # @include git-project
18
- # -> version: $(cd ${{srcdir}}; git tag | tail -1 | sed 's/^v//')
19
- #
20
- # @include postgres-project prefix: pg_
21
- # -> pg_name
22
- # pg_version
23
- # pg_libdir
24
- # pg_sharedir
32
+ # Other qrpm files can be included. Their entries are merged into this file
33
+ # and later definitions win. './file' is relative to the directory of the
34
+ # qrpm file and '../file' to its parent, '/file' is an absolute path, and a
35
+ # bare name is searched for in the directories given with the -I option
25
36
  #
26
- # @include postgres-project git@github.com:... commit-id
37
+ # include: ./common.yml
38
+ # include:
39
+ # - ./common.yml
40
+ # - site-defaults.yml
41
+
42
+ # VARIABLES
27
43
  #
28
- # @include redhat/httpd
29
- # @include redhat/pg
30
- # @include pgdg
44
+ # Any other key is a variable. Values can refer to other variables with $name
45
+ # or ${name}, and to members of nested variables with $pg.version. Use ${name}
46
+ # when the variable is followed by a letter, a digit, or a dot as in
47
+ # ${name}.conf. Variables can be overridden on the command line:
31
48
  #
32
- # pg.version: 14
33
- # pg: pgdg[14]
34
-
35
- name: $pg_name-url_encode
36
- summary: Adds the 'url_encode' extension to postgres ${pg.version}
37
- description: RPM wrapper for the postgres url_encode extension (https://github.com/okbob/url_encode)
38
- version: $(cd ${{srcdir}}; git tag | tail -1 | sed 's/^v//')
39
- # ^Oops, hardcoded FIXME: Have a dependency graph and use some standard algorithm
40
-
41
- include:
42
- - ./qrpm.includes
43
-
44
- requires:
45
- - $pg_name-server
46
- - $pg_name-libs
47
-
48
- a: $b
49
- b: $c
50
- c: $a
51
- # Idea
52
- #submod: url_encode
53
- #subdir: url_encode
54
- #patches:
55
- # - patch/patch1.patch
56
- srcdir: url_encode
57
-
58
- root: ""
49
+ # qrpm prefix=/opt/other example.yml
59
50
 
51
+ prefix: /opt/$name
60
52
  pg:
61
- name: $(rpm -q --qf '%{NAME}\n' -f $(readlink -f $(which pg_config)))
62
- version: $(pg_config --version | sed 's/^[^0-9]* \([0-9]\+\).*$/\1/')
63
- major: $version
64
- libdir: $(pg_config --libdir)
65
- sharedir: $(pg_config --sharedir)
53
+ version: 15
54
+ libdir: /usr/pgsql-$pg.version/lib
55
+
56
+ # $(command) runs the command with bash when the qrpm file is compiled and
57
+ # uses its output as the value. Variables inside the command are written
58
+ # ${{name}}. Everything from '$(' to the last ')' on the line is the command
59
+ year: $(date +%Y)
60
+ tarname: $(basename ${{prefix}})
61
+
62
+ # A backslash escapes '$'
63
+ price: \$5
64
+
65
+ # The source directory. File paths in the directory entries below are
66
+ # relative to it and the build routine runs in it. Default '.'
67
+ srcdir: example
68
+
69
+ # ROUTINES
70
+ #
71
+ # Routines are shell scripts. They are not interpolated, instead the qrpm
72
+ # variables they refer to are defined as shell variables at the top of the
73
+ # script. Shell variables, positional parameters, and $(...) work as usual.
74
+ # 'make' runs in the source directory on the build host when the package is
75
+ # built. Nothing is built if it is left out
76
+ make: |
77
+ echo "Built in $year on $(hostname)" > bin/another_file
78
+
79
+ # 'pre' and 'post' run on the installation host before and after the package
80
+ # is installed, 'pre_uninstall' and 'post_uninstall' before and after it is
81
+ # uninstalled. $1 is 1 on install and 2 on upgrade
82
+ post: |
83
+ if [ $1 -eq 1 ]; then
84
+ echo "$name $version installed in $prefix"
85
+ fi
86
+
87
+ post_uninstall: |
88
+ echo "$name uninstalled"
89
+
90
+ # DIRECTORIES
91
+ #
92
+ # A directory entry is a key that is a path or starts with a variable, with a
93
+ # list of files as value. The standard directories are
94
+ #
95
+ # $etcdir $bindir $sbindir $libdir $libexecdir $sharedir $docdir $vardir
96
+ # $spooldir $rundir $lockdir $cachedir $logdir $tmpdir
97
+ #
98
+ # A standard directory resolves to the system directory (eg. /etc) when it is
99
+ # the only directory in the package and otherwise to a package subdirectory
100
+ # (eg. /etc/$name). Use the explicit variants when it matters: $sysetcdir is
101
+ # always /etc and $pcketcdir is always /etc/$name. There is no package
102
+ # subdirectory for bin and sbin. See 'qrpm --help' for the full list
103
+
104
+ # A plain list of files. The destination name is the basename of the source
105
+ $bindir:
106
+ - bin/a_file
107
+ - bin/another_file
108
+
109
+ # A file can also be a hash with the following keys
110
+ #
111
+ # file Path to the source file, relative to $srcdir
112
+ # name Destination file name. Default is the basename of the source
113
+ # perm Permissions in octal (0640) or symbolic chmod(1) notation
114
+ # (u=rw,g=r,o=). Default is the permissions of the source
115
+ # symlink Path on the target system that the destination links to
116
+ # reflink Path on the target system that the destination hard links to
117
+ # owner Owner in user.group notation, eg. apache.apache, apache, or
118
+ # .apache
119
+ # config Configuration file: true, false, or noreplace. Files in /etc
120
+ # default to noreplace, so they are kept on upgrade and the new
121
+ # file is saved next to them
122
+ # dir Name of a directory that is created on the target system. It
123
+ # is initially empty but other entries can add files to it, which
124
+ # makes it possible to set the permissions and owner of a
125
+ # directory
126
+ #
127
+ # Exactly one of file, symlink, reflink, and dir must be given. perm, owner,
128
+ # and config can't be used with links, and name and config can't be used
129
+ # with dir
130
+ $sbindir:
131
+ - name: example-admin
132
+ file: bin/a_file
133
+ perm: u=rwx,g=rx,o=
134
+ - symlink: /usr/bin/a_file # Creates /usr/sbin/a_file -> /usr/bin/a_file
135
+ - name: a_link
136
+ reflink: /usr/bin/another_file
137
+
138
+ # The package subdirectory /usr/share/example
139
+ $pcksharedir:
140
+ - share/some_data
141
+
142
+ # Paths can be extended and can contain variables
143
+ $pcksharedir/data:
144
+ - share/some_other_data
66
145
 
67
- #init: # FIXME Doesn't work atm
68
- # - git submodule init
69
- # - git submodule update
146
+ # A directory can also be a variable. $pg.libdir is the libdir member of the
147
+ # pg variable defined above, so this is /usr/pgsql-15/lib
148
+ $pg.libdir:
149
+ - share/some_data
70
150
 
71
- make:
72
- - cd $srcdir; make
151
+ $prefix/etc:
152
+ - name: ${name}.conf
153
+ file: share/some_data
154
+ perm: 0640
155
+ config: noreplace # Not under /etc, so it must be given
73
156
 
74
- ${pg.sharedir}/extension:
75
- - $srcdir/url_encode.control
76
- - $srcdir/sql/url_encode--1.2.sql
157
+ # Files in /etc are configuration files by default
158
+ $pcketcdir:
159
+ - name: settings
160
+ file: share/some_data
161
+ - name: generated # Overwritten on upgrade, old file saved as .rpmsave
162
+ file: share/some_other_data
163
+ config: true
77
164
 
78
- ${pg.libdir}:
79
- - $srcdir/src/url_encode.so
80
- - $srcdir/postgresql$version
165
+ # A directory entry creates a directory with the given owner and permissions.
166
+ # It is initially empty, but other entries can add files to it. Here the
167
+ # store directory belongs to nobody and holds a file owned by the nobody group
168
+ $pckvardir:
169
+ - dir: store
170
+ owner: nobody.nobody
171
+ perm: 0750
172
+ - dir: cache # An empty directory with default owner and permissions
81
173
 
82
- $root/somedir:
83
- - $srcdir/somefile
174
+ $pckvardir/store:
175
+ - name: data
176
+ file: share/some_data
177
+ owner: .nobody
84
178
 
179
+ __END__
180
+ Everything after __END__ is ignored
data/exe/qrpm CHANGED
@@ -34,110 +34,210 @@ begin
34
34
  is set to the name of the current directory and version to the latest tag
35
35
  in git (which needs to be present). Other defaults are detailed below
36
36
 
37
- VARIABLES
37
+ SETUP
38
+ Use qrpm -t to generate a template qrpm.yml file:
38
39
 
39
- The configuration file can define and use variables. They are defined by
40
- key/value definitions and the value can refer to values of other
41
- variables using $NAME or ${NAME}. Variables can also be given on the
42
- command line in <variable>=<value> format
40
+ qrpm -t [TEMPLATE-FILE]
43
41
 
44
- $(...) constructs are commands that are executed by bash(1). The parser
45
- considers everything from the opening '$(' to the last ')' on the line as
46
- part of the command so only one command is allowed. This restriction keeps
47
- the parser simple, it may change in the future
42
+ Then customize as needed
48
43
 
49
- INCLUDE FILES
44
+ VARIABLES
45
+ The configuration file can define and use variables. They are defined by
46
+ key/value definitions and the value can refer to values of other
47
+ variables using $NAME or ${NAME}. Variables can also be given on the
48
+ command line in <variable>=<value> format
50
49
 
51
- The qrpm file can include other files that are searched for in a list of
52
- directories. Relative paths are relative to the directory of the qrpm file
53
- (but see the -C option). The search directories can be set on the command
54
- line using the -I option
50
+ $(...) constructs are commands that are executed by bash(1). The parser
51
+ considers everything from the opening '$(' to the last ')' on the line as
52
+ part of the command so only one command is allowed. This restriction keeps
53
+ the parser simple, it may change in the future
55
54
 
56
- BUILT-IN VARIABLES
55
+ STANDARD VARIABLES
56
+ The following RPM variables are recognized. They all have defaults:
57
+
58
+ name
59
+ Name of the package. Default is the name of the current directory
60
+
61
+ version
62
+ Version number. The default is extracted from the newest tag/branch
63
+ in the git history. See VERSIONS below
64
+
65
+ version_file
66
+ File that is scanned for the version. An alternative to 'version'
67
+
68
+ summary
69
+ A short one-line text. Default 'The <name> RPM package'
70
+
71
+ description
72
+ A longer multiline text. Default is the summary
73
+
74
+ release
75
+ Build number of this version of the package. It is appended to the
76
+ version in the package name (eg. 1.2.3-1) and is incremented when the
77
+ package is rebuilt without changing the version. Default 1
78
+
79
+ packager
80
+ Packager name. Default the current user
81
+
82
+ license
83
+ License of the package. Default GPL
84
+
85
+ require
86
+ List of required RPM packages
57
87
 
58
- There are the following built-in variables. They are listed below with their
59
- default values:
60
-
61
- rootdir /
62
- rootconfdir /etc
63
- rootexecdir /usr
64
- rootlibdir /usr
65
- rootconstdir /usr/share
66
- rootdocdir /usr/share
67
- rootdatadir /var
68
-
69
- sysetcdir /etc
70
- sysbindir /usr/bin
71
- syssbindir /usr/sbin
72
- syslibdir /usr/lib64
73
- syslibexecdir /usr/libexec
74
- syssharedir /usr/share
75
- sysdocdir /usr/share/doc
76
- sysvardir /var/lib
77
- sysspooldir /var/spool
78
- sysrundir /var/run
79
- syslockdir /var/lock
80
- syscachedir /var/cache
81
- syslogdir /var/log
82
- systmpdir /tmp
83
-
84
- pcketcdir /etc/NAME
85
- pckbindir /usr/bin
86
- pcksbindir /usr/sbin
87
- pcklibdir /usr/lib64/NAME
88
- pcklibexecdir /usr/libexec/NAME
89
- pcksharedir /usr/share/NAME
90
- pckdocdir /usr/share/doc/NAME
91
- pckvardir /var/NAME
92
- pckspooldir /var/spool/NAME
93
- pckrundir /var/run/NAME
94
- pcklockdir /var/lock/NAME
95
- pckcachedir /var/cache/NAME
96
- pcklogdir /var/log/NAME
97
- pcktmpdir /tmp/NAME
98
-
99
- Note that there are no package specific directories for bin and sbin
88
+ ROUTINES
89
+ Routines are shell scripts that run when the package is built or when
90
+ it is installed or uninstalled. They are not interpolated. Instead the
91
+ qrpm variables they refer to as $name or ${name} are defined as shell
92
+ variables at the top of the script, so shell variables like $HOME,
93
+ positional parameters like $1, and $(...) constructs work as usual.
94
+ Variable names can't start with a digit for that reason:
95
+
96
+ make
97
+ Runs on the build host in the source directory when the package is
98
+ built
99
+
100
+ pre
101
+ Runs on the installation host before the package is installed
102
+
103
+ post
104
+ Runs on the installation host after the package is installed
105
+
106
+ pre_uninstall
107
+ Runs on the installation host before the package is uninstalled
108
+
109
+ post_uninstall
110
+ Runs on the installation host after the package is uninstalled
111
+
112
+ BUILT-IN VARIABLES
113
+ There are the following built-in variables. They are listed below with their
114
+ default values. Note that rootdir is a prefix of all other directories and
115
+ not a directory in itself, it is empty by default
116
+
117
+ rootdir
118
+ rootconfdir /etc
119
+ rootexecdir /usr
120
+ rootbindir /bin
121
+ rootsbindir /sbin
122
+ rootlibdir /usr
123
+ rootconstdir /usr/share
124
+ rootdocdir /usr/share
125
+ rootdatadir /var
126
+
127
+ The system directories are the standard directories of the system:
128
+
129
+ sysetcdir /etc
130
+ sysbindir /bin
131
+ syssbindir /sbin
132
+ syslibdir /usr/lib64
133
+ syslibexecdir /usr/libexec
134
+ syssharedir /usr/share
135
+ sysdocdir /usr/share/doc
136
+ sysvardir /var/lib
137
+ sysspooldir /var/spool
138
+ sysrundir /var/run
139
+ syslockdir /var/lock
140
+ syscachedir /var/cache
141
+ syslogdir /var/log
142
+ systmpdir /tmp
143
+
144
+ The package directories are subdirectories of the system directories
145
+ named after the package. There are no package specific directories for
146
+ bin and sbin:
147
+
148
+ pcketcdir /etc/NAME
149
+ pckbindir /bin
150
+ pcksbindir /sbin
151
+ pcklibdir /usr/lib64/NAME
152
+ pcklibexecdir /usr/libexec/NAME
153
+ pcksharedir /usr/share/NAME
154
+ pckdocdir /usr/share/doc/NAME
155
+ pckvardir /var/lib/NAME
156
+ pckspooldir /var/spool/NAME
157
+ pckrundir /var/run/NAME
158
+ pcklockdir /var/lock/NAME
159
+ pckcachedir /var/cache/NAME
160
+ pcklogdir /var/log/NAME
161
+ pcktmpdir /tmp/NAME
162
+
163
+ VERSIONS
164
+ The version is searched for in the git history of the source directory
165
+ when the qrpm file has no 'version' field. The highest version among
166
+ the tags reachable from HEAD wins. If there is none, the name of the
167
+ current branch is used. It is an error if no version is found, add a
168
+ 'version' field in that case
169
+
170
+ A tag or branch looks like a version if it is a semantic version with
171
+ the usual quirks: an optional prefix like 'release-' or 'release/', an
172
+ optional 'v', a pre-release suffix like '-rc1' or '.beta2', and build
173
+ metadata after '+'. Only the version and the pre-release suffix are
174
+ used and the suffix is separated with '~' so that rpm orders it before
175
+ the final version, eg. 'v2.0.0-rc1' becomes '2.0.0~rc1'
176
+
177
+ 'version_file' names a file relative to the source directory that is
178
+ scanned for a version instead of searching the git history. The first
179
+ version that follows the word 'version' wins, as in VERSION = "1.2.3"
180
+ or __version__ = '1.2.3', so that other dotted numbers in the file are
181
+ skipped. If there is none, the first version-like token (with at least
182
+ one dot) in the file is used. It can't be used together with
183
+ 'version':
184
+
185
+ version_file: lib/mypackage/version.rb
100
186
 
101
187
  INSTALLATION DIRECTORIES
188
+ The root directories are the prefixes that the system directories are
189
+ derived from. They correspond to the prefix variables of autoconf:
190
+ rootconfdir is sysconfdir, rootexecdir is exec_prefix (the root of the
191
+ architecture dependent files bin, sbin, lib and libexec), rootconstdir
192
+ is datarootdir, and rootdatadir is localstatedir. rootdir is a prefix
193
+ of all other directories and not a directory in itself. It is empty by
194
+ default. rootbindir and rootsbindir are /bin and /sbin, but on systems
195
+ where those are symbolic links (merged /usr) they are the directories
196
+ the links point to, typically /usr/bin and /usr/sbin:
102
197
 
103
- OPTIONS
198
+ INCLUDE FILES
199
+ The qrpm file can include other files that are searched for in a list of
200
+ directories. Relative paths are relative to the directory of the qrpm file
201
+ (but see the -C option). The search directories can be set on the command
202
+ line using the -I option
104
203
 
105
- -f,force
106
- Create package even if repository is dirty. Normally qrpm checks if the
107
- current directory is clean
204
+ OPTIONS
205
+ -f,force
206
+ Create package even if repository is dirty. Normally qrpm checks if the
207
+ current (git) directory is clean
108
208
 
109
- -C,directory=EDIR
110
- Change to directory before doing anything else but include the current
111
- directory in the search path. This makes it possible to override parts of
112
- a spec file
209
+ -C,directory=EDIR
210
+ Change to directory before doing anything else but include the current
211
+ directory in the search path. This makes it possible to override parts of
212
+ a spec file
113
213
 
114
- +I,include=EDIR
115
- Include directory, later definitions are searched first
214
+ +I,include=EDIR
215
+ Include directory, later definitions are searched first
116
216
 
117
- -s,spec=OFILE?
118
- Only create the spec file and not the RPM package. Use this option to
119
- inspect what RPM is going to do
217
+ -s,spec=OFILE?
218
+ Only create the spec file and not the RPM package. Use this option to
219
+ inspect what RPM is going to do
120
220
 
121
- -S,source
122
- Create a source RPM file instead of a regular RPM file
221
+ -S,source
222
+ Create a source RPM file instead of a regular RPM file
123
223
 
124
- -t,template=OFILE?
125
- Generate a QRPM template. It is in YAML format with the extension that a
126
- single '__END__' terminates the file immediately. The name of the file
127
- defaults to 'qrpm.yml'. It is an error if the file exists
224
+ -t,template=OFILE?
225
+ Generate a QRPM template. It is in YAML format with the extension that a
226
+ single '__END__' terminates the file immediately. The name of the file
227
+ defaults to 'qrpm.yml'. It is an error if the file exists
128
228
 
129
- -T,force-template=OFILE?
130
- Like --template but overwrites file if it exists
229
+ -T,force-template=OFILE?
230
+ Like --template but overwrites file if it exists
131
231
 
132
- -b,builddir=NPATH?
133
- Use the given path as the RPM build dir, default is 'builddir'. Doesn't
134
- remove the directory afterwards. It it is an error if the directory exists
232
+ -b,builddir=NPATH?
233
+ Use the given path as the RPM build dir, default is 'builddir'. Doesn't
234
+ remove the directory afterwards. It it is an error if the directory exists
135
235
 
136
- -B,force-builddir=PATH?
137
- Like --builddir but overwrites the directory if it exists beforehand
236
+ -B,force-builddir=PATH?
237
+ Like --builddir but overwrites the directory if it exists beforehand
138
238
 
139
- -d,dump
140
- Dump internal data and exit. For debug
239
+ -d,dump
240
+ Dump internal data and exit. For debug
141
241
 
142
242
  COMMANDS
143
243
  show! -- QRPM-FILE VARIABLE...
@@ -149,7 +249,7 @@ begin
149
249
 
150
250
  if opts.template? || opts.force_template?
151
251
  outfile = opts.template || opts.force_template || Qrpm::QRPM_CONFIG_FILE
152
- opts.force_template? || !File.exists?(outfile) or ShellOpts.error "Won't overwrite existing file: #{outfile}"
252
+ opts.force_template? || !File.exist?(outfile) or ShellOpts.error "Won't overwrite existing file: #{outfile}"
153
253
  FileUtils::cp Qrpm::QRPM_CONFIG_FILE_TEMPLATE, outfile
154
254
  puts "Generated #{outfile}" if !opts.quiet?
155
255
  exit
@@ -184,18 +284,17 @@ begin
184
284
  # Compute builddir
185
285
  if opts.builddir? && opts.force_builddir?
186
286
  ShellOpts.error "Can't use both --builddir and --force-builddir"
187
- elsif opts.builddir? || opts.force_builddir?
287
+ elsif opts.builddir? || opts.force_builddir?
188
288
  builddir = opts.builddir || opts.force_builddir || "builddir"
189
- opts.force_builddir? || !File.exist?(builddir) or
289
+ opts.force_builddir? || !File.exist?(builddir) or
190
290
  ShellOpts.error "Build directory 'builddir' exists - use -B to override"
191
291
  builddir = File.expand_path(builddir)
192
292
  else
193
293
  builddir = nil
194
294
  end
195
295
 
196
- # Check if repository is clean
197
- opts.force? || opts.dump? || `cd #{qrpmdir}; git status --porcelain | grep -v '??' 2>/dev/null` == "" or
198
- ShellOpts.error "Repository is dirty"
296
+ # Check if repository is clean. Only changes below the qrpm directory count
297
+ opts.force? || opts.dump? || !Qrpm.dirty?(qrpmdir) or ShellOpts.error "Repository is dirty"
199
298
 
200
299
  # Create lexer
201
300
  lexer = Qrpm::Lexer.new([currdir, qrpmdir].uniq, opts.include.reverse)
@@ -219,7 +318,7 @@ begin
219
318
 
220
319
  if opts.subcommand == :show!
221
320
  for variable in show
222
- puts qrpm[variable].sub(/^\/\//, "/")
321
+ puts qrpm[variable]
223
322
  end
224
323
  exit
225
324
  end
@@ -240,15 +339,15 @@ begin
240
339
  # Create spec/srpm/rpm file
241
340
  target = (opts.spec? ? :spec : (opts.source? ? :srpm : :rpm))
242
341
  files = rpm.build(
243
- target: target,
244
- file: opts.spec,
245
- verbose: opts.verbose?,
246
- destdir: currdir,
342
+ target: target,
343
+ file: opts.spec,
344
+ verbose: opts.verbose?,
345
+ destdir: currdir,
247
346
  builddir: builddir)
248
347
 
249
348
  puts "Built #{files.map { |f| File.basename(f) }.join(" ")}" if !opts.quiet?
250
349
 
251
- rescue RuntimeError => ex
350
+ rescue RuntimeError, Qrpm::CompileError => ex
252
351
  ShellOpts.failure ex.message
253
352
  end
254
353