This project is mostly about automating spec file formatting to have all specs more look-alike, much better for review and there is no need to force people to write that way, just to format it afterwards is sufficient. Other task is to track changes in osc repo and adjust changelog accordingly.

Format spec file tasks:

  • Unify syntax of how parallel jobs are done in favor of %{?smpmflags} and append it to each make call - reason: install/check can be also run in more threads for bigger speed; the only place where we should not append this is where -j1 is passed in make line (eg we allow people to force single thread build where needed) ; we should proably create policy where -j1 is required there should be upstream bug report about it.
  • remove out $RPMOPTFLAGS and $RPMBUILDROOT in favor of macros %{opt_flags} and %{buildroot}
  • remove completely %clean section
  • try to detect and remove removal of BUILD_ROOT as first command in install phase
  • decide wether to use {} in vars or not %variable or %{variable} (i am in favor of bracketing) and write replacer that puts them on spec everywhere
  • automatically put in %mandir %bindir and other path variables instead of hardcoding the paths in specs
  • write rpmlint macro that detects proper CFLAGS usage and kills package otherwise, same for other (EG: forcing -no-as-needed is bad :))

osc vc:

  • detect added/deleted/modified pactches in sources and automatically append "Added bla.patch" and similar to changes file when osc vc is run.

Status

This project is completed and spec-cleaner is ready for consumption

Related material


Comments

  • sleep_walker
    about 6 years ago by sleep_walker | Reply

    I'm not big fan of perl and I have seen spec-cleaner written in Python by Vincent Untz, Pavol Rusnak and Petr Uzel. This tool already can do some of requested tasks and even more. So I decided to bring spec-cleaner as drop-in replacement for prepare_spec script used by OBS.

    I don't know much neither python nor perl, so the progress is not as fast as I would hope for.

    Status at the end of HackWeek 10:

    osc vc (in fact, package build) - done, waiting for review/accept/merge

    spec-cleaner - features seen in preparespec and implemented for spec-cleaner - remove Epoch tag - replace BuildArchitectures with BuildArch - licenses - added support for the licenseschanges.txt in separate file as it is in preparespec (current perl implementation) - remove license separator ';', use and/or with parenthesis - requested features - as -q' is default for %setup now, remove it --n %{name}-%{version}' is also default behaviour for %setup, remove it - implemented bracketing of macros which are not keywords in relevant areas (some macros looks unusual, but consistent like %{makeinstall}) - other features - simplyfied code after bracketing all macros - don't remove double quotes around %{buildroot} when present, it is matter of good taste - identified weak matching to be fixed

    Spec-cleaner is still hosted on gitorious and respective repository on github wasn't created yet. I asked Ludwig Nussel to fix that but it hasn't been done so far so I have all my work stored only locally.

Similar Projects

This project is one of its kind!