Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accept ddeb from remote repositories when using "update" #19

Open
wants to merge 70 commits into
base: multiple-versions-debian
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
61f3176
debian: Switch to dh
bdrung Oct 13, 2015
1adb413
Run shunit2 tests on build time
bdrung Feb 27, 2017
d55bfe6
[testsuite] Use the host architecture by default
bdrung Feb 6, 2017
29575bc
[testsuite] Use existing priority
bdrung Mar 28, 2017
c1990d9
[testsuite] Use dpkg-source format 3.0
bdrung Feb 6, 2017
df77778
[testsuite] genpackage.sh: Silence output
bdrung Mar 28, 2017
81fc5b5
[testsuite] Use useful names for .changes files
bdrung Aug 22, 2017
3c4e75f
[testsuite] Add basic shunit2 based tests
bdrung Feb 6, 2017
3514203
Add ignores for tests to .gitignore
bdrung Feb 6, 2017
ae4a8ff
[format] Fix indentation (spaces to tabs)
bdrung May 30, 2014
17e12ba
Evaluate return value of write command
bdrung Feb 3, 2017
34a4529
Fix typo "could not found" -> "could not find"
bdrung Mar 30, 2017
00ec339
Fix missing quotation mark in component list
bdrung Aug 27, 2018
bd8ce63
Print version when removing a package
bdrung Feb 3, 2017
c3d8dcb
[refactor] Introduce static newcursor() function
bdrung Feb 3, 2017
8e330e4
table_getrecord: Add newline to error message
bdrung Feb 1, 2017
c73a4be
[refactor] Merge cursor_nexttemp() into cursor_nexttempdata()
bdrung Feb 3, 2017
689daf4
[refactor] Introduce parse_data()
bdrung Feb 3, 2017
1af26e4
table_printerror: Improve database error message
bdrung Feb 1, 2017
6608f08
[refactor] database: Move cursor struct upwards
bdrung Feb 2, 2017
0f5d3f9
[refactor] rename table_newduplicatecursor
bdrung Feb 3, 2017
572e2e0
[refactor] Introduce cursor_next()
bdrung Feb 3, 2017
f503e07
[refactor] rename todo to remaining
bdrung Feb 2, 2017
9c232a2
[refactor] target_removepackage: Support specifying package version
bdrung Feb 2, 2017
442dc90
[refactor] Introduce splitnameandversion()
bdrung Feb 2, 2017
39d41e7
[refactor] table_close: Set default return value
bdrung Feb 6, 2017
235f365
[refactor] target: Change error handling
bdrung Apr 10, 2017
4c38746
Add helper function debianversioncompare()
bdrung Feb 2, 2017
e5b43d2
Add helper function get_package_name()
bdrung Feb 2, 2017
e0a4d0a
Add helper function package_primarykey()
bdrung Feb 2, 2017
db3001e
Add helper function cascade_strcmp()
bdrung Feb 2, 2017
c22deb0
Add helper function strcmp2()
bdrung Feb 2, 2017
fff3550
Add helper function table_newduplicatecursor()
bdrung Feb 3, 2017
b7d433f
package_openiterator: Support opened databases
bdrung Mar 28, 2017
2a51a8a
Add helper function package_openduplicateiterator()
bdrung Feb 3, 2017
a1083a7
[refactor] Pass distribution to tracking_done
bdrung Apr 10, 2017
03abe61
Remember opened tracking databases
bdrung Apr 10, 2017
762ed36
Support listing multiple versions in ls command
bdrung Feb 3, 2017
8236dc7
Support listing multiple versions in list command
bdrung Feb 8, 2017
fd43165
[refactor] Add duplicate option to table_newglobalcursor
bdrung Aug 29, 2018
9190cbc
[refactor] package_openiterator: Pass through duplicate option
bdrung Aug 29, 2018
00ddf0a
Fix "Package database is not sorted" in update command
bdrung Aug 29, 2018
3959181
[refactor] Introduce nameandversion struct for copy command
bdrung Feb 2, 2017
6ed0523
[refactor] Use nameandversion struct for remove command
bdrung Feb 6, 2017
84108ed
table_addrecord: Support non-duplicate tables
bdrung Feb 23, 2017
f588775
Support adding the same upstream tarball twice
bdrung Feb 6, 2017
71ba94f
Support multiple versions for removesrc command
bdrung Aug 30, 2018
035061f
Add multiple version management
bdrung Feb 6, 2017
14c5850
Add Limit option
bdrung Feb 28, 2017
9b43ffd
[testsuite] Add multiversion test cases
bdrung Feb 7, 2017
4adbde1
Convert old database format into new format
bdrung Feb 23, 2017
a7c605d
[testsuite] Add test case for bug #8
bdrung Aug 27, 2018
84dc701
Use database environment
bdrung Apr 11, 2017
9310fac
Keep track of all opened database tables
bdrung Feb 24, 2017
a359ed2
Add print_opened_tables (for debugging purposes)
bdrung Feb 24, 2017
b4928d6
Remove tracking of opened individual databases
bdrung Feb 24, 2017
f3c21dc
Enhance copy functions parameters to support moving
bdrung Feb 23, 2017
801a6dd
Add fromtarget to struct target_package_list
bdrung Feb 23, 2017
ee6e177
package_add: Add fromtracks parameter
bdrung Mar 30, 2017
e2d15aa
Implement remove source support
bdrung Feb 23, 2017
7510b36
Add move* commands
bdrung Feb 23, 2017
1d771a5
[testsuite] Add test cases for move* command
bdrung Feb 27, 2017
e9161a2
Add Archive option
bdrung Feb 28, 2017
b6a33e2
[testsuite] Add test cases for Archive option
bdrung Feb 28, 2017
a748820
Accept .ddeb files as dbgsym packages
bdrung Apr 12, 2017
c2a4974
Add trace debugging output
bdrung Mar 29, 2017
d7f9b26
debian: Update changelog
bdrung Apr 2, 2019
d18e2ed
Add README.md describing this git branch
bdrung Aug 27, 2018
630bb1e
README.md: Add "How to keep multiple versions"
bdrung Jul 19, 2019
f3baf94
Accept ddeb from remote repositories when using "update"
Hugal31 May 24, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,9 @@ Makefile
/debian/reprepro.debhelper.*
/debian/reprepro.substvars
/debian/reprepro
/autom4te.cache/
/config.h.in~
/tests/.deps/
/tests/testpkgs/
/tests/testrepo/
/tests/upstreamrepo/
62 changes: 62 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
reprepro with multiple versions support
=======================================

This git repository hosts a branch for reprepro which adds multiple versions
support to it. See [Debian bug #570623](https://bugs.debian.org/570623) for
details and updates.

The upstream repository can be found on https://salsa.debian.org/brlink/reprepro

Release Notes
=============

The multiple-versions patch set adds following features:

* Add shunit2 based tests (Closes: [#857302](https://bugs.debian.org/857302))
* Support multiple versions. (Closes: [#570623](https://bugs.debian.org/570623))
* Add the commands move, movesrc, movematched, movefilter
* Add Limit and Archive option

How to keep multiple versions
-----------------------------

The default behavior of this reprepro is identical to upstream's version. To
keep multiple versions of the same package in the archive, you have to set the
`Limit` option to the desired maximum amount (or to 0 for unlimited). See the
description in the man page for details.

Database layout changes
-----------------------

The database layout changes from the upstream release to the
multiple versions patch set. The difference is as following:

### upstream

* packages.db maps "package name" to "control file" without duplicates
* no packagenames.db

### multiple versions

* packages.db maps "package name|version" to "control file" without
duplicates
* packagenames.db maps "package name" to "package name|version"
allowing duplicates and duplicates sorted by dpkg --compare-versions
descending

The first time the database is opened by reprepro with multiple versions
support, the database will be upgraded from the upstream layout to the multiple
versions layout. *Warning*: There is no way back (but could be done with a
simple Python script)!

Howto rebase
============

1. Rebase the `multiple-versions` branch on top of the updated upstream
`master` branch and push it to https://salsa.debian.org/bdrung/reprepro/

2. Refresh the `multiple-versions-debian` branch by taking the upstream
`debian` branch. Apply patch `debian: Switch to dh` and
`Run shunit2 tests on build time`. Cherry-pick all commits from
`multiple-versions`. Then apply patch `Add trace debugging output`,
`debian: Update changelog` and `Add README.md describing this git branch`.
4 changes: 2 additions & 2 deletions archallflood.c
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ static retvalue floodlist_initialize(struct floodlist **fl, struct target *t) {

/* Begin with the packages currently in the archive */

r = package_openiterator(t, READONLY, &iterator);
r = package_openiterator(t, READONLY, true, &iterator);
if (RET_WAS_ERROR(r)) {
floodlist_free(list);
return r;
Expand Down Expand Up @@ -549,7 +549,7 @@ static retvalue floodlist_pull(struct floodlist *list, struct target *source) {
struct package_cursor iterator;

list->last = NULL;
r = package_openiterator(source, READONLY, &iterator);
r = package_openiterator(source, READONLY, true, &iterator);
if (RET_WAS_ERROR(r))
return r;
result = RET_NOTHING;
Expand Down
12 changes: 9 additions & 3 deletions atoms.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

const char **atoms_architectures;
const char **atoms_components;
const char * const packagetypes[4] = { "!!NONE!!", "dsc", "deb", "udeb" };
const char * const packagetypes[5] = { "!!NONE!!", "dsc", "deb", "udeb", "ddeb" };
const char **atoms_packagetypes = (const char **)&packagetypes;
const char **atoms_commands;
static int command_count;
Expand Down Expand Up @@ -159,6 +159,8 @@ packagetype_t packagetype_find(const char *value) {
return pt_deb;
else if (strcmp(value, "udeb") == 0)
return pt_udeb;
else if (strcmp(value, "ddeb") == 0)
return pt_ddeb;
else
return atom_unknown;
}
Expand All @@ -169,8 +171,12 @@ packagetype_t packagetype_find_l(const char *value, size_t len) {
return pt_dsc;
else if (strncmp(value, "deb", 3) == 0)
return pt_deb;
} else if (len == 4 && strncmp(value, "udeb", 4) == 0)
return pt_udeb;
} else if (len == 4) {
if (strncmp(value, "udeb", 4) == 0)
return pt_udeb;
else if (strncmp(value, "ddeb", 4) == 0)
return pt_ddeb;
}
return atom_unknown;
}

Expand Down
1 change: 1 addition & 0 deletions atoms.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ enum atom_type { at_architecture, at_component, at_packagetype, at_command };
#define pt_dsc ((packagetype_t)1)
#define pt_deb ((packagetype_t)2)
#define pt_udeb ((packagetype_t)3)
#define pt_ddeb ((packagetype_t)4)

#define atom_defined(a) ((a) > (atom_t)0)

Expand Down
6 changes: 4 additions & 2 deletions changes.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ retvalue changes_parsefileline(const char *fileline, /*@out@*/filetype *result_t

if (l >= 4 && memcmp(p-4, ".deb", 4) == 0)
type = fe_DEB;
else if (l >= 5 && memcmp(p-5, ".ddeb", 5) == 0)
type = fe_DDEB;
else if (l >= 5 && memcmp(p-5, ".udeb", 5) == 0)
type = fe_UDEB;
else
Expand All @@ -189,7 +191,7 @@ retvalue changes_parsefileline(const char *fileline, /*@out@*/filetype *result_t
if (type == fe_DEB)
archend = versionstart + l - 4;
else {
assert (type == fe_UDEB);
assert (type == fe_DDEB || type == fe_UDEB);
archend = versionstart + l - 5;
}
if (archend - archstart == 6 &&
Expand All @@ -204,7 +206,7 @@ retvalue changes_parsefileline(const char *fileline, /*@out@*/filetype *result_t
bool issignature = false;

/* without those, it gets more complicated.
* It's not .deb or .udeb, so most likely a
* It's not .deb, .ddeb or .udeb, so most likely a
* source file (or perhaps a log (reprepro extension)) */

/* if it uses a known compression, things are easy,
Expand Down
6 changes: 3 additions & 3 deletions changes.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@

typedef enum {
fe_UNKNOWN=0,
fe_DEB, fe_UDEB,
fe_DEB, fe_UDEB, fe_DDEB,
fe_DSC, fe_DIFF, fe_ORIG, fe_TAR,
fe_SIG,
fe_ALTSRC,
fe_BYHAND, fe_LOG, fe_CHANGES,
fe_BUILDINFO
} filetype;

#define FE_PACKAGE(ft) ((ft) == fe_DEB || (ft) == fe_UDEB || (ft) == fe_DSC)
#define FE_BINARY(ft) ((ft) == fe_DEB || (ft) == fe_UDEB)
#define FE_PACKAGE(ft) ((ft) == fe_DEB || (ft) == fe_UDEB || (ft) == fe_DSC || (ft) == fe_DDEB)
#define FE_BINARY(ft) ((ft) == fe_DEB || (ft) == fe_DDEB || (ft) == fe_UDEB)
#define FE_SOURCE(ft) ((ft) == fe_DIFF || (ft) == fe_ORIG || (ft) == fe_TAR || (ft) == fe_DSC || (ft) == fe_UNKNOWN || (ft) == fe_ALTSRC || (ft) == fe_SIG)

struct hash_data;
Expand Down
23 changes: 23 additions & 0 deletions checkin.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,11 @@ static retvalue newentry(struct fileentry **entry, const char *fileline, const s
*ignoredlines_p = true;
return RET_NOTHING;
}
if (e->type == fe_DDEB && limitations_missed(packagetypes, pt_ddeb)) {
freeentries(e);
*ignoredlines_p = true;
return RET_NOTHING;
}
if (e->type != fe_LOG && e->type != fe_BUILDINFO &&
e->architecture_into == architecture_source &&
strcmp(e->name, sourcename) != 0) {
Expand Down Expand Up @@ -1243,6 +1248,15 @@ static retvalue changes_checkpkgs(struct distribution *distribution, struct chan
e->filekey, e->checksums,
&changes->binaries,
changes->source, changes->sourceversion);
} else if (e->type == fe_DDEB) {
r = deb_prepare(&e->pkg.deb,
e->component, e->architecture_into,
e->section, e->priority,
pt_ddeb,
distribution, fullfilename,
e->filekey, e->checksums,
&changes->binaries,
changes->source, changes->sourceversion);
} else if (e->type == fe_DSC) {
if (!changes->isbinnmu || IGNORING(dscinbinnmu,
"File '%s' looks like a source package, but this .changes looks like a binNMU\n"
Expand Down Expand Up @@ -1291,6 +1305,15 @@ static retvalue changes_includepkgs(struct distribution *distribution, struct ch
pt_deb, distribution, trackingdata);
if (r == RET_NOTHING)
*missed_p = true;
} else if (e->type == fe_DDEB) {
r = deb_addprepared(e->pkg.deb,
/* architecture all needs this, the rest is
* already filtered out */
(e->architecture_into == architecture_all)?
forcearchitectures:NULL,
pt_ddeb, distribution, trackingdata);
if (r == RET_NOTHING)
*missed_p = true;
} else if (e->type == fe_UDEB) {
r = deb_addprepared(e->pkg.deb,
/* architecture all needs this, the rest is
Expand Down
61 changes: 52 additions & 9 deletions checkindeb.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,22 +105,43 @@ static retvalue deb_preparelocation(struct debpackage *pkg, component_t forcecom
const struct overridedata *oinfo;
retvalue r;

if (packagetype == pt_udeb) {
if (verbose >= 15) {
fprintf(stderr, "trace: deb_preparelocation(pkg={deb={name=%s}}, forcecomponent=%s, forcearchitectures=[",
pkg == NULL ? NULL : pkg->deb.name, atoms_components[forcecomponent]);
atomlist_fprint(stderr, at_architecture, forcearchitectures);
fprintf(stderr, "], forcesection=%s, packagetype=%s, distribution={codename=%s}, debfilename=%s) called.\n",
forcesection, atoms_packagetypes[packagetype], distribution->codename, debfilename);
}

if (packagetype == pt_ddeb) {
/* ddebs don't have overrides */
forcesection = "debug";
forcepriority = "extra";
binoverride = NULL;
components = &distribution->ddebcomponents;
} else if (packagetype == pt_udeb) {
binoverride = distribution->overrides.udeb;
components = &distribution->udebcomponents;
} else {
binoverride = distribution->overrides.deb;
components = &distribution->components;
}

oinfo = override_search(binoverride, pkg->deb.name);
*oinfo_ptr = oinfo;
if (forcesection == NULL) {
forcesection = override_get(oinfo, SECTION_FIELDNAME);
}
if (forcepriority == NULL) {
forcepriority = override_get(oinfo, PRIORITY_FIELDNAME);
if (binoverride == NULL) {
oinfo = NULL;
} else {
oinfo = override_search(binoverride, pkg->deb.name);

if (forcesection == NULL) {
forcesection = override_get(oinfo, SECTION_FIELDNAME);
}

if (forcepriority == NULL) {
forcepriority = override_get(oinfo, PRIORITY_FIELDNAME);
}
}
*oinfo_ptr = oinfo;

if (!atom_defined(forcecomponent)) {
const char *fc;

Expand Down Expand Up @@ -261,7 +282,29 @@ retvalue deb_prepare(/*@out@*/struct debpackage **deb, component_t forcecomponen
base = NULL;
}

if (!strlist_in(allowed_binaries, packagenametocheck) &&
if (packagetype == pt_ddeb) {
/* ddebs are allowed if they are an allowed
* binary + "-dbgsym" */
int i;
bool found = false;

for (i = 0; i < allowed_binaries->count; i++) {
const char *s = allowed_binaries->values[i];
size_t len = strlen(s);

if (strncmp(s, pkg->deb.name, len) == 0 &&
strcmp(pkg->deb.name + len, "-dbgsym") == 0) {
found = true;
}
}

if (!found && !IGNORING(surprisingbinary,
"'%s' has packagename '%s' not corresponding to a .deb listed in the .changes file!\n",
debfilename, pkg->deb.name)) {
deb_free(pkg);
return RET_ERROR;
}
} else if (!strlist_in(allowed_binaries, packagenametocheck) &&
!IGNORING(surprisingbinary,
"'%s' has packagename '%s' not listed in the .changes file!\n",
debfilename, packagenametocheck)) {
Expand Down
5 changes: 5 additions & 0 deletions configparser.h
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,11 @@ static retvalue configparser_ ## sname ## _set_ ## name(UNUSED(void *dummy), con
struct sname *item = data; \
return config_gettruth(iter, name, &item->field); \
}
#define CFnumberSETPROC(sname, minval, maxval, field) \
static retvalue configparser_ ## sname ## _set_ ## field(UNUSED(void *dummy), UNUSED(const char *name), void *data, struct configiterator *iter) { \
struct sname *item = data; \
return config_getnumber(iter, name, &item->field, minval, maxval); \
}
#define CFallSETPROC(sname, field) \
static retvalue configparser_ ## sname ## _set_ ## field(UNUSED(void *dummy), UNUSED(const char *name), void *data, struct configiterator *iter) { \
struct sname *item = data; \
Expand Down
Loading